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

Side by Side Diff: core/src/fxge/ge/fx_ge_font.cpp

Issue 801913002: Simplify PDFium by removing code that's not used in the open source repo. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years 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
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 "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "../../../include/fxge/fx_freetype.h" 8 #include "../../../include/fxge/fx_freetype.h"
9 #include "text_int.h" 9 #include "text_int.h"
10 #define EM_ADJUST(em, a) (em == 0?(a): (a)*1000/em) 10 #define EM_ADJUST(em, a) (em == 0?(a): (a)*1000/em)
(...skipping 14 matching lines...) Expand all
25 m_pDwFont = NULL; 25 m_pDwFont = NULL;
26 m_hHandle = NULL; 26 m_hHandle = NULL;
27 m_bDwLoaded = FALSE; 27 m_bDwLoaded = FALSE;
28 } 28 }
29 CFX_Font::~CFX_Font() 29 CFX_Font::~CFX_Font()
30 { 30 {
31 if (m_pSubstFont) { 31 if (m_pSubstFont) {
32 delete m_pSubstFont; 32 delete m_pSubstFont;
33 m_pSubstFont = NULL; 33 m_pSubstFont = NULL;
34 } 34 }
35 #ifdef FOXIT_CHROME_BUILD
36 if (m_pFontDataAllocation) { 35 if (m_pFontDataAllocation) {
37 FX_Free(m_pFontDataAllocation); 36 FX_Free(m_pFontDataAllocation);
38 m_pFontDataAllocation = NULL; 37 m_pFontDataAllocation = NULL;
39 } 38 }
40 #endif
41 if (m_Face) { 39 if (m_Face) {
42 #ifdef FOXIT_CHROME_BUILD
43 if (FXFT_Get_Face_External_Stream(m_Face)) { 40 if (FXFT_Get_Face_External_Stream(m_Face)) {
44 FXFT_Clear_Face_External_Stream(m_Face); 41 FXFT_Clear_Face_External_Stream(m_Face);
45 } 42 }
46 #endif
47 if(m_bEmbedded) { 43 if(m_bEmbedded) {
48 DeleteFace(); 44 DeleteFace();
49 } else { 45 } else {
50 CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face); 46 CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face);
51 } 47 }
52 } 48 }
53 if (m_pOwnedStream) { 49 if (m_pOwnedStream) {
54 FX_Free(m_pOwnedStream); 50 FX_Free(m_pOwnedStream);
55 m_pOwnedStream = NULL; 51 m_pOwnedStream = NULL;
56 } 52 }
57 if (m_pGsubData) { 53 if (m_pGsubData) {
58 FX_Free(m_pGsubData); 54 FX_Free(m_pGsubData);
59 m_pGsubData = NULL; 55 m_pGsubData = NULL;
60 } 56 }
61 #if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ && (!defined(_FPDFAPI_MINI_))) 57 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
62 ReleasePlatformResource(); 58 ReleasePlatformResource();
63 #endif 59 #endif
64 } 60 }
65 void CFX_Font::DeleteFace() 61 void CFX_Font::DeleteFace()
66 { 62 {
67 FXFT_Done_Face(m_Face); 63 FXFT_Done_Face(m_Face);
68 m_Face = NULL; 64 m_Face = NULL;
69 } 65 }
70 FX_BOOL CFX_Font::LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags, 66 FX_BOOL CFX_Font::LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags,
71 int weight, int italic_angle, int CharsetCP, FX_BOOL bVertical) 67 int weight, int italic_angle, int CharsetCP, FX_BOOL bVertical)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 return NULL; 172 return NULL;
177 } 173 }
178 error = FXFT_Set_Pixel_Sizes(face, 64, 64); 174 error = FXFT_Set_Pixel_Sizes(face, 64, 64);
179 if (error) { 175 if (error) {
180 return NULL; 176 return NULL;
181 } 177 }
182 return face; 178 return face;
183 } 179 }
184 FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) 180 FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size)
185 { 181 {
186 #ifdef FOXIT_CHROME_BUILD
187 m_pFontDataAllocation = FX_Alloc(FX_BYTE, size); 182 m_pFontDataAllocation = FX_Alloc(FX_BYTE, size);
188 if (!m_pFontDataAllocation) { 183 if (!m_pFontDataAllocation) {
189 return FALSE; 184 return FALSE;
190 } 185 }
191 FXSYS_memcpy32(m_pFontDataAllocation, data, size); 186 FXSYS_memcpy32(m_pFontDataAllocation, data, size);
192 m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size); 187 m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size);
193 m_pFontData = (FX_LPBYTE)m_pFontDataAllocation; 188 m_pFontData = (FX_LPBYTE)m_pFontDataAllocation;
194 #else
195 m_Face = FT_LoadFont((FX_LPBYTE)data, size);
196 m_pFontData = (FX_LPBYTE)data;
197 #endif
198 m_bEmbedded = TRUE; 189 m_bEmbedded = TRUE;
199 m_dwSize = size; 190 m_dwSize = size;
200 return m_Face != NULL; 191 return m_Face != NULL;
201 } 192 }
202 FX_BOOL CFX_Font::IsTTFont() 193 FX_BOOL CFX_Font::IsTTFont()
203 { 194 {
204 if (m_Face == NULL) { 195 if (m_Face == NULL) {
205 return FALSE; 196 return FALSE;
206 } 197 }
207 return FXFT_Is_Face_TT_OT(m_Face) == FXFT_FACE_FLAG_SFNT; 198 return FXFT_Is_Face_TT_OT(m_Face) == FXFT_FACE_FLAG_SFNT;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 439 }
449 } 440 }
450 return FXFT_Get_Char_Index(face, charcode); 441 return FXFT_Get_Char_Index(face, charcode);
451 } 442 }
452 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont) 443 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont)
453 { 444 {
454 CFX_UnicodeEncoding* pEncoding = NULL; 445 CFX_UnicodeEncoding* pEncoding = NULL;
455 pEncoding = FX_NEW CFX_UnicodeEncoding(pFont); 446 pEncoding = FX_NEW CFX_UnicodeEncoding(pFont);
456 return pEncoding; 447 return pEncoding;
457 } 448 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698