[cairo] A question regarding text extents
Uli Schlachter
psychon at znc.in
Mon Nov 12 13:11:01 PST 2012
Hi,
On 10.11.2012 13:33, Zozó Teki wrote:
> I use cairo_text_extents() to retrieve how much space is needed for a
> piece of text to be able to draw a simple box around it. I have
> noticed that this function returns a different value depending on the
> transformation matrix in effect. Specifically, if I scale the context,
> the returned x_advance is somewhat larger (and also the text is drawn
> somewhat larger) - but not by the scaling factor.
[...]
Welcome to hinting. It makes fonts look better by making them "stick" to the
pixel grid. This also means that animations which zoom in/out of text look bad,
because the text "stutters".
The API documentation can tell you a little more (especially how to disable
hinting):
http://cairographics.org/manual/cairo-cairo-font-options-t.html#cairo-hint-style-t
Cheers,
Uli
--
Bitte nicht mit dem verbleibenden Auge in den Laser gucken.
- Vincent Ebert
More information about the cairo
mailing list