[cairo] About cairo_show_text and UTF-8...

Mike Emmel mike.emmel at gmail.com
Fri Jan 6 12:44:15 PST 2006

On 1/6/06, Bill Spitzak <spitzak at d2.com> wrote:
> Owen Taylor wrote:
> > This is not remotely possible (I think I've explained this before but
> > I'll try again)
> >
> > Pango deals with fonts on a level that is *not* a simple model of
> > character => glyph. Modern fonts include tables that describe how
> > the different glyphs in the font interact with each other; this
> > includes kerning, ligatures, and more sophisticated forms of
> > combination that are essential to rendering most of the scripts of the
> > world. (Arabic, Hindi/Devanagari, Thai, etc, etc, etc.)
> >
> > So, you can't just take two fonts and glom them together into one
> > big font that has all the characters in either font.
> I don't understand this. All I want is the first 0x10ffff glyph indicies
> to always draw something that has some relationship to the Unicode
> glyphs. A possible accurate definition is that they should draw the
> exact same glyph Pango would draw if given a 1-character string of only
> that index. That does not mean Pango is limited to these same glyphs. My
> recommendation is that the fontset contain alternate forms in non-unicde
> indexes above 0x10ffff, though instead Pango could just select several
> of them like it does with fonts now. And Pango can retrieve the tables
> for all the fonts from the fontset.
> > You *could* add fontsetting code into the Cairo toy API. That would
> > require changes to the Cairo internal interfaces, but is otherwise
> > not all that hard. But it would be entirely separate from the Pango
> > fontsetting code, other than they would both use fontconfig to
> > get the lists of fonts to combine.
> Please, somebody, do this, if that is the only solution.
> However my belief is that doing this in two places is wasteful and
> possibly dangerous. If Cairo can manage this large set of glyphs, Pango
> should be able to take advantage of it, and Pango should be able talk to
> Cairo about only a single "font", rather than having to shuffle Cairo
> fonts around. This would also allow easy mixing and migrating from the
> "toy" interface to Pango, and would encourage Pango adoption. I am also
> extremely worried that different algorithims will lead to programs
> producing different output when given the same font-name string, which
> is a big turn-off for users.

Except that you would not want cairo to always choose the fonts in the fontset
there are problems with that thus you need to probably expose the fontset api.
And you still have not solved bidi much less mixed bidi text.
Its not and easy problem.

I looked at it and there is no reason you can't come up with a much
smaller library then pango that has most of the functionality by
removing gobject dependency and only offering a fontconfig/cairo
solution. You don't need all the internal abstraction layers that
pango has to interact with a number of font systems. For pango it
should be trivial to wrap such a library.


More information about the cairo mailing list