Results 1 to 6 of 6

Thread: mapping of glyph Indexes with charmap (or Unicodes)???

  1. #1
    Join Date
    Jun 2007
    Posts
    21
    Thanks
    1
    Qt products
    Qt3 Qt/Embedded

    Lightbulb mapping of glyph Indexes with charmap (or Unicodes)???

    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.........

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: mapping of glyph Indexes with charmap (or Unicodes)???

    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:
    Qt Code:
    1. FT_CALLBACK_DEF( FT_UInt )
    2. tt_cmap0_char_index( TT_CMap cmap,
    3. FT_UInt32 char_code )
    4. {
    5. FT_Byte* table = cmap->data;
    6.  
    7.  
    8. return char_code < 256 ? table[6 + char_code] : 0;
    9. }
    To copy to clipboard, switch view to plain text mode 
    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

  3. The following user says thank you to marcel for this useful post:

    Gaurav K SIngh (2nd August 2007)

  4. #3
    Join Date
    Jun 2007
    Posts
    21
    Thanks
    1
    Qt products
    Qt3 Qt/Embedded

    Thumbs up Re: mapping of glyph Indexes with charmap (or Unicodes)???

    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.........

  5. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: mapping of glyph Indexes with charmap (or Unicodes)???

    No problem.
    I think there are several cmaps for true type fonts.
    cmap0, 1... etc.

    So you should search in all of them.

    Regards

  6. #5
    Join Date
    Jun 2007
    Posts
    21
    Thanks
    1
    Qt products
    Qt3 Qt/Embedded

    Thumbs up Re: mapping of glyph Indexes with charmap (or Unicodes)???

    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.

  7. #6
    Join Date
    Jun 2007
    Posts
    21
    Thanks
    1
    Qt products
    Qt3 Qt/Embedded

    Default Re: mapping of glyph Indexes with charmap (or Unicodes)???

    --------------------------------------------------------------------------------

    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...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.