diff options
author | npm <npm@chromium.org> | 2016-10-06 12:29:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-06 12:29:09 -0700 |
commit | 065c35006d96eaca324f49248d20d83709a25fbe (patch) | |
tree | 46d3d235bc8a8192748fa64166cb3d86aa65a0d8 /core/fxge/win32 | |
parent | aa6e8b555e113a3f91a49258ed83810abf0d4929 (diff) | |
download | pdfium-065c35006d96eaca324f49248d20d83709a25fbe.tar.xz |
Split m_InstalledTTFonts into two vectors to avoid sketchy logic.
Instead of relying on ' ' to determine whether the CFX_Bytestring
is added on one place or another, use another vector. When trying
to match fonts from the fontmapper, compare with both vectors.
BUG=pdfium:510
Review-Url: https://codereview.chromium.org/2395883002
Diffstat (limited to 'core/fxge/win32')
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index bc6817da63..0ef7829549 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -471,13 +471,13 @@ CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) { for (size_t i = 0; i < m_pMapper->m_InstalledTTFonts.size(); ++i) { CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i]; - if (thisname[0] == ' ') { - if (thisname.Mid(1, name.GetLength()) == name) { - return m_pMapper->m_InstalledTTFonts[i + 1]; - } - } else if (thisname.Left(name.GetLength()) == name) { + if (thisname.Left(name.GetLength()) == name) return m_pMapper->m_InstalledTTFonts[i]; - } + } + for (size_t i = 0; i < m_pMapper->m_LocalizedTTFonts.size(); ++i) { + CFX_ByteString thisname = m_pMapper->m_LocalizedTTFonts[i].first; + if (thisname.Left(name.GetLength()) == name) + return m_pMapper->m_LocalizedTTFonts[i].second; } return CFX_ByteString(); } |