[Cairo] Re: [xsvg] cairo_text_extents ?

Carl Worth cworth at east.isi.edu
Tue Nov 25 08:26:38 PST 2003

On Nov 21, John Ellson wrote:
 > OK, Please try this.    The attached tar file contains cairo and libxsvg 
 > patches and 4 test cases.

John, thanks for this contribution. Your timing is excellent as I just
implemented cairo_text_path and was just starting to implement
cairo_text_extents. Your patch has already fixed a couple of problems
I was having.

But, I do still have a question or two about the semantics of the
cairo_text_extents_t structure. Currently, it looks like this:

	typedef struct {
	    double left_side_bearing;
	    double right_side_bearing;
	    double ascent;
	    double descent;
	    double x_advance;
	    double y_advance;
	} cairo_text_extents_t;

Are the bearing values magnitudes or signed quantities? That is, which
of the following calculations is correct:

	/* magnitudes */
	width = extents.right_side_bearing + extents.left_side_bearing;

	/* signed */
	width = extents.right_side_bearing - extents.left_side_bearing;

Second, will the use of the names "left" and "right" behave in a sane
fashion when subjected to transforms with reflection?

Third, could we get by with shorter names here, eg. left and right?
I'm having a hard time managing word wrap issues with equations like
the one above, (eg. think trying to do "offset = width / 2.0" in one


More information about the cairo mailing list