[cairo] text measuring speed

Jon Smirl jonsmirl at gmail.com
Sun Jun 12 19:53:10 PDT 2005

On 6/11/05, Keith Packard <keithp at keithp.com> wrote:
> Because hints affect glyphs metrics, cairo must use post-hinted metrics
> for measuring text, this means using the metrics of the glyphs after the
> hinting and scaling operation.  It can not, however, use pure
> device-space metrics as those will have the reshaping transformation
> applied and hence be no longer aligned with the nominal font-space
> baseline of the glyphs.

This is the part that impacts font generation on the graphics card. 

Suppose we had an app generate a window and the graphic card saved
this window without generating the glyphs bitmaps, but instead it has
a program telling it where the glyphs need to go and what size. Also,
at this point we also don't know the the final sub-pixel positioning
of the window.

Now the composition manager takes the window and turns it into a
trapezoid. When the GPU is blending the window into the framebuffer,
it hits the glyph generation data. Now we know the final trapezoid
transform and sub-pixel positing for the glyphs since the transform
may have altered the subpixel position.  The glyph generation program
would contain the glyph outline, it would transform it using the final
transform, run the autohinter algorithm and rasterize.

The problem is that running the autohinter algorithm may change the
glyph metrics from what the app used to lay them out with.

As part of the glyph generation program I could record the original
metrics from the layout and transform them using the final transform.
Then the autohinter algorithm would need to be adjusted to hint, but
hint in such a way as to not change the original metrics.

Given the right hardware, do you think this would work? We don't even
have to have the hardware, we could alter X to record the glyph
generation data and then do final glyph generation in the composition

Jon Smirl
jonsmirl at gmail.com

More information about the cairo mailing list