Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Unified Diff: core/fxge/ge/cfx_fontmapper.cpp

Issue 2395883002: Use another vector for installed fonts in CFX_FontMapper (Closed)
Patch Set: Nits Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxge/cfx_fontmapper.h ('k') | core/fxge/win32/fx_win32_device.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b388545751cbed27924ee5b83b1e4e911e7cc4fc 100644
--- a/core/fxge/ge/cfx_fontmapper.cpp
+++ b/core/fxge/ge/cfx_fontmapper.cpp
@@ -347,10 +347,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);
- }
+ if (!new_name.IsEmpty())
+ m_LocalizedTTFonts.push_back(std::make_pair(new_name, name));
m_pFontInfo->DeleteFont(hFont);
}
m_InstalledTTFonts.push_back(name);
@@ -372,14 +370,15 @@ CFX_ByteString CFX_FontMapper::MatchInstalledFonts(
for (i = pdfium::CollectionSize<int>(m_InstalledTTFonts) - 1; i >= 0; i--) {
CFX_ByteString norm1 = TT_NormalizeName(m_InstalledTTFonts[i].c_str());
if (norm1 == norm_name)
- break;
+ return m_InstalledTTFonts[i];
}
- if (i < 0)
- return CFX_ByteString();
- CFX_ByteString match = m_InstalledTTFonts[i];
- if (match[0] == ' ')
- match = m_InstalledTTFonts[i + 1];
- return match;
+ for (i = pdfium::CollectionSize<int>(m_LocalizedTTFonts) - 1; i >= 0; i--) {
+ CFX_ByteString norm1 =
+ TT_NormalizeName(m_LocalizedTTFonts[i].first.c_str());
+ if (norm1 == norm_name)
+ return m_LocalizedTTFonts[i].second;
+ }
+ return CFX_ByteString();
}
FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
« no previous file with comments | « core/fxge/cfx_fontmapper.h ('k') | core/fxge/win32/fx_win32_device.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698