ReactOS 0.4.15-dev-7906-g1b85a5f
cidobjs.c File Reference
#include <ft2build.h>
#include "cidgload.h"
#include "cidload.h"
#include "ciderrs.h"
Include dependency graph for cidobjs.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_cidobjs
 

Functions

 cid_slot_done (FT_GlyphSlot slot)
 
 cid_slot_init (FT_GlyphSlot slot)
 
static PSH_Globals_Funcs cid_size_get_globals_funcs (CID_Size size)
 
 cid_size_done (FT_Size cidsize)
 
 cid_size_init (FT_Size cidsize)
 
 cid_size_request (FT_Size size, FT_Size_Request req)
 
 cid_face_done (FT_Face cidface)
 
 cid_face_init (FT_Stream stream, FT_Face cidface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
 
 cid_driver_init (FT_Module module)
 
 cid_driver_done (FT_Module driver)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_cidobjs

Definition at line 41 of file cidobjs.c.

Function Documentation

◆ cid_driver_done()

cid_driver_done ( FT_Module  driver)

Definition at line 520 of file cidobjs.c.

521 {
522 FT_UNUSED( driver );
523 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
struct @1669::@1670 driver

◆ cid_driver_init()

cid_driver_init ( FT_Module  module)

Definition at line 467 of file cidobjs.c.

468 {
470
471 FT_UInt32 seed;
472
473
474 /* set default property values, cf. `ftt1drv.h' */
475#ifdef T1_CONFIG_OPTION_OLD_ENGINE
476 driver->hinting_engine = FT_HINTING_FREETYPE;
477#else
478 driver->hinting_engine = FT_HINTING_ADOBE;
479#endif
480
481 driver->no_stem_darkening = TRUE;
482
491
492 /* compute random seed from some memory addresses */
493 seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
494 (FT_Offset)(char*)&module ^
495 (FT_Offset)(char*)module->memory );
496 seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
497
498 driver->random_seed = (FT_Int32)seed;
499 if ( driver->random_seed < 0 )
500 driver->random_seed = -driver->random_seed;
501 else if ( driver->random_seed == 0 )
502 driver->random_seed = 123456789;
503
504 return FT_Err_Ok;
505 }
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1
Definition: ftoption.h:777
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4
Definition: ftoption.h:787
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4
Definition: ftoption.h:786
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2
Definition: ftoption.h:780
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2
Definition: ftoption.h:781
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1
Definition: ftoption.h:778
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3
Definition: ftoption.h:783
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3
Definition: ftoption.h:784
#define TRUE
Definition: types.h:120
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_HINTING_FREETYPE
Definition: ftdriver.h:345
#define FT_HINTING_ADOBE
Definition: ftdriver.h:346
size_t FT_Offset
Definition: fttypes.h:324
FT_BEGIN_HEADER struct PS_DriverRec_ * PS_Driver

◆ cid_face_done()

cid_face_done ( FT_Face  cidface)

Definition at line 195 of file cidobjs.c.

196 {
197 CID_Face face = (CID_Face)cidface;
201
202
203 if ( !face )
204 return;
205
206 cid = &face->cid;
207 info = &cid->font_info;
208 memory = cidface->memory;
209
210 /* release subrs */
211 if ( face->subrs )
212 {
213 FT_Int n;
214
215
216 for ( n = 0; n < cid->num_dicts; n++ )
217 {
218 CID_Subrs subr = face->subrs + n;
219
220
221 if ( subr->code )
222 {
223 FT_FREE( subr->code[0] );
224 FT_FREE( subr->code );
225 }
226 }
227
228 FT_FREE( face->subrs );
229 }
230
231 /* release FontInfo strings */
232 FT_FREE( info->version );
233 FT_FREE( info->notice );
234 FT_FREE( info->full_name );
235 FT_FREE( info->family_name );
236 FT_FREE( info->weight );
237
238 /* release font dictionaries */
239 FT_FREE( cid->font_dicts );
240 cid->num_dicts = 0;
241
242 /* release other strings */
243 FT_FREE( cid->cid_font_name );
244 FT_FREE( cid->registry );
245 FT_FREE( cid->ordering );
246
247 cidface->family_name = NULL;
248 cidface->style_name = NULL;
249
250 FT_FREE( face->binary_data );
251 FT_FREE( face->cid_stream );
252 }
#define NULL
Definition: types.h:112
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
signed int FT_Int
Definition: fttypes.h:220
GLdouble n
Definition: glext.h:7729
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
static char memory[1024 *256]
Definition: process.c:116
static TfClientId cid
FT_Byte ** code
Definition: t1types.h:133
FT_String * style_name
Definition: freetype.h:1079
FT_String * family_name
Definition: freetype.h:1078
FT_Memory memory
Definition: freetype.h:1112
struct CID_FaceRec_ * CID_Face
Definition: t1types.h:197

◆ cid_face_init()

cid_face_init ( FT_Stream  stream,
FT_Face  cidface,
FT_Int  face_index,
FT_Int  num_params,
FT_Parameter params 
)

Definition at line 279 of file cidobjs.c.

284 {
285 CID_Face face = (CID_Face)cidface;
287 PSAux_Service psaux;
288 PSHinter_Service pshinter;
289
290 FT_UNUSED( num_params );
291 FT_UNUSED( params );
292 FT_UNUSED( stream );
293
294
295 cidface->num_faces = 1;
296
297 psaux = (PSAux_Service)face->psaux;
298 if ( !psaux )
299 {
301 FT_FACE_LIBRARY( face ), "psaux" );
302
303 if ( !psaux )
304 {
305 FT_ERROR(( "cid_face_init: cannot access `psaux' module\n" ));
306 error = FT_THROW( Missing_Module );
307 goto Exit;
308 }
309
310 face->psaux = psaux;
311 }
312
313 pshinter = (PSHinter_Service)face->pshinter;
314 if ( !pshinter )
315 {
317 FT_FACE_LIBRARY( face ), "pshinter" );
318
319 face->pshinter = pshinter;
320 }
321
322 FT_TRACE2(( "CID driver\n" ));
323
324 /* open the tokenizer; this will also check the font format */
325 if ( FT_STREAM_SEEK( 0 ) )
326 goto Exit;
327
328 error = cid_face_open( face, face_index );
329 if ( error )
330 goto Exit;
331
332 /* if we just wanted to check the format, leave successfully now */
333 if ( face_index < 0 )
334 goto Exit;
335
336 /* check the face index */
337 /* XXX: handle CID fonts with more than a single face */
338 if ( ( face_index & 0xFFFF ) != 0 )
339 {
340 FT_ERROR(( "cid_face_init: invalid face index\n" ));
341 error = FT_THROW( Invalid_Argument );
342 goto Exit;
343 }
344
345 /* now load the font program into the face object */
346
347 /* initialize the face object fields */
348
349 /* set up root face fields */
350 {
351 CID_FaceInfo cid = &face->cid;
352 PS_FontInfo info = &cid->font_info;
353
354
355 cidface->num_glyphs = (FT_Long)cid->cid_count;
356 cidface->num_charmaps = 0;
357
358 cidface->face_index = face_index & 0xFFFF;
359
360 cidface->face_flags |= FT_FACE_FLAG_SCALABLE | /* scalable outlines */
361 FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
362 FT_FACE_FLAG_HINTER; /* has native hinter */
363
364 if ( info->is_fixed_pitch )
366
367 /* XXX: TODO: add kerning with .afm support */
368
369 /* get style name -- be careful, some broken fonts only */
370 /* have a /FontName dictionary entry! */
371 cidface->family_name = info->family_name;
372 /* assume "Regular" style if we don't know better */
373 cidface->style_name = (char *)"Regular";
374 if ( cidface->family_name )
375 {
376 char* full = info->full_name;
377 char* family = cidface->family_name;
378
379
380 if ( full )
381 {
382 while ( *full )
383 {
384 if ( *full == *family )
385 {
386 family++;
387 full++;
388 }
389 else
390 {
391 if ( *full == ' ' || *full == '-' )
392 full++;
393 else if ( *family == ' ' || *family == '-' )
394 family++;
395 else
396 {
397 if ( !*family )
398 cidface->style_name = full;
399 break;
400 }
401 }
402 }
403 }
404 }
405 else
406 {
407 /* do we have a `/FontName'? */
408 if ( cid->cid_font_name )
409 cidface->family_name = cid->cid_font_name;
410 }
411
412 /* compute style flags */
413 cidface->style_flags = 0;
414 if ( info->italic_angle )
416 if ( info->weight )
417 {
418 if ( !ft_strcmp( info->weight, "Bold" ) ||
419 !ft_strcmp( info->weight, "Black" ) )
421 }
422
423 /* no embedded bitmap support */
424 cidface->num_fixed_sizes = 0;
425 cidface->available_sizes = NULL;
426
427 cidface->bbox.xMin = cid->font_bbox.xMin >> 16;
428 cidface->bbox.yMin = cid->font_bbox.yMin >> 16;
429 /* no `U' suffix here to 0xFFFF! */
430 cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16;
431 cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16;
432
433 if ( !cidface->units_per_EM )
434 cidface->units_per_EM = 1000;
435
436 cidface->ascender = (FT_Short)( cidface->bbox.yMax );
437 cidface->descender = (FT_Short)( cidface->bbox.yMin );
438
439 cidface->height = (FT_Short)( ( cidface->units_per_EM * 12 ) / 10 );
440 if ( cidface->height < cidface->ascender - cidface->descender )
441 cidface->height = (FT_Short)( cidface->ascender - cidface->descender );
442
443 cidface->underline_position = (FT_Short)info->underline_position;
444 cidface->underline_thickness = (FT_Short)info->underline_thickness;
445 }
446
447 Exit:
448 return error;
449 }
cid_face_open(CID_Face face, FT_Int face_index)
Definition: cidload.c:690
#define FT_STYLE_FLAG_ITALIC
Definition: freetype.h:1517
#define FT_FACE_FLAG_SCALABLE
Definition: freetype.h:1238
#define FT_FACE_FLAG_HINTER
Definition: freetype.h:1249
#define FT_FACE_FLAG_FIXED_WIDTH
Definition: freetype.h:1240
#define FT_STYLE_FLAG_BOLD
Definition: freetype.h:1518
#define FT_FACE_FLAG_HORIZONTAL
Definition: freetype.h:1242
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_TRACE2(varformat)
Definition: ftdebug.h:159
#define FT_FACE_LIBRARY(x)
Definition: ftobjs.h:635
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
Definition: ftobjs.c:4865
#define ft_strcmp
Definition: ftstdlib.h:86
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:489
int FT_Error
Definition: fttypes.h:300
signed long FT_Long
Definition: fttypes.h:242
signed short FT_Short
Definition: fttypes.h:198
GLenum const GLfloat * params
Definition: glext.h:5645
PSHinter_Interface * PSHinter_Service
Definition: pshints.h:680
if(dx< 0)
Definition: linetemp.h:194
#define error(str)
Definition: mkdosfs.c:1605
struct PSAux_ServiceRec_ * PSAux_Service
static void Exit(void)
Definition: sock.c:1330
FT_Pos xMin
Definition: ftimage.h:117
FT_Pos yMax
Definition: ftimage.h:118
FT_Pos yMin
Definition: ftimage.h:117
FT_Pos xMax
Definition: ftimage.h:118
FT_Bitmap_Size * available_sizes
Definition: freetype.h:1082
FT_Long num_glyphs
Definition: freetype.h:1076
FT_Short height
Definition: freetype.h:1097
FT_Short underline_thickness
Definition: freetype.h:1103
FT_Int num_charmaps
Definition: freetype.h:1084
FT_Short descender
Definition: freetype.h:1096
FT_BBox bbox
Definition: freetype.h:1092
FT_UShort units_per_EM
Definition: freetype.h:1094
FT_Int num_fixed_sizes
Definition: freetype.h:1081
FT_Long style_flags
Definition: freetype.h:1074
FT_Long face_index
Definition: freetype.h:1071
FT_Short underline_position
Definition: freetype.h:1102
FT_Long face_flags
Definition: freetype.h:1073
FT_Long num_faces
Definition: freetype.h:1070
FT_Short ascender
Definition: freetype.h:1095
Definition: parse.h:23

◆ cid_size_done()

cid_size_done ( FT_Size  cidsize)

Definition at line 112 of file cidobjs.c.

113 {
114 CID_Size size = (CID_Size)cidsize;
115
116
117 if ( cidsize->internal->module_data )
118 {
120
121
123 if ( funcs )
124 funcs->destroy( (PSH_Globals)cidsize->internal->module_data );
125
126 cidsize->internal->module_data = NULL;
127 }
128 }
static PSH_Globals_Funcs cid_size_get_globals_funcs(CID_Size size)
Definition: cidobjs.c:96
struct CID_SizeRec_ * CID_Size
Definition: cidobjs.h:56
GLsizeiptr size
Definition: glext.h:5919
typedefFT_BEGIN_HEADER struct PSH_GlobalsRec_ * PSH_Globals
Definition: pshints.h:41
static struct __wine_debug_functions funcs
Definition: debug.c:59
FT_Size_Internal internal
Definition: freetype.h:1678
void * module_data
Definition: ftobjs.h:497

◆ cid_size_get_globals_funcs()

static PSH_Globals_Funcs cid_size_get_globals_funcs ( CID_Size  size)
static

Definition at line 96 of file cidobjs.c.

97 {
99 PSHinter_Service pshinter = (PSHinter_Service)face->pshinter;
101
102
103 module = FT_Get_Module( size->root.face->driver->root.library,
104 "pshinter" );
105 return ( module && pshinter && pshinter->get_globals_funcs )
106 ? pshinter->get_globals_funcs( module )
107 : 0;
108 }
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4837
FT_FaceRec root
Definition: t1types.h:232

Referenced by cid_size_done(), cid_size_init(), and cid_size_request().

◆ cid_size_init()

cid_size_init ( FT_Size  cidsize)

Definition at line 132 of file cidobjs.c.

133 {
134 CID_Size size = (CID_Size)cidsize;
137
138
139 if ( funcs )
140 {
141 PSH_Globals globals;
142 CID_Face face = (CID_Face)cidsize->face;
143 CID_FaceDict dict = face->cid.font_dicts + face->root.face_index;
144 PS_Private priv = &dict->private_dict;
145
146
147 error = funcs->create( cidsize->face->memory, priv, &globals );
148 if ( !error )
149 cidsize->internal->module_data = globals;
150 }
151
152 return error;
153 }
FT_Face face
Definition: freetype.h:1675

◆ cid_size_request()

cid_size_request ( FT_Size  size,
FT_Size_Request  req 
)

Definition at line 157 of file cidobjs.c.

159 {
161
162
163 FT_Request_Metrics( size->face, req );
164
166
167 if ( funcs )
168 funcs->set_scale( (PSH_Globals)size->internal->module_data,
169 size->metrics.x_scale,
170 size->metrics.y_scale,
171 0, 0 );
172
173 return FT_Err_Ok;
174 }
FT_Request_Metrics(FT_Face face, FT_Size_Request req)
Definition: ftobjs.c:3028

◆ cid_slot_done()

cid_slot_done ( FT_GlyphSlot  slot)

Definition at line 51 of file cidobjs.c.

52 {
53 slot->internal->glyph_hints = NULL;
54 }
Definition: vfat.h:185

◆ cid_slot_init()

cid_slot_init ( FT_GlyphSlot  slot)

Definition at line 58 of file cidobjs.c.

59 {
61 PSHinter_Service pshinter;
62
63
64 face = (CID_Face)slot->face;
65 pshinter = (PSHinter_Service)face->pshinter;
66
67 if ( pshinter )
68 {
70
71
72 module = FT_Get_Module( slot->face->driver->root.library,
73 "pshinter" );
74 if ( module )
75 {
77
78
79 funcs = pshinter->get_t1_funcs( module );
80 slot->internal->glyph_hints = (void*)funcs;
81 }
82 }
83
84 return 0;
85 }
WORD face[3]
Definition: mesh.c:4747
T1_Hints_Funcs(* get_t1_funcs)(FT_Module module)
Definition: pshints.h:675