Discussion:
[zathura] Calibrate zoom to physical monitor size?
Caleb Maclennan
2015-10-10 07:15:11 UTC
Permalink
I'm using Zathura (using the MuPDF plugin) to review various layouts for
printing. It's important to me that I'm looking at things approximately
the same size as they will come out on paper. I realize the difference
between screen pixels and how things look in print will still affect
perception, but to save test prints while I rough out margins and trim
sizes I want to be able to hold up a paper to the screen and have it
match the on-screen canvas.

Zathura's default zoom level (100%) is anything but actual size for my
particular hardware configuration. In fact it's off by almost ⅓. If I
set the zoom to 133% I get something very close to actual size. How do
I make this the default zoom level? I would like everything else to
scale against that so that 50% is actually half size, etc. Is there a
way to calibrate the settings to my monitors—some sort of scale factor
setting perhaps?

Interestingly, Evince seems to know something about my monitor size
because it scales things exactly right out of the box. 100% turns up on
my monitor as exactly the right paper size (actually it's off by a
smidgen, 100.5% is more like it but it would be close enough). On the
other hand Acroread is off by a mile, but in the opposite direction as
Zathura. There, a value of 87% works out about right—actual-size is
actually jumbo scale.

How does Zathura decide what size to show at all? Is there a way to fix
this so 100% is actually actual-size? Is there a system DPI value that
can be set that will calibrate this?

Thanks for any pointers.

Caleb

P.S. I originally posted a question about this to the Unix & Linux Stack
Exchange site before finding this list. Any solutions I hear from here
I'll post back to there as a self-answer, but if anybody wanted to post
a solution directly
 http://unix.stackexchange.com/q/235170/1925
Sebastian Ramacher
2015-10-10 15:38:37 UTC
Permalink
Post by Caleb Maclennan
I'm using Zathura (using the MuPDF plugin) to review various layouts for
printing. It's important to me that I'm looking at things approximately the
same size as they will come out on paper. I realize the difference between
screen pixels and how things look in print will still affect perception, but
to save test prints while I rough out margins and trim sizes I want to be
able to hold up a paper to the screen and have it match the on-screen
canvas.
Zathura's default zoom level (100%) is anything but actual size for my
particular hardware configuration. In fact it's off by almost ⅓. If I set
the zoom to 133% I get something very close to actual size. How do I make
this the default zoom level? I would like everything else to scale against
that so that 50% is actually half size, etc. Is there a way to calibrate
the settings to my monitors—some sort of scale factor setting perhaps?
Interestingly, Evince seems to know something about my monitor size because
it scales things exactly right out of the box. 100% turns up on my monitor
as exactly the right paper size (actually it's off by a smidgen, 100.5% is
more like it but it would be close enough). On the other hand Acroread is
off by a mile, but in the opposite direction as Zathura. There, a value of
87% works out about right—actual-size is actually jumbo scale.
How does Zathura decide what size to show at all? Is there a way to fix this
so 100% is actually actual-size? Is there a system DPI value that can be set
that will calibrate this?
At the moment zathura isn't considering the DPI value at all and this is causing
the symptoms you see. However, libzathura-gtk already considers the DPI value.
So once we switch zathura to libzathura-gtk, this should work as expected.

Cheers
--
Sebastian Ramacher
Caleb Maclennan
2015-10-10 16:04:31 UTC
Permalink
This post might be inappropriate. Click to display it.
Sebastian Ramacher
2015-10-22 17:57:39 UTC
Permalink
Huh. I hate to ask what an ETA looks like, but is this immanent or a someday
thing? I wasn't even aware there was a GTK port in the works.
zathura was always using GTK+. But the current design made it necessary to redo
some parts from scratch. Now we have libzathura (managing all the plugins and
providing the document interface) and libzathura-gtk (widgets to render pages in
a GTK+ based application).

We are currently in the process of finishing up some parts in libzathura and
libzathura-gtk and then we will port zathura to the new libraries.
In the mean time I'm wondering if there isn't a way to hack this in. Since
this is machine specific anyway I'm totally okay with compiling my own copy
from source and running that. I looked around earlier today in the source
repo but wasn't able to locate any since place where the code could be
easily hacked with a multiplier, but I have to imagine this exists somewhere
and that a simple source code change could hard code the relative scale on
the canvas.
Know where that might be?
You can take a look at libzathura-gtk/page/callbacks.c [1] and look for the
code protected by #ifdef HAVE_HIDPI_SUPPORT. This should get you started. Code
like this may be needed in other places too.

Cheers

[1] https://git.pwmt.org/?p=libzathura-gtk.git;a=summary
--
Sebastian Ramacher
Loading...