diff options
author | thestig <thestig@chromium.org> | 2016-06-21 14:38:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-21 14:38:28 -0700 |
commit | 907a5223ea5abd09878de20cc74c59ebd0d6c3c8 (patch) | |
tree | 7dba8b090eda4f65da57d1979bdb02cedd273055 /core/fxge | |
parent | 56a8b1944d555ed65dda97164b702a9a657485ca (diff) | |
download | pdfium-907a5223ea5abd09878de20cc74c59ebd0d6c3c8.tar.xz |
Use FXFONT defines in place of integers.
Fix nits along the way.
Review-Url: https://codereview.chromium.org/2083943003
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/apple/fx_mac_imp.cpp | 12 | ||||
-rw-r--r-- | core/fxge/ge/fx_ge_font.cpp | 3 | ||||
-rw-r--r-- | core/fxge/ge/fx_ge_fontmap.cpp | 13 | ||||
-rw-r--r-- | core/fxge/ge/fx_ge_text.cpp | 4 | ||||
-rw-r--r-- | core/fxge/include/fx_font.h | 13 |
5 files changed, 20 insertions, 25 deletions
diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp index 528b7274db..489ce816cc 100644 --- a/core/fxge/apple/fx_mac_imp.cpp +++ b/core/fxge/apple/fx_mac_imp.cpp @@ -28,6 +28,9 @@ static const struct { class CFX_MacFontInfo : public CFX_FolderFontInfo { public: + CFX_MacFontInfo() {} + ~CFX_MacFontInfo() override {} + // CFX_FolderFontInfo void* MapFont(int weight, FX_BOOL bItalic, @@ -41,12 +44,12 @@ class CFX_MacFontInfo : public CFX_FolderFontInfo { #define JAPAN_MINCHO "Hiragino Mincho Pro W6" static void GetJapanesePreference(CFX_ByteString& face, int weight, - int picth_family) { + int pitch_family) { if (face.Find("Gothic") >= 0) { face = JAPAN_GOTHIC; return; } - if (!(picth_family & FXFONT_FF_ROMAN) && weight > 400) { + if (!(pitch_family & FXFONT_FF_ROMAN) && weight > 400) { face = JAPAN_GOTHIC; } else { face = JAPAN_MINCHO; @@ -93,10 +96,7 @@ void* CFX_MacFontInfo::MapFont(int weight, face = "LiSong Pro Light"; } it = m_FontList.find(face); - if (it != m_FontList.end()) - return it->second; - - return nullptr; + return it != m_FontList.end() ? it->second : nullptr; } std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault( diff --git a/core/fxge/ge/fx_ge_font.cpp b/core/fxge/ge/fx_ge_font.cpp index 3bb1580d01..fd6f8a2cf8 100644 --- a/core/fxge/ge/fx_ge_font.cpp +++ b/core/fxge/ge/fx_ge_font.cpp @@ -456,7 +456,8 @@ uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) { if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0) return FXFT_Get_Char_Index(face, charcode); - if (m_pFont->GetSubstFont() && m_pFont->GetSubstFont()->m_Charset == 2) { + if (m_pFont->GetSubstFont() && + m_pFont->GetSubstFont()->m_Charset == FXFONT_SYMBOL_CHARSET) { uint32_t index = 0; if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0) index = FXFT_Get_Char_Index(face, charcode); diff --git a/core/fxge/ge/fx_ge_fontmap.cpp b/core/fxge/ge/fx_ge_fontmap.cpp index 81e3137913..cc7e9f1aa2 100644 --- a/core/fxge/ge/fx_ge_fontmap.cpp +++ b/core/fxge/ge/fx_ge_fontmap.cpp @@ -293,7 +293,7 @@ uint8_t GetCharsetFromCodePage(uint16_t codepage) { }); if (pCharmap < pEnd && codepage == pCharmap->codepage) return pCharmap->charset; - return 1; + return FXFONT_DEFAULT_CHARSET; } CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) { @@ -412,14 +412,15 @@ int32_t GetSimilarValue(int weight, CFX_SubstFont::CFX_SubstFont() { m_ExtHandle = nullptr; - m_Charset = 0; + m_Charset = FXFONT_ANSI_CHARSET; m_SubstFlags = 0; m_Weight = 0; m_ItalicAngle = 0; - m_bSubstOfCJK = FALSE; + m_bSubstCJK = false; m_WeightCJK = 0; - m_bItlicCJK = FALSE; + m_bItalicCJK = false; } + CTTFontDesc::~CTTFontDesc() { if (m_Type == 1) { if (m_SingleFace.m_pFace) { @@ -1057,14 +1058,14 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, weight = old_weight; } } else { - pSubstFont->m_bSubstOfCJK = TRUE; + pSubstFont->m_bSubstCJK = true; if (nStyle) { pSubstFont->m_WeightCJK = weight; } else { pSubstFont->m_WeightCJK = FXFONT_FW_NORMAL; } if (nStyle & FX_FONT_STYLE_Italic) { - pSubstFont->m_bItlicCJK = TRUE; + pSubstFont->m_bItalicCJK = true; } } } else { diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp index 9f635edacc..f09e44eefb 100644 --- a/core/fxge/ge/fx_ge_text.cpp +++ b/core/fxge/ge/fx_ge_text.cpp @@ -1092,10 +1092,10 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_BOOL bUseCJKSubFont = FALSE; const CFX_SubstFont* pSubstFont = pFont->GetSubstFont(); if (pSubstFont) { - bUseCJKSubFont = pSubstFont->m_bSubstOfCJK && bFontStyle; + bUseCJKSubFont = pSubstFont->m_bSubstCJK && bFontStyle; int skew = 0; if (bUseCJKSubFont) { - skew = pSubstFont->m_bItlicCJK ? -15 : 0; + skew = pSubstFont->m_bItalicCJK ? -15 : 0; } else { skew = pSubstFont->m_ItalicAngle; } diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h index 78913c6867..f99d4a8af9 100644 --- a/core/fxge/include/fx_font.h +++ b/core/fxge/include/fx_font.h @@ -218,23 +218,16 @@ class CFX_SubstFont { CFX_SubstFont(); void* m_ExtHandle; - CFX_ByteString m_Family; - int m_Charset; - uint32_t m_SubstFlags; - int m_Weight; - int m_ItalicAngle; - - FX_BOOL m_bSubstOfCJK; - + bool m_bSubstCJK; int m_WeightCJK; - - FX_BOOL m_bItlicCJK; + bool m_bItalicCJK; }; + #define FX_FONT_FLAG_SERIF 0x01 #define FX_FONT_FLAG_FIXEDPITCH 0x02 #define FX_FONT_FLAG_ITALIC 0x04 |