Linux и WYSIWYG
It took me a little text and graphics to print onto an existing sheet of paper. I decided to fit completely. I set the scale to 100%, I attach the sheet to the screen, and meanwhile, on the screen and on paper, the percent run is 20%.
This happens when the real resolution of the screen (in dots per inch) does not coincide with what the program thinks. When a program has a task to draw something long on the screen, for example, L cm, it calculates how much it is in pixels. To do this, she receives a DPI, and then approximately the following formula gets the length in pixels.
Actually, the problem is how the program can get this DPI, and then the dances with a tambourine begin. In general, the monitor can give the video card, and that in turn the OS, its linear dimensions. To do this, use the DDC (Display Data Channel) interface and EDID protocol. And then the problems begin.
Problem number 1 - the EDID protocol transmits the linear dimensions of the screen to the nearest cm. It would seem like no problem, but half a centimeter on a small screen (like laptops) is 3-4%. Not a disaster, but it can be avoided.
Problem No. 2 - X.org, despite the fact that it reads the dimensions via EDID, for some reason, in my case, it didn’t apply them and set the DPI to 96. You can find this out with the following command in the graphics terminal:
$ xdpyinfo | grep resolution resolution: 96x96 dots per inch
Problem number 3 - the application may use other sources to get DPI. This happens with applications using the GTK3 library. Why is that? I do not know. Leave this to the conscience of GTK3 developers.
So, tighten the whole thing.
1) Measure the ruler of the monitor. In my case, it turns out 347 mm by 195 mm.
2) Calculate the DPI. To do this, we need to know the resolution of the monitor. I have 1600x900. Most likely the DPI is the same for vertical and horizontal measurements, but this is not always the case. . .
3) Open the X.org configuration file/etc/X11/xorg.conf. If there is no such file, then from root you need to run:
and write the resulting file to the specified path. Add the DisplaySize line to the Monitor section, something should look like this:
VendorName "Monitor Vendor"
ModelName "Monitor Model"
DisplaySize 347 195
This will solve problems 1 and 2.
4) Create a ~/.Xresources file or add to an existing DPI setting:
This will solve the problem 3.
Then restart the X-session and everything should pick up.