diff options
Diffstat (limited to 'xfa/fgas/font/cfgas_gefont.cpp')
-rw-r--r-- | xfa/fgas/font/cfgas_gefont.cpp | 28 |
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; } |