| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "../../../include/fxge/fx_ge.h" | 9 #include "../../../include/fxge/fx_ge.h" |
| 10 #include "../../../include/fxge/fx_freetype.h" | 10 #include "../../../include/fxge/fx_freetype.h" |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 uint8_t _GetCharsetFromCodePage(FX_WORD codepage) | 698 uint8_t _GetCharsetFromCodePage(FX_WORD codepage) |
| 699 { | 699 { |
| 700 int32_t iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; | 700 int32_t iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; |
| 701 FXSYS_assert(iEnd >= 0); | 701 FXSYS_assert(iEnd >= 0); |
| 702 int32_t iStart = 0, iMid; | 702 int32_t iStart = 0, iMid; |
| 703 do { | 703 do { |
| 704 iMid = (iStart + iEnd) / 2; | 704 iMid = (iStart + iEnd) / 2; |
| 705 const CHARSET_MAP & cp = g_Codepage2CharsetTable[iMid]; | 705 const CHARSET_MAP & cp = g_Codepage2CharsetTable[iMid]; |
| 706 if (codepage == cp.codepage) { | 706 if (codepage == cp.codepage) { |
| 707 return cp.charset; | 707 return cp.charset; |
| 708 } else if (codepage < cp.codepage) { | 708 } |
| 709 if (codepage < cp.codepage) { |
| 709 iEnd = iMid - 1; | 710 iEnd = iMid - 1; |
| 710 } else { | 711 } else { |
| 711 iStart = iMid + 1; | 712 iStart = iMid + 1; |
| 712 } | 713 } |
| 713 } while (iStart <= iEnd); | 714 } while (iStart <= iEnd); |
| 714 return 1; | 715 return 1; |
| 715 } | 716 } |
| 716 FX_DWORD _GetCodePageRangeFromCharset(int charset) | 717 FX_DWORD _GetCodePageRangeFromCharset(int charset) |
| 717 { | 718 { |
| 718 if (charset == FXFONT_EASTEUROPE_CHARSET) { | 719 if (charset == FXFONT_EASTEUROPE_CHARSET) { |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | 1173 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; |
| 1173 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; | 1174 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; |
| 1174 if (m_FoxitFaces[12]) { | 1175 if (m_FoxitFaces[12]) { |
| 1175 return m_FoxitFaces[12]; | 1176 return m_FoxitFaces[12]; |
| 1176 } | 1177 } |
| 1177 const uint8_t* pFontData = NULL; | 1178 const uint8_t* pFontData = NULL; |
| 1178 FX_DWORD size = 0; | 1179 FX_DWORD size = 0; |
| 1179 m_pFontMgr->GetStandardFont(pFontData, size, 12); | 1180 m_pFontMgr->GetStandardFont(pFontData, size, 12); |
| 1180 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size,
0); | 1181 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size,
0); |
| 1181 return m_FoxitFaces[12]; | 1182 return m_FoxitFaces[12]; |
| 1182 } else { | |
| 1183 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; | |
| 1184 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMB
OLIC, weight, italic_angle, 0, pSubstFont); | |
| 1185 } | 1183 } |
| 1186 #else | 1184 #endif |
| 1187 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; | 1185 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; |
| 1188 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC
, weight, italic_angle, 0, pSubstFont); | 1186 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC
, weight, italic_angle, 0, pSubstFont); |
| 1189 #endif | |
| 1190 } | 1187 } |
| 1191 if (Charset == FXFONT_ANSI_CHARSET) { | 1188 if (Charset == FXFONT_ANSI_CHARSET) { |
| 1192 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | 1189 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; |
| 1193 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old
_weight, PitchFamily); | 1190 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old
_weight, PitchFamily); |
| 1194 } | 1191 } |
| 1195 int index = m_CharsetArray.Find(Charset); | 1192 int index = m_CharsetArray.Find(Charset); |
| 1196 if (index < 0) { | 1193 if (index < 0) { |
| 1197 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old
_weight, PitchFamily); | 1194 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old
_weight, PitchFamily); |
| 1198 } else { | |
| 1199 hFont = m_pFontInfo->GetFont(m_FaceArray[index]); | |
| 1200 } | 1195 } |
| 1196 hFont = m_pFontInfo->GetFont(m_FaceArray[index]); |
| 1201 } | 1197 } |
| 1202 } | 1198 } |
| 1203 pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont); | 1199 pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont); |
| 1204 if (hFont == NULL) { | 1200 if (hFont == NULL) { |
| 1205 return NULL; | 1201 return NULL; |
| 1206 } | 1202 } |
| 1207 m_pFontInfo->GetFaceName(hFont, SubstName); | 1203 m_pFontInfo->GetFaceName(hFont, SubstName); |
| 1208 if (Charset == FXFONT_DEFAULT_CHARSET) { | 1204 if (Charset == FXFONT_DEFAULT_CHARSET) { |
| 1209 m_pFontInfo->GetFontCharset(hFont, Charset); | 1205 m_pFontInfo->GetFontCharset(hFont, Charset); |
| 1210 } | 1206 } |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 return FALSE; | 1616 return FALSE; |
| 1621 } | 1617 } |
| 1622 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; | 1618 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; |
| 1623 name = pFont->m_FaceName; | 1619 name = pFont->m_FaceName; |
| 1624 return TRUE; | 1620 return TRUE; |
| 1625 } | 1621 } |
| 1626 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) | 1622 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) |
| 1627 { | 1623 { |
| 1628 return FALSE; | 1624 return FALSE; |
| 1629 } | 1625 } |
| OLD | NEW |