[cairo] scaled fonts in X11

Johann Lermer johann.lermer at elvin.eu
Mon May 11 16:27:25 UTC 2020


On Mon, 11 May 2020 10:07:55 -0400
"James K. Lowden" <jklowden at schemamania.org> wrote:

> 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? 


a 12 point font which ist scaled by 1,33 is different from a 16 point font. 
The reason is,that smaller fonts have usually different dimensions to make 
them easier to read. And honestly, Cairo does not very well in scaling fonts. 
There seems to be a bug with scaled fonts, CTM and the cairo context, whenyou
use X11 as target surface: 
when you set a scaled font to 12, the CTM to a scale of e.g.
1,33 and then you save the context and restore it, the font's scale is
at 16 and the CTM's scale at 1. Next time you write on the screen, the
font has different character sizes. 

When you use the toy api, the CTM's scale is always 1. Which is
usually wrong, in my opinion, but at least the character sizes do not
change.


More information about the cairo mailing list