[cairo] Text scaling and hinting
Owen Taylor
otaylor at redhat.com
Wed May 4 19:32:18 PDT 2005
On Wed, 2005-05-04 at 18:06 +1200, Robert O'Callahan wrote:
> I'm currently working on having Mozilla draw text through the new
> Cairo font APIs (the text in my blog screenshot was a hack based on
> Xft). The new Cairo font APIs have all metrics depending on the
> current transformation matrix because of hinting effects. That's fine,
> but we also need the ability to get a cairo_scaled_font_t and render
> those exact outlines under other transformation matrices.
>
> One obvious use case is animated rotation/scaling of a multi-line text
> object. If we allow the metrics to change during the animation, lines
> might break in different places during the animation, which is
> probably not what the author wants. Performance would also suffer
> because we'd have to run our layout algorithm at each and every step
> of the animation. Alternatively, we could just cross our fingers, hope
> that the metrics don't change much, and don't rerun the layout
> algorithm --- but that will lead to glyphs overlapping at the
> boundaries of text runs, and other ugliness.
If you want to do animation, you want to turn off hinting. The only
other option would be to have some sort of complicated system of
transitions between different hinted endpoints, and I don't see that
as feasible with the general state of font rendering technology
we have available.
Scaling hinted outlines will universally look worse than using
unhinted outlines.
Within the toy API of Cairo, there is currently no way to turn of
hinting. If that ever became interesting, my suggestion of an API
for it is to add something like:
cairo_simple_font_face_new (family, slant, weight, flags);
where flags would included a DISABLE_HINTING. Or possibly instead
add cairo_simple_font_face_new_unhinted(). There is an assumption
of immutability for font faces that would make a setter harder,
though not impossible. (There's a cache you'd have to remove items
from.)
If you are using cairo_font_font_face_create_*, then disabling
hinting is available currently.
If you are using PangoCairo, then there is no current way to
disable hinting ... I have a patch around somewhere I did for that,
which I should revive or do again from scratch. It's related to
getting the GNOME font properties dialog working with GTK+ HEAD.
Regards,
Owen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050504/d7ef14fa/attachment.pgp
More information about the cairo
mailing list