| 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 uint8_t _GetCharsetFromCodePage(FX_WORD codepage) | 681 uint8_t _GetCharsetFromCodePage(FX_WORD codepage) |
| 682 { | 682 { |
| 683 int32_t iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; | 683 int32_t iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; |
| 684 FXSYS_assert(iEnd >= 0); | 684 FXSYS_assert(iEnd >= 0); |
| 685 int32_t iStart = 0, iMid; | 685 int32_t iStart = 0, iMid; |
| 686 do { | 686 do { |
| 687 iMid = (iStart + iEnd) / 2; | 687 iMid = (iStart + iEnd) / 2; |
| 688 const CHARSET_MAP & cp = g_Codepage2CharsetTable[iMid]; | 688 const CHARSET_MAP & cp = g_Codepage2CharsetTable[iMid]; |
| 689 if (codepage == cp.codepage) { | 689 if (codepage == cp.codepage) { |
| 690 return cp.charset; | 690 return cp.charset; |
| 691 } else if (codepage < cp.codepage) { | 691 } |
| 692 if (codepage < cp.codepage) { |
| 692 iEnd = iMid - 1; | 693 iEnd = iMid - 1; |
| 693 } else { | 694 } else { |
| 694 iStart = iMid + 1; | 695 iStart = iMid + 1; |
| 695 } | 696 } |
| 696 } while (iStart <= iEnd); | 697 } while (iStart <= iEnd); |
| 697 return 1; | 698 return 1; |
| 698 } | 699 } |
| 699 FX_DWORD _GetCodePageRangeFromCharset(int charset) | 700 FX_DWORD _GetCodePageRangeFromCharset(int charset) |
| 700 { | 701 { |
| 701 if (charset == FXFONT_EASTEUROPE_CHARSET) { | 702 if (charset == FXFONT_EASTEUROPE_CHARSET) { |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | 1153 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; |
| 1153 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; | 1154 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; |
| 1154 if (m_FoxitFaces[12]) { | 1155 if (m_FoxitFaces[12]) { |
| 1155 return m_FoxitFaces[12]; | 1156 return m_FoxitFaces[12]; |
| 1156 } | 1157 } |
| 1157 const uint8_t* pFontData = NULL; | 1158 const uint8_t* pFontData = NULL; |
| 1158 FX_DWORD size = 0; | 1159 FX_DWORD size = 0; |
| 1159 m_pFontMgr->GetStandardFont(pFontData, size, 12); | 1160 m_pFontMgr->GetStandardFont(pFontData, size, 12); |
| 1160 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size,
0); | 1161 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size,
0); |
| 1161 return m_FoxitFaces[12]; | 1162 return m_FoxitFaces[12]; |
| 1162 } else { | |
| 1163 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; | |
| 1164 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMB
OLIC, weight, italic_angle, 0, pSubstFont); | |
| 1165 } | 1163 } |
| 1166 #else | 1164 #endif |
| 1167 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; | 1165 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; |
| 1168 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC
, weight, italic_angle, 0, pSubstFont); | 1166 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC
, weight, italic_angle, 0, pSubstFont); |
| 1169 #endif | |
| 1170 } | 1167 } |
| 1171 if (Charset == FXFONT_ANSI_CHARSET) { | 1168 if (Charset == FXFONT_ANSI_CHARSET) { |
| 1172 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | 1169 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; |
| 1173 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old
_weight, PitchFamily); | 1170 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old
_weight, PitchFamily); |
| 1174 } | 1171 } |
| 1175 int index = m_CharsetArray.Find(Charset); | 1172 int index = m_CharsetArray.Find(Charset); |
| 1176 if (index < 0) { | 1173 if (index < 0) { |
| 1177 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old
_weight, PitchFamily); | 1174 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old
_weight, PitchFamily); |
| 1178 } else { | |
| 1179 hFont = m_pFontInfo->GetFont(m_FaceArray[index]); | |
| 1180 } | 1175 } |
| 1176 hFont = m_pFontInfo->GetFont(m_FaceArray[index]); |
| 1181 } | 1177 } |
| 1182 } | 1178 } |
| 1183 pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont); | 1179 pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont); |
| 1184 if (hFont == NULL) { | 1180 if (hFont == NULL) { |
| 1185 return NULL; | 1181 return NULL; |
| 1186 } | 1182 } |
| 1187 m_pFontInfo->GetFaceName(hFont, SubstName); | 1183 m_pFontInfo->GetFaceName(hFont, SubstName); |
| 1188 if (Charset == FXFONT_DEFAULT_CHARSET) { | 1184 if (Charset == FXFONT_DEFAULT_CHARSET) { |
| 1189 m_pFontInfo->GetFontCharset(hFont, Charset); | 1185 m_pFontInfo->GetFontCharset(hFont, Charset); |
| 1190 } | 1186 } |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 return FALSE; | 1512 return FALSE; |
| 1517 } | 1513 } |
| 1518 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; | 1514 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; |
| 1519 name = pFont->m_FaceName; | 1515 name = pFont->m_FaceName; |
| 1520 return TRUE; | 1516 return TRUE; |
| 1521 } | 1517 } |
| 1522 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) | 1518 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) |
| 1523 { | 1519 { |
| 1524 return FALSE; | 1520 return FALSE; |
| 1525 } | 1521 } |
| OLD | NEW |