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

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

Issue 1171733003: Remove typdefs for pointer types in fx_system.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual fixes. Created 5 years, 6 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/src/fxge/ge/fx_ge_device.cpp ('k') | core/src/fxge/ge/fx_ge_fontmap.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 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)
11 extern void _FPDFAPI_GetInternalFontData(int id1, FX_LPCBYTE& data, FX_DWORD& si ze); 11 extern void _FPDFAPI_GetInternalFontData(int id1, const uint8_t*& data, FX_DWORD & size);
12 CFX_Font::CFX_Font() 12 CFX_Font::CFX_Font()
13 { 13 {
14 m_pSubstFont = NULL; 14 m_pSubstFont = NULL;
15 m_Face = NULL; 15 m_Face = NULL;
16 m_bEmbedded = FALSE; 16 m_bEmbedded = FALSE;
17 m_bVertical = FALSE; 17 m_bVertical = FALSE;
18 m_pFontData = NULL; 18 m_pFontData = NULL;
19 m_pFontDataAllocation = NULL; 19 m_pFontDataAllocation = NULL;
20 m_dwSize = 0; 20 m_dwSize = 0;
21 m_pOwnedStream = NULL; 21 m_pOwnedStream = NULL;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (m_pSubstFont && (m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM)) { 146 if (m_pSubstFont && (m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM)) {
147 AdjustMMParams(glyph_index, 0, 0); 147 AdjustMMParams(glyph_index, 0, 0);
148 } 148 }
149 int err = FXFT_Load_Glyph(m_Face, glyph_index, FXFT_LOAD_NO_SCALE | FXFT_LOA D_IGNORE_GLOBAL_ADVANCE_WIDTH); 149 int err = FXFT_Load_Glyph(m_Face, glyph_index, FXFT_LOAD_NO_SCALE | FXFT_LOA D_IGNORE_GLOBAL_ADVANCE_WIDTH);
150 if (err) { 150 if (err) {
151 return 0; 151 return 0;
152 } 152 }
153 int width = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriA dvance(m_Face)); 153 int width = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriA dvance(m_Face));
154 return width; 154 return width;
155 } 155 }
156 static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) 156 static FXFT_Face FT_LoadFont(uint8_t* pData, int size)
157 { 157 {
158 FXFT_Library library; 158 FXFT_Library library;
159 if (CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary == NULL) { 159 if (CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary == NULL) {
160 FXFT_Init_FreeType(&CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary); 160 FXFT_Init_FreeType(&CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary);
161 } 161 }
162 library = CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary; 162 library = CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary;
163 FXFT_Face face = NULL; 163 FXFT_Face face = NULL;
164 int error = FXFT_New_Memory_Face(library, pData, size, 0, &face); 164 int error = FXFT_New_Memory_Face(library, pData, size, 0, &face);
165 if (error) { 165 if (error) {
166 return NULL; 166 return NULL;
167 } 167 }
168 error = FXFT_Set_Pixel_Sizes(face, 64, 64); 168 error = FXFT_Set_Pixel_Sizes(face, 64, 64);
169 if (error) { 169 if (error) {
170 return NULL; 170 return NULL;
171 } 171 }
172 return face; 172 return face;
173 } 173 }
174 FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) 174 FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, FX_DWORD size)
175 { 175 {
176 m_pFontDataAllocation = FX_Alloc(uint8_t, size); 176 m_pFontDataAllocation = FX_Alloc(uint8_t, size);
177 FXSYS_memcpy32(m_pFontDataAllocation, data, size); 177 FXSYS_memcpy32(m_pFontDataAllocation, data, size);
178 m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size); 178 m_Face = FT_LoadFont((uint8_t*)m_pFontDataAllocation, size);
179 m_pFontData = (FX_LPBYTE)m_pFontDataAllocation; 179 m_pFontData = (uint8_t*)m_pFontDataAllocation;
180 m_bEmbedded = TRUE; 180 m_bEmbedded = TRUE;
181 m_dwSize = size; 181 m_dwSize = size;
182 return m_Face != NULL; 182 return m_Face != NULL;
183 } 183 }
184 FX_BOOL CFX_Font::IsTTFont() 184 FX_BOOL CFX_Font::IsTTFont()
185 { 185 {
186 if (m_Face == NULL) { 186 if (m_Face == NULL) {
187 return FALSE; 187 return FALSE;
188 } 188 }
189 return FXFT_Is_Face_TT_OT(m_Face) == FXFT_FACE_FLAG_SFNT; 189 return FXFT_Is_Face_TT_OT(m_Face) == FXFT_FACE_FLAG_SFNT;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 break; 428 break;
429 } 429 }
430 } 430 }
431 } 431 }
432 return FXFT_Get_Char_Index(face, charcode); 432 return FXFT_Get_Char_Index(face, charcode);
433 } 433 }
434 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont) 434 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont)
435 { 435 {
436 return new CFX_UnicodeEncoding(pFont); 436 return new CFX_UnicodeEncoding(pFont);
437 } 437 }
OLDNEW
« no previous file with comments | « core/src/fxge/ge/fx_ge_device.cpp ('k') | core/src/fxge/ge/fx_ge_fontmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698