[Cairo] Re: [xsvg] cairo_text_extents ?

Keith Packard keithp at keithp.com
Tue Dec 16 14:00:43 PST 2003


Around 16 o'clock on Dec 16, Carl Worth wrote:

> One other potential confusion in the current API is which corner does
> x_bearing/y_bearing point to, lower-left or upper-left? The confusion
> here is that the default cairo user-space and the default font space
> have reversed directions for the Y axis.

Hence the use of 'ascent' and 'descent' which are not ambiguous, although 
they do have an interesting sign definition.

> Sure, but even if I know what the names mean, I can still get confused
> as to which to use. For example, if my SVG file says
> text-anchor="middle", should I adjust the origin by x_advance/2.0 or
> width/2.0? I honestly don't know.

it's harder than that; you want to center the glyphs:

	x - width / 2 + x_bearing	(I think)

-keith






More information about the cairo mailing list