PDA

View Full Version : mapping of glyph Indexes with charmap (or Unicodes)???



Gaurav K SIngh
2nd August 2007, 08:07
Hi all,

we are digging in the Internationalization topic in QT and we are facing a troublesome situation here.
We got some characters whose glyph indexes are known to us but there charmap or unicode is not available.
so please suggest the location ,where the mapping takes place or show some otherway to achieve the chaprmap code or unicode of those characters.

Thanks.........

marcel
2nd August 2007, 13:17
OK. Since no one is risking... I'm gonna try again.
I think this can be done. I'll try to draft a few steps:

1. Get the charmap for the UNICODE encoding.
This can be done as following:


FT_CMap cmap = FT_CMAP( face->charmap );

Keep in mind that perfect would be to first select the unicode charmap in the face. But in most faces that charmap is the default.

2. Dig pretty deep in freetype code and docs.
I can only tell you the reverse function for what you want to achieve.
Since you're working with true type fonts, you need the reverse of this:


FT_CALLBACK_DEF( FT_UInt )
tt_cmap0_char_index( TT_CMap cmap,
FT_UInt32 char_code )
{
FT_Byte* table = cmap->data;


return char_code < 256 ? table[6 + char_code] : 0;
}

This is from ttcmap.c. Every font type has a particular implementation for retrieving the glyph index.

In your situation, you will actually pass the glyph index. you will have to iterate in "table" to search for the index matching yours.
Once you find it, return the table index that gave you your glyph index.

I do not pretend to know everything about what's under the hood in freetype( not sure how many people actually know ), but you should really get familiar about how charmap lookup tables are built/loaded and what exceptional cases there may be.

In the mean time, you might even find another solution to your problem.

Regards

Gaurav K SIngh
2nd August 2007, 15:07
Thanks for your valuable support and effort
from yesterday only i m puttin in my best to find some solution and i m gonna try this also with all my limits.

lets hope it will work otherwise once again i will call u to help me .
thanks a lot.........

marcel
2nd August 2007, 15:16
No problem.
I think there are several cmaps for true type fonts.
cmap0, 1... etc.

So you should search in all of them.

Regards

Gaurav K SIngh
4th August 2007, 07:53
Ya , actually i was trying to do the same,
I tried to put some warning and comments to find out the exact path of calling in ttcmap0.c
but to my dismay,

The commands like "printf", "cout", and "qWarning" are not showing any message at the terminal, so i m not being able to find out the exact path , So can u plz help me in this.

and do you know how the "tree" as mentioned in the file ,used to store the glyphs , actually do function.
i mean hw the compiler gets any glyph and hw the tree is storing them i mean in what order.

Thanks....
wating for your valuable suggestion.

Gaurav K SIngh
6th August 2007, 08:51
--------------------------------------------------------------------------------

Ya , actually i was trying to do the same,
I tried to put some warning and comments to find out the exact path of calling in ttcmap0.c
but to my dismay,

The commands like "printf", "cout", and "qWarning" are not showing any message at the terminal, so i m not being able to find out the exact path , So can u plz help me in this.

and do you know how the "tree" as mentioned in the file ,used to store the glyphs , actually do function.
i mean hw the compiler gets any glyph and hw the tree is storing them i mean in what order.

Thanks....
wating for your valuable suggestion...