diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2018-05-31 14:08:11 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-31 14:08:11 +0000 |
commit | 656eb84f83fc1701737d9c65658371a99428d727 (patch) | |
tree | 6fb28e4283c1ef8696b42d8b7d200a13c32742fc /core/fxge/cfx_fontmapper.cpp | |
parent | 8f7ee98e2c622c21f452cd9fd5956fe85bcb2b7c (diff) | |
download | pdfium-656eb84f83fc1701737d9c65658371a99428d727.tar.xz |
Move codepage/charset methods into related places.
Change-Id: I71417cc5b1bd00f77d42740198cc17487ebd686e
Reviewed-on: https://pdfium-review.googlesource.com/33330
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core/fxge/cfx_fontmapper.cpp')
-rw-r--r-- | core/fxge/cfx_fontmapper.cpp | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp index b9a8eac1a1..e6fc984edc 100644 --- a/core/fxge/cfx_fontmapper.cpp +++ b/core/fxge/cfx_fontmapper.cpp @@ -145,19 +145,6 @@ const struct AltFontFamily { {"ForteMT", "Forte"}, }; -const struct CODEPAGE_MAP { - uint16_t codepage; - uint8_t charset; -} g_Codepage2CharsetTable[] = { - {0, 1}, {42, 2}, {437, 254}, {850, 255}, {874, 222}, - {932, 128}, {936, 134}, {949, 129}, {950, 136}, {1250, 238}, - {1251, 204}, {1252, 0}, {1253, 161}, {1254, 162}, {1255, 177}, - {1256, 178}, {1257, 186}, {1258, 163}, {1361, 130}, {10000, 77}, - {10001, 78}, {10002, 81}, {10003, 79}, {10004, 84}, {10005, 83}, - {10006, 85}, {10007, 89}, {10008, 80}, {10021, 87}, {10029, 88}, - {10081, 86}, -}; - ByteString TT_NormalizeName(const char* family) { ByteString norm(family); norm.Remove(' '); @@ -170,19 +157,6 @@ ByteString TT_NormalizeName(const char* family) { return norm; } -uint8_t GetCharsetFromCodePage(uint16_t codepage) { - const CODEPAGE_MAP* pEnd = - g_Codepage2CharsetTable + FX_ArraySize(g_Codepage2CharsetTable); - const CODEPAGE_MAP* pCharmap = - std::lower_bound(g_Codepage2CharsetTable, pEnd, codepage, - [](const CODEPAGE_MAP& charset, uint16_t page) { - return charset.codepage < page; - }); - if (pCharmap < pEnd && codepage == pCharmap->codepage) - return pCharmap->charset; - return FX_CHARSET_Default; -} - void GetFontFamily(uint32_t nStyle, ByteString* fontName) { if (fontName->Contains("Script")) { if (FontStyleIsBold(nStyle)) @@ -544,13 +518,10 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name, int Charset = FX_CHARSET_ANSI; if (WindowCP) - Charset = GetCharsetFromCodePage(WindowCP); + Charset = FX_GetCharsetFromCodePage(WindowCP); else if (iBaseFont == kNumStandardFonts && FontStyleIsSymbolic(flags)) Charset = FX_CHARSET_Symbol; - const bool bCJK = (Charset == FX_CHARSET_ShiftJIS || - Charset == FX_CHARSET_ChineseSimplified || - Charset == FX_CHARSET_Hangul || - Charset == FX_CHARSET_ChineseTraditional); + const bool bCJK = FX_CharSetIsCJK(Charset); bool bItalic = FontStyleIsItalic(nStyle); GetFontFamily(nStyle, &family); |