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

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

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: 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)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 int res = pFile->ReadBlock(buffer, offset, count); 130 int res = pFile->ReadBlock(buffer, offset, count);
131 if (res) { 131 if (res) {
132 return count; 132 return count;
133 } 133 }
134 return 0; 134 return 0;
135 } 135 }
136 void _FTStreamClose(FXFT_Stream stream) 136 void _FTStreamClose(FXFT_Stream stream)
137 { 137 {
138 } 138 }
139 }; 139 };
140 FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FX FT_Stream* stream, FX_INT32 faceIndex = 0) 140 FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FX FT_Stream* stream, int32_t faceIndex = 0)
141 { 141 {
142 FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(FX_BYTE, sizeof (FXFT_StreamRec) ); 142 FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(uint8_t, sizeof (FXFT_StreamRec) );
143 stream1->base = NULL; 143 stream1->base = NULL;
144 stream1->size = (unsigned long)pFile->GetSize(); 144 stream1->size = (unsigned long)pFile->GetSize();
145 stream1->pos = 0; 145 stream1->pos = 0;
146 stream1->descriptor.pointer = pFile; 146 stream1->descriptor.pointer = pFile;
147 stream1->close = _FTStreamClose; 147 stream1->close = _FTStreamClose;
148 stream1->read = _FTStreamRead; 148 stream1->read = _FTStreamRead;
149 FXFT_Open_Args args; 149 FXFT_Open_Args args;
150 args.flags = FT_OPEN_STREAM; 150 args.flags = FT_OPEN_STREAM;
151 args.stream = stream1; 151 args.stream = stream1;
152 if (FXFT_Open_Face(library, &args, faceIndex, Face)) { 152 if (FXFT_Open_Face(library, &args, faceIndex, Face)) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return NULL; 202 return NULL;
203 } 203 }
204 error = FXFT_Set_Pixel_Sizes(face, 64, 64); 204 error = FXFT_Set_Pixel_Sizes(face, 64, 64);
205 if (error) { 205 if (error) {
206 return NULL; 206 return NULL;
207 } 207 }
208 return face; 208 return face;
209 } 209 }
210 FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) 210 FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size)
211 { 211 {
212 m_pFontDataAllocation = FX_Alloc(FX_BYTE, size); 212 m_pFontDataAllocation = FX_Alloc(uint8_t, size);
213 FXSYS_memcpy32(m_pFontDataAllocation, data, size); 213 FXSYS_memcpy32(m_pFontDataAllocation, data, size);
214 m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size); 214 m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size);
215 m_pFontData = (FX_LPBYTE)m_pFontDataAllocation; 215 m_pFontData = (FX_LPBYTE)m_pFontDataAllocation;
216 m_bEmbedded = TRUE; 216 m_bEmbedded = TRUE;
217 m_dwSize = size; 217 m_dwSize = size;
218 return m_Face != NULL; 218 return m_Face != NULL;
219 } 219 }
220 FX_BOOL CFX_Font::IsTTFont() 220 FX_BOOL CFX_Font::IsTTFont()
221 { 221 {
222 if (m_Face == NULL) { 222 if (m_Face == NULL) {
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 } 631 }
632 static int s_count = sizeof(gs_EncodingID) / sizeof(FX_DWORD); 632 static int s_count = sizeof(gs_EncodingID) / sizeof(FX_DWORD);
633 for (int i = 0; i < s_count; i++) { 633 for (int i = 0; i < s_count; i++) {
634 IFX_FontEncodingEx* pFontEncoding = _FXFM_CreateFontEncoding(pFont, gs_E ncodingID[i]); 634 IFX_FontEncodingEx* pFontEncoding = _FXFM_CreateFontEncoding(pFont, gs_E ncodingID[i]);
635 if (pFontEncoding) { 635 if (pFontEncoding) {
636 return pFontEncoding; 636 return pFontEncoding;
637 } 637 }
638 } 638 }
639 return NULL; 639 return NULL;
640 } 640 }
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