[Cairo] Re: [xsvg] cairo_text_extents ?

John Ellson ellson at research.att.com
Tue Nov 25 13:38:48 PST 2003


Carl Worth wrote:

> > First, I'm uncomfortable with the need to multiply by the original fontsize
> > in xsvg.c.  I think it would be better if the units returned by the  
> > text_extents functions were those of the model.
>
>All of the values at the cairo interface are in user space
>coordinates. So, if you're dividing by font size after
>cairo_text_extents, then it's not returning the right thing yet.
>
Multiplying actually, but we agree that its not right.

> > The issue is that the scale from the font matrix includes two
> > factors: the fontsize from the model and the zooming factor from
> > the view.
>
>Within a cairo_font, there's a single matrix. For the sake of the font
>renderer, two scale values are extracted from the matrix and supplied
>as the font size (see _get_scale_factors). This is important to do so
>that font hints are applied properly.
>
>The other relevant transformation is gstate->ctm which maps from user
>space to device space. Its inverse is also available.
>
>So I think we do have all of the necessary information.
>

How do I get to gstate->ctm from the parameters available to 
_cairo_ft_font_font_extents()
and _cairo_ft_font_glyph_extents() ?


>
> > Second, the freetype code is able to support vertical text strings (e.g. 
> > Chinese).
> > 
> > I'd like to propose that cairo_gstate maintain a flag for vertical text 
> > so that the
> > text_extents code can compute just the appropriate vertical or 
> > horizontal extents.
>
>Keith and I just chatted about this issue. The idea he came up with is
>to require an FcPattern argument to cairo_ft_font_create_for_ft_face.
>This pattern would contain only font rendering options (including
>FC_VERTICAL_LAYOUT). Any face-specifying options would be ignored.
>
>With that change in place, all cairo_ft_font objects will have an
>FcPattern, and we can simply query that for the value of the
>FC_VERTICAL_LAYOUT property to return the right metrics.
>

Sounds good.

> > If these sound reasonable then I would be willing to prepare a 
> > subsequent patch for
> > them.
>
>I'm working on this now. If you're interested in helping out in
>realtime, I'll be in the #cairo channel on irc.freenode.net.
>  
>

I'm not a practised irc user, and we have to go to my stepson's college
basketball game this evening, so perhaps I'll join you on IRC another time.

Thanks anyway.

John





More information about the cairo mailing list