ReactOS 0.4.16-dev-122-g325d74c
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 "cffpic.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   trace_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_GET &&cmap->clazz !=&CFF_CMAP_UNICODE_CLASS_REC_GET)
 
 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_GET 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_GET
 
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_GET
 
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_GET
 
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_GET
 
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_GET
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_PROPERTIES
 
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_getCFF_SERVICE_PROPERTIES_GET
 
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 1099 of file cffdrivr.c.

◆ FT_COMPONENT

#define FT_COMPONENT   trace_cffdriver

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

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

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

772 {
775
776
777 cff = (CFF_Font)face->extra.data;
778
779 if ( cff )
780 {
781 FT_UInt c;
783
784
785 if ( dict->cid_registry == 0xFFFFU )
786 {
787 error = FT_THROW( Invalid_Argument );
788 goto Fail;
789 }
790
791 if ( glyph_index > cff->num_glyphs )
792 {
793 error = FT_THROW( Invalid_Argument );
794 goto Fail;
795 }
796
797 c = cff->charset.sids[glyph_index];
798
799 if ( cid )
800 *cid = c;
801 }
802
803 Fail:
804 return error;
805 }
CFF_Font cff
Definition: cffdrivr.c:695
struct CFF_FontRec_ * CFF_Font
Definition: cfftypes.h:152
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:98
FT_UInt cid_registry
Definition: cfftypes.h:210
CFF_CharsetRec charset
Definition: cfftypes.h:355
CFF_SubFontRec top_font
Definition: cfftypes.h:373
FT_UInt num_glyphs
Definition: cfftypes.h:340
CFF_FontRecDictRec font_dict
Definition: cfftypes.h:300

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

314 {
315 CFF_Font font = (CFF_Font)face->extra.data;
316 FT_String* gname;
319
320
321 /* CFF2 table does not have glyph names; */
322 /* we need to use `post' table method */
323 if ( font->version_major == 2 )
324 {
326 FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
327 FT_Service_GlyphDict service =
328 (FT_Service_GlyphDict)ft_module_get_service(
329 sfnt_module,
331 0 );
332
333
334 if ( service && service->get_name )
335 return service->get_name( FT_FACE( face ),
336 glyph_index,
337 buffer,
338 buffer_max );
339 else
340 {
341 FT_ERROR(( "cff_get_glyph_name:"
342 " cannot get glyph name from a CFF2 font\n"
343 " "
344 " without the `PSNames' module\n" ));
345 error = FT_THROW( Missing_Module );
346 goto Exit;
347 }
348 }
349
350 if ( !font->psnames )
351 {
352 FT_ERROR(( "cff_get_glyph_name:"
353 " cannot get glyph name from CFF & CEF fonts\n"
354 " "
355 " without the `PSNames' module\n" ));
356 error = FT_THROW( Missing_Module );
357 goto Exit;
358 }
359
360 /* first, locate the sid in the charset table */
361 sid = font->charset.sids[glyph_index];
362
363 /* now, lookup the name itself */
365
366 if ( gname )
367 FT_STRCPYN( buffer, gname, buffer_max );
368
370
371 Exit:
372 return error;
373 }
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:1021
FT_Library library
Definition: cffdrivr.c:654
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_STRCPYN(dst, src, size)
Definition: ftmemory.h:382
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4837
#define FT_FACE_LIBRARY(x)
Definition: ftobjs.h:635
#define FT_FACE(x)
Definition: ftobjs.h:630
ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
Definition: ftobjs.c:4880
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()

Definition at line 1057 of file cffdrivr.c.

1059 {
1063
1064
1065 /* CFF_SERVICES_GET dereferences `library' in PIC mode */
1066#ifdef FT_CONFIG_OPTION_PIC
1067 if ( !driver )
1068 return NULL;
1069 library = driver->library;
1070 if ( !library )
1071 return NULL;
1072#endif
1073
1075 if ( result )
1076 return result;
1077
1078 /* `driver' is not yet evaluated in non-PIC mode */
1079#ifndef FT_CONFIG_OPTION_PIC
1080 if ( !driver )
1081 return NULL;
1082 library = driver->library;
1083 if ( !library )
1084 return NULL;
1085#endif
1086
1087 /* we pass our request to the `sfnt' module */
1088 sfnt = FT_Get_Module( library, "sfnt" );
1089
1090 return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
1091 }
#define CFF_SERVICES_GET
Definition: cffpic.h:33
#define NULL
Definition: types.h:112
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:98
GLuint64EXT * result
Definition: glext.h:11304
struct @1673::@1674 driver
TT_CMap_Info_GetFunc tt_get_cmap_info const char * module_interface
Definition: sfdriver.c:1176
FT_Module_Requester get_interface
Definition: sfnt.h:569
SFNT_Service sfnt
Definition: ttdriver.c:206

◆ cff_get_is_cid()

static FT_Error cff_get_is_cid ( CFF_Face  face,
FT_Bool is_cid 
)
static

Definition at line 746 of file cffdrivr.c.

748 {
750 CFF_Font cff = (CFF_Font)face->extra.data;
751
752
753 *is_cid = 0;
754
755 if ( cff )
756 {
758
759
760 if ( dict->cid_registry != 0xFFFFU )
761 *is_cid = 1;
762 }
763
764 return error;
765 }

◆ cff_get_kerning()

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

Definition at line 109 of file cffdrivr.c.

113 {
114 TT_Face face = (TT_Face)ttface;
116
117
118 kerning->x = 0;
119 kerning->y = 0;
120
121 if ( sfnt )
123
124 return FT_Err_Ok;
125 }
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77
TT_Face_GetKerningFunc get_kerning
Definition: sfnt.h:604
FT_UInt FT_UInt FT_Vector * kerning
Definition: ttdriver.c:204
FT_UInt left_glyph
Definition: ttdriver.c:201
FT_UInt FT_UInt right_glyph
Definition: ttdriver.c:202

◆ cff_get_name_index()

static FT_UInt cff_get_name_index ( CFF_Face  face,
FT_String glyph_name 
)
static

Definition at line 377 of file cffdrivr.c.

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

159 {
162 CFF_Size size = (CFF_Size)cffsize;
163
164
165 if ( !slot )
166 return FT_THROW( Invalid_Slot_Handle );
167
168 FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index ));
169
170 /* check whether we want a scaled outline or bitmap */
171 if ( !size )
172 load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
173
174 /* reset the size object if necessary */
175 if ( load_flags & FT_LOAD_NO_SCALE )
176 size = NULL;
177
178 if ( size )
179 {
180 /* these two objects must have the same parent */
181 if ( cffsize->face != cffslot->face )
182 return FT_THROW( Invalid_Face_Handle );
183 }
184
185 /* now load the glyph outline if necessary */
186 error = cff_slot_load( slot, size, glyph_index, load_flags );
187
188 /* force drop-out mode to 2 - irrelevant now */
189 /* slot->outline.dropout_mode = 2; */
190
191 return error;
192 }
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:3009
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3010
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
GLsizeiptr size
Definition: glext.h:5919
FT_Face face
Definition: freetype.h:1675

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

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

◆ cff_ps_get_font_info()

static FT_Error cff_ps_get_font_info ( CFF_Face  face,
PS_FontInfoRec afont_info 
)
static

Definition at line 461 of file cffdrivr.c.

463 {
464 CFF_Font cff = (CFF_Font)face->extra.data;
466
467
468 if ( cff && !cff->font_info )
469 {
471 PS_FontInfoRec *font_info = NULL;
472 FT_Memory memory = face->root.memory;
473
474
475 if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
476 goto Fail;
477
478 font_info->version = cff_index_get_sid_string( cff,
479 dict->version );
480 font_info->notice = cff_index_get_sid_string( cff,
481 dict->notice );
482 font_info->full_name = cff_index_get_sid_string( cff,
483 dict->full_name );
484 font_info->family_name = cff_index_get_sid_string( cff,
485 dict->family_name );
486 font_info->weight = cff_index_get_sid_string( cff,
487 dict->weight );
488 font_info->italic_angle = dict->italic_angle;
489 font_info->is_fixed_pitch = dict->is_fixed_pitch;
490 font_info->underline_position = (FT_Short)dict->underline_position;
491 font_info->underline_thickness = (FT_UShort)dict->underline_thickness;
492
493 cff->font_info = font_info;
494 }
495
496 if ( cff )
497 *afont_info = *cff->font_info;
498
499 Fail:
500 return error;
501 }
FT_UInt family_name
Definition: cfftypes.h:186
FT_Bool is_fixed_pitch
Definition: cfftypes.h:188
FT_Fixed underline_position
Definition: cfftypes.h:190
FT_Fixed underline_thickness
Definition: cfftypes.h:191
FT_Fixed italic_angle
Definition: cfftypes.h:189
PS_FontInfoRec * font_info
Definition: cfftypes.h:389
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 440 of file cffdrivr.c.

455 {
456 return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0;
457 }
#define FT_FACE_FLAG_GLYPH_NAMES
Definition: freetype.h:1247

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

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

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

699 {
701
702
703 if ( dict->cid_registry == 0xFFFFU )
704 {
705 error = FT_THROW( Invalid_Argument );
706 goto Fail;
707 }
708
709 if ( registry )
710 {
711 if ( !cff->registry )
713 dict->cid_registry );
715 }
716
717 if ( ordering )
718 {
719 if ( !cff->ordering )
721 dict->cid_ordering );
723 }
724
725 /*
726 * XXX: According to Adobe TechNote #5176, the supplement in CFF
727 * can be a real number. We truncate it to fit public API
728 * since freetype-2.3.6.
729 */
730 if ( supplement )
731 {
732 if ( dict->cid_supplement < FT_INT_MIN ||
733 dict->cid_supplement > FT_INT_MAX )
734 FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
735 dict->cid_supplement ));
737 }
738 }
const char const char ** ordering
Definition: cffdrivr.c:691
const char const char FT_Int * supplement
Definition: cffdrivr.c:693
const char ** registry
Definition: cffdrivr.c:690
#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:211
FT_Long cid_supplement
Definition: cfftypes.h:212
FT_String * registry
Definition: cfftypes.h:392
FT_String * ordering
Definition: cfftypes.h:393

◆ if() [2/2]

if ( cmap->clazz !  = &CFF_CMAP_ENCODING_CLASS_REC_GET && cmap->clazz != &CFF_CMAP_UNICODE_CLASS_REC_GET)

Definition at line 657 of file cffdrivr.c.

659 {
660 FT_Module sfnt = FT_Get_Module( library, "sfnt" );
661 FT_Service_TTCMaps service =
662 (FT_Service_TTCMaps)ft_module_get_service( sfnt,
664 0 );
665
666
667 if ( service && service->get_cmap_info )
668 error = service->get_cmap_info( charmap, cmap_info );
669 }
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_TT_CMAP
Definition: cffdrivr.c:1022
TT_CMapInfo * cmap_info
Definition: cffdrivr.c:649

Variable Documentation

◆ __pad0__

Fail __pad0__

Definition at line 740 of file cffdrivr.c.

◆ cff

◆ CFF_SERVICE_CID_INFO_GET

Definition at line 1023 of file cffdrivr.c.

◆ CFF_SERVICE_GET_CMAP_INFO_GET

Definition at line 1022 of file cffdrivr.c.

◆ CFF_SERVICE_GLYPH_DICT_GET

Definition at line 1021 of file cffdrivr.c.

◆ CFF_SERVICE_PROPERTIES_GET

Definition at line 1024 of file cffdrivr.c.

◆ CFF_SERVICE_PS_INFO_GET

Definition at line 1019 of file cffdrivr.c.

◆ CFF_SERVICE_PS_NAME_GET

Definition at line 1020 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:159

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

◆ FT_FONT_FORMAT_CFF

Definition at line 1018 of file cffdrivr.c.

◆ FT_SERVICE_ID_CFF_LOAD

Definition at line 1025 of file cffdrivr.c.

◆ FT_SERVICE_ID_CID

Definition at line 1023 of file cffdrivr.c.

◆ FT_SERVICE_ID_FONT_FORMAT

Definition at line 1018 of file cffdrivr.c.

◆ FT_SERVICE_ID_GLYPH_DICT

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

Referenced by FT_DEFINE_SERVICE_PSINFOREC().

◆ FT_SERVICE_ID_POSTSCRIPT_INFO

Definition at line 1019 of file cffdrivr.c.

◆ FT_SERVICE_ID_PROPERTIES

Definition at line 1024 of file cffdrivr.c.

◆ FT_SERVICE_ID_TT_CMAP

Definition at line 1022 of file cffdrivr.c.

Referenced by if().

◆ library

Definition at line 654 of file cffdrivr.c.

Referenced by af_get_interface(), 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_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_Glyph(), FT_Get_Module(), FT_Get_Module_Interface(), FT_Get_Renderer(), FT_Get_TrueType_Engine_Type(), FT_Glyph_Stroke(), FT_Glyph_StrokeBorder(), FT_Glyph_To_Bitmap(), FT_GlyphSlot_Embolden(), FT_Library_SetLcdFilter(), FT_Library_SetLcdFilterWeights(), FT_Library_Version(), FT_Load_Glyph(), ft_lookup_glyph_renderer(), FT_Lookup_Renderer(), ft_module_get_service(), FT_New_Face(), FT_New_Library(), FT_New_Memory_Face(), FT_New_Memory_Stream(), 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(), main(), parse_afm(), SeiBuildGlobalInclExclList(), sfnt_init_face(), tt_face_build_cmaps(), tt_face_init(), and tt_get_interface().

◆ ordering

const char const char* * ordering

Definition at line 691 of file cffdrivr.c.

Referenced by if().

◆ ps_property_set

FT_Properties_SetFunc ps_property_set

Definition at line 828 of file cffdrivr.c.

◆ registry

◆ supplement

const char const char FT_Int* supplement
Initial value:

Definition at line 692 of file cffdrivr.c.

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