ReactOS 0.4.16-dev-1067-ge98bba2
afmodule.c File Reference
#include "afglobal.h"
#include "afmodule.h"
#include "afloader.h"
#include "aferrors.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   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 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_autofitter_interface
 
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   afmodule

Definition at line 69 of file afmodule.c.

Function Documentation

◆ af_autofitter_done()

af_autofitter_done ( FT_Module  ft_module)

Definition at line 469 of file afmodule.c.

470 {
471 FT_UNUSED( ft_module );
472
473#ifdef FT_DEBUG_AUTOFIT
474 if ( _af_debug_hints_rec->memory )
475 af_glyph_hints_done( _af_debug_hints_rec );
476#endif
477 }
af_glyph_hints_done(AF_GlyphHints hints)
Definition: afhints.c:702
#define FT_UNUSED(arg)
Definition: ftconfig.h:100

◆ af_autofitter_init()

af_autofitter_init ( FT_Module  ft_module)

Definition at line 443 of file afmodule.c.

444 {
445 AF_Module module = (AF_Module)ft_module;
446
447
448 module->fallback_style = AF_STYLE_FALLBACK;
449 module->default_script = AF_SCRIPT_DEFAULT;
450#ifdef AF_CONFIG_OPTION_USE_WARPER
451 module->warping = 0;
452#endif
453 module->no_stem_darkening = TRUE;
454
463
464 return FT_Err_Ok;
465 }
#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 TRUE
Definition: types.h:120
return FT_Err_Ok
Definition: ftbbox.c:527
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1
Definition: ftoption.h:813
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4
Definition: ftoption.h:823
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4
Definition: ftoption.h:822
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2
Definition: ftoption.h:816
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2
Definition: ftoption.h:817
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1
Definition: ftoption.h:814
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3
Definition: ftoption.h:819
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3
Definition: ftoption.h:820

◆ 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 481 of file afmodule.c.

486 {
488 FT_Memory memory = module->root.library->memory;
489
490#ifdef FT_DEBUG_AUTOFIT
491
492 /* in debug mode, we use a global object that survives this routine */
493
494 AF_GlyphHints hints = _af_debug_hints_rec;
495#ifdef __REACTOS__
496 AF_LoaderRec *loader = malloc(sizeof(*loader));
497 if (!loader)
498 return FT_Err_Out_Of_Memory;
499#else
500 AF_LoaderRec loader[1];
501#endif
502
503 FT_UNUSED( size );
504
505
506 if ( hints->memory )
508
510 af_loader_init( loader, hints );
511
512 error = af_loader_load_glyph( loader, module, slot->face,
513 glyph_index, load_flags );
514
515#ifdef FT_DEBUG_LEVEL_TRACE
516 if ( ft_trace_levels[FT_TRACE_COMP( FT_COMPONENT )] )
517 {
518#endif
519 af_glyph_hints_dump_points( hints, 0 );
520 af_glyph_hints_dump_segments( hints, 0 );
521 af_glyph_hints_dump_edges( hints, 0 );
522#ifdef FT_DEBUG_LEVEL_TRACE
523 }
524#endif
525
526 af_loader_done( loader );
527
528#ifdef __REACTOS__
529 free(loader);
530#endif
531 return error;
532
533#else /* !FT_DEBUG_AUTOFIT */
534
535#ifdef __REACTOS__
536 AF_GlyphHintsRec *hints = malloc(sizeof(*hints));
537 AF_LoaderRec *loader = malloc(sizeof(*loader));
538 if (!hints || !loader)
539 {
540 free(hints);
541 free(loader);
542 error = FT_Err_Out_Of_Memory;
543 goto Exit;
544 }
545#else
547 AF_LoaderRec loader[1];
548#endif
549
550 FT_UNUSED( size );
551
552
554 af_loader_init( loader, hints );
555
556 error = af_loader_load_glyph( loader, module, slot->face,
557 glyph_index, load_flags );
558
559 af_loader_done( loader );
561
562#ifdef __REACTOS__
563Exit:
564 free(hints);
565 free(loader);
566#endif
567 return error;
568
569#endif /* !FT_DEBUG_AUTOFIT */
570 }
af_glyph_hints_init(AF_GlyphHints hints, FT_Memory memory)
Definition: afhints.c:692
af_loader_init(AF_Loader loader, AF_GlyphHints hints)
Definition: afloader.c:31
af_loader_load_glyph(AF_Loader loader, AF_Module module, FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: afloader.c:213
af_loader_done(AF_Loader loader)
Definition: afloader.c:72
FT_BEGIN_HEADER struct AF_LoaderRec_ AF_LoaderRec
#define FT_COMPONENT
Definition: afmodule.c:69
#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:65
int FT_Error
Definition: fttypes.h:299
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 af_get_interface ( FT_Module  module,
const char module_interface 
)

Definition at line 433 of file afmodule.c.

435 {
436 FT_UNUSED( module );
437
438 return ft_service_list_lookup( af_services, module_interface );
439 }
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:110
TT_CMap_Info_GetFunc tt_get_cmap_info const char * module_interface
Definition: sfdriver.c:1184

◆ af_property_get()

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

Definition at line 317 of file afmodule.c.

320 {
322 AF_Module module = (AF_Module)ft_module;
323 FT_UInt fallback_style = module->fallback_style;
324 FT_UInt default_script = module->default_script;
325#ifdef AF_CONFIG_OPTION_USE_WARPER
326 FT_Bool warping = module->warping;
327#endif
328
329
330 if ( !ft_strcmp( property_name, "glyph-to-script-map" ) )
331 {
333 AF_FaceGlobals globals;
334
335
336 error = af_property_get_face_globals( prop->face, &globals, module );
337 if ( !error )
338 prop->map = globals->glyph_styles;
339
340 return error;
341 }
342 else if ( !ft_strcmp( property_name, "fallback-script" ) )
343 {
345
346 AF_StyleClass style_class = af_style_classes[fallback_style];
347
348
349 *val = style_class->script;
350
351 return error;
352 }
353 else if ( !ft_strcmp( property_name, "default-script" ) )
354 {
356
357
358 *val = default_script;
359
360 return error;
361 }
362 else if ( !ft_strcmp( property_name, "increase-x-height" ) )
363 {
365 AF_FaceGlobals globals;
366
367
368 error = af_property_get_face_globals( prop->face, &globals, module );
369 if ( !error )
370 prop->limit = globals->increase_x_height;
371
372 return error;
373 }
374#ifdef AF_CONFIG_OPTION_USE_WARPER
375 else if ( !ft_strcmp( property_name, "warping" ) )
376 {
378
379
380 *val = warping;
381
382 return error;
383 }
384#endif /* AF_CONFIG_OPTION_USE_WARPER */
385 else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
386 {
387 FT_Int* darken_params = module->darken_params;
388 FT_Int* val = (FT_Int*)value;
389
390
391 val[0] = darken_params[0];
392 val[1] = darken_params[1];
393 val[2] = darken_params[2];
394 val[3] = darken_params[3];
395 val[4] = darken_params[4];
396 val[5] = darken_params[5];
397 val[6] = darken_params[6];
398 val[7] = darken_params[7];
399
400 return error;
401 }
402 else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
403 {
404 FT_Bool no_stem_darkening = module->no_stem_darkening;
406
407
408 *val = no_stem_darkening;
409
410 return error;
411 }
412
413 FT_TRACE0(( "af_property_get: missing property `%s'\n",
414 property_name ));
415 return FT_THROW( Missing_Property );
416 }
af_style_classes[]
Definition: afglobal.c:102
static FT_Error af_property_get_face_globals(FT_Face face, AF_FaceGlobals *aglobals, AF_Module module)
Definition: afmodule.c:73
#define FT_TRACE0(varformat)
Definition: ftdebug.h:185
#define FT_THROW(e)
Definition: ftdebug.h:241
#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:452
Definition: pdh_main.c:96

◆ 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 73 of file afmodule.c.

76 {
78 AF_FaceGlobals globals;
79
80
81 if ( !face )
82 return FT_THROW( Invalid_Face_Handle );
83
84 globals = (AF_FaceGlobals)face->autohint.data;
85 if ( !globals )
86 {
87 /* trigger computation of the global style data */
88 /* in case it hasn't been done yet */
89 error = af_face_globals_new( face, &globals, module );
90 if ( !error )
91 {
92 face->autohint.data =
93 (FT_Pointer)globals;
94 face->autohint.finalizer =
96 }
97 }
98
99 if ( !error )
100 *aglobals = globals;
101
102 return error;
103 }
af_face_globals_new(FT_Face face, AF_FaceGlobals *aglobals, AF_Module module)
Definition: afglobal.c:331
af_face_globals_free(AF_FaceGlobals globals)
Definition: afglobal.c:382
struct AF_FaceGlobalsRec_ * AF_FaceGlobals
Definition: aftypes.h:469
void * FT_Pointer
Definition: fttypes.h:310
void(* FT_Generic_Finalizer)(void *object)
Definition: fttypes.h:435
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 107 of file afmodule.c.

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

◆ af_autofitter_init

const void FT_Module_Constructor af_autofitter_init

Definition at line 594 of file afmodule.c.

◆ af_autofitter_interface

const void* & af_autofitter_interface

Definition at line 592 of file afmodule.c.

◆ autofitter

autofitter

Definition at line 588 of file afmodule.c.

◆ FT_MODULE_HINTER

FT_MODULE_HINTER

Definition at line 585 of file afmodule.c.

◆ FT_SERVICE_ID_PROPERTIES

FT_SERVICE_ID_PROPERTIES

Definition at line 429 of file afmodule.c.