Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: xfa/fxfa/app/xfa_fontmgr.cpp

Issue 1821043003: Remove FX_WORD in favor of uint16_t. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use stdint.h directly, bitfield minefield. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/app/xfa_fontmgr.h ('k') | xfa/fxfa/parser/xfa_basic_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/app/xfa_fontmgr.h" 7 #include "xfa/fxfa/app/xfa_fontmgr.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 int32_t iCounts = m_CacheFonts.GetSize(); 1758 int32_t iCounts = m_CacheFonts.GetSize();
1759 for (int32_t i = 0; i < iCounts; i++) { 1759 for (int32_t i = 0; i < iCounts; i++) {
1760 ((IFX_Font*)m_CacheFonts[i])->Release(); 1760 ((IFX_Font*)m_CacheFonts[i])->Release();
1761 } 1761 }
1762 m_CacheFonts.RemoveAll(); 1762 m_CacheFonts.RemoveAll();
1763 } 1763 }
1764 1764
1765 IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, 1765 IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc,
1766 const CFX_WideStringC& wsFontFamily, 1766 const CFX_WideStringC& wsFontFamily,
1767 FX_DWORD dwFontStyles, 1767 FX_DWORD dwFontStyles,
1768 FX_WORD wCodePage) { 1768 uint16_t wCodePage) {
1769 CFX_WideString wsFontName = wsFontFamily; 1769 CFX_WideString wsFontName = wsFontFamily;
1770 IFX_FontMgr* pFDEFontMgr = 1770 IFX_FontMgr* pFDEFontMgr =
1771 static_cast<CXFA_FFDoc*>(hDoc)->GetApp()->GetFDEFontMgr(); 1771 static_cast<CXFA_FFDoc*>(hDoc)->GetApp()->GetFDEFontMgr();
1772 IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage); 1772 IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage);
1773 if (!pFont) { 1773 if (!pFont) {
1774 const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName); 1774 const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName);
1775 if (pCurFont && pCurFont->pReplaceFont) { 1775 if (pCurFont && pCurFont->pReplaceFont) {
1776 FX_DWORD dwStyle = 0; 1776 FX_DWORD dwStyle = 0;
1777 if (dwFontStyles & FX_FONTSTYLE_Bold) { 1777 if (dwFontStyles & FX_FONTSTYLE_Bold) {
1778 dwStyle |= FX_FONTSTYLE_Bold; 1778 dwStyle |= FX_FONTSTYLE_Bold;
(...skipping 23 matching lines...) Expand all
1802 } 1802 }
1803 if (pFont) { 1803 if (pFont) {
1804 m_CacheFonts.Add(pFont); 1804 m_CacheFonts.Add(pFont);
1805 } 1805 }
1806 return pFont; 1806 return pFont;
1807 } 1807 }
1808 1808
1809 IFX_Font* CXFA_DefFontMgr::GetDefaultFont(IXFA_Doc* hDoc, 1809 IFX_Font* CXFA_DefFontMgr::GetDefaultFont(IXFA_Doc* hDoc,
1810 const CFX_WideStringC& wsFontFamily, 1810 const CFX_WideStringC& wsFontFamily,
1811 FX_DWORD dwFontStyles, 1811 FX_DWORD dwFontStyles,
1812 FX_WORD wCodePage) { 1812 uint16_t wCodePage) {
1813 IFX_FontMgr* pFDEFontMgr = ((CXFA_FFDoc*)hDoc)->GetApp()->GetFDEFontMgr(); 1813 IFX_FontMgr* pFDEFontMgr = ((CXFA_FFDoc*)hDoc)->GetApp()->GetFDEFontMgr();
1814 IFX_Font* pFont = 1814 IFX_Font* pFont =
1815 pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); 1815 pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage);
1816 if (!pFont) 1816 if (!pFont)
1817 pFont = 1817 pFont =
1818 pFDEFontMgr->LoadFont((const FX_WCHAR*)NULL, dwFontStyles, wCodePage); 1818 pFDEFontMgr->LoadFont((const FX_WCHAR*)NULL, dwFontStyles, wCodePage);
1819 FXSYS_assert(pFont); 1819 FXSYS_assert(pFont);
1820 if (pFont) { 1820 if (pFont) {
1821 m_CacheFonts.Add(pFont); 1821 m_CacheFonts.Add(pFont);
1822 } 1822 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 iWidth = pPDFFont->GetCharWidthF(wUnicode); 2014 iWidth = pPDFFont->GetCharWidthF(wUnicode);
2015 return TRUE; 2015 return TRUE;
2016 } 2016 }
2017 CXFA_FontMgr::CXFA_FontMgr() : m_pDefFontMgr(NULL) {} 2017 CXFA_FontMgr::CXFA_FontMgr() : m_pDefFontMgr(NULL) {}
2018 CXFA_FontMgr::~CXFA_FontMgr() { 2018 CXFA_FontMgr::~CXFA_FontMgr() {
2019 DelAllMgrMap(); 2019 DelAllMgrMap();
2020 } 2020 }
2021 IFX_Font* CXFA_FontMgr::GetFont(IXFA_Doc* hDoc, 2021 IFX_Font* CXFA_FontMgr::GetFont(IXFA_Doc* hDoc,
2022 const CFX_WideStringC& wsFontFamily, 2022 const CFX_WideStringC& wsFontFamily,
2023 FX_DWORD dwFontStyles, 2023 FX_DWORD dwFontStyles,
2024 FX_WORD wCodePage) { 2024 uint16_t wCodePage) {
2025 FX_DWORD dwHash = FX_HashCode_String_GetW(wsFontFamily.GetPtr(), 2025 FX_DWORD dwHash = FX_HashCode_String_GetW(wsFontFamily.GetPtr(),
2026 wsFontFamily.GetLength(), FALSE); 2026 wsFontFamily.GetLength(), FALSE);
2027 CFX_ByteString bsKey; 2027 CFX_ByteString bsKey;
2028 bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage); 2028 bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage);
2029 auto it = m_FontMap.find(bsKey); 2029 auto it = m_FontMap.find(bsKey);
2030 if (it != m_FontMap.end()) 2030 if (it != m_FontMap.end())
2031 return it->second; 2031 return it->second;
2032 CFX_WideString wsEnglishName; 2032 CFX_WideString wsEnglishName;
2033 XFA_LocalFontNameToEnglishName(wsFontFamily, wsEnglishName); 2033 XFA_LocalFontNameToEnglishName(wsFontFamily, wsEnglishName);
2034 CXFA_PDFFontMgr* pMgr = (CXFA_PDFFontMgr*)m_PDFFontMgrArray.GetValueAt(hDoc); 2034 CXFA_PDFFontMgr* pMgr = (CXFA_PDFFontMgr*)m_PDFFontMgrArray.GetValueAt(hDoc);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 CXFA_PDFFontMgr* pMgr = NULL; 2080 CXFA_PDFFontMgr* pMgr = NULL;
2081 m_PDFFontMgrArray.GetNextAssoc(ps, (void*&)hDoc, (void*&)pMgr); 2081 m_PDFFontMgrArray.GetNextAssoc(ps, (void*&)hDoc, (void*&)pMgr);
2082 delete pMgr; 2082 delete pMgr;
2083 } 2083 }
2084 m_PDFFontMgrArray.RemoveAll(); 2084 m_PDFFontMgrArray.RemoveAll();
2085 m_FontMap.clear(); 2085 m_FontMap.clear();
2086 } 2086 }
2087 void CXFA_FontMgr::SetDefFontMgr(IXFA_FontMgr* pFontMgr) { 2087 void CXFA_FontMgr::SetDefFontMgr(IXFA_FontMgr* pFontMgr) {
2088 m_pDefFontMgr = pFontMgr; 2088 m_pDefFontMgr = pFontMgr;
2089 } 2089 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_fontmgr.h ('k') | xfa/fxfa/parser/xfa_basic_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698