ReactOS 0.4.16-dev-1067-ge98bba2
cffdrivr.c File Reference
#include <ft2build.h>
#include "cffdrivr.h"
#include "cffgload.h"
#include "cffload.h"
#include "cffcmap.h"
#include "cffparse.h"
#include "cffobjs.h"
#include "cfferrs.h"
Include dependency graph for cffdrivr.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FT_COMPONENT   cffdriver
 
#define CFF_SIZE_SELECT   0
 

Functions

 cff_get_kerning (FT_Face ttface, FT_UInt left_glyph, FT_UInt right_glyph, FT_Vector *kerning)
 
 cff_glyph_load (FT_GlyphSlot cffslot, FT_Size cffsize, FT_UInt glyph_index, FT_Int32 load_flags)
 
 cff_get_advances (FT_Face face, FT_UInt start, FT_UInt count, FT_Int32 flags, FT_Fixed *advances)
 
static FT_Error cff_get_glyph_name (CFF_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
 
static FT_UInt cff_get_name_index (CFF_Face face, FT_String *glyph_name)
 
 FT_DEFINE_SERVICE_GLYPHDICTREC (cff_service_glyph_dict,(FT_GlyphDict_GetNameFunc) cff_get_glyph_name,(FT_GlyphDict_NameIndexFunc) cff_get_name_index) static FT_Int cff_ps_has_glyph_names(FT_Face face)
 
static FT_Error cff_ps_get_font_info (CFF_Face face, PS_FontInfoRec *afont_info)
 
static FT_Error cff_ps_get_font_extra (CFF_Face face, PS_FontExtraRec *afont_extra)
 
 FT_DEFINE_SERVICE_PSINFOREC (cff_service_ps_info,(PS_GetFontInfoFunc) cff_ps_get_font_info,(PS_GetFontExtraFunc) cff_ps_get_font_extra,(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,(PS_GetFontPrivateFunc) NULL,(PS_GetFontValueFunc) NULL) static const char *cff_get_ps_name(CFF_Face face)
 
 FT_DEFINE_SERVICE_PSFONTNAMEREC (cff_service_ps_name,(FT_PsName_GetFunc) cff_get_ps_name) static FT_Error cff_get_cmap_info(FT_CharMap charmap
 
 if (cmap->clazz !=&cff_cmap_encoding_class_rec &&cmap->clazz !=&cff_cmap_unicode_class_rec)
 
 FT_DEFINE_SERVICE_TTCMAPSREC (cff_service_get_cmap_info,(TT_CMap_Info_GetFunc) cff_get_cmap_info) static FT_Error cff_get_ros(CFF_Face face
 
 if (cff)
 
static FT_Error cff_get_is_cid (CFF_Face face, FT_Bool *is_cid)
 
static FT_Error cff_get_cid_from_glyph_index (CFF_Face face, FT_UInt glyph_index, FT_UInt *cid)
 
 FT_DEFINE_SERVICE_CIDREC (cff_service_cid_info,(FT_CID_GetRegistryOrderingSupplementFunc) cff_get_ros,(FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid,(FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index) FT_DEFINE_SERVICE_PROPERTIESREC(cff_service_properties
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_DEFINE_SERVICE_CFFLOADREC (cff_service_cff_load,(FT_Get_Standard_Encoding_Func) cff_get_standard_encoding,(FT_Load_Private_Dict_Func) cff_load_private_dict,(FT_FD_Select_Get_Func) cff_fd_select_get,(FT_Blend_Check_Vector_Func) cff_blend_check_vector,(FT_Blend_Build_Vector_Func) cff_blend_build_vector) FT_DEFINE_SERVICEDESCREC8(cff_services
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get &cff_service_cff_load cff_get_interface (FT_Module driver, const char *module_interface)
 

Variables

TT_CMapInfocmap_info
 
FT_Error error = FT_Err_Ok
 
FT_Face face = FT_CMAP_FACE( cmap )
 
FT_Library library = FT_FACE_LIBRARY( face )
 
const char ** registry
 
const char const char ** ordering
 
const char const char FT_Intsupplement
 
CFF_Font cff = (CFF_Font)face->extra.data
 
Fail __pad0__
 
FT_Properties_SetFunc ps_property_set
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_FONT_FORMAT
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_FONT_FORMAT_CFF
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_POSTSCRIPT_INFO
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_getcff_service_ps_info
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_POSTSCRIPT_FONT_NAME
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_getcff_service_ps_name
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_GLYPH_DICT
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_getcff_service_glyph_dict
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_TT_CMAP
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_getcff_service_get_cmap_info
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_CID
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_getcff_service_cid_info
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_PROPERTIES
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_getcff_service_properties
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_CFF_LOAD
 

Macro Definition Documentation

◆ CFF_SIZE_SELECT

#define CFF_SIZE_SELECT   0

Definition at line 1121 of file cffdrivr.c.

◆ FT_COMPONENT

#define FT_COMPONENT   cffdriver

Definition at line 59 of file cffdrivr.c.

Function Documentation

◆ cff_get_advances()

cff_get_advances ( FT_Face  face,
FT_UInt  start,
FT_UInt  count,
FT_Int32  flags,
FT_Fixed advances 
)

Definition at line 203 of file cffdrivr.c.

208 {
209 FT_UInt nn;
211 FT_GlyphSlot slot = face->glyph;
212
213
214 if ( FT_IS_SFNT( face ) )
215 {
216 /* OpenType 1.7 mandates that the data from `hmtx' table be used; */
217 /* it is no longer necessary that those values are identical to */
218 /* the values in the `CFF' table */
219
220 TT_Face ttface = (TT_Face)face;
222
223
225 {
226#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
227 /* no fast retrieval for blended MM fonts without VVAR table */
228 if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
229 !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
230 return FT_THROW( Unimplemented_Feature );
231#endif
232
233 /* check whether we have data from the `vmtx' table at all; */
234 /* otherwise we extract the info from the CFF glyphstrings */
235 /* (instead of synthesizing a global value using the `OS/2' */
236 /* table) */
237 if ( !ttface->vertical_info )
238 goto Missing_Table;
239
240 for ( nn = 0; nn < count; nn++ )
241 {
242 FT_UShort ah;
243
244
245 ( (SFNT_Service)ttface->sfnt )->get_metrics( ttface,
246 1,
247 start + nn,
248 &dummy,
249 &ah );
250
251 FT_TRACE5(( " idx %d: advance height %d font unit%s\n",
252 start + nn,
253 ah,
254 ah == 1 ? "" : "s" ));
255 advances[nn] = ah;
256 }
257 }
258 else
259 {
260#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
261 /* no fast retrieval for blended MM fonts without HVAR table */
262 if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
263 !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
264 return FT_THROW( Unimplemented_Feature );
265#endif
266
267 /* check whether we have data from the `hmtx' table at all */
268 if ( !ttface->horizontal.number_Of_HMetrics )
269 goto Missing_Table;
270
271 for ( nn = 0; nn < count; nn++ )
272 {
273 FT_UShort aw;
274
275
276 ( (SFNT_Service)ttface->sfnt )->get_metrics( ttface,
277 0,
278 start + nn,
279 &dummy,
280 &aw );
281
282 FT_TRACE5(( " idx %d: advance width %d font unit%s\n",
283 start + nn,
284 aw,
285 aw == 1 ? "" : "s" ));
286 advances[nn] = aw;
287 }
288 }
289
290 return error;
291 }
292
293 Missing_Table:
294 flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
295
296 for ( nn = 0; nn < count; nn++ )
297 {
298 error = cff_glyph_load( slot, face->size, start + nn, flags );
299 if ( error )
300 break;
301
302 advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
303 ? slot->linearVertAdvance
304 : slot->linearHoriAdvance;
305 }
306
307 return error;
308 }
cff_glyph_load(FT_GlyphSlot cffslot, FT_Size cffsize, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: cffdrivr.c:162
FT_Error error
Definition: cffdrivr.c:658
#define FT_LOAD_VERTICAL_LAYOUT
Definition: freetype.h:3031
#define FT_IS_SFNT(face)
Definition: freetype.h:1303
#define FT_LOAD_ADVANCE_ONLY
Definition: freetype.h:3049
#define FT_IS_VARIATION(face)
Definition: freetype.h:1414
#define FT_IS_NAMED_INSTANCE(face)
Definition: freetype.h:1396
return FT_Err_Ok
Definition: ftbbox.c:527
#define FT_TRACE5(varformat)
Definition: ftdebug.h:190
#define FT_THROW(e)
Definition: ftdebug.h:241
int FT_Error
Definition: fttypes.h:299
unsigned short FT_UShort
Definition: fttypes.h:209
signed short FT_Short
Definition: fttypes.h:198
unsigned int FT_UInt
Definition: fttypes.h:231
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLbitfield flags
Definition: glext.h:7161
SFNT_Interface * SFNT_Service
Definition: sfnt.h:784
FT_Bool vertical_info
Definition: tttypes.h:1551
void * sfnt
Definition: tttypes.h:1573
TT_HoriHeader horizontal
Definition: tttypes.h:1547
FT_UShort number_Of_HMetrics
Definition: tttables.h:220
Definition: vfat.h:185
#define TT_FACE_FLAG_VAR_HADVANCE
Definition: tttypes.h:1211
struct TT_FaceRec_ * TT_Face
Definition: tttypes.h:1064
#define TT_FACE_FLAG_VAR_VADVANCE
Definition: tttypes.h:1216

◆ cff_get_cid_from_glyph_index()

static FT_Error cff_get_cid_from_glyph_index ( CFF_Face  face,
FT_UInt  glyph_index,
FT_UInt cid 
)
static

Definition at line 776 of file cffdrivr.c.

779 {
782
783
784 cff = (CFF_Font)face->extra.data;
785
786 if ( cff )
787 {
788 FT_UInt c;
790
791
792 if ( dict->cid_registry == 0xFFFFU )
793 {
794 error = FT_THROW( Invalid_Argument );
795 goto Fail;
796 }
797
798 if ( glyph_index >= cff->num_glyphs )
799 {
800 error = FT_THROW( Invalid_Argument );
801 goto Fail;
802 }
803
804 c = cff->charset.sids[glyph_index];
805
806 if ( cid )
807 *cid = c;
808 }
809
810 Fail:
811 return error;
812 }
CFF_Font cff
Definition: cffdrivr.c:702
struct CFF_FontRec_ * CFF_Font
Definition: cfftypes.h:157
int Fail
Definition: ehthrow.cxx:24
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
if(dx< 0)
Definition: linetemp.h:194
static TfClientId cid
FT_UShort * sids
Definition: cfftypes.h:103
FT_UInt cid_registry
Definition: cfftypes.h:215
CFF_CharsetRec charset
Definition: cfftypes.h:360
CFF_SubFontRec top_font
Definition: cfftypes.h:378
FT_UInt num_glyphs
Definition: cfftypes.h:345
CFF_FontRecDictRec font_dict
Definition: cfftypes.h:305

◆ cff_get_glyph_name()

static FT_Error cff_get_glyph_name ( CFF_Face  face,
FT_UInt  glyph_index,
FT_Pointer  buffer,
FT_UInt  buffer_max 
)
static

Definition at line 317 of file cffdrivr.c.

321 {
322 CFF_Font font = (CFF_Font)face->extra.data;
323 FT_String* gname;
326
327
328 /* CFF2 table does not have glyph names; */
329 /* we need to use `post' table method */
330 if ( font->version_major == 2 )
331 {
333 FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
334 FT_Service_GlyphDict service =
335 (FT_Service_GlyphDict)ft_module_get_service(
336 sfnt_module,
338 0 );
339
340
341 if ( service && service->get_name )
342 return service->get_name( FT_FACE( face ),
343 glyph_index,
344 buffer,
345 buffer_max );
346 else
347 {
348 FT_ERROR(( "cff_get_glyph_name:"
349 " cannot get glyph name from a CFF2 font\n"
350 " "
351 " without the `psnames' module\n" ));
352 error = FT_THROW( Missing_Module );
353 goto Exit;
354 }
355 }
356
357 if ( !font->psnames )
358 {
359 FT_ERROR(( "cff_get_glyph_name:"
360 " cannot get glyph name from CFF & CEF fonts\n"
361 " "
362 " without the `psnames' module\n" ));
363 error = FT_THROW( Missing_Module );
364 goto Exit;
365 }
366
367 /* first, locate the sid in the charset table */
368 sid = font->charset.sids[glyph_index];
369
370 /* now, lookup the name itself */
372
373 if ( gname )
374 FT_STRCPYN( buffer, gname, buffer_max );
375
377
378 Exit:
379 return error;
380 }
FT_UInt sid
Definition: cffcmap.c:139
return cff_index_get_sid_string(cff, sid)
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_GLYPH_DICT
Definition: cffdrivr.c:1054
FT_Library library
Definition: cffdrivr.c:661
#define FT_ERROR(varformat)
Definition: ftdebug.h:209
#define FT_STRCPYN(dst, src, size)
Definition: ftmemory.h:381
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4964
#define FT_FACE_LIBRARY(x)
Definition: ftobjs.h:604
#define FT_FACE(x)
Definition: ftobjs.h:599
ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
Definition: ftobjs.c:5007
char FT_String
Definition: fttypes.h:187
GLuint buffer
Definition: glext.h:5915
Definition: mk_font.cpp:20
static void Exit(void)
Definition: sock.c:1330

◆ cff_get_interface()

FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get &cff_service_cff_load cff_get_interface ( FT_Module  driver,
const char module_interface 
)

Definition at line 1090 of file cffdrivr.c.

1092 {
1096
1097
1099 if ( result )
1100 return result;
1101
1102 /* `driver' is not yet evaluated */
1103 if ( !driver )
1104 return NULL;
1105 library = driver->library;
1106 if ( !library )
1107 return NULL;
1108
1109 /* we pass our request to the `sfnt' module */
1110 sfnt = FT_Get_Module( library, "sfnt" );
1111
1112 return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
1113 }
#define NULL
Definition: types.h:112
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:110
GLuint64EXT * result
Definition: glext.h:11304
struct @1717::@1718 driver
TT_CMap_Info_GetFunc tt_get_cmap_info const char * module_interface
Definition: sfdriver.c:1184
FT_Module_Requester get_interface
Definition: sfnt.h:717
SFNT_Service sfnt
Definition: ttdriver.c:209

◆ cff_get_is_cid()

static FT_Error cff_get_is_cid ( CFF_Face  face,
FT_Bool is_cid 
)
static

Definition at line 753 of file cffdrivr.c.

755 {
757 CFF_Font cff = (CFF_Font)face->extra.data;
758
759
760 *is_cid = 0;
761
762 if ( cff )
763 {
765
766
767 if ( dict->cid_registry != 0xFFFFU )
768 *is_cid = 1;
769 }
770
771 return error;
772 }

◆ cff_get_kerning()

cff_get_kerning ( FT_Face  ttface,
FT_UInt  left_glyph,
FT_UInt  right_glyph,
FT_Vector kerning 
)

Definition at line 112 of file cffdrivr.c.

116 {
117 TT_Face face = (TT_Face)ttface;
119
120
121 kerning->x = 0;
122 kerning->y = 0;
123
124 if ( sfnt )
126
127 return FT_Err_Ok;
128 }
FT_Pos x
Definition: ftimage.h:78
FT_Pos y
Definition: ftimage.h:79
TT_Face_GetKerningFunc get_kerning
Definition: sfnt.h:752
FT_UInt FT_UInt FT_Vector * kerning
Definition: ttdriver.c:207
FT_UInt left_glyph
Definition: ttdriver.c:204
FT_UInt FT_UInt right_glyph
Definition: ttdriver.c:205

◆ cff_get_name_index()

static FT_UInt cff_get_name_index ( CFF_Face  face,
FT_String glyph_name 
)
static

Definition at line 384 of file cffdrivr.c.

386 {
389 FT_Service_PsCMaps psnames;
392 FT_UInt i;
393
394
395 cff = (CFF_FontRec *)face->extra.data;
396 charset = &cff->charset;
397
398 /* CFF2 table does not have glyph names; */
399 /* we need to use `post' table method */
400 if ( cff->version_major == 2 )
401 {
403 FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
404 FT_Service_GlyphDict service =
405 (FT_Service_GlyphDict)ft_module_get_service(
406 sfnt_module,
408 0 );
409
410
411 if ( service && service->name_index )
412 return service->name_index( FT_FACE( face ), glyph_name );
413 else
414 {
415 FT_ERROR(( "cff_get_name_index:"
416 " cannot get glyph index from a CFF2 font\n"
417 " "
418 " without the `psnames' module\n" ));
419 return 0;
420 }
421 }
422
423 FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
424 if ( !psnames )
425 return 0;
426
427 for ( i = 0; i < cff->num_glyphs; i++ )
428 {
429 sid = charset->sids[i];
430
431 if ( sid > 390 )
432 name = cff_index_get_string( cff, sid - 391 );
433 else
434 name = (FT_String *)psnames->adobe_std_strings( sid );
435
436 if ( !name )
437 continue;
438
439 if ( !ft_strcmp( glyph_name, name ) )
440 return i;
441 }
442
443 return 0;
444 }
CFF_Charset charset
Definition: cffcmap.c:138
cff_index_get_string(CFF_Font font, FT_UInt element)
Definition: cffload.c:646
#define FT_FACE_FIND_GLOBAL_SERVICE(face, ptr, id)
Definition: ftserv.h:127
#define ft_strcmp
Definition: ftstdlib.h:86
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
FT_Byte version_major
Definition: cfftypes.h:347
Definition: name.c:39

◆ cff_glyph_load()

cff_glyph_load ( FT_GlyphSlot  cffslot,
FT_Size  cffsize,
FT_UInt  glyph_index,
FT_Int32  load_flags 
)

Definition at line 162 of file cffdrivr.c.

166 {
169 CFF_Size size = (CFF_Size)cffsize;
170
171
172 if ( !slot )
173 return FT_THROW( Invalid_Slot_Handle );
174
175 FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index ));
176
177 /* check whether we want a scaled outline or bitmap */
178 if ( !size )
179 load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
180
181 /* reset the size object if necessary */
182 if ( load_flags & FT_LOAD_NO_SCALE )
183 size = NULL;
184
185 if ( size )
186 {
187 /* these two objects must have the same parent */
188 if ( cffsize->face != cffslot->face )
189 return FT_THROW( Invalid_Face_Handle );
190 }
191
192 /* now load the glyph outline if necessary */
193 error = cff_slot_load( slot, size, glyph_index, load_flags );
194
195 /* force drop-out mode to 2 - irrelevant now */
196 /* slot->outline.dropout_mode = 2; */
197
198 return error;
199 }
cff_slot_load(CFF_GlyphSlot glyph, CFF_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: cffgload.c:195
struct CFF_GlyphSlotRec_ * CFF_GlyphSlot
struct CFF_SizeRec_ * CFF_Size
#define FT_LOAD_NO_SCALE
Definition: freetype.h:3027
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3028
#define FT_TRACE1(varformat)
Definition: ftdebug.h:186
GLsizeiptr size
Definition: glext.h:5919
FT_Face face
Definition: freetype.h:1647

Referenced by cff_get_advances().

◆ cff_ps_get_font_extra()

static FT_Error cff_ps_get_font_extra ( CFF_Face  face,
PS_FontExtraRec afont_extra 
)
static

Definition at line 512 of file cffdrivr.c.

514 {
515 CFF_Font cff = (CFF_Font)face->extra.data;
517
518
519 if ( cff && cff->font_extra == NULL )
520 {
522 PS_FontExtraRec* font_extra = NULL;
523 FT_Memory memory = face->root.memory;
524 FT_String* embedded_postscript;
525
526
527 if ( FT_ALLOC( font_extra, sizeof ( *font_extra ) ) )
528 goto Fail;
529
530 font_extra->fs_type = 0U;
531
532 embedded_postscript = cff_index_get_sid_string(
533 cff,
534 dict->embedded_postscript );
535 if ( embedded_postscript )
536 {
537 FT_String* start_fstype;
538 FT_String* start_def;
539
540
541 /* Identify the XYZ integer in `/FSType XYZ def' substring. */
542 if ( ( start_fstype = ft_strstr( embedded_postscript,
543 "/FSType" ) ) != NULL &&
544 ( start_def = ft_strstr( start_fstype +
545 sizeof ( "/FSType" ) - 1,
546 "def" ) ) != NULL )
547 {
548 FT_String* s;
549
550
551 for ( s = start_fstype + sizeof ( "/FSType" ) - 1;
552 s != start_def;
553 s++ )
554 {
555 if ( *s >= '0' && *s <= '9' )
556 {
557 if ( font_extra->fs_type >= ( FT_USHORT_MAX - 9 ) / 10 )
558 {
559 /* Overflow - ignore the FSType value. */
560 font_extra->fs_type = 0U;
561 break;
562 }
563
564 font_extra->fs_type *= 10;
565 font_extra->fs_type += (FT_UShort)( *s - '0' );
566 }
567 else if ( *s != ' ' && *s != '\n' && *s != '\r' )
568 {
569 /* Non-whitespace character between `/FSType' and next `def' */
570 /* - ignore the FSType value. */
571 font_extra->fs_type = 0U;
572 break;
573 }
574 }
575 }
576 }
577
578 cff->font_extra = font_extra;
579 }
580
581 if ( cff )
582 *afont_extra = *cff->font_extra;
583
584 Fail:
585 return error;
586 }
#define U(x)
Definition: wordpad.c:45
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:302
#define FT_USHORT_MAX
Definition: ftstdlib.h:62
#define ft_strstr
Definition: ftstdlib.h:92
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:65
GLdouble s
Definition: gl.h:2039
static char memory[1024 *256]
Definition: process.c:116
FT_UInt embedded_postscript
Definition: cfftypes.h:212
PS_FontExtraRec * font_extra
Definition: cfftypes.h:407
FT_UShort fs_type
Definition: t1types.h:92

◆ cff_ps_get_font_info()

static FT_Error cff_ps_get_font_info ( CFF_Face  face,
PS_FontInfoRec afont_info 
)
static

Definition at line 468 of file cffdrivr.c.

470 {
471 CFF_Font cff = (CFF_Font)face->extra.data;
473
474
475 if ( cff && !cff->font_info )
476 {
478 PS_FontInfoRec *font_info = NULL;
479 FT_Memory memory = face->root.memory;
480
481
482 if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
483 goto Fail;
484
485 font_info->version = cff_index_get_sid_string( cff,
486 dict->version );
487 font_info->notice = cff_index_get_sid_string( cff,
488 dict->notice );
489 font_info->full_name = cff_index_get_sid_string( cff,
490 dict->full_name );
491 font_info->family_name = cff_index_get_sid_string( cff,
492 dict->family_name );
493 font_info->weight = cff_index_get_sid_string( cff,
494 dict->weight );
495 font_info->italic_angle = dict->italic_angle;
496 font_info->is_fixed_pitch = dict->is_fixed_pitch;
497 font_info->underline_position = (FT_Short)dict->underline_position;
498 font_info->underline_thickness = (FT_UShort)dict->underline_thickness;
499
500 cff->font_info = font_info;
501 }
502
503 if ( cff )
504 *afont_info = *cff->font_info;
505
506 Fail:
507 return error;
508 }
FT_UInt family_name
Definition: cfftypes.h:191
FT_Bool is_fixed_pitch
Definition: cfftypes.h:193
FT_Fixed underline_position
Definition: cfftypes.h:195
FT_Fixed underline_thickness
Definition: cfftypes.h:196
FT_Fixed italic_angle
Definition: cfftypes.h:194
PS_FontInfoRec * font_info
Definition: cfftypes.h:394
FT_BEGIN_HEADER struct PS_FontInfoRec_ PS_FontInfoRec

◆ FT_DEFINE_SERVICE_CFFLOADREC()

FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_DEFINE_SERVICE_CFFLOADREC ( cff_service_cff_load  ,
(FT_Get_Standard_Encoding_Func cff_get_standard_encoding,
(FT_Load_Private_Dict_Func cff_load_private_dict,
(FT_FD_Select_Get_Func cff_fd_select_get,
(FT_Blend_Check_Vector_Func cff_blend_check_vector,
(FT_Blend_Build_Vector_Func cff_blend_build_vector 
)

◆ FT_DEFINE_SERVICE_CIDREC()

FT_DEFINE_SERVICE_CIDREC ( cff_service_cid_info  ,
(FT_CID_GetRegistryOrderingSupplementFunc cff_get_ros,
(FT_CID_GetIsInternallyCIDKeyedFunc cff_get_is_cid,
(FT_CID_GetCIDFromGlyphIndexFunc cff_get_cid_from_glyph_index 
)

◆ FT_DEFINE_SERVICE_GLYPHDICTREC()

FT_DEFINE_SERVICE_GLYPHDICTREC ( cff_service_glyph_dict  ,
(FT_GlyphDict_GetNameFunc cff_get_glyph_name,
(FT_GlyphDict_NameIndexFunc cff_get_name_index 
)

Definition at line 447 of file cffdrivr.c.

462 {
463 return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0;
464 }
#define FT_FACE_FLAG_GLYPH_NAMES
Definition: freetype.h:1219

◆ FT_DEFINE_SERVICE_PSFONTNAMEREC()

FT_DEFINE_SERVICE_PSFONTNAMEREC ( cff_service_ps_name  ,
(FT_PsName_GetFunc cff_get_ps_name 
)

◆ FT_DEFINE_SERVICE_PSINFOREC()

FT_DEFINE_SERVICE_PSINFOREC ( cff_service_ps_info  ,
(PS_GetFontInfoFunc cff_ps_get_font_info,
(PS_GetFontExtraFunc cff_ps_get_font_extra,
(PS_HasGlyphNamesFunc cff_ps_has_glyph_names,
(PS_GetFontPrivateFunc NULL,
(PS_GetFontValueFunc NULL 
) const

Definition at line 589 of file cffdrivr.c.

609 {
610 CFF_Font cff = (CFF_Font)face->extra.data;
612
613
614 /* following the OpenType specification 1.7, we return the name stored */
615 /* in the `name' table for a CFF wrapped into an SFNT container */
616
617 if ( FT_IS_SFNT( FT_FACE( face ) ) && sfnt )
618 {
620 FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
621 FT_Service_PsFontName service =
622 (FT_Service_PsFontName)ft_module_get_service(
623 sfnt_module,
625 0 );
626
627
628 if ( service && service->get_ps_font_name )
629 return service->get_ps_font_name( FT_FACE( face ) );
630 }
631
632 return (const char*)cff->font_name;
633 }
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_POSTSCRIPT_FONT_NAME
Definition: cffdrivr.c:1053
FT_String * font_name
Definition: cfftypes.h:367

◆ FT_DEFINE_SERVICE_TTCMAPSREC()

FT_DEFINE_SERVICE_TTCMAPSREC ( cff_service_get_cmap_info  ,
(TT_CMap_Info_GetFunc cff_get_cmap_info 
)

◆ if() [1/2]

if ( cff  )

Definition at line 705 of file cffdrivr.c.

706 {
708
709
710 if ( dict->cid_registry == 0xFFFFU )
711 {
712 error = FT_THROW( Invalid_Argument );
713 goto Fail;
714 }
715
716 if ( registry )
717 {
718 if ( !cff->registry )
720 dict->cid_registry );
722 }
723
724 if ( ordering )
725 {
726 if ( !cff->ordering )
728 dict->cid_ordering );
730 }
731
732 /*
733 * XXX: According to Adobe TechNote #5176, the supplement in CFF
734 * can be a real number. We truncate it to fit public API
735 * since freetype-2.3.6.
736 */
737 if ( supplement )
738 {
739 if ( dict->cid_supplement < FT_INT_MIN ||
740 dict->cid_supplement > FT_INT_MAX )
741 FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
742 dict->cid_supplement ));
744 }
745 }
const char const char ** ordering
Definition: cffdrivr.c:698
const char const char FT_Int * supplement
Definition: cffdrivr.c:700
const char ** registry
Definition: cffdrivr.c:697
#define FT_INT_MIN
Definition: ftstdlib.h:64
#define FT_INT_MAX
Definition: ftstdlib.h:63
signed int FT_Int
Definition: fttypes.h:220
FT_UInt cid_ordering
Definition: cfftypes.h:216
FT_Long cid_supplement
Definition: cfftypes.h:217
FT_String * registry
Definition: cfftypes.h:397
FT_String * ordering
Definition: cfftypes.h:398

◆ if() [2/2]

if ( cmap->clazz !  = &cff_cmap_encoding_class_rec && cmap->clazz != &cff_cmap_unicode_class_rec)

Definition at line 664 of file cffdrivr.c.

666 {
667 FT_Module sfnt = FT_Get_Module( library, "sfnt" );
668 FT_Service_TTCMaps service =
669 (FT_Service_TTCMaps)ft_module_get_service( sfnt,
671 0 );
672
673
674 if ( service && service->get_cmap_info )
675 error = service->get_cmap_info( charmap, cmap_info );
676 }
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_TT_CMAP
Definition: cffdrivr.c:1055
TT_CMapInfo * cmap_info
Definition: cffdrivr.c:656

Variable Documentation

◆ __pad0__

Fail __pad0__

Definition at line 747 of file cffdrivr.c.

◆ cff

◆ cff_service_cid_info

Definition at line 1056 of file cffdrivr.c.

◆ cff_service_get_cmap_info

Definition at line 1055 of file cffdrivr.c.

◆ cff_service_glyph_dict

Definition at line 1054 of file cffdrivr.c.

◆ cff_service_properties

Definition at line 1057 of file cffdrivr.c.

◆ cff_service_ps_info

Definition at line 1052 of file cffdrivr.c.

◆ cff_service_ps_name

Definition at line 1053 of file cffdrivr.c.

◆ cmap_info

TT_CMapInfo* cmap_info
Initial value:
{
FT_CMap cmap = FT_CMAP( charmap )
#define FT_CMAP(x)
Definition: ftobjs.h:157

Definition at line 655 of file cffdrivr.c.

Referenced by FT_Get_CMap_Format(), FT_Get_CMap_Language_ID(), if(), and tt_get_cmap_info().

◆ error

◆ face

Definition at line 660 of file cffdrivr.c.

◆ FT_FONT_FORMAT_CFF

Definition at line 1051 of file cffdrivr.c.

◆ FT_SERVICE_ID_CFF_LOAD

Definition at line 1058 of file cffdrivr.c.

◆ FT_SERVICE_ID_CID

Definition at line 1056 of file cffdrivr.c.

◆ FT_SERVICE_ID_FONT_FORMAT

Definition at line 1051 of file cffdrivr.c.

◆ FT_SERVICE_ID_GLYPH_DICT

Definition at line 1054 of file cffdrivr.c.

Referenced by cff_get_glyph_name(), and cff_get_name_index().

◆ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME

FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_POSTSCRIPT_FONT_NAME

Definition at line 1053 of file cffdrivr.c.

Referenced by FT_DEFINE_SERVICE_PSINFOREC().

◆ FT_SERVICE_ID_POSTSCRIPT_INFO

Definition at line 1052 of file cffdrivr.c.

◆ FT_SERVICE_ID_PROPERTIES

Definition at line 1057 of file cffdrivr.c.

◆ FT_SERVICE_ID_TT_CMAP

Definition at line 1055 of file cffdrivr.c.

Referenced by if().

◆ library

Definition at line 661 of file cffdrivr.c.

Referenced by cff_face_init(), cff_font_load(), cff_get_glyph_name(), cff_get_interface(), cff_get_name_index(), cff_parser_init(), cff_parser_run(), Destroy_Module(), expect_shim_imp(), FT_Add_Default_Modules(), FT_Add_Module(), ft_add_renderer(), FT_Bitmap_Blend(), FT_Bitmap_Convert(), FT_Bitmap_Copy(), FT_Bitmap_Done(), FT_Bitmap_Embolden(), ft_bitmap_glyph_copy(), ft_bitmap_glyph_done(), ft_bitmap_glyph_init(), FT_DEFINE_GLYPH(), FT_DEFINE_SERVICE_PSINFOREC(), FT_Done_FreeType(), FT_Done_Library(), FT_Done_MM_Var(), FT_Get_Module(), FT_Get_Module_Interface(), FT_Get_Renderer(), FT_Get_TrueType_Engine_Type(), FT_Glyph_To_Bitmap(), FT_GlyphSlot_Embolden(), FT_Library_SetLcdFilter(), FT_Library_SetLcdFilterWeights(), FT_Library_SetLcdGeometry(), FT_Library_Version(), FT_Load_Glyph(), ft_lookup_glyph_renderer(), FT_Lookup_Renderer(), ft_module_get_service(), FT_New_Face(), FT_New_Glyph(), FT_New_Library(), FT_New_Memory_Face(), FT_Open_Face(), ft_open_face_internal(), FT_Outline_Done(), FT_Outline_Get_Bitmap(), ft_outline_glyph_copy(), ft_outline_glyph_done(), FT_Outline_New(), FT_Outline_Render(), ft_property_do(), FT_Property_Get(), FT_Property_Set(), FT_Raccess_Get_DataOffsets(), FT_Raccess_Get_HeaderInfo(), FT_Raccess_Guess(), FT_Reference_Library(), FT_Remove_Module(), ft_remove_renderer(), FT_Render_Glyph(), FT_Render_Glyph_Internal(), ft_set_current_renderer(), FT_Set_Debug_Hook(), FT_Set_Default_Properties(), FT_Set_Renderer(), FT_Stream_New(), FT_Stroker_New(), FTC_Manager_New(), if(), SeiBuildGlobalInclExclList(), sfnt_init_face(), tt_face_build_cmaps(), tt_face_init(), and tt_get_interface().

◆ ordering

const char const char* * ordering

Definition at line 698 of file cffdrivr.c.

Referenced by if().

◆ ps_property_set

FT_Properties_SetFunc ps_property_set

Definition at line 835 of file cffdrivr.c.

◆ registry

◆ supplement

const char const char FT_Int* supplement
Initial value:

Definition at line 699 of file cffdrivr.c.

Referenced by cid_get_ros(), FT_Get_CID_Registry_Ordering_Supplement(), and if().