On Wed, Jul 30, 2008 at 11:38 AM, sqweek <[EMAIL PROTECTED]> wrote: > On Wed, Jul 30, 2008 at 10:20 AM, Anthony Martin <[EMAIL PROTECTED]> wrote: >> I started the process of explaining how X draws >> a character with X(mb|wc|utf8)DrawString but >> about half way through, I was confused. > > I'd love to hear it anyway.
Hm, maybe I should give you an idea of my current understanding. It starts with some text, which is somehow encoded into numbers. Hopefully the encoding is utf-8 as I think wmii assumes it. Locale probably affects things here... Anyway, the text can be decoded into a sequence of codepoints, which is what we are really interested in for dealing with fonts. That just about covers what I _know_ about the situation, the remainder is supposition: Logically, a font file must be a mapping from codepoint to glyph. It shouldn't matter what codepage the font was designed for, since I'm sure eg. the glyph め has equivalent codepoints in shift_JIS and iso10646. If you always work internally with iso10646 you ought to be able to map the codepoints from other codepages when loading fonts. Um, I'm probably getting sidetracked. So you've decoded some text to get codepoints, and now you need to draw them. You sequentially step through the font list looking for that codepoint, get the associated glyph and draw it. It all seems pretty simple actually, which is probably a sure sign I'm way off X11's implementation ;) -sqweek
