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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 int width = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriA
dvance(m_Face)); | 159 int width = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Glyph_HoriA
dvance(m_Face)); |
160 return width; | 160 return width; |
161 } | 161 } |
162 static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) | 162 static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) |
163 { | 163 { |
164 FXFT_Library library; | 164 FXFT_Library library; |
165 if (CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary == NULL) { | 165 if (CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary == NULL) { |
166 FXFT_Init_FreeType(&CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary); | 166 FXFT_Init_FreeType(&CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary); |
167 } | 167 } |
168 library = CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary; | 168 library = CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary; |
169 FXFT_Face face; | 169 FXFT_Face face = NULL; |
170 int error = FXFT_New_Memory_Face(library, pData, size, 0, &face); | 170 int error = FXFT_New_Memory_Face(library, pData, size, 0, &face); |
171 if (error) { | 171 if (error) { |
172 return NULL; | 172 return NULL; |
173 } | 173 } |
174 error = FXFT_Set_Pixel_Sizes(face, 64, 64); | 174 error = FXFT_Set_Pixel_Sizes(face, 64, 64); |
175 if (error) { | 175 if (error) { |
176 return NULL; | 176 return NULL; |
177 } | 177 } |
178 return face; | 178 return face; |
179 } | 179 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 } | 439 } |
440 } | 440 } |
441 return FXFT_Get_Char_Index(face, charcode); | 441 return FXFT_Get_Char_Index(face, charcode); |
442 } | 442 } |
443 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont) | 443 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont) |
444 { | 444 { |
445 CFX_UnicodeEncoding* pEncoding = NULL; | 445 CFX_UnicodeEncoding* pEncoding = NULL; |
446 pEncoding = FX_NEW CFX_UnicodeEncoding(pFont); | 446 pEncoding = FX_NEW CFX_UnicodeEncoding(pFont); |
447 return pEncoding; | 447 return pEncoding; |
448 } | 448 } |
OLD | NEW |