summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/PWL_FontMap.cpp
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-27 11:55:24 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-27 11:55:24 -0700
commit8ea3f5176aab4d6688710d9937cf38a43c14d030 (patch)
tree8e74d88332e022d89943470a09a5fa57957d7828 /fpdfsdk/pdfwindow/PWL_FontMap.cpp
parentc08cd7abb2069b6056ec99c8ec5b87524e45df01 (diff)
downloadpdfium-8ea3f5176aab4d6688710d9937cf38a43c14d030.tar.xz
Clean up some CPDF_Font subclasses.
Review-Url: https://codereview.chromium.org/2093313002
Diffstat (limited to 'fpdfsdk/pdfwindow/PWL_FontMap.cpp')
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.cpp23
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) {