ReactOS 0.4.16-dev-252-g9ccafe8
afmodule.c File Reference
#include "afglobal.h"
#include "afmodule.h"
#include "afloader.h"
#include "aferrors.h"
#include "afpic.h"
Include dependency graph for afmodule.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_afmodule
 

Functions

static FT_Error af_property_get_face_globals (FT_Face face, AF_FaceGlobals *aglobals, AF_Module module)
 
static FT_Error af_property_set (FT_Module ft_module, const char *property_name, const void *value, FT_Bool value_is_string)
 
static FT_Error af_property_get (FT_Module ft_module, const char *property_name, void *value)
 
 FT_DEFINE_SERVICE_PROPERTIESREC (af_service_properties,(FT_Properties_SetFunc) af_property_set,(FT_Properties_GetFunc) af_property_get) FT_DEFINE_SERVICEDESCREC1(af_services
 
&AF_SERVICE_PROPERTIES_GET af_get_interface (FT_Module module, const char *module_interface)
 
 af_autofitter_init (FT_Module ft_module)
 
 af_autofitter_done (FT_Module ft_module)
 
 af_autofitter_load_glyph (AF_Module module, FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
 
 FT_DEFINE_AUTOHINTER_INTERFACE (af_autofitter_interface, NULL, NULL, NULL,(FT_AutoHinter_GlyphLoadFunc) af_autofitter_load_glyph) FT_DEFINE_MODULE(autofit_module_class
 
 sizeof (AF_ModuleRec)
 

Variables

 FT_SERVICE_ID_PROPERTIES
 
 FT_MODULE_HINTER
 
 autofitter
 
const void *& AF_INTERFACE_GET
 
const void FT_Module_Constructor af_autofitter_init
 
const void FT_Module_Constructor FT_Module_Destructor af_autofitter_done
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_afmodule

Definition at line 70 of file afmodule.c.

Function Documentation

◆ af_autofitter_done()

af_autofitter_done ( FT_Module  ft_module)

Definition at line 495 of file afmodule.c.

496 {
497 FT_UNUSED( ft_module );
498
499#ifdef FT_DEBUG_AUTOFIT
500 if ( _af_debug_hints_rec->memory )
501 af_glyph_hints_done( _af_debug_hints_rec );
502#endif
503 }
af_glyph_hints_done(AF_GlyphHints hints)
Definition: afhints.c:672
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ af_autofitter_init()

af_autofitter_init ( FT_Module  ft_module)

Definition at line 469 of file afmodule.c.

470 {
471 AF_Module module = (AF_Module)ft_module;
472
473
474 module->fallback_style = AF_STYLE_FALLBACK;
475 module->default_script = AF_SCRIPT_DEFAULT;
476#ifdef AF_CONFIG_OPTION_USE_WARPER
477 module->warping = 0;
478#endif
479 module->no_stem_darkening = TRUE;
480
489
490 return FT_Err_Ok;
491 }
#define AF_STYLE_FALLBACK
Definition: afglobal.h:71
#define AF_SCRIPT_DEFAULT
Definition: afglobal.h:74
FT_BEGIN_HEADER struct AF_ModuleRec_ * AF_Module
#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

◆ af_autofitter_load_glyph()

af_autofitter_load_glyph ( AF_Module  module,
FT_GlyphSlot  slot,
FT_Size  size,
FT_UInt  glyph_index,
FT_Int32  load_flags 
)

Definition at line 507 of file afmodule.c.

512 {
514 FT_Memory memory = module->root.library->memory;
515
516#ifdef FT_DEBUG_AUTOFIT
517
518 /* in debug mode, we use a global object that survives this routine */
519
520 AF_GlyphHints hints = _af_debug_hints_rec;
521 AF_LoaderRec loader[1];
522
523 FT_UNUSED( size );
524
525
526 if ( hints->memory )
528
530 af_loader_init( loader, hints );
531
532 error = af_loader_load_glyph( loader, module, slot->face,
533 glyph_index, load_flags );
534
535#ifdef FT_DEBUG_LEVEL_TRACE
536 if ( ft_trace_levels[FT_COMPONENT] )
537 {
538#endif
539 af_glyph_hints_dump_points( hints, 0 );
540 af_glyph_hints_dump_segments( hints, 0 );
541 af_glyph_hints_dump_edges( hints, 0 );
542#ifdef FT_DEBUG_LEVEL_TRACE
543 }
544#endif
545
546 af_loader_done( loader );
547
548 return error;
549
550#else /* !FT_DEBUG_AUTOFIT */
551
552#ifdef __REACTOS__
554 AF_LoaderRec *loader = malloc(sizeof(AF_LoaderRec));
555 if (!hints || !loader)
556 {
557 error = FT_Err_Out_Of_Memory;
558 goto Exit;
559 }
560#else
562 AF_LoaderRec loader[1];
563#endif
564
565 FT_UNUSED( size );
566
567
569 af_loader_init( loader, hints );
570
571 error = af_loader_load_glyph( loader, module, slot->face,
572 glyph_index, load_flags );
573
574 af_loader_done( loader );
576
577#ifdef __REACTOS__
578Exit:
579 free(hints);
580 free(loader);
581#endif
582
583 return error;
584
585#endif /* !FT_DEBUG_AUTOFIT */
586 }
af_glyph_hints_init(AF_GlyphHints hints, FT_Memory memory)
Definition: afhints.c:662
af_loader_init(AF_Loader loader, AF_GlyphHints hints)
Definition: afloader.c:32
af_loader_load_glyph(AF_Loader loader, AF_Module module, FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: afloader.c:214
af_loader_done(AF_Loader loader)
Definition: afloader.c:73
FT_BEGIN_HEADER struct AF_LoaderRec_ AF_LoaderRec
#define FT_COMPONENT
Definition: afmodule.c:70
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
int FT_Error
Definition: fttypes.h:300
GLsizeiptr size
Definition: glext.h:5919
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
static void Exit(void)
Definition: sock.c:1330
Definition: vfat.h:185

◆ af_get_interface()

&AF_SERVICE_PROPERTIES_GET af_get_interface ( FT_Module  module,
const char module_interface 
)

Definition at line 447 of file afmodule.c.

449 {
450 /* AF_SERVICES_GET dereferences `library' in PIC mode */
451#ifdef FT_CONFIG_OPTION_PIC
453
454
455 if ( !module )
456 return NULL;
457 library = module->library;
458 if ( !library )
459 return NULL;
460#else
461 FT_UNUSED( module );
462#endif
463
465 }
#define AF_SERVICES_GET
Definition: afpic.h:28
FT_Library library
Definition: cffdrivr.c:654
#define NULL
Definition: types.h:112
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:98
TT_CMap_Info_GetFunc tt_get_cmap_info const char * module_interface
Definition: sfdriver.c:1176

◆ af_property_get()

static FT_Error af_property_get ( FT_Module  ft_module,
const char property_name,
void value 
)
static

Definition at line 331 of file afmodule.c.

334 {
336 AF_Module module = (AF_Module)ft_module;
337 FT_UInt fallback_style = module->fallback_style;
338 FT_UInt default_script = module->default_script;
339#ifdef AF_CONFIG_OPTION_USE_WARPER
340 FT_Bool warping = module->warping;
341#endif
342
343
344 if ( !ft_strcmp( property_name, "glyph-to-script-map" ) )
345 {
347 AF_FaceGlobals globals;
348
349
350 error = af_property_get_face_globals( prop->face, &globals, module );
351 if ( !error )
352 prop->map = globals->glyph_styles;
353
354 return error;
355 }
356 else if ( !ft_strcmp( property_name, "fallback-script" ) )
357 {
359
360 AF_StyleClass style_class = AF_STYLE_CLASSES_GET[fallback_style];
361
362
363 *val = style_class->script;
364
365 return error;
366 }
367 else if ( !ft_strcmp( property_name, "default-script" ) )
368 {
370
371
372 *val = default_script;
373
374 return error;
375 }
376 else if ( !ft_strcmp( property_name, "increase-x-height" ) )
377 {
379 AF_FaceGlobals globals;
380
381
382 error = af_property_get_face_globals( prop->face, &globals, module );
383 if ( !error )
384 prop->limit = globals->increase_x_height;
385
386 return error;
387 }
388#ifdef AF_CONFIG_OPTION_USE_WARPER
389 else if ( !ft_strcmp( property_name, "warping" ) )
390 {
392
393
394 *val = warping;
395
396 return error;
397 }
398#endif /* AF_CONFIG_OPTION_USE_WARPER */
399 else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
400 {
401 FT_Int* darken_params = module->darken_params;
402 FT_Int* val = (FT_Int*)value;
403
404
405 val[0] = darken_params[0];
406 val[1] = darken_params[1];
407 val[2] = darken_params[2];
408 val[3] = darken_params[3];
409 val[4] = darken_params[4];
410 val[5] = darken_params[5];
411 val[6] = darken_params[6];
412 val[7] = darken_params[7];
413
414 return error;
415 }
416 else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
417 {
418 FT_Bool no_stem_darkening = module->no_stem_darkening;
420
421
422 *val = no_stem_darkening;
423
424 return error;
425 }
426
427 FT_TRACE0(( "af_property_get: missing property `%s'\n",
428 property_name ));
429 return FT_THROW( Missing_Property );
430 }
static FT_Error af_property_get_face_globals(FT_Face face, AF_FaceGlobals *aglobals, AF_Module module)
Definition: afmodule.c:74
#define AF_STYLE_CLASSES_GET
Definition: afpic.h:33
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
#define FT_THROW(e)
Definition: ftdebug.h:213
#define ft_strcmp
Definition: ftstdlib.h:86
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
GLuint GLfloat * val
Definition: glext.h:7180
FT_UShort * glyph_styles
Definition: afglobal.h:109
FT_UInt increase_x_height
Definition: afglobal.h:117
AF_Script script
Definition: aftypes.h:450
Definition: pdh_main.c:94

◆ af_property_get_face_globals()

static FT_Error af_property_get_face_globals ( FT_Face  face,
AF_FaceGlobals aglobals,
AF_Module  module 
)
static

Definition at line 74 of file afmodule.c.

77 {
79 AF_FaceGlobals globals;
80
81
82 if ( !face )
83 return FT_THROW( Invalid_Face_Handle );
84
85 globals = (AF_FaceGlobals)face->autohint.data;
86 if ( !globals )
87 {
88 /* trigger computation of the global style data */
89 /* in case it hasn't been done yet */
90 error = af_face_globals_new( face, &globals, module );
91 if ( !error )
92 {
93 face->autohint.data =
94 (FT_Pointer)globals;
95 face->autohint.finalizer =
97 }
98 }
99
100 if ( !error )
101 *aglobals = globals;
102
103 return error;
104 }
af_face_globals_new(FT_Face face, AF_FaceGlobals *aglobals, AF_Module module)
Definition: afglobal.c:336
af_face_globals_free(AF_FaceGlobals globals)
Definition: afglobal.c:387
struct AF_FaceGlobalsRec_ * AF_FaceGlobals
Definition: aftypes.h:467
void * FT_Pointer
Definition: fttypes.h:311
void(* FT_Generic_Finalizer)(void *object)
Definition: fttypes.h:428
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
if(dx< 0)
Definition: linetemp.h:194

Referenced by af_property_get(), and af_property_set().

◆ af_property_set()

static FT_Error af_property_set ( FT_Module  ft_module,
const char property_name,
const void value,
FT_Bool  value_is_string 
)
static

Definition at line 121 of file afmodule.c.

125 {
127 AF_Module module = (AF_Module)ft_module;
128
129#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
130 FT_UNUSED( value_is_string );
131#endif
132
133
134 if ( !ft_strcmp( property_name, "fallback-script" ) )
135 {
136 FT_UInt* fallback_script;
137 FT_UInt ss;
138
139
140#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
141 if ( value_is_string )
142 return FT_THROW( Invalid_Argument );
143#endif
144
145 fallback_script = (FT_UInt*)value;
146
147 /* We translate the fallback script to a fallback style that uses */
148 /* `fallback-script' as its script and `AF_COVERAGE_NONE' as its */
149 /* coverage value. */
150 for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
151 {
153
154
155 if ( (FT_UInt)style_class->script == *fallback_script &&
156 style_class->coverage == AF_COVERAGE_DEFAULT )
157 {
158 module->fallback_style = ss;
159 break;
160 }
161 }
162
163 if ( !AF_STYLE_CLASSES_GET[ss] )
164 {
165 FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n",
166 fallback_script, property_name ));
167 return FT_THROW( Invalid_Argument );
168 }
169
170 return error;
171 }
172 else if ( !ft_strcmp( property_name, "default-script" ) )
173 {
174 FT_UInt* default_script;
175
176
177#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
178 if ( value_is_string )
179 return FT_THROW( Invalid_Argument );
180#endif
181
182 default_script = (FT_UInt*)value;
183
184 module->default_script = *default_script;
185
186 return error;
187 }
188 else if ( !ft_strcmp( property_name, "increase-x-height" ) )
189 {
191 AF_FaceGlobals globals;
192
193
194#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
195 if ( value_is_string )
196 return FT_THROW( Invalid_Argument );
197#endif
198
200
201 error = af_property_get_face_globals( prop->face, &globals, module );
202 if ( !error )
203 globals->increase_x_height = prop->limit;
204
205 return error;
206 }
207#ifdef AF_CONFIG_OPTION_USE_WARPER
208 else if ( !ft_strcmp( property_name, "warping" ) )
209 {
210#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
211 if ( value_is_string )
212 {
213 const char* s = (const char*)value;
214 long w = ft_strtol( s, NULL, 10 );
215
216
217 if ( w == 0 )
218 module->warping = 0;
219 else if ( w == 1 )
220 module->warping = 1;
221 else
222 return FT_THROW( Invalid_Argument );
223 }
224 else
225#endif
226 {
227 FT_Bool* warping = (FT_Bool*)value;
228
229
230 module->warping = *warping;
231 }
232
233 return error;
234 }
235#endif /* AF_CONFIG_OPTION_USE_WARPER */
236 else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
237 {
238 FT_Int* darken_params;
239 FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
240
241#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
242 FT_Int dp[8];
243
244
245 if ( value_is_string )
246 {
247 const char* s = (const char*)value;
248 char* ep;
249 int i;
250
251
252 /* eight comma-separated numbers */
253 for ( i = 0; i < 7; i++ )
254 {
255 dp[i] = (FT_Int)ft_strtol( s, &ep, 10 );
256 if ( *ep != ',' || s == ep )
257 return FT_THROW( Invalid_Argument );
258
259 s = ep + 1;
260 }
261
262 dp[7] = (FT_Int)ft_strtol( s, &ep, 10 );
263 if ( !( *ep == '\0' || *ep == ' ' ) || s == ep )
264 return FT_THROW( Invalid_Argument );
265
266 darken_params = dp;
267 }
268 else
269#endif
270 darken_params = (FT_Int*)value;
271
272 x1 = darken_params[0];
273 y1 = darken_params[1];
274 x2 = darken_params[2];
275 y2 = darken_params[3];
276 x3 = darken_params[4];
277 y3 = darken_params[5];
278 x4 = darken_params[6];
279 y4 = darken_params[7];
280
281 if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
282 y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
283 x1 > x2 || x2 > x3 || x3 > x4 ||
284 y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 )
285 return FT_THROW( Invalid_Argument );
286
287 module->darken_params[0] = x1;
288 module->darken_params[1] = y1;
289 module->darken_params[2] = x2;
290 module->darken_params[3] = y2;
291 module->darken_params[4] = x3;
292 module->darken_params[5] = y3;
293 module->darken_params[6] = x4;
294 module->darken_params[7] = y4;
295
296 return error;
297 }
298 else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
299 {
300#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
301 if ( value_is_string )
302 {
303 const char* s = (const char*)value;
304 long nsd = ft_strtol( s, NULL, 10 );
305
306
307 if ( !nsd )
308 module->no_stem_darkening = FALSE;
309 else
310 module->no_stem_darkening = TRUE;
311 }
312 else
313#endif
314 {
315 FT_Bool* no_stem_darkening = (FT_Bool*)value;
316
317
318 module->no_stem_darkening = *no_stem_darkening;
319 }
320
321 return error;
322 }
323
324 FT_TRACE0(( "af_property_set: missing property `%s'\n",
325 property_name ));
326 return FT_THROW( Missing_Property );
327 }
@ AF_COVERAGE_DEFAULT
Definition: aftypes.h:412
#define FALSE
Definition: types.h:117
#define ft_strtol
Definition: ftstdlib.h:145
GLdouble s
Definition: gl.h:2039
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
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
#define ss
Definition: i386-dis.c:441
AF_Coverage coverage
Definition: aftypes.h:452
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711

◆ FT_DEFINE_AUTOHINTER_INTERFACE()

FT_DEFINE_AUTOHINTER_INTERFACE ( af_autofitter_interface  ,
NULL  ,
NULL  ,
NULL  ,
(FT_AutoHinter_GlyphLoadFunc af_autofitter_load_glyph 
)

◆ FT_DEFINE_SERVICE_PROPERTIESREC()

FT_DEFINE_SERVICE_PROPERTIESREC ( af_service_properties  ,
(FT_Properties_SetFunc af_property_set,
(FT_Properties_GetFunc af_property_get 
)

◆ sizeof()

sizeof ( AF_ModuleRec  )

Variable Documentation

◆ af_autofitter_done

Definition at line 611 of file afmodule.c.

◆ af_autofitter_init

const void FT_Module_Constructor af_autofitter_init

Definition at line 610 of file afmodule.c.

◆ AF_INTERFACE_GET

const void* & AF_INTERFACE_GET

Definition at line 608 of file afmodule.c.

◆ autofitter

autofitter

Definition at line 604 of file afmodule.c.

◆ FT_MODULE_HINTER

FT_MODULE_HINTER

Definition at line 601 of file afmodule.c.

◆ FT_SERVICE_ID_PROPERTIES

FT_SERVICE_ID_PROPERTIES

Definition at line 443 of file afmodule.c.