Index: core/fxge/ge/cfx_fontmapper.cpp |
diff --git a/core/fxge/ge/cfx_fontmapper.cpp b/core/fxge/ge/cfx_fontmapper.cpp |
index 86dc2389d607a8ee77e96cd91478c94c70545c6c..eb04f30a707229c3d884418f83460f26e0e4e4f5 100644 |
--- a/core/fxge/ge/cfx_fontmapper.cpp |
+++ b/core/fxge/ge/cfx_fontmapper.cpp |
@@ -348,8 +348,8 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { |
CFX_ByteString new_name = GetPSNameFromTT(hFont); |
if (!new_name.IsEmpty()) { |
- new_name.Insert(0, ' '); |
- m_InstalledTTFonts.push_back(new_name); |
+ m_LocalizedTTFonts.push_back(new_name); |
+ m_IndexForLocalizedFonts.push_back(m_InstalledTTFonts.size()); |
} |
m_pFontInfo->DeleteFont(hFont); |
} |
@@ -374,12 +374,16 @@ CFX_ByteString CFX_FontMapper::MatchInstalledFonts( |
if (norm1 == norm_name) |
break; |
} |
- if (i < 0) |
- return CFX_ByteString(); |
- CFX_ByteString match = m_InstalledTTFonts[i]; |
- if (match[0] == ' ') |
- match = m_InstalledTTFonts[i + 1]; |
- return match; |
+ if (i >= 0) |
+ return m_InstalledTTFonts[i]; |
+ for (i = pdfium::CollectionSize<int>(m_LocalizedTTFonts) - 1; i >= 0; i--) { |
+ CFX_ByteString norm1 = TT_NormalizeName(m_LocalizedTTFonts[i].c_str()); |
+ if (norm1 == norm_name) |
+ break; |
+ } |
+ if (i >= 0) |
+ return m_InstalledTTFonts[m_IndexForLocalizedFonts[i]]; |
+ return CFX_ByteString(); |
} |
FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, |