2005-01-21 05:15:33 +00:00
|
|
|
#include "FTFace.h"
|
|
|
|
#include "FTCharmap.h"
|
|
|
|
|
|
|
|
|
|
|
|
FTCharmap::FTCharmap( FTFace* face)
|
|
|
|
: ftFace( *(face->Face())),
|
|
|
|
err(0)
|
|
|
|
{
|
|
|
|
if( !ftFace->charmap)
|
|
|
|
{
|
|
|
|
err = FT_Set_Charmap( ftFace, ftFace->charmaps[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
ftEncoding = ftFace->charmap->encoding;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FTCharmap::~FTCharmap()
|
|
|
|
{
|
|
|
|
charMap.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FTCharmap::CharMap( FT_Encoding encoding)
|
|
|
|
{
|
|
|
|
if( ftEncoding == encoding)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = FT_Select_Charmap( ftFace, encoding );
|
|
|
|
|
|
|
|
if( !err)
|
|
|
|
{
|
|
|
|
ftEncoding = encoding;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ftEncoding = ft_encoding_none;
|
|
|
|
}
|
|
|
|
|
|
|
|
charMap.clear();
|
|
|
|
return !err;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-25 16:35:56 +00:00
|
|
|
unsigned int FTCharmap::GlyphListIndex( const unsigned int characterCode )
|
2005-01-21 05:15:33 +00:00
|
|
|
{
|
|
|
|
return charMap.find( characterCode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-25 16:35:56 +00:00
|
|
|
unsigned int FTCharmap::FontIndex( const unsigned int characterCode )
|
2005-01-21 05:15:33 +00:00
|
|
|
{
|
|
|
|
return FT_Get_Char_Index( ftFace, characterCode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FTCharmap::InsertIndex( const unsigned int characterCode, const unsigned int containerIndex)
|
|
|
|
{
|
|
|
|
charMap.insert( characterCode, containerIndex);
|
|
|
|
}
|