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

Side by Side Diff: xfa/fgas/font/fgas_stdfontmgr.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, 4 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.h ('k') | xfa/fxfa/app/xfa_fontmgr.cpp » ('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 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 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/fgas/font/fgas_stdfontmgr.h" 7 #include "xfa/fgas/font/fgas_stdfontmgr.h"
8 8
9 #include "core/fxcrt/include/fx_stream.h" 9 #include "core/fxcrt/include/fx_stream.h"
10 #include "core/fxge/include/cfx_fontmapper.h" 10 #include "core/fxge/include/cfx_fontmapper.h"
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 pFonts->SetAt(i, nullptr); 1149 pFonts->SetAt(i, nullptr);
1150 } 1150 }
1151 } 1151 }
1152 } else { 1152 } else {
1153 m_Hash2Fonts.RemoveKey(dwHash); 1153 m_Hash2Fonts.RemoveKey(dwHash);
1154 } 1154 }
1155 } 1155 }
1156 } 1156 }
1157 1157
1158 void CFGAS_FontMgrImp::RegisterFace(FXFT_Face pFace, 1158 void CFGAS_FontMgrImp::RegisterFace(FXFT_Face pFace,
1159 CFX_FontDescriptors& Fonts,
1160 const CFX_WideString* pFaceName) { 1159 const CFX_WideString* pFaceName) {
1161 if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0) 1160 if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0)
1162 return; 1161 return;
1163 1162
1164 std::unique_ptr<CFX_FontDescriptor> pFont(new CFX_FontDescriptor); 1163 std::unique_ptr<CFX_FontDescriptor> pFont(new CFX_FontDescriptor);
1165 pFont->m_dwFontStyles |= FXFT_Is_Face_Bold(pFace) ? FX_FONTSTYLE_Bold : 0; 1164 pFont->m_dwFontStyles |= FXFT_Is_Face_Bold(pFace) ? FX_FONTSTYLE_Bold : 0;
1166 pFont->m_dwFontStyles |= FXFT_Is_Face_Italic(pFace) ? FX_FONTSTYLE_Italic : 0; 1165 pFont->m_dwFontStyles |= FXFT_Is_Face_Italic(pFace) ? FX_FONTSTYLE_Italic : 0;
1167 pFont->m_dwFontStyles |= GetFlags(pFace); 1166 pFont->m_dwFontStyles |= GetFlags(pFace);
1168 1167
1169 std::vector<uint16_t> charsets = GetCharsets(pFace); 1168 std::vector<uint16_t> charsets = GetCharsets(pFace);
(...skipping 11 matching lines...) Expand all
1181 table.clear(); 1180 table.clear();
1182 } 1181 }
1183 GetNames(table.empty() ? nullptr : table.data(), pFont->m_wsFamilyNames); 1182 GetNames(table.empty() ? nullptr : table.data(), pFont->m_wsFamilyNames);
1184 1183
1185 pFont->m_wsFamilyNames.Add(CFX_ByteString(pFace->family_name).UTF8Decode()); 1184 pFont->m_wsFamilyNames.Add(CFX_ByteString(pFace->family_name).UTF8Decode());
1186 pFont->m_wsFaceName = 1185 pFont->m_wsFaceName =
1187 pFaceName ? *pFaceName 1186 pFaceName ? *pFaceName
1188 : CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace)); 1187 : CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace));
1189 pFont->m_nFaceIndex = pFace->face_index; 1188 pFont->m_nFaceIndex = pFace->face_index;
1190 1189
1191 Fonts.Add(pFont.release()); 1190 m_InstalledFonts.Add(pFont.release());
1192 } 1191 }
1193 1192
1194 void CFGAS_FontMgrImp::RegisterFaces(IFX_FileRead* pFontStream, 1193 void CFGAS_FontMgrImp::RegisterFaces(IFX_FileRead* pFontStream,
1195 const CFX_WideString* pFaceName) { 1194 const CFX_WideString* pFaceName) {
1196 int32_t index = 0; 1195 int32_t index = 0;
1197 int32_t num_faces = 0; 1196 int32_t num_faces = 0;
1198 do { 1197 do {
1199 FXFT_Face pFace = LoadFace(pFontStream, index++); 1198 FXFT_Face pFace = LoadFace(pFontStream, index++);
1200 if (!pFace) 1199 if (!pFace)
1201 continue; 1200 continue;
1202 // All faces keep number of faces. It can be retrieved from any one face. 1201 // All faces keep number of faces. It can be retrieved from any one face.
1203 if (num_faces == 0) 1202 if (num_faces == 0)
1204 num_faces = pFace->num_faces; 1203 num_faces = pFace->num_faces;
1205 RegisterFace(pFace, m_InstalledFonts, pFaceName); 1204 RegisterFace(pFace, pFaceName);
1206 if (FXFT_Get_Face_External_Stream(pFace)) 1205 if (FXFT_Get_Face_External_Stream(pFace))
1207 FXFT_Clear_Face_External_Stream(pFace); 1206 FXFT_Clear_Face_External_Stream(pFace);
1208 FXFT_Done_Face(pFace); 1207 FXFT_Done_Face(pFace);
1209 } while (index < num_faces); 1208 } while (index < num_faces);
1210 } 1209 }
1211 1210
1212 uint32_t CFGAS_FontMgrImp::GetFlags(FXFT_Face pFace) { 1211 uint32_t CFGAS_FontMgrImp::GetFlags(FXFT_Face pFace) {
1213 uint32_t flag = 0; 1212 uint32_t flag = 0;
1214 if (FT_IS_FIXED_WIDTH(pFace)) { 1213 if (FT_IS_FIXED_WIDTH(pFace)) {
1215 flag |= FX_FONTSTYLE_FixedPitch; 1214 flag |= FX_FONTSTYLE_FixedPitch;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 1385
1387 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, 1386 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1,
1388 const CFX_WideString& Name2) { 1387 const CFX_WideString& Name2) {
1389 if (Name1.Find(Name2.c_str()) != -1) { 1388 if (Name1.Find(Name2.c_str()) != -1) {
1390 return 1; 1389 return 1;
1391 } 1390 }
1392 return 0; 1391 return 0;
1393 } 1392 }
1394 1393
1395 #endif 1394 #endif
OLDNEW
« no previous file with comments | « xfa/fgas/font/fgas_stdfontmgr.h ('k') | xfa/fxfa/app/xfa_fontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698