summaryrefslogtreecommitdiff
path: root/xfa/fgas/font/cfgas_gefont.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-05-22 13:45:08 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-22 13:45:08 +0000
commita3ee6a0081ab16a2034b36d1d0f9b6907aec67d2 (patch)
treeaddf5f561a0c94a3f250833bb075bf10e2998d64 /xfa/fgas/font/cfgas_gefont.cpp
parentb9d556e4282329c7bf6a0710ce6d742467e44e84 (diff)
downloadpdfium-a3ee6a0081ab16a2034b36d1d0f9b6907aec67d2.tar.xz
Fix spaces too wide in XFA Dropdown.
CFGAS_PDFFontMgr::GetCharWidth() is only used for spaces, for no good reason I could find. It's broken in this case too, returning a default value of 600 for any character. This CL removes this method and its only usage that led to finding this issue. Bug: pdfium:1083 Change-Id: I954de45101715b5af05169612fb5eca1b1a170b4 Reviewed-on: https://pdfium-review.googlesource.com/32740 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fgas/font/cfgas_gefont.cpp')
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index b6ec23a414..740504f088 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -164,23 +164,21 @@ bool CFGAS_GEFont::GetCharWidth(wchar_t wUnicode, int32_t* pWidth) {
if (*pWidth > 0)
return true;
- if (!m_pProvider || !m_pProvider->GetCharWidth(RetainPtr<CFGAS_GEFont>(this),
- wUnicode, pWidth)) {
- RetainPtr<CFGAS_GEFont> pFont;
- int32_t iGlyph;
- std::tie(iGlyph, pFont) = GetGlyphIndexAndFont(wUnicode, true);
- if (iGlyph != 0xFFFF && pFont) {
- if (pFont.Get() == this) {
- *pWidth = m_pFont->GetGlyphWidth(iGlyph);
- if (*pWidth < 0)
- *pWidth = -1;
- } else if (pFont->GetCharWidth(wUnicode, pWidth)) {
- return true;
- }
- } else {
- *pWidth = -1;
+ RetainPtr<CFGAS_GEFont> pFont;
+ int32_t iGlyph;
+ std::tie(iGlyph, pFont) = GetGlyphIndexAndFont(wUnicode, true);
+ if (iGlyph != 0xFFFF && pFont) {
+ if (pFont.Get() == this) {
+ *pWidth = m_pFont->GetGlyphWidth(iGlyph);
+ if (*pWidth < 0)
+ *pWidth = -1;
+ } else if (pFont->GetCharWidth(wUnicode, pWidth)) {
+ return true;
}
+ } else {
+ *pWidth = -1;
}
+
m_CharWidthMap[wUnicode] = *pWidth;
return *pWidth > 0;
}