diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-14 15:18:58 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-15 03:34:20 +0000 |
commit | 8c1a66b6c55dfce51b6b2c2c5de479b97b9792ed (patch) | |
tree | 73204e78b500c185e5373a0898db20d4892c721e | |
parent | 6e0b25b9456871be5d2e6dcb418cc6daac04ff7a (diff) | |
download | pdfium-8c1a66b6c55dfce51b6b2c2c5de479b97b9792ed.tar.xz |
Remove unused methods and data from fgas_codepage
The methods are not called, so the data is not used. Removed.
Change-Id: I29e904da2a000fd5173d2f5240ad377613db200a
Reviewed-on: https://pdfium-review.googlesource.com/3050
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | xfa/fgas/crt/fgas_codepage.cpp | 400 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_codepage.h | 2 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.cpp | 136 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_fontutils.cpp | 311 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_fontutils.h | 4 |
5 files changed, 353 insertions, 500 deletions
diff --git a/xfa/fgas/crt/fgas_codepage.cpp b/xfa/fgas/crt/fgas_codepage.cpp index 5f824667fb..cae2dd7234 100644 --- a/xfa/fgas/crt/fgas_codepage.cpp +++ b/xfa/fgas/crt/fgas_codepage.cpp @@ -10,342 +10,71 @@ namespace { -struct FX_STR2CPHASH { - uint32_t uHash; - uint16_t uCodePage; -}; - struct FX_CHARSET_MAP { uint16_t charset; uint16_t codepage; }; -struct FX_LANG2CPMAP { - uint16_t wLanguage; - uint16_t wCodepage; -}; - const FX_CHARSET_MAP g_FXCharset2CodePageTable[] = { - {0, 1252}, {1, 0}, {2, 42}, {77, 10000}, {78, 10001}, - {79, 10003}, {80, 10008}, {81, 10002}, {83, 10005}, {84, 10004}, - {85, 10006}, {86, 10081}, {87, 10021}, {88, 10029}, {89, 10007}, - {128, 932}, {129, 949}, {130, 1361}, {134, 936}, {136, 950}, - {161, 1253}, {162, 1254}, {163, 1258}, {177, 1255}, {178, 1256}, - {186, 1257}, {204, 1251}, {222, 874}, {238, 1250}, {254, 437}, - {255, 850}, -}; - -const FX_LANG2CPMAP g_FXLang2CodepageTable[] = { - {FX_LANG_Arabic_SaudiArabia, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Bulgarian_Bulgaria, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Catalan_Catalan, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Chinese_Taiwan, FX_CODEPAGE_ChineseTraditional}, - {FX_LANG_CzechRepublic, FX_CODEPAGE_MSWin_EasternEuropean}, - {FX_LANG_Danish_Denmark, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_German_Germany, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Greek_Greece, FX_CODEPAGE_MSWin_Greek}, - {FX_LANG_English_UnitedStates, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_TraditionalSort, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Finnish_Finland, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_French_France, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Hebrew_Israel, FX_CODEPAGE_MSWin_Hebrew}, - {FX_LANG_Hungarian_Hungary, FX_CODEPAGE_MSWin_EasternEuropean}, - {FX_LANG_Icelandic_Iceland, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Italian_Italy, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Japanese_Japan, FX_CODEPAGE_ShiftJIS}, - {FX_LANG_Korean_Korea, FX_CODEPAGE_Korean}, - {FX_LANG_Dutch_Netherlands, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Norwegian_Bokmal, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Polish_Poland, FX_CODEPAGE_MSWin_EasternEuropean}, - {FX_LANG_Portuguese_Brazil, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Romanian_Romania, FX_CODEPAGE_MSWin_EasternEuropean}, - {FX_LANG_Russian_Russia, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Croatian_Croatia, FX_CODEPAGE_MSWin_EasternEuropean}, - {FX_LANG_Slovak_Slovakia, FX_CODEPAGE_MSWin_EasternEuropean}, - {FX_LANG_Albanian_Albania, FX_CODEPAGE_MSWin_EasternEuropean}, - {FX_LANG_Swedish_Sweden, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Thai_Thailand, FX_CODEPAGE_MSDOS_Thai}, - {FX_LANG_Turkish_Turkey, FX_CODEPAGE_MSWin_Turkish}, - {FX_LANG_Urdu_Pakistan, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Indonesian_Indonesia, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Ukrainian_Ukraine, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Belarusian_Belarus, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Slovenian_Slovenia, FX_CODEPAGE_MSWin_EasternEuropean}, - {FX_LANG_Estonian_Estonia, FX_CODEPAGE_MSWin_Baltic}, - {FX_LANG_Latvian_Latvia, FX_CODEPAGE_MSWin_Baltic}, - {FX_LANG_Lithuanian_Lithuania, FX_CODEPAGE_MSWin_Baltic}, - {FX_LANG_Persian, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Vietnamese_Vietnam, FX_CODEPAGE_MSWin_Vietnamese}, - {FX_LANG_Armenian_Armenia, FX_CODEPAGE_DefANSI}, - {FX_LANG_Azerbaijan_Latin, FX_CODEPAGE_MSWin_Turkish}, - {FX_LANG_Basque_Basque, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Macedonian, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Afrikaans_SouthAfrica, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Georgian_Georgia, FX_CODEPAGE_DefANSI}, - {FX_LANG_Faroese_FaroeIslands, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Hindi_India, FX_CODEPAGE_DefANSI}, - {FX_LANG_Malay_Malaysia, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Kazakh_Kazakhstan, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Kyrgyz_Kyrgyzstan, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Kiswahili_Kenya, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Uzbek_LatinUzbekistan, FX_CODEPAGE_MSWin_Turkish}, - {FX_LANG_Tatar_Russia, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Punjabi_India, FX_CODEPAGE_DefANSI}, - {FX_LANG_Gujarati_India, FX_CODEPAGE_DefANSI}, - {FX_LANG_Tamil_India, FX_CODEPAGE_DefANSI}, - {FX_LANG_Telugu_India, FX_CODEPAGE_DefANSI}, - {FX_LANG_Kannada_India, FX_CODEPAGE_DefANSI}, - {FX_LANG_Marathi_India, FX_CODEPAGE_DefANSI}, - {FX_LANG_SanskritIndia, FX_CODEPAGE_DefANSI}, - {FX_LANG_Mongolian_CyrillicMongolia, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Galician_Galician, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Konkani_India, FX_CODEPAGE_DefANSI}, - {FX_LANG_Syriac_Syria, FX_CODEPAGE_DefANSI}, - {FX_LANG_Divehi_Maldives, FX_CODEPAGE_DefANSI}, - {FX_LANG_Arabic_Iraq, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Chinese_PRC, FX_CODEPAGE_ChineseSimplified}, - {FX_LANG_German_Switzerland, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_English_UnitedKingdom, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Mexico, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_French_Belgium, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Italian_Switzerland, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Dutch_Belgium, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Norwegian_Nynorsk, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Portuguese_Portugal, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_SerbianLatin_Serbia, FX_CODEPAGE_MSWin_EasternEuropean}, - {FX_LANG_Swedish_Finland, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Azerbaijan_Cyrillic, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Malay_BruneiDarussalam, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Uzbek_CyrillicUzbekistan, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Arabic_Egypt, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Chinese_HongKong, FX_CODEPAGE_ChineseTraditional}, - {FX_LANG_German_Austria, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_English_Australia, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_InternationalSort, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_French_Canada, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_SerbianCyrillic_Serbia, FX_CODEPAGE_MSWin_Cyrillic}, - {FX_LANG_Arabic_Libya, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Chinese_Singapore, FX_CODEPAGE_ChineseSimplified}, - {FX_LANG_German_Luxembourg, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_English_Canada, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Guatemala, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_French_Switzerland, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Algeria, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Chinese_Macao, FX_CODEPAGE_ChineseTraditional}, - {FX_LANG_German_Liechtenstein, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_English_NewZealand, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_CostaRica, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_French_Luxembourg, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Morocco, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_English_Ireland, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Panama, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_French_Monaco, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Tunisia, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_English_SouthAfrica, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_DominicanRepublic, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Oman, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_English_Jamaica, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Venezuela, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Yemen, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_English_Caribbean, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Colombia, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Syria, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_English_Belize, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Peru, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Jordan, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_English_TrinidadTobago, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Argentina, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Lebanon, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_English_Zimbabwe, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Ecuador, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Kuwait, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_English_Philippines, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Chile, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_UAE, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Spanish_Uruguay, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Bahrain, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Spanish_Paraguay, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Arabic_Qatar, FX_CODEPAGE_MSWin_Arabic}, - {FX_LANG_Spanish_Bolivia, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_ElSalvador, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Honduras, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_Nicaragua, FX_CODEPAGE_MSWin_WesternEuropean}, - {FX_LANG_Spanish_PuertoRico, FX_CODEPAGE_MSWin_WesternEuropean}, -}; - -const FX_STR2CPHASH g_FXCPHashTable[] = { - {0xd45, 0x6faf}, {0xd46, 0x6fb0}, {0xd47, 0x6fb1}, - {0xd48, 0x6fb2}, {0xd49, 0x4e6}, {0xd4d, 0x6fbd}, - {0xe9e, 0x4e4}, {0xc998, 0x1b5}, {0x18ef0, 0x3a8}, - {0x19f85, 0x5182}, {0x2e2335, 0x3b6}, {0x325153, 0x5182}, - {0x145bded, 0x2716}, {0x3c9a5f2, 0xc6f3}, {0x4c45f2d, 0x3a4}, - {0x4c45f4e, 0xc431}, {0x58caf51, 0x4e4}, {0x5a5cd7d, 0x3a8}, - {0x5a6c6a7, 0x4e4}, {0x5a6ca0b, 0x1b5}, {0x5a6cd68, 0x307}, - {0x5a6d8d3, 0x4e4}, {0x5a6d948, 0x354}, {0x5a6d96b, 0x362}, - {0x5a6d984, 0x366}, {0x5a90e35, 0x1b5}, {0x5e0cf00, 0x6fb5}, - {0x609c324, 0x551}, {0x617d97f, 0x5182}, {0x6a6fd91, 0xfde8}, - {0x6a6fd92, 0xfde9}, {0x6b102de, 0xcadc}, {0x6b10f48, 0x4e89}, - {0x1020805f, 0x4e4}, {0x10f0524c, 0x6fb5}, {0x11d558fe, 0x6fb0}, - {0x13898d19, 0xc42d}, {0x13898d3a, 0xc431}, {0x138a319e, 0x6fb1}, - {0x14679c09, 0x96c6}, {0x153f0a3d, 0x6fb2}, {0x1576eeb3, 0x4e20}, - {0x169a0ce6, 0xc6f9}, {0x16f3e2dc, 0x6fb3}, {0x18a8bb7a, 0x6fb4}, - {0x1a5d9419, 0x6fb5}, {0x1a847b48, 0x3a8}, {0x1b762419, 0xcec8}, - {0x1b9d7847, 0x475}, {0x1c126cb9, 0x6fb6}, {0x1ccdbc7d, 0x4f42}, - {0x1d330f5f, 0x2714}, {0x1dc74559, 0x4e6}, {0x1edd80da, 0x4e4}, - {0x23e4b03d, 0xfde8}, {0x24f28a16, 0x4f3d}, {0x286e7a32, 0x2715}, - {0x2c7c18ed, 0x3a8}, {0x2e2103b7, 0x2713}, {0x304bf479, 0x6fb4}, - {0x304bf47d, 0x6fb5}, {0x309bb869, 0xfde8}, {0x309bb86a, 0xfde9}, - {0x33664357, 0x3b6}, {0x352d6b49, 0x3a4}, {0x36f5661c, 0x1b5}, - {0x392e8f48, 0xcadc}, {0x3dc7c64c, 0x47c}, {0x3ed2e8e1, 0x4e4}, - {0x3f0c2fea, 0xcaed}, {0x3f0fef8f, 0xc6f2}, {0x3f5e130f, 0x5182}, - {0x47174d1f, 0x3a8}, {0x49686b7b, 0x6fb4}, {0x4b80b0d9, 0x3a4}, - {0x4dcda97a, 0x4e4}, {0x4dcda9b6, 0x4e4}, {0x4e881e6a, 0x5221}, - {0x4ffdf5a1, 0x36a}, {0x4ffdf5a5, 0x6fbd}, {0x5241ce16, 0x4e8b}, - {0x546bab9d, 0x4e4}, {0x54a3d64e, 0x6fb6}, {0x562179bd, 0x5161}, - {0x57c1df15, 0xc6f7}, {0x61ff6e62, 0x4f36}, {0x6359c7d8, 0x4f35}, - {0x63f3c335, 0x3a8}, {0x645a0f78, 0x477}, {0x691ac2fd, 0x275f}, - {0x6dc2eab0, 0x2d0}, {0x6dc2eeef, 0x35e}, {0x6dc2ef10, 0x36a}, - {0x7103138a, 0x47d}, {0x710dfbd0, 0xc6f5}, {0x7319f6cb, 0x36a}, - {0x745096ad, 0x3a8}, {0x74866229, 0x4e8c}, {0x77185fa5, 0x3a8}, - {0x7953f002, 0x6faf}, {0x7953f003, 0x6fb0}, {0x7953f004, 0x6fb1}, - {0x7953f005, 0x6fb2}, {0x7953f006, 0x6fb7}, {0x7953f00a, 0x6fbd}, - {0x7c577571, 0x2761}, {0x7e8c8ff1, 0x479}, {0x8031f47f, 0x3b5}, - {0x8031f481, 0x3b5}, {0x80c4a710, 0x5187}, {0x857c7e14, 0xfde8}, - {0x857c7e15, 0xfde9}, {0x86b59c90, 0x4e4}, {0x86b59c91, 0x6fb0}, - {0x86b59c92, 0x6fb1}, {0x86b59c93, 0x6fb2}, {0x86b59c94, 0x6fb3}, - {0x86b59c95, 0x6fb4}, {0x86b59c96, 0x6fb5}, {0x86b59c97, 0x4e7}, - {0x86b59c98, 0x4e6}, {0x8b4b24ec, 0x5190}, {0x8face362, 0x4e4}, - {0x8ff9ec2a, 0xfde9}, {0x919d3989, 0xcadc}, {0x9967e5ad, 0x4e22}, - {0x99f8b933, 0x6fbd}, {0x9bd2a380, 0x4fc7}, {0x9befad23, 0x4f38}, - {0x9c7ac649, 0x4f3c}, {0xa02468db, 0xdeae}, {0xa02468ec, 0xdeab}, - {0xa024692a, 0xdeaa}, {0xa0246997, 0xdeb2}, {0xa02469ff, 0xdeb0}, - {0xa0246a3d, 0xdeb1}, {0xa0246a8c, 0xdeaf}, {0xa0246a9a, 0xdeb3}, - {0xa0246b16, 0xdeac}, {0xa0246b1a, 0xdead}, {0xa071addc, 0x4b1}, - {0xa38b62dc, 0x474}, {0xa4c09fed, 0x3a8}, {0xa51e86e5, 0x4e7}, - {0xa67ab13e, 0x3a4}, {0xa7414244, 0x51a9}, {0xa9ddbead, 0xc6fb}, - {0xab24ffab, 0x4e8a}, {0xabef8ac4, 0x2710}, {0xabfa20ac, 0x6fb4}, - {0xad36895e, 0x4e2}, {0xad36895f, 0x4e3}, {0xaf310e90, 0x402}, - {0xaf31166f, 0x4e8}, {0xaf7277a5, 0x3b6}, {0xafc0d8b3, 0x96c6}, - {0xb0fd5dba, 0xcae0}, {0xb0fd5e95, 0xcadc}, {0xb1052893, 0x7149}, - {0xb1e98745, 0x36a}, {0xb277e91c, 0x5166}, {0xb2f7eac5, 0xcae0}, - {0xb2f7eba0, 0xcadc}, {0xb2f7ebc1, 0x3b5}, {0xb53fa77d, 0x3a8}, - {0xb6391138, 0x6fb5}, {0xb7358b7f, 0x6fb6}, {0xb8c42b40, 0x4e4}, - {0xb8c42ea4, 0x1b5}, {0xb8c439e7, 0x2e1}, {0xb8c43a61, 0x307}, - {0xb8c43d6c, 0x4e4}, {0xb8c43ddf, 0x352}, {0xb8c43de1, 0x354}, - {0xb8c43de6, 0x359}, {0xb8c43dff, 0x35d}, {0xb8c43e04, 0x362}, - {0xb8c43e07, 0x365}, {0xbcd29a7f, 0x3a8}, {0xbce34e78, 0x5182}, - {0xbce34e7b, 0x556a}, {0xbce81504, 0x3b5}, {0xbd8a4c95, 0x272d}, - {0xbdd89dad, 0x4e4}, {0xbdd89dae, 0x6fb0}, {0xbdd89daf, 0x6fb1}, - {0xbdd89db0, 0x6fb2}, {0xbdd89db1, 0x4e6}, {0xbdd89db5, 0x6fbd}, - {0xc1756e9f, 0x36b}, {0xc7482444, 0x47a}, {0xc9281c18, 0x4e4}, - {0xc9ef95df, 0x47b}, {0xccc9db0d, 0x4e4}, {0xccc9db0e, 0x6fb0}, - {0xcd73425f, 0x3b6}, {0xce38b40b, 0x4b0}, {0xce99e549, 0x25}, - {0xcf598740, 0x4e7}, {0xcf6d6f78, 0x4e4}, {0xcf758df6, 0x3a4}, - {0xd1266e51, 0x6fb5}, {0xd2910213, 0x2718}, {0xd29196bb, 0x2712}, - {0xd3eb2fc2, 0x476}, {0xd442dc2c, 0x4fc4}, {0xd9da4da4, 0x2711}, - {0xdbad2f42, 0x4e4}, {0xdbad2f43, 0x6fb0}, {0xdbad2f44, 0x6fb1}, - {0xdbad2f45, 0x6fb2}, {0xdbad2f46, 0x6fb3}, {0xdbad2f47, 0x6fb4}, - {0xdbad2f48, 0x6fb5}, {0xdbad2f49, 0x6fb6}, {0xdbad2f4a, 0x4e6}, - {0xdc438033, 0x4f31}, {0xdccb439b, 0x477}, {0xdccdc626, 0x3b5}, - {0xdd80a595, 0x4e4}, {0xdd80a596, 0x6fb0}, {0xdd80a59e, 0x6fb1}, - {0xdd80a5b4, 0x6fb2}, {0xdd80a5d9, 0x6fb5}, {0xdd80a5da, 0x6fb4}, - {0xdd80a5fa, 0x6fb6}, {0xdd80a615, 0x6fb3}, {0xdd80a619, 0x4e6}, - {0xdd80a61a, 0x3b5}, {0xdd80c0f8, 0x4e9f}, {0xdf7e46ff, 0x4fc8}, - {0xdf8680fd, 0x556a}, {0xdfb0bd6e, 0xc42d}, {0xdff05486, 0x2c4}, - {0xe3323399, 0x3a4}, {0xe60412dd, 0x3b5}, {0xeee47add, 0x4b0}, - {0xf021a186, 0x4e2}, {0xf021a187, 0x4e3}, {0xf021a188, 0x4e4}, - {0xf021a189, 0x4e5}, {0xf021a18a, 0x4e6}, {0xf021a18b, 0x4e7}, - {0xf021a18c, 0x4e8}, {0xf021a18d, 0x4e9}, {0xf021a18e, 0x4ea}, - {0xf0700456, 0x6fb3}, {0xf274f175, 0x3b5}, {0xf2a9730b, 0x3a8}, - {0xf3d463c2, 0x3a4}, {0xf52a70a3, 0xc42e}, {0xf5693147, 0x6fb3}, - {0xf637e157, 0x478}, {0xfc213f3a, 0x2717}, {0xff654d14, 0x3b5}, + {FX_CHARSET_ANSI, FX_CODEPAGE_MSWin_WesternEuropean}, + {FX_CHARSET_Default, FX_CODEPAGE_DefANSI}, + {FX_CHARSET_Symbol, FX_CODEPAGE_Symbol}, + {FX_CHARSET_MAC_Roman, FX_CODEPAGE_MAC_Roman}, + {FX_CHARSET_MAC_ShiftJIS, FX_CODEPAGE_MAC_ShiftJIS}, + {FX_CHARSET_MAC_Korean, FX_CODEPAGE_MAC_Korean}, + {FX_CHARSET_MAC_ChineseSimplified, FX_CODEPAGE_MAC_ChineseSimplified}, + {FX_CHARSET_MAC_ChineseTriditional, FX_CODEPAGE_MAC_ChineseTraditional}, + {FX_CHARSET_MAC_Hebrew, FX_CODEPAGE_MAC_Hebrew}, + {FX_CHARSET_MAC_Arabic, FX_CODEPAGE_MAC_Arabic}, + {FX_CHARSET_MAC_Greek, FX_CODEPAGE_MAC_Greek}, + {FX_CHARSET_MAC_Turkish, FX_CODEPAGE_MAC_Turkish}, + {FX_CHARSET_MAC_Thai, FX_CODEPAGE_MAC_Thai}, + {FX_CHARSET_MAC_EasternEuropean, FX_CODEPAGE_MAC_EasternEuropean}, + {FX_CHARSET_MAC_Cyrillic, FX_CODEPAGE_MAC_Cyrillic}, + {FX_CHARSET_ShiftJIS, FX_CODEPAGE_ShiftJIS}, + {FX_CHARSET_Korean, FX_CODEPAGE_Korean}, + {FX_CHARSET_Johab, FX_CODEPAGE_Johab}, + {FX_CHARSET_ChineseSimplified, FX_CODEPAGE_ChineseSimplified}, + {FX_CHARSET_ChineseTriditional, FX_CODEPAGE_ChineseTraditional}, + {FX_CHARSET_MSWin_Greek, FX_CODEPAGE_MSWin_Greek}, + {FX_CHARSET_MSWin_Turkish, FX_CODEPAGE_MSWin_Turkish}, + {FX_CHARSET_MSWin_Vietnamese, FX_CODEPAGE_MSWin_Vietnamese}, + {FX_CHARSET_MSWin_Hebrew, FX_CODEPAGE_MSWin_Hebrew}, + {FX_CHARSET_MSWin_Arabic, FX_CODEPAGE_MSWin_Arabic}, + {FX_CHARSET_MSWin_Baltic, FX_CODEPAGE_MSWin_Baltic}, + {FX_CHARSET_MSWin_Cyrillic, FX_CODEPAGE_MSWin_Cyrillic}, + {FX_CHARSET_Thai, FX_CODEPAGE_MSDOS_Thai}, + {FX_CHARSET_MSWin_EasterEuropean, FX_CODEPAGE_MSWin_EasternEuropean}, + {FX_CHARSET_US, FX_CODEPAGE_MSDOS_US}, + {FX_CHARSET_OEM, FX_CODEPAGE_MSDOS_WesternEuropean}, }; -uint16_t GetCodePageFromStringA(const char* pStr, int32_t iLength) { - ASSERT(pStr); - if (iLength < 0) { - iLength = FXSYS_strlen(pStr); - } - if (iLength == 0) { - return 0xFFFF; - } - uint32_t uHash = FX_HashCode_GetA(CFX_ByteStringC(pStr, iLength), true); - int32_t iStart = 0; - int32_t iEnd = sizeof(g_FXCPHashTable) / sizeof(FX_STR2CPHASH) - 1; - ASSERT(iEnd >= 0); - do { - int32_t iMid = (iStart + iEnd) / 2; - const FX_STR2CPHASH& cp = g_FXCPHashTable[iMid]; - if (uHash == cp.uHash) { - return (uint16_t)cp.uCodePage; - } else if (uHash < cp.uHash) { - iEnd = iMid - 1; - } else { - iStart = iMid + 1; - } - } while (iStart <= iEnd); - return 0xFFFF; -} - } // namespace uint16_t FX_GetCodePageFromCharset(uint8_t charset) { int32_t iEnd = sizeof(g_FXCharset2CodePageTable) / sizeof(FX_CHARSET_MAP) - 1; ASSERT(iEnd >= 0); + int32_t iStart = 0, iMid; do { iMid = (iStart + iEnd) / 2; const FX_CHARSET_MAP& cp = g_FXCharset2CodePageTable[iMid]; - if (charset == cp.charset) { + if (charset == cp.charset) return cp.codepage; - } else if (charset < cp.charset) { - iEnd = iMid - 1; - } else { - iStart = iMid + 1; - } - } while (iStart <= iEnd); - return 0xFFFF; -} - -uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage) { - int32_t iEnd = sizeof(g_FXLang2CodepageTable) / sizeof(FX_LANG2CPMAP) - 1; - ASSERT(iEnd >= 0); - int32_t iStart = 0, iMid; - do { - iMid = (iStart + iEnd) / 2; - const FX_LANG2CPMAP& cp = g_FXLang2CodepageTable[iMid]; - if (wLanguage == cp.wLanguage) { - return cp.wCodepage; - } else if (wLanguage < cp.wLanguage) { + if (charset < cp.charset) iEnd = iMid - 1; - } else { + else iStart = iMid + 1; - } } while (iStart <= iEnd); return 0xFFFF; } -uint16_t FX_GetCodePageFromStringW(const wchar_t* pStr, int32_t iLength) { - if (iLength < 0) { - iLength = FXSYS_wcslen(pStr); - } - if (iLength == 0) { - return 0xFFFF; - } - CFX_ByteString csStr; - char* pBuf = csStr.GetBuffer(iLength + 1); - for (int32_t i = 0; i < iLength; ++i) { - *pBuf++ = (char)*pStr++; - } - csStr.ReleaseBuffer(iLength); - return GetCodePageFromStringA(csStr.c_str(), iLength); -} - void FX_SwapByteOrder(wchar_t* pStr, int32_t iLength) { ASSERT(pStr); - if (iLength < 0) { + + if (iLength < 0) iLength = FXSYS_wcslen(pStr); - } + uint16_t wch; if (sizeof(wchar_t) > 2) { while (iLength-- > 0) { @@ -354,25 +83,25 @@ void FX_SwapByteOrder(wchar_t* pStr, int32_t iLength) { wch &= 0x00FF; *pStr++ = wch; } - } else { - while (iLength-- > 0) { - wch = (uint16_t)*pStr; - wch = (wch >> 8) | (wch << 8); - *pStr++ = wch; - } + return; + } + + while (iLength-- > 0) { + wch = (uint16_t)*pStr; + wch = (wch >> 8) | (wch << 8); + *pStr++ = wch; } } void FX_UTF16ToWChar(void* pBuffer, int32_t iLength) { ASSERT(pBuffer && iLength > 0); - if (sizeof(wchar_t) == 2) { + if (sizeof(wchar_t) == 2) return; - } - uint16_t* pSrc = (uint16_t*)pBuffer; - wchar_t* pDst = (wchar_t*)pBuffer; - while (--iLength >= 0) { - pDst[iLength] = (wchar_t)pSrc[iLength]; - } + + uint16_t* pSrc = static_cast<uint16_t*>(pBuffer); + wchar_t* pDst = static_cast<wchar_t*>(pBuffer); + while (--iLength >= 0) + pDst[iLength] = static_cast<wchar_t>(pSrc[iLength]); } int32_t FX_DecodeString(uint16_t wCodePage, @@ -381,33 +110,34 @@ int32_t FX_DecodeString(uint16_t wCodePage, wchar_t* pDst, int32_t* pDstLen, bool bErrBreak) { - if (wCodePage == FX_CODEPAGE_UTF8) { + if (wCodePage == FX_CODEPAGE_UTF8) return FX_UTF8Decode(pSrc, pSrcLen, pDst, pDstLen); - } return -1; } + int32_t FX_UTF8Decode(const char* pSrc, int32_t* pSrcLen, wchar_t* pDst, int32_t* pDstLen) { - if (!pSrcLen || !pDstLen) { + if (!pSrcLen || !pDstLen) return -1; - } + int32_t iSrcLen = *pSrcLen; if (iSrcLen < 1) { *pSrcLen = *pDstLen = 0; return 1; } + int32_t iDstLen = *pDstLen; bool bValidDst = (pDst && iDstLen > 0); uint32_t dwCode = 0; int32_t iPending = 0; - int32_t iSrcNum = 0, iDstNum = 0; - int32_t k = 0; + int32_t iSrcNum = 0; + int32_t iDstNum = 0; int32_t iIndex = 0; - k = 1; + int32_t k = 1; while (iIndex < iSrcLen) { - uint8_t byte = (uint8_t) * (pSrc + iIndex); + uint8_t byte = static_cast<uint8_t>(*(pSrc + iIndex)); if (byte < 0x80) { iPending = 0; k = 1; @@ -415,14 +145,13 @@ int32_t FX_UTF8Decode(const char* pSrc, iSrcNum += k; if (bValidDst) { *pDst++ = byte; - if (iDstNum >= iDstLen) { + if (iDstNum >= iDstLen) break; - } } } else if (byte < 0xc0) { - if (iPending < 1) { + if (iPending < 1) break; - } + iPending--; dwCode |= (byte & 0x3f) << (iPending * 6); if (iPending == 0) { @@ -430,9 +159,8 @@ int32_t FX_UTF8Decode(const char* pSrc, iSrcNum += k; if (bValidDst) { *pDst++ = dwCode; - if (iDstNum >= iDstLen) { + if (iDstNum >= iDstLen) break; - } } } } else if (byte < 0xe0) { diff --git a/xfa/fgas/crt/fgas_codepage.h b/xfa/fgas/crt/fgas_codepage.h index e3a535edfc..3dfabe600e 100644 --- a/xfa/fgas/crt/fgas_codepage.h +++ b/xfa/fgas/crt/fgas_codepage.h @@ -134,8 +134,6 @@ #define FX_CHARSET_OEM 255 uint16_t FX_GetCodePageFromCharset(uint8_t charset); -uint16_t FX_GetCodePageFromStringW(const wchar_t* pStr, int32_t iLength); -uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage); void FX_SwapByteOrder(wchar_t* pStr, int32_t iLength); void FX_UTF16ToWChar(void* pBuffer, int32_t iLength); diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index 1746a2427d..7b8e19a5bc 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -95,6 +95,36 @@ const FX_FONTDESCRIPTOR* MatchDefaultFont( return iBestSimilar < 1 ? nullptr : pBestFont; } +uint32_t GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles) { + uint32_t dwHash = wCodePage; + if (dwFontStyles & FX_FONTSTYLE_FixedPitch) + dwHash |= 0x00010000; + if (dwFontStyles & FX_FONTSTYLE_Serif) + dwHash |= 0x00020000; + if (dwFontStyles & FX_FONTSTYLE_Symbolic) + dwHash |= 0x00040000; + if (dwFontStyles & FX_FONTSTYLE_Script) + dwHash |= 0x00080000; + if (dwFontStyles & FX_FONTSTYLE_Italic) + dwHash |= 0x00100000; + if (dwFontStyles & FX_FONTSTYLE_Bold) + dwHash |= 0x00200000; + return dwHash; +} + +uint32_t GetFontFamilyHash(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { + CFX_WideString wsFont(pszFontFamily); + if (dwFontStyles & FX_FONTSTYLE_Bold) + wsFont += L"Bold"; + if (dwFontStyles & FX_FONTSTYLE_Italic) + wsFont += L"Italic"; + + wsFont += wCodePage; + return FX_HashCode_GetW(wsFont.AsStringC(), false); +} + } // namespace std::unique_ptr<CFGAS_FontMgr> CFGAS_FontMgr::Create( @@ -114,7 +144,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { - uint32_t dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); + uint32_t dwHash = GetFontHashCode(wCodePage, dwFontStyles); auto it = m_CPFonts.find(dwHash); if (it != m_CPFonts.end()) { return it->second ? LoadFont(it->second, dwFontStyles, wCodePage) : nullptr; @@ -135,7 +165,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( m_Fonts.push_back(pFont); m_CPFonts[dwHash] = pFont; - dwHash = FGAS_GetFontFamilyHash(pFD->wsFontFace, dwFontStyles, wCodePage); + dwHash = GetFontFamilyHash(pFD->wsFontFace, dwFontStyles, wCodePage); m_FamilyFonts[dwHash] = pFont; return LoadFont(pFont, dwFontStyles, wCodePage); } @@ -149,7 +179,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( return nullptr; uint32_t dwHash = - FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, pRet->wBitField); + GetFontFamilyHash(pszFontFamily, dwFontStyles, pRet->wBitField); auto it = m_UnicodeFonts.find(dwHash); if (it != m_UnicodeFonts.end()) { return it->second ? LoadFont(it->second, dwFontStyles, pRet->wCodePage) @@ -174,9 +204,8 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( m_Fonts.push_back(pFont); m_UnicodeFonts[dwHash] = pFont; - m_CPFonts[FGAS_GetFontHashCode(wCodePage, dwFontStyles)] = pFont; - m_FamilyFonts[FGAS_GetFontFamilyHash(pFontFace, dwFontStyles, wCodePage)] = - pFont; + m_CPFonts[GetFontHashCode(wCodePage, dwFontStyles)] = pFont; + m_FamilyFonts[GetFontFamilyHash(pFontFace, dwFontStyles, wCodePage)] = pFont; return LoadFont(pFont, dwFontStyles, wCodePage); } @@ -185,8 +214,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( uint32_t dwFontStyles, uint16_t wCodePage) { CFX_RetainPtr<CFGAS_GEFont> pFont; - uint32_t dwHash = - FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage); + uint32_t dwHash = GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage); auto it = m_FamilyFonts.find(dwHash); if (it != m_FamilyFonts.end()) return it->second ? LoadFont(it->second, dwFontStyles, wCodePage) : nullptr; @@ -208,7 +236,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( m_Fonts.push_back(pFont); m_FamilyFonts[dwHash] = pFont; - dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); + dwHash = GetFontHashCode(wCodePage, dwFontStyles); m_CPFonts[dwHash] = pFont; return LoadFont(pFont, dwFontStyles, wCodePage); } @@ -369,29 +397,75 @@ const char* g_FontFolders[] = { #endif }; -struct FX_BitCodePage { - uint16_t wBit; - uint16_t wCodePage; -}; - -const FX_BitCodePage g_Bit2CodePage[] = { - {0, 1252}, {1, 1250}, {2, 1251}, {3, 1253}, {4, 1254}, {5, 1255}, - {6, 1256}, {7, 1257}, {8, 1258}, {9, 0}, {10, 0}, {11, 0}, - {12, 0}, {13, 0}, {14, 0}, {15, 0}, {16, 874}, {17, 932}, - {18, 936}, {19, 949}, {20, 950}, {21, 1361}, {22, 0}, {23, 0}, - {24, 0}, {25, 0}, {26, 0}, {27, 0}, {28, 0}, {29, 0}, - {30, 0}, {31, 0}, {32, 0}, {33, 0}, {34, 0}, {35, 0}, - {36, 0}, {37, 0}, {38, 0}, {39, 0}, {40, 0}, {41, 0}, - {42, 0}, {43, 0}, {44, 0}, {45, 0}, {46, 0}, {47, 0}, - {48, 869}, {49, 866}, {50, 865}, {51, 864}, {52, 863}, {53, 862}, - {54, 861}, {55, 860}, {56, 857}, {57, 855}, {58, 852}, {59, 775}, - {60, 737}, {61, 708}, {62, 850}, {63, 437}, -}; +const uint16_t g_CodePages[] = {FX_CODEPAGE_MSWin_WesternEuropean, + FX_CODEPAGE_MSWin_EasternEuropean, + FX_CODEPAGE_MSWin_Cyrillic, + FX_CODEPAGE_MSWin_Greek, + FX_CODEPAGE_MSWin_Turkish, + FX_CODEPAGE_MSWin_Hebrew, + FX_CODEPAGE_MSWin_Arabic, + FX_CODEPAGE_MSWin_Baltic, + FX_CODEPAGE_MSWin_Vietnamese, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_MSDOS_Thai, + FX_CODEPAGE_ShiftJIS, + FX_CODEPAGE_ChineseSimplified, + FX_CODEPAGE_Korean, + FX_CODEPAGE_ChineseTraditional, + FX_CODEPAGE_Johab, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_DefANSI, + FX_CODEPAGE_MSDOS_Greek2, + FX_CODEPAGE_MSDOS_Russian, + FX_CODEPAGE_MSDOS_Norwegian, + FX_CODEPAGE_MSDOS_Arabic, + FX_CODEPAGE_MSDOS_FrenchCanadian, + FX_CODEPAGE_MSDOS_Hebrew, + FX_CODEPAGE_MSDOS_Icelandic, + FX_CODEPAGE_MSDOS_Portuguese, + FX_CODEPAGE_MSDOS_Turkish, + FX_CODEPAGE_MSDOS_Cyrillic, + FX_CODEPAGE_MSDOS_EasternEuropean, + FX_CODEPAGE_MSDOS_Baltic, + FX_CODEPAGE_MSDOS_Greek1, + FX_CODEPAGE_Arabic_ASMO708, + FX_CODEPAGE_MSDOS_WesternEuropean, + FX_CODEPAGE_MSDOS_US}; uint16_t FX_GetCodePageBit(uint16_t wCodePage) { - for (size_t i = 0; i < FX_ArraySize(g_Bit2CodePage); ++i) { - if (g_Bit2CodePage[i].wCodePage == wCodePage) - return g_Bit2CodePage[i].wBit; + for (size_t i = 0; i < FX_ArraySize(g_CodePages); ++i) { + if (g_CodePages[i] == wCodePage) + return static_cast<uint16_t>(i); } return static_cast<uint16_t>(-1); } @@ -941,7 +1015,7 @@ int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled, if (nPenalty >= 0xFFFF) return 0xFFFF; - uint16_t wBit = (wCodePage == 0 || wCodePage == 0xFFFF) + uint16_t wBit = (wCodePage == FX_CODEPAGE_DefANSI || wCodePage == 0xFFFF) ? static_cast<uint16_t>(-1) : FX_GetCodePageBit(wCodePage); if (wBit != static_cast<uint16_t>(-1)) { diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp index e775ebdf0c..4dc599cd4b 100644 --- a/xfa/fgas/font/fgas_fontutils.cpp +++ b/xfa/fgas/font/fgas_fontutils.cpp @@ -7,147 +7,204 @@ #include "xfa/fgas/font/fgas_fontutils.h" #include "core/fxcrt/fx_ext.h" +#include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/font/cfgas_fontmgr.h" -uint32_t FGAS_GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles) { - uint32_t dwHash = wCodePage; - if (dwFontStyles & FX_FONTSTYLE_FixedPitch) { - dwHash |= 0x00010000; - } - if (dwFontStyles & FX_FONTSTYLE_Serif) { - dwHash |= 0x00020000; - } - if (dwFontStyles & FX_FONTSTYLE_Symbolic) { - dwHash |= 0x00040000; - } - if (dwFontStyles & FX_FONTSTYLE_Script) { - dwHash |= 0x00080000; - } - if (dwFontStyles & FX_FONTSTYLE_Italic) { - dwHash |= 0x00100000; - } - if (dwFontStyles & FX_FONTSTYLE_Bold) { - dwHash |= 0x00200000; - } - return dwHash; -} -uint32_t FGAS_GetFontFamilyHash(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { - CFX_WideString wsFont(pszFontFamily); - if (dwFontStyles & FX_FONTSTYLE_Bold) { - wsFont += L"Bold"; - } - if (dwFontStyles & FX_FONTSTYLE_Italic) { - wsFont += L"Italic"; - } - wsFont += wCodePage; - return FX_HashCode_GetW(wsFont.AsStringC(), false); -} -static const FGAS_FONTUSB g_FXGdiFontUSBTable[] = { - {0x0000, 0x007F, 0, 1252}, {0x0080, 0x00FF, 1, 1252}, - {0x0100, 0x017F, 2, 1250}, {0x0180, 0x024F, 3, 1250}, - {0x0250, 0x02AF, 4, 0xFFFF}, {0x02B0, 0x02FF, 5, 0xFFFF}, - {0x0300, 0x036F, 6, 0xFFFF}, {0x0370, 0x03FF, 7, 1253}, - {0x0400, 0x04FF, 9, 1251}, {0x0500, 0x052F, 9, 0xFFFF}, - {0x0530, 0x058F, 10, 0xFFFF}, {0x0590, 0x05FF, 11, 1255}, - {0x0600, 0x06FF, 13, 1256}, {0x0700, 0x074F, 71, 0xFFFF}, - {0x0750, 0x077F, 13, 0xFFFF}, {0x0780, 0x07BF, 72, 0xFFFF}, - {0x07C0, 0x07FF, 14, 0xFFFF}, {0x0800, 0x08FF, 999, 0xFFFF}, - {0x0900, 0x097F, 15, 0xFFFF}, {0x0980, 0x09FF, 16, 0xFFFF}, - {0x0A00, 0x0A7F, 17, 0xFFFF}, {0x0A80, 0x0AFF, 18, 0xFFFF}, - {0x0B00, 0x0B7F, 19, 0xFFFF}, {0x0B80, 0x0BFF, 20, 0xFFFF}, - {0x0C00, 0x0C7F, 21, 0xFFFF}, {0x0C80, 0x0CFF, 22, 0xFFFF}, - {0x0D00, 0x0D7F, 23, 0xFFFF}, {0x0D80, 0x0DFF, 73, 0xFFFF}, - {0x0E00, 0x0E7F, 24, 874}, {0x0E80, 0x0EFF, 25, 0xFFFF}, - {0x0F00, 0x0FFF, 70, 0xFFFF}, {0x1000, 0x109F, 74, 0xFFFF}, - {0x10A0, 0x10FF, 26, 0xFFFF}, {0x1100, 0x11FF, 28, 0xFFFF}, - {0x1200, 0x137F, 75, 0xFFFF}, {0x1380, 0x139F, 75, 0xFFFF}, - {0x13A0, 0x13FF, 76, 0xFFFF}, {0x1400, 0x167F, 77, 0xFFFF}, - {0x1680, 0x169F, 78, 0xFFFF}, {0x16A0, 0x16FF, 79, 0xFFFF}, - {0x1700, 0x171F, 84, 0xFFFF}, {0x1720, 0x173F, 84, 0xFFFF}, - {0x1740, 0x175F, 84, 0xFFFF}, {0x1760, 0x177F, 84, 0xFFFF}, - {0x1780, 0x17FF, 80, 0xFFFF}, {0x1800, 0x18AF, 81, 0xFFFF}, - {0x18B0, 0x18FF, 999, 0xFFFF}, {0x1900, 0x194F, 93, 0xFFFF}, - {0x1950, 0x197F, 94, 0xFFFF}, {0x1980, 0x19DF, 95, 0xFFFF}, - {0x19E0, 0x19FF, 80, 0xFFFF}, {0x1A00, 0x1A1F, 96, 0xFFFF}, - {0x1A20, 0x1AFF, 999, 0xFFFF}, {0x1B00, 0x1B7F, 27, 0xFFFF}, - {0x1B80, 0x1BBF, 112, 0xFFFF}, {0x1BC0, 0x1BFF, 999, 0xFFFF}, - {0x1C00, 0x1C4F, 113, 0xFFFF}, {0x1C50, 0x1C7F, 114, 0xFFFF}, - {0x1C80, 0x1CFF, 999, 0xFFFF}, {0x1D00, 0x1D7F, 4, 0xFFFF}, - {0x1D80, 0x1DBF, 4, 0xFFFF}, {0x1DC0, 0x1DFF, 6, 0xFFFF}, - {0x1E00, 0x1EFF, 29, 0xFFFF}, {0x1F00, 0x1FFF, 30, 0xFFFF}, - {0x2000, 0x206F, 31, 0xFFFF}, {0x2070, 0x209F, 32, 0xFFFF}, - {0x20A0, 0x20CF, 33, 0xFFFF}, {0x20D0, 0x20FF, 34, 0xFFFF}, - {0x2100, 0x214F, 35, 0xFFFF}, {0x2150, 0x215F, 36, 0xFFFF}, - {0x2160, 0x216B, 36, 936}, {0x216C, 0x216F, 36, 0xFFFF}, - {0x2170, 0x2179, 36, 936}, {0x217A, 0x218F, 36, 0xFFFF}, - {0x2190, 0x2199, 37, 949}, {0x219A, 0x21FF, 37, 0xFFFF}, - {0x2200, 0x22FF, 38, 0xFFFF}, {0x2300, 0x23FF, 39, 0xFFFF}, - {0x2400, 0x243F, 40, 0xFFFF}, {0x2440, 0x245F, 41, 0xFFFF}, - {0x2460, 0x2473, 42, 932}, {0x2474, 0x249B, 42, 936}, - {0x249C, 0x24E9, 42, 949}, {0x24EA, 0x24FF, 42, 0xFFFF}, - {0x2500, 0x2573, 43, 936}, {0x2574, 0x257F, 43, 0xFFFF}, - {0x2580, 0x2580, 44, 0xFFFF}, {0x2581, 0x258F, 44, 936}, - {0x2590, 0x259F, 44, 0xFFFF}, {0x25A0, 0x25FF, 45, 0xFFFF}, - {0x2600, 0x26FF, 46, 0xFFFF}, {0x2700, 0x27BF, 47, 0xFFFF}, - {0x27C0, 0x27EF, 38, 0xFFFF}, {0x27F0, 0x27FF, 37, 0xFFFF}, - {0x2800, 0x28FF, 82, 0xFFFF}, {0x2900, 0x297F, 37, 0xFFFF}, - {0x2980, 0x29FF, 38, 0xFFFF}, {0x2A00, 0x2AFF, 38, 0xFFFF}, - {0x2B00, 0x2BFF, 37, 0xFFFF}, {0x2C00, 0x2C5F, 97, 0xFFFF}, - {0x2C60, 0x2C7F, 29, 0xFFFF}, {0x2C80, 0x2CFF, 8, 0xFFFF}, - {0x2D00, 0x2D2F, 26, 0xFFFF}, {0x2D30, 0x2D7F, 98, 0xFFFF}, - {0x2D80, 0x2DDF, 75, 0xFFFF}, {0x2DE0, 0x2DFF, 9, 0xFFFF}, - {0x2E00, 0x2E7F, 31, 0xFFFF}, {0x2E80, 0x2EFF, 59, 0xFFFF}, - {0x2F00, 0x2FDF, 59, 0xFFFF}, {0x2FE0, 0x2FEF, 999, 0xFFFF}, - {0x2FF0, 0x2FFF, 59, 0xFFFF}, {0x3000, 0x303F, 48, 0xFFFF}, - {0x3040, 0x309F, 49, 932}, {0x30A0, 0x30FF, 50, 932}, - {0x3100, 0x3129, 51, 936}, {0x312A, 0x312F, 51, 0xFFFF}, - {0x3130, 0x318F, 52, 949}, {0x3190, 0x319F, 59, 0xFFFF}, - {0x31A0, 0x31BF, 51, 0xFFFF}, {0x31C0, 0x31EF, 61, 0xFFFF}, - {0x31F0, 0x31FF, 50, 0xFFFF}, {0x3200, 0x321C, 54, 949}, - {0x321D, 0x325F, 54, 0xFFFF}, {0x3260, 0x327F, 54, 949}, - {0x3280, 0x32FF, 54, 0xFFFF}, {0x3300, 0x3387, 55, 0xFFFF}, - {0x3388, 0x33D0, 55, 949}, {0x33D1, 0x33FF, 55, 0xFFFF}, - {0x3400, 0x4DBF, 59, 0xFFFF}, {0x4DC0, 0x4DFF, 99, 0xFFFF}, - {0x4E00, 0x9FA5, 59, 936}, {0x9FA6, 0x9FFF, 59, 0xFFFF}, - {0xA000, 0xA48F, 83, 0xFFFF}, {0xA490, 0xA4CF, 83, 0xFFFF}, - {0xA4D0, 0xA4FF, 999, 0xFFFF}, {0xA500, 0xA63F, 12, 0xFFFF}, - {0xA640, 0xA69F, 9, 0xFFFF}, {0xA6A0, 0xA6FF, 999, 0xFFFF}, - {0xA700, 0xA71F, 5, 0xFFFF}, {0xA720, 0xA7FF, 29, 0xFFFF}, - {0xA800, 0xA82F, 100, 0xFFFF}, {0xA830, 0xA8FF, 999, 0xFFFF}, - {0xA840, 0xA87F, 53, 0xFFFF}, {0xA880, 0xA8DF, 115, 0xFFFF}, - {0xA8E0, 0xA8FF, 999, 0xFFFF}, {0xA900, 0xA92F, 116, 0xFFFF}, - {0xA930, 0xA95F, 117, 0xFFFF}, {0xA960, 0xA9FF, 999, 0xFFFF}, - {0xAA00, 0xAA5F, 118, 0xFFFF}, {0xAA60, 0xABFF, 999, 0xFFFF}, - {0xAC00, 0xD7AF, 56, 949}, {0xD7B0, 0xD7FF, 999, 0xFFFF}, - {0xD800, 0xDB7F, 57, 0xFFFF}, {0xDB80, 0xDBFF, 57, 0xFFFF}, - {0xDC00, 0xDFFF, 57, 0xFFFF}, {0xE000, 0xE814, 60, 0xFFFF}, - {0xE815, 0xE864, 60, 936}, {0xE865, 0xF8FF, 60, 0xFFFF}, - {0xF900, 0xFA0B, 61, 949}, {0xFA0C, 0xFA0D, 61, 936}, - {0xFA0E, 0xFA2D, 61, 932}, {0xFA2E, 0xFAFF, 61, 0xFFFF}, - {0xFB00, 0xFB4F, 62, 0xFFFF}, {0xFB50, 0xFDFF, 63, 1256}, - {0xFE00, 0xFE0F, 91, 0xFFFF}, {0xFE10, 0xFE1F, 65, 0xFFFF}, - {0xFE20, 0xFE2F, 64, 0xFFFF}, {0xFE30, 0xFE4F, 65, 0xFFFF}, - {0xFE50, 0xFE6F, 66, 0xFFFF}, {0xFE70, 0xFEFF, 67, 1256}, - {0xFF00, 0xFF5F, 68, 936}, {0xFF60, 0xFF9F, 68, 932}, +namespace { + +const FGAS_FONTUSB g_FXGdiFontUSBTable[] = { + {0x0000, 0x007F, 0, FX_CODEPAGE_MSWin_WesternEuropean}, + {0x0080, 0x00FF, 1, FX_CODEPAGE_MSWin_WesternEuropean}, + {0x0100, 0x017F, 2, FX_CODEPAGE_MSWin_EasternEuropean}, + {0x0180, 0x024F, 3, FX_CODEPAGE_MSWin_EasternEuropean}, + {0x0250, 0x02AF, 4, 0xFFFF}, + {0x02B0, 0x02FF, 5, 0xFFFF}, + {0x0300, 0x036F, 6, 0xFFFF}, + {0x0370, 0x03FF, 7, FX_CODEPAGE_MSWin_Greek}, + {0x0400, 0x04FF, 9, FX_CODEPAGE_MSWin_Cyrillic}, + {0x0500, 0x052F, 9, 0xFFFF}, + {0x0530, 0x058F, 10, 0xFFFF}, + {0x0590, 0x05FF, 11, FX_CODEPAGE_MSWin_Hebrew}, + {0x0600, 0x06FF, 13, FX_CODEPAGE_MSWin_Arabic}, + {0x0700, 0x074F, 71, 0xFFFF}, + {0x0750, 0x077F, 13, 0xFFFF}, + {0x0780, 0x07BF, 72, 0xFFFF}, + {0x07C0, 0x07FF, 14, 0xFFFF}, + {0x0800, 0x08FF, 999, 0xFFFF}, + {0x0900, 0x097F, 15, 0xFFFF}, + {0x0980, 0x09FF, 16, 0xFFFF}, + {0x0A00, 0x0A7F, 17, 0xFFFF}, + {0x0A80, 0x0AFF, 18, 0xFFFF}, + {0x0B00, 0x0B7F, 19, 0xFFFF}, + {0x0B80, 0x0BFF, 20, 0xFFFF}, + {0x0C00, 0x0C7F, 21, 0xFFFF}, + {0x0C80, 0x0CFF, 22, 0xFFFF}, + {0x0D00, 0x0D7F, 23, 0xFFFF}, + {0x0D80, 0x0DFF, 73, 0xFFFF}, + {0x0E00, 0x0E7F, 24, FX_CODEPAGE_MSDOS_Thai}, + {0x0E80, 0x0EFF, 25, 0xFFFF}, + {0x0F00, 0x0FFF, 70, 0xFFFF}, + {0x1000, 0x109F, 74, 0xFFFF}, + {0x10A0, 0x10FF, 26, 0xFFFF}, + {0x1100, 0x11FF, 28, 0xFFFF}, + {0x1200, 0x137F, 75, 0xFFFF}, + {0x1380, 0x139F, 75, 0xFFFF}, + {0x13A0, 0x13FF, 76, 0xFFFF}, + {0x1400, 0x167F, 77, 0xFFFF}, + {0x1680, 0x169F, 78, 0xFFFF}, + {0x16A0, 0x16FF, 79, 0xFFFF}, + {0x1700, 0x171F, 84, 0xFFFF}, + {0x1720, 0x173F, 84, 0xFFFF}, + {0x1740, 0x175F, 84, 0xFFFF}, + {0x1760, 0x177F, 84, 0xFFFF}, + {0x1780, 0x17FF, 80, 0xFFFF}, + {0x1800, 0x18AF, 81, 0xFFFF}, + {0x18B0, 0x18FF, 999, 0xFFFF}, + {0x1900, 0x194F, 93, 0xFFFF}, + {0x1950, 0x197F, 94, 0xFFFF}, + {0x1980, 0x19DF, 95, 0xFFFF}, + {0x19E0, 0x19FF, 80, 0xFFFF}, + {0x1A00, 0x1A1F, 96, 0xFFFF}, + {0x1A20, 0x1AFF, 999, 0xFFFF}, + {0x1B00, 0x1B7F, 27, 0xFFFF}, + {0x1B80, 0x1BBF, 112, 0xFFFF}, + {0x1BC0, 0x1BFF, 999, 0xFFFF}, + {0x1C00, 0x1C4F, 113, 0xFFFF}, + {0x1C50, 0x1C7F, 114, 0xFFFF}, + {0x1C80, 0x1CFF, 999, 0xFFFF}, + {0x1D00, 0x1D7F, 4, 0xFFFF}, + {0x1D80, 0x1DBF, 4, 0xFFFF}, + {0x1DC0, 0x1DFF, 6, 0xFFFF}, + {0x1E00, 0x1EFF, 29, 0xFFFF}, + {0x1F00, 0x1FFF, 30, 0xFFFF}, + {0x2000, 0x206F, 31, 0xFFFF}, + {0x2070, 0x209F, 32, 0xFFFF}, + {0x20A0, 0x20CF, 33, 0xFFFF}, + {0x20D0, 0x20FF, 34, 0xFFFF}, + {0x2100, 0x214F, 35, 0xFFFF}, + {0x2150, 0x215F, 36, 0xFFFF}, + {0x2160, 0x216B, 36, FX_CODEPAGE_ChineseSimplified}, + {0x216C, 0x216F, 36, 0xFFFF}, + {0x2170, 0x2179, 36, FX_CODEPAGE_ChineseSimplified}, + {0x217A, 0x218F, 36, 0xFFFF}, + {0x2190, 0x2199, 37, FX_CODEPAGE_Korean}, + {0x219A, 0x21FF, 37, 0xFFFF}, + {0x2200, 0x22FF, 38, 0xFFFF}, + {0x2300, 0x23FF, 39, 0xFFFF}, + {0x2400, 0x243F, 40, 0xFFFF}, + {0x2440, 0x245F, 41, 0xFFFF}, + {0x2460, 0x2473, 42, FX_CODEPAGE_ShiftJIS}, + {0x2474, 0x249B, 42, FX_CODEPAGE_ChineseSimplified}, + {0x249C, 0x24E9, 42, FX_CODEPAGE_Korean}, + {0x24EA, 0x24FF, 42, 0xFFFF}, + {0x2500, 0x2573, 43, FX_CODEPAGE_ChineseSimplified}, + {0x2574, 0x257F, 43, 0xFFFF}, + {0x2580, 0x2580, 44, 0xFFFF}, + {0x2581, 0x258F, 44, FX_CODEPAGE_ChineseSimplified}, + {0x2590, 0x259F, 44, 0xFFFF}, + {0x25A0, 0x25FF, 45, 0xFFFF}, + {0x2600, 0x26FF, 46, 0xFFFF}, + {0x2700, 0x27BF, 47, 0xFFFF}, + {0x27C0, 0x27EF, 38, 0xFFFF}, + {0x27F0, 0x27FF, 37, 0xFFFF}, + {0x2800, 0x28FF, 82, 0xFFFF}, + {0x2900, 0x297F, 37, 0xFFFF}, + {0x2980, 0x29FF, 38, 0xFFFF}, + {0x2A00, 0x2AFF, 38, 0xFFFF}, + {0x2B00, 0x2BFF, 37, 0xFFFF}, + {0x2C00, 0x2C5F, 97, 0xFFFF}, + {0x2C60, 0x2C7F, 29, 0xFFFF}, + {0x2C80, 0x2CFF, 8, 0xFFFF}, + {0x2D00, 0x2D2F, 26, 0xFFFF}, + {0x2D30, 0x2D7F, 98, 0xFFFF}, + {0x2D80, 0x2DDF, 75, 0xFFFF}, + {0x2DE0, 0x2DFF, 9, 0xFFFF}, + {0x2E00, 0x2E7F, 31, 0xFFFF}, + {0x2E80, 0x2EFF, 59, 0xFFFF}, + {0x2F00, 0x2FDF, 59, 0xFFFF}, + {0x2FE0, 0x2FEF, 999, 0xFFFF}, + {0x2FF0, 0x2FFF, 59, 0xFFFF}, + {0x3000, 0x303F, 48, 0xFFFF}, + {0x3040, 0x309F, 49, FX_CODEPAGE_ShiftJIS}, + {0x30A0, 0x30FF, 50, FX_CODEPAGE_ShiftJIS}, + {0x3100, 0x3129, 51, FX_CODEPAGE_ChineseSimplified}, + {0x312A, 0x312F, 51, 0xFFFF}, + {0x3130, 0x318F, 52, FX_CODEPAGE_Korean}, + {0x3190, 0x319F, 59, 0xFFFF}, + {0x31A0, 0x31BF, 51, 0xFFFF}, + {0x31C0, 0x31EF, 61, 0xFFFF}, + {0x31F0, 0x31FF, 50, 0xFFFF}, + {0x3200, 0x321C, 54, FX_CODEPAGE_Korean}, + {0x321D, 0x325F, 54, 0xFFFF}, + {0x3260, 0x327F, 54, FX_CODEPAGE_Korean}, + {0x3280, 0x32FF, 54, 0xFFFF}, + {0x3300, 0x3387, 55, 0xFFFF}, + {0x3388, 0x33D0, 55, FX_CODEPAGE_Korean}, + {0x33D1, 0x33FF, 55, 0xFFFF}, + {0x3400, 0x4DBF, 59, 0xFFFF}, + {0x4DC0, 0x4DFF, 99, 0xFFFF}, + {0x4E00, 0x9FA5, 59, FX_CODEPAGE_ChineseSimplified}, + {0x9FA6, 0x9FFF, 59, 0xFFFF}, + {0xA000, 0xA48F, 83, 0xFFFF}, + {0xA490, 0xA4CF, 83, 0xFFFF}, + {0xA4D0, 0xA4FF, 999, 0xFFFF}, + {0xA500, 0xA63F, 12, 0xFFFF}, + {0xA640, 0xA69F, 9, 0xFFFF}, + {0xA6A0, 0xA6FF, 999, 0xFFFF}, + {0xA700, 0xA71F, 5, 0xFFFF}, + {0xA720, 0xA7FF, 29, 0xFFFF}, + {0xA800, 0xA82F, 100, 0xFFFF}, + {0xA830, 0xA8FF, 999, 0xFFFF}, + {0xA840, 0xA87F, 53, 0xFFFF}, + {0xA880, 0xA8DF, 115, 0xFFFF}, + {0xA8E0, 0xA8FF, 999, 0xFFFF}, + {0xA900, 0xA92F, 116, 0xFFFF}, + {0xA930, 0xA95F, 117, 0xFFFF}, + {0xA960, 0xA9FF, 999, 0xFFFF}, + {0xAA00, 0xAA5F, 118, 0xFFFF}, + {0xAA60, 0xABFF, 999, 0xFFFF}, + {0xAC00, 0xD7AF, 56, FX_CODEPAGE_Korean}, + {0xD7B0, 0xD7FF, 999, 0xFFFF}, + {0xD800, 0xDB7F, 57, 0xFFFF}, + {0xDB80, 0xDBFF, 57, 0xFFFF}, + {0xDC00, 0xDFFF, 57, 0xFFFF}, + {0xE000, 0xE814, 60, 0xFFFF}, + {0xE815, 0xE864, 60, FX_CODEPAGE_ChineseSimplified}, + {0xE865, 0xF8FF, 60, 0xFFFF}, + {0xF900, 0xFA0B, 61, FX_CODEPAGE_Korean}, + {0xFA0C, 0xFA0D, 61, FX_CODEPAGE_ChineseSimplified}, + {0xFA0E, 0xFA2D, 61, FX_CODEPAGE_ShiftJIS}, + {0xFA2E, 0xFAFF, 61, 0xFFFF}, + {0xFB00, 0xFB4F, 62, 0xFFFF}, + {0xFB50, 0xFDFF, 63, FX_CODEPAGE_MSWin_Arabic}, + {0xFE00, 0xFE0F, 91, 0xFFFF}, + {0xFE10, 0xFE1F, 65, 0xFFFF}, + {0xFE20, 0xFE2F, 64, 0xFFFF}, + {0xFE30, 0xFE4F, 65, 0xFFFF}, + {0xFE50, 0xFE6F, 66, 0xFFFF}, + {0xFE70, 0xFEFF, 67, FX_CODEPAGE_MSWin_Arabic}, + {0xFF00, 0xFF5F, 68, FX_CODEPAGE_ChineseSimplified}, + {0xFF60, 0xFF9F, 68, FX_CODEPAGE_ShiftJIS}, {0xFFA0, 0xFFEF, 68, 0xFFFF}, }; +} // namespace + const FGAS_FONTUSB* FGAS_GetUnicodeBitField(wchar_t wUnicode) { int32_t iEnd = sizeof(g_FXGdiFontUSBTable) / sizeof(FGAS_FONTUSB) - 1; ASSERT(iEnd >= 0); - int32_t iStart = 0, iMid; + + int32_t iStart = 0; + int32_t iMid; do { iMid = (iStart + iEnd) / 2; const FGAS_FONTUSB& usb = g_FXGdiFontUSBTable[iMid]; - if (wUnicode < usb.wStartUnicode) { + if (wUnicode < usb.wStartUnicode) iEnd = iMid - 1; - } else if (wUnicode > usb.wEndUnicode) { + else if (wUnicode > usb.wEndUnicode) iStart = iMid + 1; - } else { + else return &usb; - } } while (iStart <= iEnd); return nullptr; } diff --git a/xfa/fgas/font/fgas_fontutils.h b/xfa/fgas/font/fgas_fontutils.h index d92b469e7b..f247a1fe53 100644 --- a/xfa/fgas/font/fgas_fontutils.h +++ b/xfa/fgas/font/fgas_fontutils.h @@ -16,10 +16,6 @@ struct FGAS_FONTUSB { uint16_t wCodePage; }; -uint32_t FGAS_GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles); -uint32_t FGAS_GetFontFamilyHash(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage); const FGAS_FONTUSB* FGAS_GetUnicodeBitField(wchar_t wUnicode); #endif // XFA_FGAS_FONT_FGAS_FONTUTILS_H_ |