Index: fpdfsdk/src/pdfwindow/PWL_FontMap.cpp |
diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp |
index 84b8c94363c13d6e9a7d78414321990b2e5fdf8c..6b2db4a97e6c316254c5511198c66ae8f8fd740f 100644 |
--- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp |
+++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp |
@@ -101,29 +101,23 @@ int32_t CPWL_FontMap::GetWordFontIndex(FX_WORD word, int32_t nCharset, int32_t n |
nCharset == pData->nCharset) |
{ |
if (KnowWord(0, word)) |
- { |
return 0; |
- } |
} |
} |
} |
- int32_t nNewFontIndex = -1; |
- |
- nNewFontIndex = GetFontIndex(GetNativeFontName(nCharset), nCharset, TRUE); |
+ int32_t nNewFontIndex = GetFontIndex(GetNativeFontName(nCharset), nCharset, TRUE); |
if (nNewFontIndex >= 0) |
{ |
if (KnowWord(nNewFontIndex, word)) |
return nNewFontIndex; |
} |
- |
nNewFontIndex = GetFontIndex("Arial Unicode MS", DEFAULT_CHARSET, FALSE); |
if (nNewFontIndex >= 0) |
{ |
if (KnowWord(nNewFontIndex, word)) |
- return nNewFontIndex; |
+ return nNewFontIndex; |
} |
- |
return -1; |
} |
@@ -139,14 +133,10 @@ int32_t CPWL_FontMap::CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word) |
pData->pFont->GlyphFromCharCode(nCharCode); |
return nCharCode; |
} |
- else |
- { |
- if (word < 0xFF) |
- return word; |
- } |
+ if (word < 0xFF) |
+ return word; |
} |
} |
- |
return -1; |
} |
@@ -247,14 +237,11 @@ int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName, int32_t nCharset |
int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, FX_BOOL bFind) |
{ |
int32_t nFontIndex = FindFont(EncodeFontAlias(sFontName, nCharset), nCharset); |
- if (nFontIndex >= 0) return nFontIndex; |
- |
-// nFontIndex = FindFont("", nCharset); |
-// if (nFontIndex >= 0) return nFontIndex; |
+ if (nFontIndex >= 0) |
+ return nFontIndex; |
CFX_ByteString sAlias; |
CPDF_Font* pFont = NULL; |
- |
if (bFind) |
pFont = FindFontSameCharset(sAlias, nCharset); |
@@ -262,21 +249,9 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, int32_t nCha |
{ |
CFX_ByteString sTemp = sFontName; |
pFont = AddFontToDocument(GetDocument(), sTemp, nCharset); |
- |
- /* |
- if (FindFont(sAlias)) |
- { |
- sAlias = EncodeFontAlias(sTemp, nCharset); |
- } |
- else |
- */ |
- { |
- sAlias = EncodeFontAlias(sTemp, nCharset); |
- } |
+ sAlias = EncodeFontAlias(sTemp, nCharset); |
} |
- |
AddedFont(pFont, sAlias); |
- |
return AddFontData(pFont, sAlias, nCharset); |
} |
@@ -349,13 +324,11 @@ CFX_ByteString CPWL_FontMap::GetFontName(int32_t nFontIndex) |
CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) |
{ |
- CFX_ByteString sFontName; |
if (nCharset == DEFAULT_CHARSET) |
nCharset = GetNativeCharset(); |
- sFontName = GetDefaultFontByCharset(nCharset); |
- |
+ CFX_ByteString sFontName = GetDefaultFontByCharset(nCharset); |
if (m_pSystemHandler) |
{ |
if (m_pSystemHandler->FindNativeTrueTypeFont(nCharset, sFontName)) |
@@ -363,7 +336,6 @@ CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) |
sFontName = m_pSystemHandler->GetNativeTrueTypeFont(nCharset); |
} |
- |
return sFontName; |
} |
@@ -371,8 +343,8 @@ CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& |
{ |
if (IsStandardFont(sFontName)) |
return AddStandardFont(pDoc, sFontName); |
- else |
- return AddSystemFont(pDoc, sFontName, nCharset); |
+ |
+ return AddSystemFont(pDoc, sFontName, nCharset); |
} |
CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName) |