[cairo] text measuring speed

Keith Packard keithp at keithp.com
Mon Jun 13 00:02:56 PDT 2005


On Mon, 2005-06-13 at 02:04 -0400, Jon Smirl wrote:

> How about having the composer provide a transform function? Then
> modify Cairo/Freetype call the external transform function if
> provided. Also long as someone appropriately transforms the
> coordinates Cairo and Freetype don't care where the coordinate come
> from, right?

It's not a matter of doing the transformation.  FreeType hints are only
defined for a scaling transformation; if you re-read the article I wrote
about how FreeType and cairo work together, you'll note that hinting is
applied after the simple scaling operation and before the secondary
affine transformation.

That's probably survivable; we'd likely just extract the outlines from
the library to pass directly into the rasterizer.  Figuring out what
nominal 'pixel size' to execute hints against might be a bit of fun, but
we could fake something for odd cases as long as the rectilinear
transformations were right.

However, cairo doesn't know how to stroke objects correctly in a
projective space -- our whole stroke algorithm is defined only for fixed
device-space pen polygons.  We could probably execute the algorithm in
some affine space that was 'fine enough' to avoid visible artifacts
post-projective transform, but we're talking a serious rework of the
internals of cairo at this point, with some potentially major
performance implications.

So, the current affine limitation within FreeType and cairo is not just
a limitation within the API, but is carried deep into the libraries
where it simplifies (and speeds) many fundemental algorithms.  Going
back and reworking these to live in a projective space is possible, but
there are obvious concerns about performance which can't just be
shrugged off, given the already serious performance problems present in
the cairo implementation.

-keith

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050613/d6ec4b82/attachment.pgp


More information about the cairo mailing list