   Freetype 2: Creating a hash map to access glyphs from unicode characters
  hi!i've finished a basic font rendering system using Freetype 2. So far I just specify all the characters to be loaded from a font face in an array. I would like the system to be more flexible though, and allow not only for extended roman letters, but for unicode characters in general.my idea was to load all glyphs from a font face and then create a hash map where each glyph corresponds to its unicode character. when renderig text, i could look up each glyph in the map and render it; if no glyph could be found for a given character, it would be skipped. this way, users could render any unicode character as long as they provide a suitable font.to load all available glyphs from a font file, i do the following:unsigned long code;unsigned int index;map<unsigned long, shared_ptr<Glyph>> glyphs;// fetch first character from font facecode = FT_Get_First_Char( fontFace, &index );while( index != 0 ){// load glyph at index and add it to hash mapglyphs = loadGlyph( fontFace, index );// fetch next character from font facecode = FT_Get_Next_Char( fontFace, code, &index );}loadGlyph( fontFace, index ) calls FT_Load_Glyph( fontFace, index ) to access a glyph.i would now like to look up glyphs from the hash map using unicode characters (wchar_t) from a wstring. however, the character codes returned by FT_Get_First_Char/FT_Get_Next_Char do not seem to correspond to unicode character codes (although the unicode charmap is loaded in the font).how do i have to convert the codes?BONUS QUESTION: is there an alternative to std::map that suits better here?
FT_Get_Char_Index is probably what you are looking for. See FT2 Tutorial: Step 1.This might be helpful: GD.net: FreeType. See the file FTSystem.cpp.Also, if this is for GPU rendering, this may possibly be relevant as well: Rectangle packing for GPU rendering.   ;Quote:Original post by clbFT_Get_Char_Index is probably what you are looking for. See FT2 Tutorial: Step 1.this returns the index of a given character but what i want is the character which corresponds to a glyph at a given index. as i said, i want to load ALL glyphs in a font (without knowing what they are) and then link them to (unicode) characters. so i want to do the opposite of what FT_Get_Char_Index() can do. i know it's tricky as there is no 1:1 relation between glyph and character but FT_Get_First_Char() and FT_Get_Next_Char() DO return some character code, so there should be a way i can use this to link glyphs and characters or character codes, respectively.thank you anyway, i'll have a look at your 3rd link.