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

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

Issue 1857073002: Make down-conversion explicit from CFX_Widetring to CFX_WideStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: String argument type Created 4 years, 8 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_ffwidgetacc.cpp ('k') | xfa/fxfa/app/xfa_textlayout.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/include/fxfa/xfa_fontmgr.h" 7 #include "xfa/include/fxfa/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 } 1758 }
1759 1759
1760 IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, 1760 IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc,
1761 const CFX_WideStringC& wsFontFamily, 1761 const CFX_WideStringC& wsFontFamily,
1762 uint32_t dwFontStyles, 1762 uint32_t dwFontStyles,
1763 uint16_t wCodePage) { 1763 uint16_t wCodePage) {
1764 CFX_WideString wsFontName = wsFontFamily; 1764 CFX_WideString wsFontName = wsFontFamily;
1765 IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); 1765 IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
1766 IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage); 1766 IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage);
1767 if (!pFont) { 1767 if (!pFont) {
1768 const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName); 1768 const XFA_FONTINFO* pCurFont =
1769 XFA_GetFontINFOByFontName(wsFontName.AsWideStringC());
1769 if (pCurFont && pCurFont->pReplaceFont) { 1770 if (pCurFont && pCurFont->pReplaceFont) {
1770 uint32_t dwStyle = 0; 1771 uint32_t dwStyle = 0;
1771 if (dwFontStyles & FX_FONTSTYLE_Bold) { 1772 if (dwFontStyles & FX_FONTSTYLE_Bold) {
1772 dwStyle |= FX_FONTSTYLE_Bold; 1773 dwStyle |= FX_FONTSTYLE_Bold;
1773 } 1774 }
1774 if (dwFontStyles & FX_FONTSTYLE_Italic) { 1775 if (dwFontStyles & FX_FONTSTYLE_Italic) {
1775 dwStyle |= FX_FONTSTYLE_Italic; 1776 dwStyle |= FX_FONTSTYLE_Italic;
1776 } 1777 }
1777 const FX_WCHAR* pReplace = pCurFont->pReplaceFont; 1778 const FX_WCHAR* pReplace = pCurFont->pReplaceFont;
1778 int32_t iLength = FXSYS_wcslen(pReplace); 1779 int32_t iLength = FXSYS_wcslen(pReplace);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage); 2023 bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage);
2023 auto it = m_FontMap.find(bsKey); 2024 auto it = m_FontMap.find(bsKey);
2024 if (it != m_FontMap.end()) 2025 if (it != m_FontMap.end())
2025 return it->second; 2026 return it->second;
2026 CFX_WideString wsEnglishName; 2027 CFX_WideString wsEnglishName;
2027 XFA_LocalFontNameToEnglishName(wsFontFamily, wsEnglishName); 2028 XFA_LocalFontNameToEnglishName(wsFontFamily, wsEnglishName);
2028 CXFA_PDFFontMgr* pMgr = (CXFA_PDFFontMgr*)m_PDFFontMgrArray.GetValueAt(hDoc); 2029 CXFA_PDFFontMgr* pMgr = (CXFA_PDFFontMgr*)m_PDFFontMgrArray.GetValueAt(hDoc);
2029 CPDF_Font* pPDFFont = NULL; 2030 CPDF_Font* pPDFFont = NULL;
2030 IFX_Font* pFont = NULL; 2031 IFX_Font* pFont = NULL;
2031 if (pMgr) { 2032 if (pMgr) {
2032 pFont = pMgr->GetFont(wsEnglishName, dwFontStyles, &pPDFFont); 2033 pFont =
2034 pMgr->GetFont(wsEnglishName.AsWideStringC(), dwFontStyles, &pPDFFont);
2033 if (pFont) 2035 if (pFont)
2034 return pFont; 2036 return pFont;
2035 } 2037 }
2036 if (!pFont && m_pDefFontMgr) { 2038 if (!pFont && m_pDefFontMgr) {
2037 pFont = m_pDefFontMgr->GetFont(hDoc, wsFontFamily, dwFontStyles, wCodePage); 2039 pFont = m_pDefFontMgr->GetFont(hDoc, wsFontFamily, dwFontStyles, wCodePage);
2038 } 2040 }
2039 if (!pFont && pMgr) { 2041 if (!pFont && pMgr) {
2040 pPDFFont = NULL; 2042 pPDFFont = NULL;
2041 pFont = pMgr->GetFont(wsEnglishName, dwFontStyles, &pPDFFont, FALSE); 2043 pFont = pMgr->GetFont(wsEnglishName.AsWideStringC(), dwFontStyles,
2044 &pPDFFont, FALSE);
2042 if (pFont) 2045 if (pFont)
2043 return pFont; 2046 return pFont;
2044 } 2047 }
2045 if (!pFont && m_pDefFontMgr) { 2048 if (!pFont && m_pDefFontMgr) {
2046 pFont = m_pDefFontMgr->GetDefaultFont(hDoc, wsFontFamily, dwFontStyles, 2049 pFont = m_pDefFontMgr->GetDefaultFont(hDoc, wsFontFamily, dwFontStyles,
2047 wCodePage); 2050 wCodePage);
2048 } 2051 }
2049 if (pFont) { 2052 if (pFont) {
2050 if (pPDFFont) { 2053 if (pPDFFont) {
2051 pMgr->m_FDE2PDFFont.SetAt(pFont, pPDFFont); 2054 pMgr->m_FDE2PDFFont.SetAt(pFont, pPDFFont);
(...skipping 22 matching lines...) Expand all
2074 CXFA_PDFFontMgr* pMgr = NULL; 2077 CXFA_PDFFontMgr* pMgr = NULL;
2075 m_PDFFontMgrArray.GetNextAssoc(ps, (void*&)hDoc, (void*&)pMgr); 2078 m_PDFFontMgrArray.GetNextAssoc(ps, (void*&)hDoc, (void*&)pMgr);
2076 delete pMgr; 2079 delete pMgr;
2077 } 2080 }
2078 m_PDFFontMgrArray.RemoveAll(); 2081 m_PDFFontMgrArray.RemoveAll();
2079 m_FontMap.clear(); 2082 m_FontMap.clear();
2080 } 2083 }
2081 void CXFA_FontMgr::SetDefFontMgr(CXFA_DefFontMgr* pFontMgr) { 2084 void CXFA_FontMgr::SetDefFontMgr(CXFA_DefFontMgr* pFontMgr) {
2082 m_pDefFontMgr = pFontMgr; 2085 m_pDefFontMgr = pFontMgr;
2083 } 2086 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffwidgetacc.cpp ('k') | xfa/fxfa/app/xfa_textlayout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698