{
inline bool
-_MakeId(unsigned long character, Tizen::Graphics::_Util::FixedPoint26_6 size, int style, unsigned long& out)
+_MakeId(unsigned long glyphIndex, Tizen::Graphics::_Util::FixedPoint26_6 size, int style, unsigned long& out)
{
int fixedSize = size >> 5;
- if (((character >> 22) > 0) || ((fixedSize >> 8) > 0) || ((style >> 2) > 0))
+ if (((glyphIndex >> 22) > 0) || ((fixedSize >> 8) > 0) || ((style >> 2) > 0))
{
return false;
}
- out = (character << 10) | ((fixedSize & 0xFF) << 2) | (style & 0x3);
+ out = (glyphIndex << 10) | ((fixedSize & 0xFF) << 2) | (style & 0x3);
return true;
}
}
bool
-_FontCache::Find(unsigned long character, _Util::FixedPoint26_6 size, int style, _IFont::Glyph** pOut)
+_FontCache::Find(unsigned long glyphIndex, _Util::FixedPoint26_6 size, int style, _IFont::Glyph** pOut)
{
unsigned long id = 0;
- bool rtn = _MakeId(character, size, style, id);
+ bool rtn = _MakeId(glyphIndex, size, style, id);
if (!rtn)
{
}
bool
-_FontCache::Add(unsigned long character, _Util::FixedPoint26_6 size, int style, _IFont::Glyph* pGlyph)
+_FontCache::Add(unsigned long glyphIndex, _Util::FixedPoint26_6 size, int style, _IFont::Glyph* pGlyph)
{
unsigned long bufferSize = 0;
unsigned long id = 0;
- bool rtn = _MakeId(character, size, style, id);
+ bool rtn = _MakeId(glyphIndex, size, style, id);
if (!rtn)
{
// Requested glyph is not cachable
}
void
-_FontCache::Remove(unsigned long character, _Util::FixedPoint26_6 size, int style)
+_FontCache::Remove(unsigned long glyphIndex, _Util::FixedPoint26_6 size, int style)
{
unsigned long id = 0;
- bool rtn = _MakeId(character, size, style, id);
+ bool rtn = _MakeId(glyphIndex, size, style, id);
if (!rtn)
{
return;
}
bool
-_FontFt2::FindCache(unsigned long character, _Util::FixedPoint26_6 size, int style, Glyph** pOut)
+_FontFt2::FindCache(unsigned long glyphIndex, _Util::FixedPoint26_6 size, int style, Glyph** pOut)
{
- return (__fontCache.get()) ? __fontCache->Find(character, __fontAttrib.size, __fontAttrib.style, pOut) : false;
+ return (__fontCache.get()) ? __fontCache->Find(glyphIndex, __fontAttrib.size, __fontAttrib.style, pOut) : false;
}
bool
-_FontFt2::AddCache(unsigned long character, _Util::FixedPoint26_6 size, int style, Glyph* pGlyph)
+_FontFt2::AddCache(unsigned long glyphIndex, _Util::FixedPoint26_6 size, int style, Glyph* pGlyph)
{
- return (__fontCache.get()) ? __fontCache->Add(character, size, style, pGlyph) : false;
+ return (__fontCache.get()) ? __fontCache->Add(glyphIndex, size, style, pGlyph) : false;
}
bool
}
pFace = FT_Face(__pFontFace);
- index1 = __GetCharIndex(character1);
- index2 = __GetCharIndex(character2);
+ index1 = __GetGlyphIndex(character1);
+ index2 = __GetGlyphIndex(character2);
bool hasKerning = false;
CHECK_NULL_PARAM(__pFontFace);
CHECK_NULL_PARAM(ppFontGlyphData);
- bool rtn = FindCache(character, __fontAttrib.size, __fontAttrib.style, ppFontGlyphData);
+ FT_UInt glyphIndex = __GetGlyphIndex(character);
+
+ bool rtn = FindCache(glyphIndex, __fontAttrib.size, __fontAttrib.style, ppFontGlyphData);
if (rtn)
{
*ppFontGlyphData = null;
FT_Face pFace = null;
- FT_UInt ixCurr = character;
pFace = FT_Face(__pFontFace);
SysLog(NID_GRP, "[] FT_IS_SCALABLE has been failed");
}
- // retrieve glyph index from character code
- ixCurr = __GetCharIndex(character);
-
// set transformation
FT_Matrix matrix;
FT_Vector pen = {0, 0};
if (isSynthetic)
{
- errCode = FT_Load_Glyph(pFace, ixCurr, FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP);
+ errCode = FT_Load_Glyph(pFace, glyphIndex, FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP);
}
else
{
- //errCode = FT_Load_Glyph(pFace, ixCurr, FT_LOAD_RENDER);
- errCode = FT_Load_Glyph(pFace, ixCurr, FT_LOAD_DEFAULT);
+ //errCode = FT_Load_Glyph(pFace, glyphIndex, FT_LOAD_RENDER);
+ errCode = FT_Load_Glyph(pFace, glyphIndex, FT_LOAD_DEFAULT);
}
if (errCode) // 0: success
//TODO sunmi557.shin, will not support
FT_Error errCode = 1;
- errCode = FT_Load_Glyph(pFace, ixCurr, FT_LOAD_RENDER | FT_LOAD_MONOCHROME);
+ errCode = FT_Load_Glyph(pFace, glyphIndex, FT_LOAD_RENDER | FT_LOAD_MONOCHROME);
if (errCode)
{
if (__isLoadGlyph)
{
- rtn = AddCache(character, __fontAttrib.size, __fontAttrib.style, *ppFontGlyphData);
+ rtn = AddCache(glyphIndex, __fontAttrib.size, __fontAttrib.style, *ppFontGlyphData);
}
if (*ppFontGlyphData != null)
unsigned long
_FontFt2::CheckGlyph(unsigned long character)
{
- return __GetCharIndex(character);
+ return __GetGlyphIndex(character);
}
bool
if (!auxInfo.isAvailable)
{
- char* pFontGlyphData = new (std::nothrow) char[sizeof(_IFont::Glyph)];
+ _IFont::Glyph* pFontGlyphData = (_IFont::Glyph*) new (std::nothrow) char[sizeof(_IFont::Glyph)];
if (pFontGlyphData)
{
memset(pFontGlyphData, 0, sizeof(_IFont::Glyph));
- out.Add((_IFont::Glyph*) pFontGlyphData);
+ pFontGlyphData->hasOwnerShip = 1;
+ out.Add(pFontGlyphData);
}
continue;
}
- FT_UInt glyph_index = auxInfo.glyphIndex;
+ FT_UInt glyphIndex = auxInfo.glyphIndex;
// bidi cache underdevelop
- //_IFont::Glyph *pFontGlyphData;
- //
- //bool rtn = FindCache(glyph_index, __fontAttrib.size, __fontAttrib.style, &pFontGlyphData);
- //
- //if (rtn)
- //{
- // out.Add(pFontGlyphData);
- // continue;
- //}
+ _IFont::Glyph* pFontGlyphData;
+
+ bool rtn = FindCache(glyphIndex, __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);
+ error = FT_Load_Glyph(pFace, glyphIndex, FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP);
}
else
{
- error = FT_Load_Glyph(pFace, glyph_index, /*FT_LOAD_RENDER*/FT_LOAD_DEFAULT/* | FT_LOAD_NO_BITMAP*/);
+ error = FT_Load_Glyph(pFace, glyphIndex, /*FT_LOAD_RENDER*/FT_LOAD_DEFAULT/* | FT_LOAD_NO_BITMAP*/);
}
if (error)
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)
{
out.Add(pFontGlyphData);
// bidi cache underdevelop
- //AddCache(glyph_index, __fontAttrib.size, __fontAttrib.style, pFontGlyphData);
- //
- //if (pFontGlyphData != null)
- //{
- // pFontGlyphData->hasOwnerShip = 1;
- //}
+ AddCache(glyphIndex, __fontAttrib.size, __fontAttrib.style, pFontGlyphData);
+
+ if (pFontGlyphData != null)
+ {
+ pFontGlyphData->hasOwnerShip = 1;
+ }
}
return true;
}
unsigned long
-_FontFt2::__GetCharIndex(unsigned long character) const
+_FontFt2::__GetGlyphIndex(unsigned long character) const
{
if (!__isValid)
{
if (pFace->charmap != null)
{
- unsigned long ixCurr = FT_Get_Char_Index(pFace, character);
+ unsigned long glyphIndex = FT_Get_Char_Index(pFace, character);
- return ixCurr;
+ return glyphIndex;
}
return character;