I just want to mention on this list what I'm doing for glyph extents in Mozilla at the moment [1]. I'm taking advantage of the fact that almost all the time, we only care about glyph extents when they fall outside the "font box" for the string [2] --- the box formed by the font ascent and descent vertically, and the glyph advances horizontally. Most glyphs fall inside their font-box, so we special-case glyphs that have no left bearing (for LTR scripts) and do not extend beyond the font ascent/descent --- in these cases we can just cache the offset of the glyph's right edge. The cache can actually be an array of 16-bit offsets indexed by glyph, which is very fast and small. I don't bother limiting the cache size. With this cache, I'm seeing negligible slowdown on Mac page load times (compared to not getting glyph extents at all). With this cache I'm not really using the cairo cache at all, so I'm bypassing it and going straight to ATSUI.
<br><br>I&#39;m not sure how to integrate this with cairo in the long term. A simple API change would be to give me a way to get the extents for a single glyph, bypassing the cache ... then I wouldn&#39;t need my own plaform-specific glyph extents code. A more complex API would be something like &quot;give me the extents for this glyph list, unioned with the font-box for the glyphs&quot;, which would allow the above optimization to be performed by cairo itself.
<br><br>[1] Well, it&#39;s not checked in yet.<br>[2] This is to compute a &quot;big enough&quot; area that needs to be repainted when the text changes.<br><br clear="all">Rob<br>-- <br>&quot;Two men owed money to a certain moneylender. One owed him five hundred denarii, and the other fifty. Neither of them had the money to pay him back, so he canceled the debts of both. Now which of them will love him more?&quot; Simon replied, &quot;I suppose the one who had the bigger debt canceled.&quot; &quot;You have judged correctly,&quot; Jesus said. [Luke 7:41-43]