We know code point 65
represent A
. There is one to one mapping, hence it's easy to render. Take symbol A from the font file and render it.
65 == A
Now let's consider Hindi language. Code point 0x0924
represents त
, again easy to map.
0x0924 == त
But, if code point 0x0924
is immediately followed by code points 0x094d
and 0x0930
which represents ्
and र
respectively, the representation is not combination of these 3 but a new symbol त्र
0x0924 0x094d 0x0930 != त ् र
But
0x0924 0x094d 0x0930 == त्र
My question are.
Welcome to modern fonts: they're not what you think. The days of "one codepoint maps to one letter" are kind of 20 years ago, modern fonts have -for the last few decades- been doing way more than that. I'm going to explain this in terms of OpenType fonts (what most people call "ttf" and "otf" fonts. Yes, those are the same font, they only differ in their glyph outline encoding, which is kind of the least notable part about a modern font), because that's the kind you're most likely using, in which case: the font pretty much controls everything, and the text engine you're relying on is simply following its instructions.
OpenType fonts have a "Character Map" that provides (all) the simple one-to-one mapping(s) from input byte code to some glyph ("shape") somewhere in the list of available glyphs. (Note that this does not define "which glyphs exist" for the font, it only says which glyphs are directly matched to individual character codes such as individual ASCII bytes or Unicode codepoints. There can be thousands more glyphs that are used for compositing, or multi-codepoint substitution, etc that cannot be resolved through the character map).
Also, one font can, and usually does, contain more than one mapping, because different historical and current character sets (ASCII, EUC-KR, ISO2022-JP, Unicode, etc. etc. etc.) don't use the same codes for the same letters/symbols. If they share any at all, of course.
While mapping binary codes to other binary codes is trivially simple, the real power of modern fonts, particularly OpenType, is what happens next.
Making good fonts, even just programming of them (so not taking the typeface design into account at all) is quite a specialised job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With