[cairo] Lots of text API pushed
behdad at behdad.org
Fri Aug 8 00:17:11 PDT 2008
I finally pushed what I've been working on for the past few days.
- Toy-api font-face constructor and getters,
- cairo_scaled_font_text_to_glyphs(). This is essentially a *just* a
wrapper around the font backend text_to_glyphs method. However, the
documentation and input/output sanity checking turned it into a 350-line
beast. It's also the most complicated API in cairo now. I like it.
- user-font got a small API change in the init function, and a major
one in the text_to_glyphs() method to match
scaled_font_text_to_glyphs(). Namely, to add cluster support and fix
- _allocate and _free functions added for cairo_glyph_t and
- Fixed bugs with PDF show_text_glyphs handling.
With these and Pango master, show_text_glyphs is actually generating
results. Bugs to fix still (including some in Poppler), but the results
are already looking interesting.
Things that need a fix before releasing 1.7.2 (hopefully tomorrow):
- test/user-font text is coming out with the wrong color in PDF. Only
happens with this test. So, should be some bug with Type3 fonts.
- test/user-font-proxy text is coming out as bitmap glyphs in PDF.
- win32-font is totally broken now because I disabled its
text_to_glyphs(). Either that should be updated to the new API
(computing clusters if needed), or just rewrite it as the much simpler
ucs4_to_index(). This is toy font API after all.
- Decide what to do with zero-glyph clusters. PDF tries to generate
ActualText for them, but that can't really work without something inside
the ActualText. We can disallow zero-glyph clusters and then I will
handle them in Pango using a user-font with no drawings.
- Add some section documentation for user fonts.
Comments and patches welcome.
To test show_text_glyph, just grab pango master and cairo trunk and
print text in gedit. Open in acroread, select all, copy, paste in gedit
and compare. The Arabic text with diacritic marks is particularly
showing bad. Try with pango/pango-view/HELLO.txt if you are brave
enough. The Indic text is showing improvements, but is still coming out
That's all for tonight,
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo