From fd9e0b8f5f9204a46090c3b392b9a4322a6ea09d Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 6 Dec 2017 20:01:01 +0000 Subject: Fix nits on some font code. Change-Id: I80be0de1a7d9ba502b4468bc13a4595566f8fb30 Reviewed-on: https://pdfium-review.googlesource.com/20432 Commit-Queue: Lei Zhang Reviewed-by: dsinclair --- core/fxge/cfx_fontmapper.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'core/fxge/cfx_fontmapper.cpp') diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp index 406a8222db..0aa41239eb 100644 --- a/core/fxge/cfx_fontmapper.cpp +++ b/core/fxge/cfx_fontmapper.cpp @@ -250,21 +250,20 @@ std::tuple GetStyleType(const ByteString& bsStyle, return std::make_tuple(false, FXFONT_NORMAL, 0); } -bool CheckSupportThirdPartFont(ByteString name, int& PitchFamily) { - if (name == "MyriadPro") { - PitchFamily &= ~FXFONT_FF_ROMAN; - return true; - } - return false; +bool CheckSupportThirdPartFont(const ByteString& name, int* PitchFamily) { + if (name != "MyriadPro") + return false; + *PitchFamily &= ~FXFONT_FF_ROMAN; + return true; } -void UpdatePitchFamily(uint32_t flags, int& PitchFamily) { +void UpdatePitchFamily(uint32_t flags, int* PitchFamily) { if (FontStyleIsSerif(flags)) - PitchFamily |= FXFONT_FF_ROMAN; + *PitchFamily |= FXFONT_FF_ROMAN; if (FontStyleIsScript(flags)) - PitchFamily |= FXFONT_FF_SCRIPT; + *PitchFamily |= FXFONT_FF_SCRIPT; if (FontStyleIsFixedPitch(flags)) - PitchFamily |= FXFONT_FF_FIXEDPITCH; + *PitchFamily |= FXFONT_FF_FIXEDPITCH; } } // namespace @@ -485,7 +484,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name, nStyle |= styleType; } } - UpdatePitchFamily(flags, PitchFamily); + UpdatePitchFamily(flags, &PitchFamily); } int old_weight = weight; @@ -563,7 +562,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name, } if (match.IsEmpty() && iBaseFont >= kNumStandardFonts) { if (!bCJK) { - if (!CheckSupportThirdPartFont(family, PitchFamily)) { + if (!CheckSupportThirdPartFont(family, &PitchFamily)) { bItalic = italic_angle != 0; weight = old_weight; } @@ -707,7 +706,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(uint32_t dwUnicode, bool bItalic = (flags & FXFONT_ITALIC) != 0; int PitchFamily = 0; - UpdatePitchFamily(flags, PitchFamily); + UpdatePitchFamily(flags, &PitchFamily); void* hFont = m_pFontInfo->MapFontByUnicode(dwUnicode, weight, bItalic, PitchFamily); if (!hFont) -- cgit v1.2.3