[cairo] scaled fonts in X11
James K. Lowden
jklowden at schemamania.org
Mon May 11 14:07:55 UTC 2020
Given the choice between setting a font size to, say, 12 points, and
scaling the cairo_t and font to a readable size, or just asking for 16
points, is there any theoretical advantage either way?
My input is intended for a Postscript device, but my output is X11.
Postscript operates in terms of 72 points to the inch, whereas my
particular display is 96:
$ xdpyinfo | sed -Ene '/dimensions/,/resolution/ p'
dimensions: 1440x878 pixels (381x232 millimeters)
resolution: 96x96 dots per inch
Currently, I just multiply the Postscript dimensions (size & motion) by
96/72, and it looks good. The effect is to increase the argument to
cairo_set_font_size from 12 to 16.
But I could dip my toe in the scaled font pond, and use a context
matrix. That would have the advantage of working logically in
Postscript space, transferring the arguments verbatim, at the cost of
managing a scaling matrix. That seems a lot more complicated than just
multiplying by 4/3. Is there any reason to expect better antialiasing
or whatever, using cairo_scaled_font_create to make a 12-point font
appear bigger, versus just asking for a 16-point font, unscaled?
BTW, I was unable to find any kind of user guide for
cairo_scaled_font_create and friends. The only sources I've found all
point to the reference manual. Pointers would be welcome ....
More information about the cairo