ReactOS 0.4.16-dev-2354-g16de117
cffdrivr.c File Reference
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, const 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 1120 of file cffdrivr.c.

◆ FT_COMPONENT

#define FT_COMPONENT   cffdriver

Definition at line 58 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 202 of file cffdrivr.c.

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

◆ 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 775 of file cffdrivr.c.

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

◆ 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 316 of file cffdrivr.c.

320 {
321 CFF_Font font = (CFF_Font)face->extra.data;
322 FT_String* gname;
325
326
327 /* CFF2 table does not have glyph names; */
328 /* we need to use `post' table method */
329 if ( font->version_major == 2 )
330 {
332 FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
333 FT_Service_GlyphDict service =
334 (FT_Service_GlyphDict)ft_module_get_service(
335 sfnt_module,
337 0 );
338
339
340 if ( service && service->get_name )
341 return service->get_name( FT_FACE( face ),
342 glyph_index,
343 buffer,
344 buffer_max );
345 else
346 {
347 FT_ERROR(( "cff_get_glyph_name:"
348 " cannot get glyph name from a CFF2 font\n"
349 " "
350 " without the `psnames' module\n" ));
351 error = FT_THROW( Missing_Module );
352 goto Exit;
353 }
354 }
355
356 if ( !font->psnames )
357 {
358 FT_ERROR(( "cff_get_glyph_name:"
359 " cannot get glyph name from CFF & CEF fonts\n"
360 " "
361 " without the `psnames' module\n" ));
362 error = FT_THROW( Missing_Module );
363 goto Exit;
364 }
365
366 /* first, locate the sid in the charset table */
367 sid = font->charset.sids[glyph_index];
368
369 /* now, lookup the name itself */
371
372 if ( gname )
373 FT_STRCPYN( buffer, gname, buffer_max );
374
376
377 Exit:
378 return error;
379 }
FT_UInt sid
Definition: cffcmap.c:138
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:1053
FT_Library library
Definition: cffdrivr.c:660
#define FT_ERROR(varformat)
Definition: ftdebug.h:211
#define FT_STRCPYN(dst, src, size)
Definition: ftmemory.h:390
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4984
#define FT_FACE_LIBRARY(x)
Definition: ftobjs.h:602
#define FT_FACE(x)
Definition: ftobjs.h:597
ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
Definition: ftobjs.c:5027
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 1089 of file cffdrivr.c.

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

◆ cff_get_is_cid()

static FT_Error cff_get_is_cid ( CFF_Face  face,
FT_Bool is_cid 
)
static

Definition at line 752 of file cffdrivr.c.

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

◆ cff_get_kerning()

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

Definition at line 111 of file cffdrivr.c.

115 {
116 TT_Face face = (TT_Face)ttface;
118
119
120 kerning->x = 0;
121 kerning->y = 0;
122
123 if ( sfnt )
125
126 return FT_Err_Ok;
127 }
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78
TT_Face_GetKerningFunc get_kerning
Definition: sfnt.h:752
FT_UInt FT_UInt FT_Vector * kerning
Definition: ttdriver.c:206
FT_UInt left_glyph
Definition: ttdriver.c:203
FT_UInt FT_UInt right_glyph
Definition: ttdriver.c:204

◆ cff_get_name_index()

static FT_UInt cff_get_name_index ( CFF_Face  face,
const FT_String glyph_name 
)
static

Definition at line 383 of file cffdrivr.c.

385 {
388 FT_Service_PsCMaps psnames;
391 FT_UInt i;
392
393
394 cff = (CFF_FontRec *)face->extra.data;
395 charset = &cff->charset;
396
397 /* CFF2 table does not have glyph names; */
398 /* we need to use `post' table method */
399 if ( cff->version_major == 2 )
400 {
402 FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
403 FT_Service_GlyphDict service =
404 (FT_Service_GlyphDict)ft_module_get_service(
405 sfnt_module,
407 0 );
408
409
410 if ( service && service->name_index )
411 return service->name_index( FT_FACE( face ), glyph_name );
412 else
413 {
414 FT_ERROR(( "cff_get_name_index:"
415 " cannot get glyph index from a CFF2 font\n"
416 " "
417 " without the `psnames' module\n" ));
418 return 0;
419 }
420 }
421
422 FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
423 if ( !psnames )
424 return 0;
425
426 for ( i = 0; i < cff->num_glyphs; i++ )
427 {
428 sid = charset->sids[i];
429
430 if ( sid > 390 )
431 name = cff_index_get_string( cff, sid - 391 );
432 else
433 name = (FT_String *)psnames->adobe_std_strings( sid );
434
435 if ( !name )
436 continue;
437
438 if ( !ft_strcmp( glyph_name, name ) )
439 return i;
440 }
441
442 return 0;
443 }
CFF_Charset charset
Definition: cffcmap.c:137
cff_index_get_string(CFF_Font font, FT_UInt element)
Definition: cffload.c:652
#define FT_FACE_FIND_GLOBAL_SERVICE(face, ptr, id)
Definition: ftserv.h:128
#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:346
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 161 of file cffdrivr.c.

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

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 511 of file cffdrivr.c.

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

◆ cff_ps_get_font_info()

static FT_Error cff_ps_get_font_info ( CFF_Face  face,
PS_FontInfoRec afont_info 
)
static

Definition at line 467 of file cffdrivr.c.

469 {
470 CFF_Font cff = (CFF_Font)face->extra.data;
472
473
474 if ( cff && !cff->font_info )
475 {
477 PS_FontInfoRec *font_info = NULL;
478 FT_Memory memory = face->root.memory;
479
480
481 if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
482 goto Fail;
483
484 font_info->version = cff_index_get_sid_string( cff,
485 dict->version );
486 font_info->notice = cff_index_get_sid_string( cff,
487 dict->notice );
488 font_info->full_name = cff_index_get_sid_string( cff,
489 dict->full_name );
490 font_info->family_name = cff_index_get_sid_string( cff,
491 dict->family_name );
492 font_info->weight = cff_index_get_sid_string( cff,
493 dict->weight );
494 font_info->italic_angle = dict->italic_angle;
495 font_info->is_fixed_pitch = dict->is_fixed_pitch;
496 font_info->underline_position = (FT_Short)dict->underline_position;
497 font_info->underline_thickness = (FT_UShort)dict->underline_thickness;
498
499 cff->font_info = font_info;
500 }
501
502 if ( cff )
503 *afont_info = *cff->font_info;
504
505 Fail:
506 return error;
507 }
FT_UInt family_name
Definition: cfftypes.h:190
FT_Bool is_fixed_pitch
Definition: cfftypes.h:192
FT_Fixed underline_position
Definition: cfftypes.h:194
FT_Fixed underline_thickness
Definition: cfftypes.h:195
FT_Fixed italic_angle
Definition: cfftypes.h:193
PS_FontInfoRec * font_info
Definition: cfftypes.h:393
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 446 of file cffdrivr.c.

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

◆ 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 588 of file cffdrivr.c.

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

◆ 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 704 of file cffdrivr.c.

705 {
707
708
709 if ( dict->cid_registry == 0xFFFFU )
710 {
711 error = FT_THROW( Invalid_Argument );
712 goto Fail;
713 }
714
715 if ( registry )
716 {
717 if ( !cff->registry )
719 dict->cid_registry );
721 }
722
723 if ( ordering )
724 {
725 if ( !cff->ordering )
727 dict->cid_ordering );
729 }
730
731 /*
732 * XXX: According to Adobe TechNote #5176, the supplement in CFF
733 * can be a real number. We truncate it to fit public API
734 * since freetype-2.3.6.
735 */
736 if ( supplement )
737 {
738 if ( dict->cid_supplement < FT_INT_MIN ||
739 dict->cid_supplement > FT_INT_MAX )
740 FT_TRACE1(( "cff_get_ros: too large supplement %ld is truncated\n",
741 dict->cid_supplement ));
743 }
744 }
const char const char ** ordering
Definition: cffdrivr.c:697
const char const char FT_Int * supplement
Definition: cffdrivr.c:699
const char ** registry
Definition: cffdrivr.c:696
#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:215
FT_Long cid_supplement
Definition: cfftypes.h:216
FT_String * registry
Definition: cfftypes.h:396
FT_String * ordering
Definition: cfftypes.h:397

◆ if() [2/2]

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

Definition at line 663 of file cffdrivr.c.

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

Variable Documentation

◆ __pad0__

Fail __pad0__

Definition at line 746 of file cffdrivr.c.

◆ cff

◆ cff_service_cid_info

Definition at line 1055 of file cffdrivr.c.

◆ cff_service_get_cmap_info

Definition at line 1054 of file cffdrivr.c.

◆ cff_service_glyph_dict

Definition at line 1053 of file cffdrivr.c.

◆ cff_service_properties

Definition at line 1056 of file cffdrivr.c.

◆ cff_service_ps_info

Definition at line 1051 of file cffdrivr.c.

◆ cff_service_ps_name

Definition at line 1052 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 654 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 659 of file cffdrivr.c.

◆ FT_FONT_FORMAT_CFF

Definition at line 1050 of file cffdrivr.c.

◆ FT_SERVICE_ID_CFF_LOAD

Definition at line 1057 of file cffdrivr.c.

◆ FT_SERVICE_ID_CID

Definition at line 1055 of file cffdrivr.c.

◆ FT_SERVICE_ID_FONT_FORMAT

Definition at line 1050 of file cffdrivr.c.

◆ FT_SERVICE_ID_GLYPH_DICT

Definition at line 1053 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 1052 of file cffdrivr.c.

Referenced by FT_DEFINE_SERVICE_PSINFOREC().

◆ FT_SERVICE_ID_POSTSCRIPT_INFO

Definition at line 1051 of file cffdrivr.c.

◆ FT_SERVICE_ID_PROPERTIES

Definition at line 1056 of file cffdrivr.c.

◆ FT_SERVICE_ID_TT_CMAP

Definition at line 1054 of file cffdrivr.c.

Referenced by if().

◆ library

Definition at line 660 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(), RoGetActivationFactory(), SeiBuildGlobalInclExclList(), sfnt_init_face(), tt_face_build_cmaps(), tt_face_init(), and tt_get_interface().

◆ ordering

const char const char* * ordering

Definition at line 697 of file cffdrivr.c.

Referenced by if().

◆ ps_property_set

FT_Properties_SetFunc ps_property_set

Definition at line 834 of file cffdrivr.c.

◆ registry

◆ supplement

const char const char FT_Int* supplement
Initial value:

Definition at line 698 of file cffdrivr.c.

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