unicode<->glyphid mapping
I am working on nr-arena-glyphs.cpp
there, at line 468: NRArenaGlyphs *g = NR_ARENA_GLYPHS(child);
g->glyph holds an integer (the glyph id).
As I understand it, there must be a mapping between a unicode char and its respective glyph id. How can I retrieve it?
Juca
I am working on nr-arena-glyphs.cpp
there, at line 468: NRArenaGlyphs *g = NR_ARENA_GLYPHS(child);
g->>glyph holds an integer (the glyph id).
As I understand it, there must be a mapping between a unicode char and its respective glyph id. How can I retrieve it?
You have just hit the core of what Pango does. Yep, the answer to your question is tens of thousands of lines of code.
If you just want to know how to do the mapping, then it's pango_shape() (http://library.gnome.org/devel/pango/unstable/pango-Text-Processing.html#pan...) which is called in the middle of Layout-TNG-Compute.cpp.
The real details are complicated, but basically latin text has a one-to-one mapping, ligatures are an example of many-to-one mapping, lots of Arabic text and some Western accented characters have a one-to-many mapping, and if you combine the two you can end up with a many-to-many mapping (e.g. aé (two characters) could theoretically end up as æ and a combining ´ accent (two glyphs). This e-mail is UTF-8 encoded, if that didn't display correctly).
Richard.
participants (2)
-
Felipe Sanches
-
Richard Hughes