[cairo] utf8 text rendering on iOS

Travis Griggs travisgriggs at gmail.com
Tue Feb 28 23:45:47 PST 2012


On Feb 27, 2012, at 4:01 PM, Behdad Esfahbod wrote:

> On 02/25/2012 02:15 PM, cu wrote:
>> Thank you for the stock answer.
>> 
>> We've been using the "toy" API on a number of platforms, including
>> MacOS. It works well enough and shows utf8 fonts correctly.  I am
>> interested in making sure it works just as correctly on iOS as it does
>> on other platforms. Any useful advice would be appreciated.
> 
> 
> What you see means one of two things:
> 
> - The font you are choosing doesn't have glyphs for the characters you are
> trying to render,
> 
> - You are encoding your text wrongly (less likely).
> 
> You should check what font backends are actually being enabled / used.  If no
> native font backends could be enabled, then all you get is the internal cairo
> font which only supports ASCII.
> 
> If you want automatic font substitution, and non-Latin support or advanced
> typographic features, what Dom said shall be take more seriously (as opposed
> to take as a 'stock answer').  Either use PangoCairo, or build a text
> rendering system yourself using HarfBuzz, Cairo, FriBidi, and other pieces
> (much much more work).
> 
> Two cents from your resident text rendering expert.  Feel free to ignore.
> behdad


What I would like to see for the OSX story, is for someone to figure out how to weave CoreText and Cairo rendering together. I began doing a Smalltalk binding for CoreText a while back, and was impressed at how similar it was at many levels to the Pango binding I'd already worked on. The trick would be to use CoreText to do the layout, but then find an API that would allow the glyphs to be passed over to Cairo to do the rendering. This is how PangoCairo works, iiuc, so the APIs to hand Cairo font glyphs for rendering are there already.

Two Tenths of a Percent of Two Cents from your resident Pango binding amateur. :)

Behdad, I would love it if there was an updated "State of Harfbuzz" somewhere. Last I knew you'd gone off to work on it, and then things (for me at least) went kinda dark there. But the idea seemed to be that a Pango Generation 2 (or at least part of the Pango story) would come out of it. I see the comments on the freedesktop.org page, but not much else in the way of docs.

--
Travis Griggs
Objologist
I multiply all time estimates by pi, to account for running around in circles.





More information about the cairo mailing list