[cairo] text measuring speed

John Ellson ellson at research.att.com
Sat Jun 11 08:39:03 PDT 2005


Jon Smirl wrote:

>On 6/11/05, Keith Packard <keithp at keithp.com> wrote:
>  
>
>>On Fri, 2005-06-10 at 22:24 -0400, Jon Smirl wrote:
>>    
>>
>>>I haven't really be following all of this, but why are you always
>>>measuring one glyph extent at a time? If you measure strings
>>>freetype/pango will take into account kerning pairs allowed by the
>>>truetype font. With kerning pairs the sum of the individual glyph
>>>extents won't equal the extent of the string.
>>>      
>>>
>>This code lives beneath pango, which is precisely why I expect to see
>>requests to measure a single glyph at a time.
>>    
>>
>
>I've always been confused about why Cairo is involved with text at
>all, but I haven't been following the Cairo list in detail. Why
>doesn't pango call freetype directly to get the extent of the kerned
>string and then just hand Cairo a grayscale/alpha bitmap? What is
>gained by having a text extent function in Cairo? If this explained
>somewhere tell me and I'll go read it.
>
>  
>
+1 on this question.

In graphviz I need font resolution and text metrics during the layout 
stage, but at that point
it isn't yet known if cairo is even needed for the backend rendering.  

OTOH.  It would be nice if any font-related caches populated during  the 
layout phase could be
useful to cairo during rendering....   So if the reason for cairo-based 
text-metrics is to reuse
the caches, then that would justify it for me.

John



More information about the cairo mailing list