[Cairo] Re: [xsvg] cairo_text_extents ?

Carl Worth cworth at east.isi.edu
Tue Nov 25 12:07:58 PST 2003

On Nov 25, Bill Spitzak wrote:
 > Aren't "ascent" and "descent" sometimes different values that are supplied 
 > for the whole font?

Yes, and those numbers are available via the cairo_font_extents_t
structure and the cairo_font_extents function.

 > I think it may not be a good idea to use these numbers here.

We're not using those numbers. I'll grant you that the current names
may be confusing though.

 > My preference is to make everything signed and in the identical coordinate 
 > system, where 0,0 is the current text position on the baseline. The names can 
 > then be:
 > 	left, bottom : coordinate of lower-left of bounding box
 > 	top, right : coordinate of top-right of bounding box
 > 	dx, dy : recommended origin for the next character

My preference is to model the metrics after a well-accepted system,
(see my other mail on this issue).

 > I'm also in favor of having a current text transfomation matrix that is used 
 > to position all text, so that dy is always zero. This idea is apparently 
 > either being ignored or unpopular, but I will try to describe it again in 
 > another email.

I'm not familiar with the idea, (maybe I missed it in that giant
flurry of text API discussion while I was on vacation some time
ago). So I'll look forward to your email.

In the meantime, the philosophy behind the current API is quite simple:

cairo_show_text starts at the current point and uses the font metrics
to position each subsequent glyph.

cairo_show_glyphs lets the user position each glyph directly at the
specified user space coordinates.

To me, this seems like a good way to hit both ends of the
simple-to-use <-> full-control spectrum without much API clutter.

But, I'm always open to other suggestions.


More information about the cairo mailing list