[cairo] Font rendering options
spitzak at d2.com
Thu Jul 7 22:26:19 PDT 2005
Owen Taylor wrote:
> When handling text, there are quite a few relevant options:
> - Whether we use subpixel antialiasing
> - The subpixel order for subpixel antialiasing
"subpixel" is also useful for drawing all other graphics. I think this
can be done by using a 3x larger CTM in the desired direction, and
possibly a hint that all widths be multiples of 3.
> * Application uses the toy API to render to the screen; the user's
> preferences from the Xft X resources should be picked up.
> * Application is rendering to the screen via GTK+ and Pango.
> GTK+ tracks the user's preferences through XSETTINGS to handle
> dynamic changes. GTK+ wants to pass these options down and
> override the values from Xft.
This is bad. The fonts should match whether you are using Pango or not.
For the same reason, fonts identified by name must be absolutely
identical no matter what backend is used. Users must be able to take a
font preference from one program and put it in the other. If you don't
think this is possible, I recommend the current "toy" interface be
scrapped and replaced with an easy-to-use wrapper around Pango.
> * A vector-graphics application wants to render text in a way that
> will be as independent of zoom factor as possible. It turns off
> metrics and outline hinting.
This is wrong. Instead the application wants the metrics and outline
hinting for a *particular* size. Thus the image will look as good as
possible at a "default" size, yet scale smoothly.
This is why I wanted the font hinting to depend only on the font matrix,
and not the CTM. This also means that a program does not have to keep
two cairo_t's around to rescale text without the wrapping changing.
"turning hinting off" is then achieved by setting the CTM very small so
that the font matrix is very large, beyond the threshold where hinting
More information about the cairo