pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT;
}
if (hFont == NULL) {
+ if (flags & FXFONT_EXACTMATCH) {\r
+ return NULL;\r
+ }\r
if (bCJK) {
if (italic_angle != 0) {
bItalic = TRUE;
m_pFontInfo->DeleteFont(hFont);
return face;
}
+FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, FX_DWORD flags, int weight, int italic_angle)\r
+{\r
+ if (m_pFontInfo == NULL) {\r
+ return NULL;\r
+ }\r
+ FX_BOOL bItalic = (flags & FXFONT_ITALIC) != 0;\r
+ int PitchFamily = 0;\r
+ if (flags & FXFONT_SERIF) {\r
+ PitchFamily |= FXFONT_FF_ROMAN;\r
+ }\r
+ if (flags & FXFONT_SCRIPT) {\r
+ PitchFamily |= FXFONT_FF_SCRIPT;\r
+ }\r
+ if (flags & FXFONT_FIXED_PITCH) {\r
+ PitchFamily |= FXFONT_FF_FIXEDPITCH;\r
+ }\r
+ void* hFont = m_pFontInfo->MapFontByUnicode(dwUnicode, weight, bItalic, PitchFamily);\r
+ if (hFont == NULL) {\r
+ return NULL;\r
+ }\r
+ FX_DWORD ttc_size = m_pFontInfo->GetFontData(hFont, 0x74746366, NULL, 0);\r
+ FX_DWORD font_size = m_pFontInfo->GetFontData(hFont, 0, NULL, 0);\r
+ if(font_size == 0 && ttc_size == 0) {\r
+ m_pFontInfo->DeleteFont(hFont);\r
+ return NULL;\r
+ }\r
+ FXFT_Face face = NULL;\r
+ if (ttc_size) {\r
+ FX_BYTE temp[1024];\r
+ m_pFontInfo->GetFontData(hFont, 0x74746366, temp, 1024);\r
+ FX_DWORD checksum = 0;\r
+ for (int i = 0; i < 256; i ++) {\r
+ checksum += ((FX_DWORD*)temp)[i];\r
+ }\r
+ FX_LPBYTE pFontData;\r
+ face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, ttc_size - font_size, pFontData);\r
+ if (face == NULL) {\r
+ pFontData = FX_Alloc(FX_BYTE, ttc_size);\r
+ if (pFontData) {\r
+ m_pFontInfo->GetFontData(hFont, 0x74746366, pFontData, ttc_size);\r
+ face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData, ttc_size,\r
+ ttc_size - font_size);\r
+ }\r
+ }\r
+ } else {\r
+ CFX_ByteString SubstName;\r
+ m_pFontInfo->GetFaceName(hFont, SubstName);\r
+ FX_LPBYTE pFontData;\r
+ face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData);\r
+ if (face == NULL) {\r
+ pFontData = FX_Alloc(FX_BYTE, font_size);\r
+ if (!pFontData) {\r
+ m_pFontInfo->DeleteFont(hFont);\r
+ return NULL;\r
+ }\r
+ m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size);\r
+ face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData, font_size, m_pFontInfo->GetFaceIndex(hFont));\r
+ }\r
+ }\r
+ m_pFontInfo->DeleteFont(hFont);\r
+ return face;\r
+}\r
extern "C" {
unsigned long _FTStreamRead(FXFT_Stream stream, unsigned long offset,
unsigned char* buffer, unsigned long count);
{
return NULL;
}
+void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, int weight, FX_BOOL bItalic, int pitch_family)\r
+{\r
+ return NULL;\r
+}\r
void* CFX_FolderFontInfo::GetFont(FX_LPCSTR face)
{
FX_LPVOID p;