Hash :
de2532f4
Author :
Date :
2001-08-08T01:33:03
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
#include "FTGlyphContainer.h"
#include "FTGlyph.h"
FTGlyphContainer::FTGlyphContainer( FT_Face* f, int g, bool p)
: preCache( p),
numGlyphs(g),
tempGlyph(0),
face(f)
{
glyphs.reserve( g);
}
// OPSignature: FTGlyphContainer:~FTGlyphContainer()
FTGlyphContainer::~FTGlyphContainer()
{
vector<FTGlyph*>::iterator iter;
for( iter = glyphs.begin(); iter != glyphs.end(); ++iter)
{
delete *iter;
}
glyphs.clear();
}
bool FTGlyphContainer::Add( FTGlyph* tempGlyph)
{
glyphs.push_back( tempGlyph);
}
FT_Vector& FTGlyphContainer::render( int index, int next, FT_Vector pen)
{
kernAdvance.x = 0; kernAdvance.y = 0;
int left = FT_Get_Char_Index( *face, index);
int right = FT_Get_Char_Index( *face, next);
if( left > glyphs.size())
return kernAdvance;
if( 0 < right <= glyphs.size())
{
// ft_kerning_unfitted
err = FT_Get_Kerning( *face, left, right, ft_kerning_default, &kernAdvance);
}
advance = glyphs[left]->Render( pen);
kernAdvance.x = advance + kernAdvance.x;
// kernAdvance.y = advance.y + kernAdvance.y;
return kernAdvance;
}