From b9d556e4282329c7bf6a0710ce6d742467e44e84 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 22 May 2018 13:23:10 +0000 Subject: Declare some variables closer to when used in CFX_FontMapper. Change-Id: I06ca9eb7e8bb19f75ee75937a44e4ae548a7a92c Reviewed-on: https://pdfium-review.googlesource.com/32791 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fxge/cfx_fontmapper.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'core') diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp index c0b111a51e..87442b54e6 100644 --- a/core/fxge/cfx_fontmapper.cpp +++ b/core/fxge/cfx_fontmapper.cpp @@ -451,7 +451,6 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name, break; } int PitchFamily = 0; - bool bItalic = false; uint32_t nStyle = FXFONT_NORMAL; bool bStyleAvail = false; if (iBaseFont < 12) { @@ -487,7 +486,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name, UpdatePitchFamily(flags, &PitchFamily); } - int old_weight = weight; + const int old_weight = weight; if (FontStyleIsBold(nStyle)) weight = FXFONT_FW_BOLD; @@ -537,23 +536,23 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name, i += buf.GetLength() + 1; } } - if (FontStyleIsItalic(nStyle)) - bItalic = true; + + if (!m_pFontInfo) { + return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, + PitchFamily); + } int Charset = FX_CHARSET_ANSI; if (WindowCP) Charset = GetCharsetFromCodePage(WindowCP); else if (iBaseFont == kNumStandardFonts && FontStyleIsSymbolic(flags)) Charset = FX_CHARSET_Symbol; + const bool bCJK = (Charset == FX_CHARSET_ShiftJIS || + Charset == FX_CHARSET_ChineseSimplified || + Charset == FX_CHARSET_Hangul || + Charset == FX_CHARSET_ChineseTraditional); + bool bItalic = FontStyleIsItalic(nStyle); - bool bCJK = (Charset == FX_CHARSET_ShiftJIS || - Charset == FX_CHARSET_ChineseSimplified || - Charset == FX_CHARSET_Hangul || - Charset == FX_CHARSET_ChineseTraditional); - if (!m_pFontInfo) { - return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, - PitchFamily); - } GetFontFamily(nStyle, &family); ByteString match = MatchInstalledFonts(TT_NormalizeName(family.c_str())); if (match.IsEmpty() && family != SubstName && -- cgit v1.2.3