summaryrefslogtreecommitdiff
path: root/core/fxge/cfx_fontmapper.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-12-06 20:01:01 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-06 20:01:01 +0000
commitfd9e0b8f5f9204a46090c3b392b9a4322a6ea09d (patch)
tree4913df5be963b8fd19eaf16ceb74e23eadb9c101 /core/fxge/cfx_fontmapper.cpp
parent4bd2ad8cf901134cabae0c56524a05a542c118fd (diff)
downloadpdfium-fd9e0b8f5f9204a46090c3b392b9a4322a6ea09d.tar.xz
Fix nits on some font code.
Change-Id: I80be0de1a7d9ba502b4468bc13a4595566f8fb30 Reviewed-on: https://pdfium-review.googlesource.com/20432 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/cfx_fontmapper.cpp')
-rw-r--r--core/fxge/cfx_fontmapper.cpp25
1 files changed, 12 insertions, 13 deletions
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<bool, uint32_t, size_t> 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)