[Cairo] Re: [xsvg] cairo_text_extents ?

Owen Taylor otaylor at redhat.com
Wed Dec 3 07:32:43 PST 2003


> > in the cairo design I have no guaranteed way to make 
> > y_advance be zero. Even if I don't rotate the font transform the interface seems to 
> > allow the font to set it non-zero, perhaps due to internal rounding to pixels 
> > when the main transform is rotated. I want to be able to *guarantee* (by 
> > making it not exist in the interface) that y_advance is zero. If this is 
> > not forced, there are two ways to lay out tilted text (rotate the 
> > text_transform, and rotate the font_transform), where the advance values may be 
> > calculated differently (one by the font and the other by the calling program), and 
> > thus output text will not match between them, which is a bad thing that Cairo 
> > is supposed to fix.
> > 
> 
> 
> Unfortunately, you cannot have a single advance value, since certain scripts
> really require both x and y. For example, have a look at the Nastaliq screenshots
> at the following page:
> 
>   http://www.freetype.org/opentype/index.html
> 
> Not to say that using two matrices isn't a good idea, just that the specific "advance"
> advantage isn't valid.

You don't necessarily need non-zero y-advance to do Nastaliq - in Pango,
for example the y-advance is strictly zero, but for each glyph in a
string of glyphs, the dx/dy from the nominal position is stored.

I think this model is easier to manage, since the baseline of the *line*
in Nastaliq is horizontal, it's just individual words that get slanted.

(Figure 12 in http://people.redhat.com/otaylor/grid-fitting/ shows
Pango laying out Nastaliq text.)

Also, it should be noted that using a y-advance to do Nastaliq won't
work for OpenType Nastaliq fonts ... the positioning methods there are
substantially more complex and generally handle pairs of glyphs, not
isolated glyphs.

Regards,
						Owen






More information about the cairo mailing list