From a3ee6a0081ab16a2034b36d1d0f9b6907aec67d2 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Tue, 22 May 2018 13:45:08 +0000 Subject: 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 Reviewed-by: dsinclair --- xfa/fgas/font/cfgas_pdffontmgr.cpp | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'xfa/fgas/font/cfgas_pdffontmgr.cpp') diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp index e2fb905f66..ad28c9eaeb 100644 --- a/xfa/fgas/font/cfgas_pdffontmgr.cpp +++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp @@ -183,24 +183,6 @@ bool CFGAS_PDFFontMgr::PsNameMatchDRFontName(const ByteStringView& bsPsName, return true; } -bool CFGAS_PDFFontMgr::GetCharWidth(const RetainPtr& pFont, - wchar_t wUnicode, - int32_t* pWidth) { - if (wUnicode != 0x20) - return false; - - auto it = m_FDE2PDFFont.find(pFont); - if (it == m_FDE2PDFFont.end()) - return false; - - CPDF_Font* pPDFFont = it->second; - // TODO(npm): CFGAS_GEFont::GetCharWidth currently uses -1 as a special value, - // so |pWidth| cannot be changed to unsigned until this behavior is changed. - *pWidth = static_cast( - pPDFFont->GetCharWidthF(pPDFFont->CharCodeFromUnicode(wUnicode))); - return true; -} - void CFGAS_PDFFontMgr::SetFont(const RetainPtr& pFont, CPDF_Font* pPDFFont) { m_FDE2PDFFont[pFont] = pPDFFont; -- cgit v1.2.3