From 10e1f05a9e644cd954792bcd40ef787551cbd209 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 28 Sep 2017 15:59:42 -0400 Subject: Cleanup font defines Use methods to match font information; cleanup some font code. Change-Id: Ib99c1e466e56723cb5d264d49e1caf9bbbc0daed Reviewed-on: https://pdfium-review.googlesource.com/15072 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- core/fxge/android/cfpf_skiafontmgr.cpp | 18 +++++++++--------- core/fxge/android/cfx_androidfontinfo.cpp | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'core/fxge/android') diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index 214e718e0b..d8b751d9b2 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -176,11 +176,11 @@ uint32_t FPF_SKIAGetFamilyHash(const ByteStringView& bsFamily, uint32_t dwStyle, uint8_t uCharset) { ByteString bsFont(bsFamily); - if (dwStyle & FXFONT_BOLD) + if (FontStyleIsBold(dwStyle)) bsFont += "Bold"; - if (dwStyle & FXFONT_ITALIC) + if (FontStyleIsItalic(dwStyle)) bsFont += "Italic"; - if (dwStyle & FXFONT_SERIF) + if (FontStyleIsSerif(dwStyle)) bsFont += "Serif"; bsFont += uCharset; return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength()); @@ -317,17 +317,17 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const ByteStringView& bsFamilyname, if (dwFaceName == dwSysFontName) nFind += FPF_SKIAMATCHWEIGHT_NAME1; bool bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1); - if ((dwStyle & FXFONT_BOLD) == (pFontDes->m_dwStyle & FXFONT_BOLD)) + if (FontStyleIsBold(dwStyle) == FontStyleIsBold(pFontDes->m_dwStyle)) nFind += FPF_SKIAMATCHWEIGHT_1; - if ((dwStyle & FXFONT_ITALIC) == (pFontDes->m_dwStyle & FXFONT_ITALIC)) + if (FontStyleIsItalic(dwStyle) == FontStyleIsItalic(pFontDes->m_dwStyle)) nFind += FPF_SKIAMATCHWEIGHT_1; - if ((dwStyle & FXFONT_FIXED_PITCH) == - (pFontDes->m_dwStyle & FXFONT_FIXED_PITCH)) { + if (FontStyleIsFixedPitch(dwStyle) == + FontStyleIsFixedPitch(pFontDes->m_dwStyle)) { nFind += FPF_SKIAMATCHWEIGHT_2; } - if ((dwStyle & FXFONT_SERIF) == (pFontDes->m_dwStyle & FXFONT_SERIF)) + if (FontStyleIsSerif(dwStyle) == FontStyleIsSerif(pFontDes->m_dwStyle)) nFind += FPF_SKIAMATCHWEIGHT_1; - if ((dwStyle & FXFONT_SCRIPT) == (pFontDes->m_dwStyle & FXFONT_SCRIPT)) + if (FontStyleIsScript(dwStyle) == FontStyleIsScript(pFontDes->m_dwStyle)) nFind += FPF_SKIAMATCHWEIGHT_2; if (dwSubst == dwSysFontName || dwSubstSans == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME2; diff --git a/core/fxge/android/cfx_androidfontinfo.cpp b/core/fxge/android/cfx_androidfontinfo.cpp index c6c3e61866..15ac8c29b2 100644 --- a/core/fxge/android/cfx_androidfontinfo.cpp +++ b/core/fxge/android/cfx_androidfontinfo.cpp @@ -40,11 +40,11 @@ void* CFX_AndroidFontInfo::MapFont(int weight, dwStyle |= FXFONT_BOLD; if (bItalic) dwStyle |= FXFONT_ITALIC; - if (pitch_family & FXFONT_FF_FIXEDPITCH) + if (FontFamilyIsFixedPitch(pitch_family)) dwStyle |= FXFONT_FIXED_PITCH; - if (pitch_family & FXFONT_FF_SCRIPT) + if (FontFamilyIsScript(pitch_family)) dwStyle |= FXFONT_SCRIPT; - if (pitch_family & FXFONT_FF_ROMAN) + if (FontFamilyIsRoman(pitch_family)) dwStyle |= FXFONT_SERIF; return m_pFontMgr->CreateFont(face, charset, dwStyle, FPF_MATCHFONT_REPLACEANSI); -- cgit v1.2.3