[cairo] Cairo with m17n-lib

Bill Spitzak spitzak at d2.com
Fri Oct 22 13:31:05 PDT 2004


One thing I would like to see is that the "toy" API at least be able to draw 
ALL the glyphs in Unicode. I don't like the fact that I have to examine every 
character and select the right font for that character. Yes a Pango-type 
interface does this, but it does a lot of other stuff that I don't always 
want because I am not trying to do text formatting and I actually WANT the 
glyphs to be left-to-right appended irregardless of language. This is vital 
for displaying UTF-8 filenames or email addresses or string constants in 
programs in a way that they can be edited.

It also seems that this would reduce the amount of work Pango does, because a 
huge hash lookup could be moved to Cairo and merged with it's own code that 
keeps track of the cached glyph bitmaps.

My proposal for the "toy" api is to do these rules for each glyph until one 
of them works:

1. The toy api lets the user choose exactly one font. This font may define 
that glyph, in which case it is used. This includes overprinting compositing 
defined by TrueType fonts.

2. If that font defines a font-specific encoding that assigns a glyph to that 
code, that glyph is used. I.e if the program chooses Symbol and draws an 'a' 
then an alpha glyph is drawn. (this is vital for compatability and by far the 
biggest headache with Xft for me!)

3. Cairo also contains a hard-coded list of other fonts. Each of these are 
checked to see if they define the glyph, the first one found is used. A 
typical installation will include Symbol (Greek), Cryllic, Arabic, Hebrew, 
and other such languages, and as many Math symbols and Dingbats as possible. 
It appears nice-looking Chinese and Japanese are not availble freely, but 
commercial ones could be installed. The very last font in the list is a 16x16 
open-source bitmapped one, with hand-drawn versions of every single assigned 
Unicode character, which is still better than nothing!

4. If nothing is found Cairo draws a box with the hex code inside it.

Now where I say "hard coded" it means it is likely these are set by config 
files, and there may be a private platform-specific interface to change it, 
but no official portable Cairo interface.

Pango should be able to take advantage of this lookup by Cairo so that it no 
longer has to do the "which font" hashing. Cairo must be able to tell Pango 
which rule it would use to draw each glyph, and it should be possible for 
Pango to arrange things using the private interfaces so that all the possible 
glyphs it wants to draw at the same time can be indexed at once. "Alternative 
forms" would be done by making indexes outside the Unicode range print those 
glyphs. Obviously this will require some of Pango's logic to be moved into 
Cairo, but I think this can be kept minimal and would be a huge win for 
everybody.



More information about the cairo mailing list