Main Page | File List | File Members

FTCharmap.cpp

Go to the documentation of this file.
00001 #include "FTFace.h"
00002 #include "FTCharmap.h"
00003 
00004 
00005 FTCharmap::FTCharmap( FTFace* face)
00006 :   ftFace( *(face->Face())),
00007     err(0)
00008 {
00009     if( !ftFace->charmap)
00010     {
00011         err = FT_Set_Charmap( ftFace, ftFace->charmaps[0]);
00012     }
00013     
00014     ftEncoding = ftFace->charmap->encoding;
00015 }
00016 
00017 
00018 FTCharmap::~FTCharmap()
00019 {
00020     charMap.clear();
00021 }
00022 
00023 
00024 bool FTCharmap::CharMap( FT_Encoding encoding)
00025 {
00026     if( ftEncoding == encoding)
00027     {
00028         return true;
00029     }
00030     
00031     err = FT_Select_Charmap( ftFace, encoding );
00032     
00033     if( !err)
00034     {
00035         ftEncoding = encoding;
00036     }
00037     else
00038     {
00039         ftEncoding = ft_encoding_none;
00040     }
00041         
00042     charMap.clear();
00043     return !err;
00044 }
00045 
00046 
00047 unsigned int FTCharmap::CharIndex( unsigned int characterCode )
00048 {
00049     const CharacterMap::GlyphIndex *result = charMap.find( characterCode);
00050     if( !result)
00051     {
00052         return 0;
00053     }
00054     else
00055     {
00056         return *result;
00057     }
00058 }
00059 
00060 
00061 void FTCharmap::InsertIndex( const unsigned int characterCode, const unsigned int containerIndex)
00062 {
00063     charMap.insert( characterCode, containerIndex);
00064 }
00065 
00066 
00067 unsigned int FTCharmap::GlyphIndex( const unsigned int characterCode)
00068 {
00069     unsigned int glyphIndex = FT_Get_Char_Index( ftFace, characterCode);
00070     return glyphIndex;
00071 }

Generated on Mon Mar 8 18:45:41 2004 for FTGL by doxygen 1.3.5