Re: text to path conversion API proposal

Am 26.10.2011 um 05:59 schrieb Rik Cabanier:

> Hi Dirk,
> 
> I asked around and it seems like FreeType should be able to create outlines for you. Of course, to have a complete match, you'd also have use FreeType to render text to the screen.
> >From reading the chrome wiki, it looks like you already compile it as part of skia but it is currently unused.
> 
> Do you have any plans to go with that library instead of the OS?

Yes FreeType supports text -> glyph decomposition since a decade - I've been using it in ksvg1 in 2001 for <textPath> :-)

But I don't think that's a realistic option. First of all: each WebKit port decides on its own which text rendering system it wants to utilize.
Keeping complex text like Indic/Arabic in mind, you have to respect shaping and other things which are out of scope for FreeType - it's up to a shaper engine like Harfbuzz to handle this.
On WebKit/Mac CoreText is used exclusively to do rendering/measuring/shaping (starting with 10.6, Snow Leopard).

A unified text rendering solution, while sounding nice in theory, is practically impossible. And if eg. WebKit had it, it's nowhere guaranteed the other vendors use the same :-)

I think Camerons Approach
<cite>
... text-rendering="geometricPrecision" turns off hinting?  Having similar
rendering between text painted with that property and the paths returned
from the API would be acceptable to me.
</cite>

sounds reasonable. If the designer wants to get text outlines that _mostly_ reflect the rendering on screen using geometricPrecision is useful.
On Windows we could disable horizontal hinting, while hurting readability, those decomposed glyph outlines would match the rendered result most.
On Mac horizontal hinting is not respected at all, subpixel antialiasing is used exclusively instead, so this would make no difference.

We will never know for sure what happens internally when CoreText/DirectWrite/GDI etc. render text.
If we introduce the text2path API we should make it clear that it gives an approximation at best :-)

Cheers,
Niko

Received on Wednesday, 26 October 2011 08:52:46 UTC