[cairo] custom font options and cairo_t

Owen Taylor otaylor at redhat.com
Sat Jul 23 10:00:49 PDT 2005

While trying (unsuccesfully) to figure out what is still going wrong
for the reporter of:


I noticed something rather dreadful about cairo_font_options_t ...
you can create a cairo_scaled_font_t with a custom set of 
options, but when you go to actually *render* with that cairo_font_t,
and set the corresponding face on a cairo_t then you get the
options for the surface rather than the options of your custom
scaled font.

[ This goes back to the rejection of cairo_set_scaled_font() in favor
of having the surface dig the font you want out of the font cache. ]

For the FreeType backend using FcPattern the effects are currently
not user-visible

 - All options other than 'hint_metrics' are actually in the FcPattern
   and thus in the cairo_font_face_t.
 - 'hint metrics' doesn't affect cairo_show_glyphs()

However they are reasonably serious in that the caching doesn't work
correctly ... because there is a different set of font options, you
get a different scaled_font_t.

And for other types of font faces things are worse because there
is no equivalent to cairo_ft_font_options_substitute().

So, how to fix?

 - We could add font options to the gstate (I even suggested this
   earlier) ... this would allow the person using a scaled font
   with custom font options to set those custom font options on
   the surface.

 - We could replace or augment cairo_set_font_face() with
   cairo_set_scaled_font(). (Bringing back the issue of the 
   interaction of that with the CTM)

 - We could say that the font options passed to
   cairo_scaled_font_create() *must* be the options from the
   surface and any other customization of options has to be done
   in font-face subclass specific ways (ugh)

While the first option strikes me as a bit of a bandaid, it's the
simplest and least disruptive change, and also has the other 
justification of allowing use of custom font options with the
toy API, so it's what I'm favoring at this point.


-------------- 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/20050723/44497ace/attachment.pgp

More information about the cairo mailing list