[cairo] cairo_text_extents - imprecise width calculation?
otaylor at redhat.com
Wed Apr 20 07:21:50 PDT 2005
On Tue, 2005-04-19 at 14:06 -0700, Alexander Korban wrote:
> I'm using cairo under win32, and I noticed that
> cairo_text_extents doesn't always return precise
> It seems that precision of the extents depends on font
> scale (set using cairo_scale_font).
> For example, with this code (I'm trying to center
> cairo_select_font(pCairo, "Tahoma",
> CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
> cairo_text_extents_t extents;
> cairo_text_extents(pCairo, "OPEN", &extents);
> cairo_move_to(pCairo, 0.5 - (extents.width / 2 +
> extents.x_bearing), 0.5);
> cairo_show_text(pCairo, "OPEN");
> the text is off from the centered position to the
> by about one character. However, when the font scale
> is set to 0.65,
> everything looks fine.
> Could anyone give any suggestions please?
I don't know if I have any suggestions to give, but if
you wanted to investigate and debug in detail, that would
of course be appreciated.
My original notes on the Win32 font system can be found at:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050420/83c6076a/attachment.pgp
More information about the cairo