diff options
author | thestig <thestig@chromium.org> | 2016-06-27 11:55:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-27 11:55:24 -0700 |
commit | 8ea3f5176aab4d6688710d9937cf38a43c14d030 (patch) | |
tree | 8e74d88332e022d89943470a09a5fa57957d7828 /fpdfsdk | |
parent | c08cd7abb2069b6056ec99c8ec5b87524e45df01 (diff) | |
download | pdfium-8ea3f5176aab4d6688710d9937cf38a43c14d030.tar.xz |
Clean up some CPDF_Font subclasses.
Review-Url: https://codereview.chromium.org/2093313002
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_FontMap.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp index e810ec6a8c..9192afd5e8 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -122,18 +122,17 @@ int32_t CPWL_FontMap::GetWordFontIndex(uint16_t word, } int32_t CPWL_FontMap::CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) { - if (CPWL_FontMap_Data* pData = m_aData.GetAt(nFontIndex)) { - if (pData->pFont) { - if (pData->pFont->IsUnicodeCompatible()) { - int nCharCode = pData->pFont->CharCodeFromUnicode(word); - pData->pFont->GlyphFromCharCode(nCharCode); - return nCharCode; - } - if (word < 0xFF) - return word; - } - } - return -1; + CPWL_FontMap_Data* pData = m_aData.GetAt(nFontIndex); + if (!pData) + return -1; + + if (!pData->pFont) + return -1; + + if (pData->pFont->IsUnicodeCompatible()) + return pData->pFont->CharCodeFromUnicode(word); + + return word < 0xFF ? word : -1; } CFX_ByteString CPWL_FontMap::GetNativeFontName(int32_t nCharset) { |