[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple-font strings and char encodings in CLX
You should not really care about the bit encoding used for the element
of a string. It is the identity of the characters, not their encoding,
which matters.
Think of character encodings as ordered sets of characters, not as a
partitioning of the character space. The encodings are a mapping from
index to character.
You do not want to assume that all fonts have the same encoding. Unless
someone goes to a lot of trouble to design a whole new bunch of them,
they will not. You wouldn't want to use the standard distributed BDF
fonts on a Mac, for instance, because of the quite different resolution.
Conceptually, to display a character, you look at all the character sets
(encodings) of which it is a member. For each, you look for a font that
satisfies the character's other attributes (such as size or bold and/or
oblique). If you find one, then you index with the character's index in
that encoding (conceptually based on searching for the character as an
object in the character encoding definition).
Of course, for efficiency, you want to recognize the common case of the
bit encoding of the character having something to do with the index into
the font. But don't build it in all the way through.