From 8ea3f5176aab4d6688710d9937cf38a43c14d030 Mon Sep 17 00:00:00 2001 From: thestig Date: Mon, 27 Jun 2016 11:55:24 -0700 Subject: Clean up some CPDF_Font subclasses. Review-Url: https://codereview.chromium.org/2093313002 --- fpdfsdk/pdfwindow/PWL_FontMap.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'fpdfsdk') 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) { -- cgit v1.2.3