| OLD | NEW |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return count; | 96 return count; |
| 97 } | 97 } |
| 98 return 0; | 98 return 0; |
| 99 } | 99 } |
| 100 void _FTStreamClose(FXFT_Stream stream) | 100 void _FTStreamClose(FXFT_Stream stream) |
| 101 { | 101 { |
| 102 } | 102 } |
| 103 }; | 103 }; |
| 104 FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FX
FT_Stream* stream) | 104 FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FX
FT_Stream* stream) |
| 105 { | 105 { |
| 106 FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(FX_BYTE, sizeof (FXFT_StreamRec)
); | 106 FXFT_Stream stream1 = (FXFT_Stream)FX_Alloc(uint8_t, sizeof (FXFT_StreamRec)
); |
| 107 stream1->base = NULL; | 107 stream1->base = NULL; |
| 108 stream1->size = (unsigned long)pFile->GetSize(); | 108 stream1->size = (unsigned long)pFile->GetSize(); |
| 109 stream1->pos = 0; | 109 stream1->pos = 0; |
| 110 stream1->descriptor.pointer = pFile; | 110 stream1->descriptor.pointer = pFile; |
| 111 stream1->close = _FTStreamClose; | 111 stream1->close = _FTStreamClose; |
| 112 stream1->read = _FTStreamRead; | 112 stream1->read = _FTStreamRead; |
| 113 FXFT_Open_Args args; | 113 FXFT_Open_Args args; |
| 114 args.flags = FT_OPEN_STREAM; | 114 args.flags = FT_OPEN_STREAM; |
| 115 args.stream = stream1; | 115 args.stream = stream1; |
| 116 if (FXFT_Open_Face(library, &args, 0, Face)) { | 116 if (FXFT_Open_Face(library, &args, 0, Face)) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(FX_LPCBYTE data, FX_DWORD size) |
| 175 { | 175 { |
| 176 m_pFontDataAllocation = FX_Alloc(FX_BYTE, 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((FX_LPBYTE)m_pFontDataAllocation, size); |
| 179 m_pFontData = (FX_LPBYTE)m_pFontDataAllocation; | 179 m_pFontData = (FX_LPBYTE)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) { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |