diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-02 22:39:16 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-02 22:39:16 +0000 |
commit | 4dbea51fc4bfdcc520dec2b949fd44ec8881cac9 (patch) | |
tree | 7b79a1f13b38bf16b4db29ede0d82b2d6a7a183a /xfa/fgas/font/cfgas_defaultfontmanager.cpp | |
parent | c0a3a9b72f9bddd0b0a2b0465d961c6d9584558b (diff) | |
download | pdfium-4dbea51fc4bfdcc520dec2b949fd44ec8881cac9.tar.xz |
Reduce includes in cfgas_defaultfontmanager.h
Do IWYU elsewhere, and unindent CFGAS_DefaultFontManager::GetFont().
Change-Id: Idb06c4ae75ce2d72b231cc4c84f61e5ca8a80cc5
Reviewed-on: https://pdfium-review.googlesource.com/c/43314
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fgas/font/cfgas_defaultfontmanager.cpp')
-rw-r--r-- | xfa/fgas/font/cfgas_defaultfontmanager.cpp | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.cpp b/xfa/fgas/font/cfgas_defaultfontmanager.cpp index d8ffd548bf..fcaf6fdffe 100644 --- a/xfa/fgas/font/cfgas_defaultfontmanager.cpp +++ b/xfa/fgas/font/cfgas_defaultfontmanager.cpp @@ -6,6 +6,7 @@ #include "xfa/fgas/font/cfgas_defaultfontmanager.h" +#include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fgas/font/fgas_fontutils.h" CFGAS_DefaultFontManager::CFGAS_DefaultFontManager() {} @@ -19,35 +20,37 @@ RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetFont( WideString wsFontName(wsFontFamily); RetainPtr<CFGAS_GEFont> pFont = pFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, 0xFFFF); - if (!pFont) { - const FGAS_FontInfo* pCurFont = - FGAS_FontInfoByFontName(wsFontName.AsStringView()); - if (pCurFont && pCurFont->pReplaceFont) { - uint32_t dwStyle = 0; - // TODO(dsinclair): Why doesn't this check the other flags? - if (FontStyleIsBold(dwFontStyles)) - dwStyle |= FXFONT_BOLD; - if (FontStyleIsItalic(dwFontStyles)) - dwStyle |= FXFONT_ITALIC; + if (pFont) + return pFont; + + const FGAS_FontInfo* pCurFont = + FGAS_FontInfoByFontName(wsFontName.AsStringView()); + if (!pCurFont || !pCurFont->pReplaceFont) + return pFont; - const wchar_t* pReplace = pCurFont->pReplaceFont; - int32_t iLength = wcslen(pReplace); - while (iLength > 0) { - const wchar_t* pNameText = pReplace; - while (*pNameText != L',' && iLength > 0) { - pNameText++; - iLength--; - } - WideString wsReplace = WideString(pReplace, pNameText - pReplace); - pFont = pFontMgr->LoadFont(wsReplace.c_str(), dwStyle, 0xFFFF); - if (pFont) - break; + uint32_t dwStyle = 0; + // TODO(dsinclair): Why doesn't this check the other flags? + if (FontStyleIsBold(dwFontStyles)) + dwStyle |= FXFONT_BOLD; + if (FontStyleIsItalic(dwFontStyles)) + dwStyle |= FXFONT_ITALIC; - iLength--; - pNameText++; - pReplace = pNameText; - } + const wchar_t* pReplace = pCurFont->pReplaceFont; + int32_t iLength = wcslen(pReplace); + while (iLength > 0) { + const wchar_t* pNameText = pReplace; + while (*pNameText != L',' && iLength > 0) { + pNameText++; + iLength--; } + WideString wsReplace = WideString(pReplace, pNameText - pReplace); + pFont = pFontMgr->LoadFont(wsReplace.c_str(), dwStyle, 0xFFFF); + if (pFont) + break; + + iLength--; + pNameText++; + pReplace = pNameText; } return pFont; } |