[cairo] Font extents mysteries

Behdad Esfahbod behdad at behdad.org
Thu May 10 09:28:25 PDT 2007


On Wed, 2007-05-09 at 16:45 -0400, Tim Teulings wrote:
> 
> Am I doing something wrong? Is there an error in my code or am I
> basing by code on wrong assumptions? 

The reason you see this behavior is that you are measuring with a
default font options object, but rendering to a surface that indeed has
non-default options (in this case, metrics hinting on).  Instead you can
use what cairo_surface_get_font_options() returns.

But you really don't need to go that far (unless you are doing something
special).  All you need to do is to use cairo_text_extents() right after
cairo_select_font_face().  No need to deal with scaled fonts explicitly.

Hope it helps and you are having fun with cairo!

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list