_IFont::Glyph* pGlyph;
pEnum->GetCurrent(pGlyph);
- delete pGlyph;
+ pBaseFont->UnloadGlyph(&pGlyph);
}
delete pEnum;
_IFont::Glyph* pGlyph;
pEnum->GetCurrent(pGlyph);
- delete pGlyph;
+ pBaseFont->UnloadGlyph(&pGlyph);
}
delete pEnum;
FT_UInt glyph_index = auxInfo.glyphIndex;
+ _IFont::Glyph *pFontGlyphData;
+
+ bool rtn = FindCache(glyph_index, __fontAttrib.size, __fontAttrib.style, &pFontGlyphData);
+
+ if (rtn)
+ {
+ out.Add(pFontGlyphData);
+ continue;
+ }
+
if (isSynthetic)
{
error = FT_Load_Glyph(pFace, glyph_index, FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP);
image.bytesPerLine = pSlot->bitmap.pitch;
image.pBitmap = pSlot->bitmap.buffer;
- _IFont::Glyph *pFontGlyphData = (_IFont::Glyph*) new (std::nothrow) char[sizeof(_IFont::Glyph) + (image.bytesPerLine * image.height)];
+ pFontGlyphData = (_IFont::Glyph*) new (std::nothrow) char[sizeof(_IFont::Glyph) + (image.bytesPerLine * image.height)];
if (pFontGlyphData == null)
{
memcpy(pFontGlyphData->image.pBitmap, image.pBitmap, image.bytesPerLine * image.height);
out.Add(pFontGlyphData);
+
+ AddCache(glyph_index, __fontAttrib.size, __fontAttrib.style, pFontGlyphData);
+
+ if (pFontGlyphData != null)
+ {
+ pFontGlyphData->hasOwnerShip = 1;
+ }
}
return true;