[cairo] Re: Drawing text with Windows bitmap fonts
Owen Taylor
otaylor at redhat.com
Tue Jan 23 08:13:11 PST 2007
On Tue, 2007-01-23 at 00:22 -0800, Stuart Parmenter wrote:
> So the main problem with bitmap fonts in cairo is
> WIN32_FONT_LOGICAL_SCALE (in cairo-win32-private.h) being 32. This
> will break all bitmap fonts since we'll always ask for much larger
> fonts than you really want.
I'm actually surprised by this ... remember, we aren't asking for
a larger font size to appear on the screen, we are still asking for
a 10px font or whatever ... all that the logical scale does is change
the coordinate space that we use with our DC.
If we actually asked for a larger pixel size from Windows, then all
our metrics would be wrong for scalable fonts, since windows would
hint to the wrong pixel size.
Saying that bitmap fonts don't work with a LOGICAL_SCALE of other
than 1, is really saying that they don't work if you call
SetWorldTransform(), which I find a little hard to believe.
> In Mozilla we change this to 1 without
> any real problems. You may want to give this a shot. We can probably
> just remove all the logical scale code but we avoid going through the
> cairo-win32-font code mostly so I'm not sure if it breaks paths we
> don't hit.
>
> Try changing it to 1 and see if it works for you!
An interesting experiment, but, not I think, the right long-term
fix. Changing LOGICAL_SCALE to 1, is going to cause considerable
inaccuracy in positioning of rotated and otherwise transformed text.
If LOGICAL_SCALE is actually a problem, then instead of never using
it, you'd only want to skip it when:
- scaled_font->preserve_axes (The transform is a 90 degree
rotation or flip)
- options->hint_metrics
are true (well, options->hint_metrics isn't actually paid attention
to by the windows backend right now... not that it is hard to
implement.)
- Owen
More information about the cairo
mailing list