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

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

Issue 2259823004: [XFA] Force destruction order of font managers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Re-arrange header entries Created 4 years, 3 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/fgas/font/fgas_stdfontmgr.cpp ('k') | xfa/fxfa/include/xfa_ffapp.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/include/xfa_fontmgr.h" 7 #include "xfa/fxfa/include/xfa_fontmgr.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 int32_t iLength = FXSYS_wcslen(pReplace); 1768 int32_t iLength = FXSYS_wcslen(pReplace);
1769 while (iLength > 0) { 1769 while (iLength > 0) {
1770 const FX_WCHAR* pNameText = pReplace; 1770 const FX_WCHAR* pNameText = pReplace;
1771 while (*pNameText != L',' && iLength > 0) { 1771 while (*pNameText != L',' && iLength > 0) {
1772 pNameText++; 1772 pNameText++;
1773 iLength--; 1773 iLength--;
1774 } 1774 }
1775 CFX_WideString wsReplace = 1775 CFX_WideString wsReplace =
1776 CFX_WideString(pReplace, pNameText - pReplace); 1776 CFX_WideString(pReplace, pNameText - pReplace);
1777 pFont = pFDEFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage); 1777 pFont = pFDEFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage);
1778 if (pFont) { 1778 if (pFont)
1779 break; 1779 break;
1780 } 1780
1781 iLength--; 1781 iLength--;
1782 pNameText++; 1782 pNameText++;
1783 pReplace = pNameText; 1783 pReplace = pNameText;
1784 } 1784 }
1785 } 1785 }
1786 } 1786 }
1787 if (pFont) { 1787 if (pFont)
1788 m_CacheFonts.Add(pFont); 1788 m_CacheFonts.Add(pFont);
1789 }
1790 return pFont; 1789 return pFont;
1791 } 1790 }
1792 1791
1793 CFGAS_GEFont* CXFA_DefFontMgr::GetDefaultFont( 1792 CFGAS_GEFont* CXFA_DefFontMgr::GetDefaultFont(
1794 CXFA_FFDoc* hDoc, 1793 CXFA_FFDoc* hDoc,
1795 const CFX_WideStringC& wsFontFamily, 1794 const CFX_WideStringC& wsFontFamily,
1796 uint32_t dwFontStyles, 1795 uint32_t dwFontStyles,
1797 uint16_t wCodePage) { 1796 uint16_t wCodePage) {
1798 IFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); 1797 IFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
1799 CFGAS_GEFont* pFont = 1798 CFGAS_GEFont* pFont =
1800 pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); 1799 pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage);
1801 if (!pFont) { 1800 if (!pFont) {
1802 pFont = pFDEFontMgr->LoadFont((const FX_WCHAR*)nullptr, dwFontStyles, 1801 pFont = pFDEFontMgr->LoadFont((const FX_WCHAR*)nullptr, dwFontStyles,
1803 wCodePage); 1802 wCodePage);
1804 } 1803 }
1805 1804
1806 ASSERT(pFont); 1805 ASSERT(pFont);
1807 if (pFont) { 1806 if (pFont)
1808 m_CacheFonts.Add(pFont); 1807 m_CacheFonts.Add(pFont);
1809 }
1810 return pFont; 1808 return pFont;
1811 } 1809 }
1812 struct XFA_PDFFONTNAME { 1810 struct XFA_PDFFONTNAME {
1813 const FX_CHAR* lpPsName; 1811 const FX_CHAR* lpPsName;
1814 const FX_CHAR* lpNormal; 1812 const FX_CHAR* lpNormal;
1815 const FX_CHAR* lpBold; 1813 const FX_CHAR* lpBold;
1816 const FX_CHAR* lpItalic; 1814 const FX_CHAR* lpItalic;
1817 const FX_CHAR* lpBoldItalic; 1815 const FX_CHAR* lpBoldItalic;
1818 }; 1816 };
1819 const XFA_PDFFONTNAME g_XFAPDFFontName[] = { 1817 const XFA_PDFFONTNAME g_XFAPDFFontName[] = {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc)); 2053 m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc));
2056 } 2054 }
2057 2055
2058 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { 2056 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) {
2059 m_PDFFontMgrMap.erase(hDoc); 2057 m_PDFFontMgrMap.erase(hDoc);
2060 } 2058 }
2061 2059
2062 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { 2060 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
2063 m_pDefFontMgr = std::move(pFontMgr); 2061 m_pDefFontMgr = std::move(pFontMgr);
2064 } 2062 }
OLDNEW
« no previous file with comments | « xfa/fgas/font/fgas_stdfontmgr.cpp ('k') | xfa/fxfa/include/xfa_ffapp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698