[cairo] Font interface problem

Carl Worth cworth at east.isi.edu
Tue Mar 9 12:50:18 PST 2004

On Mar 9, Maarten Breddels wrote:
 > I think there are some problems with the current font interface.

There certainly are. This code hasn't seen a lot of heavy use, so it's
good to be getting some good feedback like this.

 > The font backends only knows about the font matrix (which is multiplied
 > with the CTM before any call to the font backend). I think it's better
 > to pass the CTM as argument to the font backend because it is really
 > needed.

Please feel free to re-work backend interfaces as necessary to get
things working.

A larger concern of mine is fixing bugs in the user-visible portion of
the API. There are problems that I've already found,
(eg. cairo_scale_font modifies fonts that the user previously grabbed
via cairo_current_font). Also, there are some ambiguities in the
current interface that need to be nailed down. Some of these will
require experience from developers trying to use cairo in non-trivial

 > Currently _cairo_gstate_text_extents does a bit of a fix to
 > change the device coordinates back to the user coordinates(allthough i'm
 > not sure if it's the right way, since it doesn't do rotation, which
 > 'bearing' and 'advance' need). I also noticed
 > _cairo_gstate_current_font_extents doesn't try to transform the device
 > coordinates to user coordinates (is that a bug?).

Your descriptions sound like bugs. If you can generate minimal test
cases to demonstrate the problems, that would help,
(cairo-demo/png/text.c might be a good starting point). Of course,
even better would be patches to fix the bugs.

 > And then there is a problem with glyphs, i think the cairo_glyph_t x and
 > y members are supposed to be in user coordinates,


 > Another thing is that (0,0) is the upper left corner, with y going down
 > the screen, but fonts are mirrored in x, so they appear upright with an
 > unmodified CTM and font matrix.

Yes, the default graphics convention is for Y to increase from
top-down, while the default font convention is for Y to increase from
bottom-up. This leads to plenty of confusion at the boundary of these
two systems, (such as cairo_text_extents). Concrete proposals to
address the problem would be quite helpful.

 > Ok, it's not a big issue, but to keep things simple, i think it's
 > better to just draw them the 'normal' way.

Could you describe more specifically what you would like to change

Thanks again for your feedback,


More information about the cairo mailing list