ReactOS 0.4.15-dev-7918-g2a2556c
afglobal.h File Reference
#include "aftypes.h"
#include "afmodule.h"
#include "afshaper.h"
#include "afscript.h"
#include "afstyles.h"
Include dependency graph for afglobal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AF_FaceGlobalsRec_
 

Macros

#define SCRIPT(s, S, d, h, H, ss)    AF_DECLARE_SCRIPT_CLASS( af_ ## s ## _script_class )
 
#define STYLE(s, S, d, ws, sc, ss, c)    AF_DECLARE_STYLE_CLASS( af_ ## s ## _style_class )
 
#define AF_STYLE_FALLBACK   AF_STYLE_NONE_DFLT
 
#define AF_SCRIPT_DEFAULT   AF_SCRIPT_LATN
 
#define AF_STYLE_MASK   0x3FFF
 
#define AF_STYLE_UNASSIGNED   AF_STYLE_MASK
 
#define AF_DIGIT   0x8000U
 
#define AF_NONBASE   0x4000U
 
#define AF_PROP_INCREASE_X_HEIGHT_MIN   6
 
#define AF_PROP_INCREASE_X_HEIGHT_MAX   0
 

Typedefs

typedef struct AF_FaceGlobalsRec_ AF_FaceGlobalsRec
 

Functions

 af_face_globals_new (FT_Face face, AF_FaceGlobals *aglobals, AF_Module module)
 
 af_face_globals_get_metrics (AF_FaceGlobals globals, FT_UInt gindex, FT_UInt options, AF_StyleMetrics *ametrics)
 
 af_face_globals_free (AF_FaceGlobals globals)
 
 af_face_globals_is_digit (AF_FaceGlobals globals, FT_UInt gindex)
 

Variables

FT_BEGIN_HEADER af_writing_system_classes []
 
 af_script_classes []
 
 af_style_classes []
 

Macro Definition Documentation

◆ AF_DIGIT

#define AF_DIGIT   0x8000U

Definition at line 82 of file afglobal.h.

◆ AF_NONBASE

#define AF_NONBASE   0x4000U

Definition at line 84 of file afglobal.h.

◆ AF_PROP_INCREASE_X_HEIGHT_MAX

#define AF_PROP_INCREASE_X_HEIGHT_MAX   0

Definition at line 88 of file afglobal.h.

◆ AF_PROP_INCREASE_X_HEIGHT_MIN

#define AF_PROP_INCREASE_X_HEIGHT_MIN   6

Definition at line 87 of file afglobal.h.

◆ AF_SCRIPT_DEFAULT

#define AF_SCRIPT_DEFAULT   AF_SCRIPT_LATN

Definition at line 74 of file afglobal.h.

◆ AF_STYLE_FALLBACK

#define AF_STYLE_FALLBACK   AF_STYLE_NONE_DFLT

Definition at line 71 of file afglobal.h.

◆ AF_STYLE_MASK

#define AF_STYLE_MASK   0x3FFF

Definition at line 77 of file afglobal.h.

◆ AF_STYLE_UNASSIGNED

#define AF_STYLE_UNASSIGNED   AF_STYLE_MASK

Definition at line 79 of file afglobal.h.

◆ SCRIPT

#define SCRIPT (   s,
  S,
  d,
  h,
  H,
  ss 
)     AF_DECLARE_SCRIPT_CLASS( af_ ## s ## _script_class )

Definition at line 37 of file afglobal.h.

◆ STYLE

#define STYLE (   s,
  S,
  d,
  ws,
  sc,
  ss,
  c 
)     AF_DECLARE_STYLE_CLASS( af_ ## s ## _style_class )

Definition at line 47 of file afglobal.h.

Typedef Documentation

◆ AF_FaceGlobalsRec

Function Documentation

◆ af_face_globals_free()

af_face_globals_free ( AF_FaceGlobals  globals)

Definition at line 387 of file afglobal.c.

388 {
389 if ( globals )
390 {
391 FT_Memory memory = globals->face->memory;
392 FT_UInt nn;
393
394
395 for ( nn = 0; nn < AF_STYLE_MAX; nn++ )
396 {
397 if ( globals->metrics[nn] )
398 {
399 AF_StyleClass style_class =
401 AF_WritingSystemClass writing_system_class =
403
404
405 if ( writing_system_class->style_metrics_done )
406 writing_system_class->style_metrics_done( globals->metrics[nn] );
407
408 FT_FREE( globals->metrics[nn] );
409 }
410 }
411
412#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
413 hb_font_destroy( globals->hb_font );
414 hb_buffer_destroy( globals->hb_buf );
415#endif
416
417 /* no need to free `globals->glyph_styles'; */
418 /* it is part of the `globals' array */
419 FT_FREE( globals );
420 }
421 }
#define AF_STYLE_CLASSES_GET
Definition: afpic.h:33
#define AF_WRITING_SYSTEM_CLASSES_GET
Definition: afpic.h:31
@ AF_STYLE_MAX
Definition: aftypes.h:440
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
unsigned int FT_UInt
Definition: fttypes.h:231
static char memory[1024 *256]
Definition: process.c:116
AF_StyleMetrics metrics[AF_STYLE_MAX]
Definition: afglobal.h:119
AF_WritingSystem writing_system
Definition: aftypes.h:449
AF_WritingSystem_DoneMetricsFunc style_metrics_done
Definition: aftypes.h:283
FT_Memory memory
Definition: freetype.h:1112

Referenced by af_face_globals_new(), af_loader_reset(), and af_property_get_face_globals().

◆ af_face_globals_get_metrics()

af_face_globals_get_metrics ( AF_FaceGlobals  globals,
FT_UInt  gindex,
FT_UInt  options,
AF_StyleMetrics ametrics 
)

Definition at line 425 of file afglobal.c.

429 {
431
433 AF_WritingSystemClass writing_system_class;
434 AF_StyleClass style_class;
435
437
438
439 if ( gindex >= (FT_ULong)globals->glyph_count )
440 {
441 error = FT_THROW( Invalid_Argument );
442 goto Exit;
443 }
444
445 /* if we have a forced style (via `options'), use it, */
446 /* otherwise look into `glyph_styles' array */
447 if ( style == AF_STYLE_NONE_DFLT || style + 1 >= AF_STYLE_MAX )
448 style = (AF_Style)( globals->glyph_styles[gindex] &
450
451 style_class = AF_STYLE_CLASSES_GET[style];
452 writing_system_class = AF_WRITING_SYSTEM_CLASSES_GET
453 [style_class->writing_system];
454
455 metrics = globals->metrics[style];
456 if ( !metrics )
457 {
458 /* create the global metrics object if necessary */
459 FT_Memory memory = globals->face->memory;
460
461
462 if ( FT_ALLOC( metrics, writing_system_class->style_metrics_size ) )
463 goto Exit;
464
465 metrics->style_class = style_class;
466 metrics->globals = globals;
467
468 if ( writing_system_class->style_metrics_init )
469 {
470 error = writing_system_class->style_metrics_init( metrics,
471 globals->face );
472 if ( error )
473 {
474 if ( writing_system_class->style_metrics_done )
475 writing_system_class->style_metrics_done( metrics );
476
477 FT_FREE( metrics );
478 goto Exit;
479 }
480 }
481
482 globals->metrics[style] = metrics;
483 }
484
485 Exit:
486 *ametrics = metrics;
487
488 return error;
489 }
#define AF_STYLE_UNASSIGNED
Definition: afglobal.h:79
Arabic default style
Definition: afstyles.h:94
enum AF_Style_ AF_Style
#define NULL
Definition: types.h:112
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
unsigned long FT_ULong
Definition: fttypes.h:253
int FT_Error
Definition: fttypes.h:300
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
#define error(str)
Definition: mkdosfs.c:1605
static void Exit(void)
Definition: sock.c:1330
FT_UShort * glyph_styles
Definition: afglobal.h:109
FT_Long glyph_count
Definition: afglobal.h:108
FT_Offset style_metrics_size
Definition: aftypes.h:280
AF_WritingSystem_InitMetricsFunc style_metrics_init
Definition: aftypes.h:281

Referenced by af_loader_load_glyph().

◆ af_face_globals_is_digit()

af_face_globals_is_digit ( AF_FaceGlobals  globals,
FT_UInt  gindex 
)

Definition at line 493 of file afglobal.c.

495 {
496 if ( gindex < (FT_ULong)globals->glyph_count )
497 return (FT_Bool)( globals->glyph_styles[gindex] & AF_DIGIT );
498
499 return (FT_Bool)0;
500 }
#define AF_DIGIT
Definition: afglobal.h:82
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108

Referenced by af_loader_load_glyph().

◆ af_face_globals_new()

af_face_globals_new ( FT_Face  face,
AF_FaceGlobals aglobals,
AF_Module  module 
)

Definition at line 336 of file afglobal.c.

339 {
342 AF_FaceGlobals globals = NULL;
343
344
345 memory = face->memory;
346
347 /* we allocate an AF_FaceGlobals structure together */
348 /* with the glyph_styles array */
349 if ( FT_ALLOC( globals,
350 sizeof ( *globals ) +
351 (FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) )
352 goto Exit;
353
354 globals->face = face;
355 globals->glyph_count = face->num_glyphs;
356 /* right after the globals structure come the glyph styles */
357 globals->glyph_styles = (FT_UShort*)( globals + 1 );
358 globals->module = module;
359 globals->stem_darkening_for_ppem = 0;
360 globals->darken_x = 0;
361 globals->darken_y = 0;
362 globals->standard_vertical_width = 0;
363 globals->standard_horizontal_width = 0;
364 globals->scale_down_factor = 0;
365
366#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
367 globals->hb_font = hb_ft_font_create( face, NULL );
368 globals->hb_buf = hb_buffer_create();
369#endif
370
372 if ( error )
373 {
374 af_face_globals_free( globals );
375 globals = NULL;
376 }
377 else
379
380 Exit:
381 *aglobals = globals;
382 return error;
383 }
af_face_globals_free(AF_FaceGlobals globals)
Definition: afglobal.c:387
static FT_Error af_face_globals_compute_style_coverage(AF_FaceGlobals globals)
Definition: afglobal.c:135
#define AF_PROP_INCREASE_X_HEIGHT_MAX
Definition: afglobal.h:88
WORD face[3]
Definition: mesh.c:4747
unsigned short FT_UShort
Definition: fttypes.h:209
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
AF_Module module
Definition: afglobal.h:137
FT_UShort stem_darkening_for_ppem
Definition: afglobal.h:123
FT_Pos standard_horizontal_width
Definition: afglobal.h:129
FT_Pos standard_vertical_width
Definition: afglobal.h:126
FT_UInt increase_x_height
Definition: afglobal.h:117
FT_Fixed scale_down_factor
Definition: afglobal.h:136
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by af_loader_reset(), and af_property_get_face_globals().

Variable Documentation

◆ af_script_classes

af_script_classes[]

Definition at line 43 of file afglobal.h.

◆ af_style_classes

af_style_classes[]

Definition at line 53 of file afglobal.h.

◆ af_writing_system_classes

FT_BEGIN_HEADER af_writing_system_classes[]

Definition at line 33 of file afglobal.h.