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

Side by Side Diff: core/fxge/ge/fx_ge_fontmap.cpp

Issue 2292503002: Refactor fx_font part 4 (Closed)
Patch Set: Comments 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 | « core/fxge/ge/fx_ge_font.cpp ('k') | core/fxge/include/cfx_fontmapper.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 "core/fxge/include/cfx_fontmapper.h" 7 #include "core/fxge/include/cfx_fontmapper.h"
8 #include "core/fxge/include/ifx_systemfontinfo.h" 8 #include "core/fxge/include/ifx_systemfontinfo.h"
9 9
10 CFX_SubstFont::CFX_SubstFont() {
11 m_Charset = FXFONT_ANSI_CHARSET;
12 m_SubstFlags = 0;
13 m_Weight = 0;
14 m_ItalicAngle = 0;
15 m_bSubstCJK = false;
16 m_WeightCJK = 0;
17 m_bItalicCJK = false;
18 }
19
20 CTTFontDesc::~CTTFontDesc() {
21 if (m_Type == 1) {
22 if (m_SingleFace.m_pFace) {
23 FXFT_Done_Face(m_SingleFace.m_pFace);
24 }
25 } else if (m_Type == 2) {
26 for (int i = 0; i < 16; i++)
27 if (m_TTCFace.m_pFaces[i]) {
28 FXFT_Done_Face(m_TTCFace.m_pFaces[i]);
29 }
30 }
31 FX_Free(m_pFontData);
32 }
33 int CTTFontDesc::ReleaseFace(FXFT_Face face) {
34 if (m_Type == 1) {
35 if (m_SingleFace.m_pFace != face) {
36 return -1;
37 }
38 } else if (m_Type == 2) {
39 int i;
40 for (i = 0; i < 16; i++)
41 if (m_TTCFace.m_pFaces[i] == face) {
42 break;
43 }
44 if (i == 16) {
45 return -1;
46 }
47 }
48 m_RefCount--;
49 if (m_RefCount) {
50 return m_RefCount;
51 }
52 delete this;
53 return 0;
54 }
55
56 static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr, 10 static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr,
57 uint32_t string_ptr_length, 11 uint32_t string_ptr_length,
58 uint16_t offset, 12 uint16_t offset,
59 uint16_t length) { 13 uint16_t length) {
60 if (string_ptr_length < static_cast<uint32_t>(offset + length)) { 14 if (string_ptr_length < static_cast<uint32_t>(offset + length)) {
61 return CFX_ByteString(); 15 return CFX_ByteString();
62 } 16 }
63 return CFX_ByteString(string_ptr + offset, length); 17 return CFX_ByteString(string_ptr + offset, length);
64 } 18 }
65 19
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 CFX_ByteString fontTables, 82 CFX_ByteString fontTables,
129 uint32_t fontOffset, 83 uint32_t fontOffset,
130 uint32_t fileSize) 84 uint32_t fileSize)
131 : m_FilePath(filePath), 85 : m_FilePath(filePath),
132 m_FaceName(faceName), 86 m_FaceName(faceName),
133 m_FontTables(fontTables), 87 m_FontTables(fontTables),
134 m_FontOffset(fontOffset), 88 m_FontOffset(fontOffset),
135 m_FileSize(fileSize), 89 m_FileSize(fileSize),
136 m_Styles(0), 90 m_Styles(0),
137 m_Charsets(0) {} 91 m_Charsets(0) {}
OLDNEW
« no previous file with comments | « core/fxge/ge/fx_ge_font.cpp ('k') | core/fxge/include/cfx_fontmapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698