ReactOS 0.4.16-dev-319-g6cf4263
ttobjs.h File Reference
#include <ft2build.h>
Include dependency graph for ttobjs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TT_GraphicsState_
 
struct  TT_CodeRange_
 
struct  TT_DefRecord_
 
struct  TT_Transform_
 
struct  TT_Size_Metrics_
 
struct  TT_SizeRec_
 
struct  TT_DriverRec_
 

Macros

#define TT_MAX_CODE_RANGES   3
 
#define IS_HINTED(flags)   ( ( flags & FT_LOAD_NO_HINTING ) == 0 )
 

Typedefs

typedef typedefFT_BEGIN_HEADER struct TT_DriverRec_TT_Driver
 
typedef FT_GlyphSlot TT_GlyphSlot
 
typedef struct TT_GraphicsState_ TT_GraphicsState
 
typedef enum TT_CodeRange_Tag_ TT_CodeRange_Tag
 
typedef struct TT_CodeRange_ TT_CodeRange
 
typedef TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES]
 
typedef struct TT_DefRecord_ TT_DefRecord
 
typedef struct TT_DefRecord_TT_DefArray
 
typedef struct TT_Transform_ TT_Transform
 
typedef struct TT_Size_Metrics_ TT_Size_Metrics
 
typedef struct TT_SizeRec_ TT_SizeRec
 
typedef struct TT_DriverRec_ TT_DriverRec
 

Enumerations

enum  TT_CodeRange_Tag_ { tt_coderange_none = 0 , tt_coderange_font , tt_coderange_cvt , tt_coderange_glyph }
 

Functions

 tt_face_init (FT_Stream stream, FT_Face ttface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
 
 tt_face_done (FT_Face ttface)
 
 tt_size_init (FT_Size ttsize)
 
 tt_size_done (FT_Size ttsize)
 
 tt_size_reset (TT_Size size, FT_Bool only_height)
 
 tt_driver_init (FT_Module ttdriver)
 
 tt_driver_done (FT_Module ttdriver)
 
 tt_slot_init (FT_GlyphSlot slot)
 

Macro Definition Documentation

◆ IS_HINTED

#define IS_HINTED (   flags)    ( ( flags & FT_LOAD_NO_HINTING ) == 0 )

Definition at line 417 of file ttobjs.h.

◆ TT_MAX_CODE_RANGES

#define TT_MAX_CODE_RANGES   3

Definition at line 125 of file ttobjs.h.

Typedef Documentation

◆ TT_CodeRange

◆ TT_CodeRange_Tag

◆ TT_CodeRangeTable

typedef TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES]

Definition at line 152 of file ttobjs.h.

◆ TT_DefArray

◆ TT_DefRecord

◆ TT_Driver

typedef typedefFT_BEGIN_HEADER struct TT_DriverRec_* TT_Driver

Definition at line 39 of file ttobjs.h.

◆ TT_DriverRec

◆ TT_GlyphSlot

Definition at line 54 of file ttobjs.h.

◆ TT_GraphicsState

◆ TT_Size_Metrics

◆ TT_SizeRec

◆ TT_Transform

Enumeration Type Documentation

◆ TT_CodeRange_Tag_

Enumerator
tt_coderange_none 
tt_coderange_font 
tt_coderange_cvt 
tt_coderange_glyph 

Definition at line 135 of file ttobjs.h.

136 {
141
enum TT_CodeRange_Tag_ TT_CodeRange_Tag
@ tt_coderange_none
Definition: ttobjs.h:137
@ tt_coderange_font
Definition: ttobjs.h:138
@ tt_coderange_cvt
Definition: ttobjs.h:139
@ tt_coderange_glyph
Definition: ttobjs.h:140

Function Documentation

◆ tt_driver_done()

tt_driver_done ( FT_Module  ttdriver)

Definition at line 1395 of file ttobjs.c.

1396 {
1397 FT_UNUSED( ttdriver );
1398 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ tt_driver_init()

tt_driver_init ( FT_Module  ttdriver)

Definition at line 1358 of file ttobjs.c.

1359 {
1360
1361#ifdef TT_USE_BYTECODE_INTERPRETER
1362
1363 TT_Driver driver = (TT_Driver)ttdriver;
1364
1365 driver->interpreter_version = TT_INTERPRETER_VERSION_35;
1366#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
1367 driver->interpreter_version = TT_INTERPRETER_VERSION_38;
1368#endif
1369#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
1370 driver->interpreter_version = TT_INTERPRETER_VERSION_40;
1371#endif
1372
1373#else /* !TT_USE_BYTECODE_INTERPRETER */
1374
1375 FT_UNUSED( ttdriver );
1376
1377#endif /* !TT_USE_BYTECODE_INTERPRETER */
1378
1379 return FT_Err_Ok;
1380 }
return FT_Err_Ok
Definition: ftbbox.c:511
#define TT_INTERPRETER_VERSION_38
Definition: ftdriver.h:748
#define TT_INTERPRETER_VERSION_40
Definition: ftdriver.h:749
#define TT_INTERPRETER_VERSION_35
Definition: ftdriver.h:747
struct @1678::@1679 driver
typedefFT_BEGIN_HEADER struct TT_DriverRec_ * TT_Driver
Definition: ttobjs.h:39

◆ tt_face_done()

tt_face_done ( FT_Face  ttface)

Definition at line 740 of file ttobjs.c.

741 {
742 TT_Face face = (TT_Face)ttface;
746
747
748 if ( !face )
749 return;
750
751 memory = ttface->memory;
752 stream = ttface->stream;
753 sfnt = (SFNT_Service)face->sfnt;
754
755 /* for `extended TrueType formats' (i.e. compressed versions) */
756 if ( face->extra.finalizer )
757 face->extra.finalizer( face->extra.data );
758
759 if ( sfnt )
760 sfnt->done_face( face );
761
762 /* freeing the locations table */
764
766
767 /* freeing the CVT */
768 FT_FREE( face->cvt );
769 face->cvt_size = 0;
770
771 /* freeing the programs */
772 FT_FRAME_RELEASE( face->font_program );
773 FT_FRAME_RELEASE( face->cvt_program );
774 face->font_program_size = 0;
775 face->cvt_program_size = 0;
776
777#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
778 tt_done_blend( face );
779 face->blend = NULL;
780#endif
781 }
#define NULL
Definition: types.h:112
#define FT_FREE(ptr)
Definition: ftmemory.h:329
#define FT_FRAME_RELEASE(bytes)
Definition: ftstream.h:526
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
if(dx< 0)
Definition: linetemp.h:194
static char memory[1024 *256]
Definition: process.c:116
SFNT_Interface * SFNT_Service
Definition: sfnt.h:628
FT_Stream stream
Definition: freetype.h:1113
FT_Memory memory
Definition: freetype.h:1112
TT_Done_Face_Func done_face
Definition: sfnt.h:568
Definition: parse.h:23
SFNT_Service sfnt
Definition: ttdriver.c:206
tt_face_free_hdmx(TT_Face face)
Definition: ttpload.c:602
tt_face_done_loca(TT_Face face)
Definition: ttpload.c:289
struct TT_FaceRec_ * TT_Face
Definition: tttypes.h:973

◆ tt_face_init()

tt_face_init ( FT_Stream  stream,
FT_Face  ttface,
FT_Int  face_index,
FT_Int  num_params,
FT_Parameter params 
)

Definition at line 578 of file ttobjs.c.

583 {
587 TT_Face face = (TT_Face)ttface;
588
589
590 FT_TRACE2(( "TTF driver\n" ));
591
592 library = ttface->driver->root.library;
593
595 if ( !sfnt )
596 {
597 FT_ERROR(( "tt_face_init: cannot access `sfnt' module\n" ));
598 error = FT_THROW( Missing_Module );
599 goto Exit;
600 }
601
602 /* create input stream from resource */
603 if ( FT_STREAM_SEEK( 0 ) )
604 goto Exit;
605
606 /* check that we have a valid TrueType file */
607 FT_TRACE2(( " " ));
608 error = sfnt->init_face( stream, face, face_index, num_params, params );
609
610 /* Stream may have changed. */
611 stream = face->root.stream;
612
613 if ( error )
614 goto Exit;
615
616 /* We must also be able to accept Mac/GX fonts, as well as OT ones. */
617 /* The 0x00020000 tag is completely undocumented; some fonts from */
618 /* Arphic made for Chinese Windows 3.1 have this. */
619 if ( face->format_tag != 0x00010000L && /* MS fonts */
620 face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */
621 face->format_tag != TTAG_true && /* Mac fonts */
622 face->format_tag != TTAG_0xA5kbd && /* `Keyboard.dfont' (legacy Mac OS X) */
623 face->format_tag != TTAG_0xA5lst ) /* `LastResort.dfont' (legacy Mac OS X) */
624 {
625 FT_TRACE2(( " not a TTF font\n" ));
626 goto Bad_Format;
627 }
628
629#ifdef TT_USE_BYTECODE_INTERPRETER
631#endif
632
633 /* If we are performing a simple font format check, exit immediately. */
634 if ( face_index < 0 )
635 return FT_Err_Ok;
636
637 /* Load font directory */
638 error = sfnt->load_face( stream, face, face_index, num_params, params );
639 if ( error )
640 goto Exit;
641
642 if ( tt_check_trickyness( ttface ) )
644
646 if ( error )
647 goto Exit;
648
649 if ( FT_IS_SCALABLE( ttface ) )
650 {
651#ifdef FT_CONFIG_OPTION_INCREMENTAL
652 if ( !ttface->internal->incremental_interface )
653#endif
654 {
656
657 /* having a (non-zero) `glyf' table without */
658 /* a `loca' table is not valid */
659 if ( face->glyf_len && FT_ERR_EQ( error, Table_Missing ) )
660 goto Exit;
661 if ( error )
662 goto Exit;
663 }
664
665 /* `fpgm', `cvt', and `prep' are optional */
667 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
668 goto Exit;
669
671 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
672 goto Exit;
673
675 if ( error && FT_ERR_NEQ( error, Table_Missing ) )
676 goto Exit;
677
678 /* Check the scalable flag based on `loca'. */
679#ifdef FT_CONFIG_OPTION_INCREMENTAL
680 if ( !ttface->internal->incremental_interface )
681#endif
682 {
683 if ( ttface->num_fixed_sizes &&
684 face->glyph_locations &&
685 tt_check_single_notdef( ttface ) )
686 {
687 FT_TRACE5(( "tt_face_init:"
688 " Only the `.notdef' glyph has an outline.\n"
689 " "
690 " Resetting scalable flag to FALSE.\n" ));
691
692 ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
693 }
694 }
695 }
696
697#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
698
699 {
700 FT_UInt instance_index = (FT_UInt)face_index >> 16;
701
702
703 if ( FT_HAS_MULTIPLE_MASTERS( ttface ) &&
704 instance_index > 0 )
705 {
706 error = TT_Set_Named_Instance( face, instance_index );
707 if ( error )
708 goto Exit;
709
710 tt_apply_mvar( face );
711 }
712 }
713
714#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
715
716 /* initialize standard glyph loading routines */
718
719 Exit:
720 return error;
721
722 Bad_Format:
723 error = FT_THROW( Unknown_File_Format );
724 goto Exit;
725 }
FT_Library library
Definition: cffdrivr.c:654
#define FT_FACE_FLAG_HINTER
Definition: freetype.h:1249
#define FT_HAS_MULTIPLE_MASTERS(face)
Definition: freetype.h:1402
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312
#define FT_FACE_FLAG_TRICKY
Definition: freetype.h:1251
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_TRACE5(varformat)
Definition: ftdebug.h:162
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_TRACE2(varformat)
Definition: ftdebug.h:159
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
Definition: ftobjs.c:4865
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:489
#define FT_ERR_EQ(x, e)
Definition: fttypes.h:591
int FT_Error
Definition: fttypes.h:300
#define FT_ERR_NEQ(x, e)
Definition: fttypes.h:593
unsigned int FT_UInt
Definition: fttypes.h:231
GLenum const GLfloat * params
Definition: glext.h:5645
#define error(str)
Definition: mkdosfs.c:1605
static void Exit(void)
Definition: sock.c:1330
FT_ModuleRec root
Definition: ftobjs.h:829
FT_Driver driver
Definition: freetype.h:1111
FT_Int num_fixed_sizes
Definition: freetype.h:1081
FT_Face_Internal internal
Definition: freetype.h:1120
FT_Long face_flags
Definition: freetype.h:1073
FT_Library library
Definition: ftobjs.h:536
TT_Init_Face_Func init_face
Definition: sfnt.h:566
TT_Load_Face_Func load_face
Definition: sfnt.h:567
TT_Init_Glyph_Loading(TT_Face face)
Definition: ttgload.c:742
static FT_Bool tt_check_trickyness(FT_Face face)
Definition: ttobjs.c:483
static FT_Bool tt_check_single_notdef(FT_Face ttface)
Definition: ttobjs.c:505
tt_face_load_prep(TT_Face face, FT_Stream stream)
Definition: ttpload.c:461
tt_face_load_cvt(TT_Face face, FT_Stream stream)
Definition: ttpload.c:318
tt_face_load_fpgm(TT_Face face, FT_Stream stream)
Definition: ttpload.c:399
tt_face_load_hdmx(TT_Face face, FT_Stream stream)
Definition: ttpload.c:522
tt_face_load_loca(TT_Face face, FT_Stream stream)
Definition: ttpload.c:62
#define TTAG_true
Definition: tttags.h:98
#define TTAG_0xA5kbd
Definition: tttags.h:110
#define TTAG_0xA5lst
Definition: tttags.h:113

◆ tt_size_done()

tt_size_done ( FT_Size  ttsize)

Definition at line 1221 of file ttobjs.c.

1222 {
1223 TT_Size size = (TT_Size)ttsize;
1224
1225
1226#ifdef TT_USE_BYTECODE_INTERPRETER
1227 tt_size_done_bytecode( ttsize );
1228#endif
1229
1230 size->ttmetrics.valid = FALSE;
1231 }
#define FALSE
Definition: types.h:117
GLsizeiptr size
Definition: glext.h:5919
struct TT_SizeRec_ * TT_Size
Definition: tttypes.h:1631

◆ tt_size_init()

tt_size_init ( FT_Size  ttsize)

Definition at line 1191 of file ttobjs.c.

1192 {
1193 TT_Size size = (TT_Size)ttsize;
1195
1196
1197#ifdef TT_USE_BYTECODE_INTERPRETER
1198 size->bytecode_ready = -1;
1199 size->cvt_ready = -1;
1200#endif
1201
1202 size->ttmetrics.valid = FALSE;
1203 size->strike_index = 0xFFFFFFFFUL;
1204
1205 return error;
1206 }

◆ tt_size_reset()

tt_size_reset ( TT_Size  size,
FT_Bool  only_height 
)

Definition at line 1251 of file ttobjs.c.

1253 {
1254 TT_Face face;
1255 FT_Size_Metrics* size_metrics;
1256
1257
1258 face = (TT_Face)size->root.face;
1259
1260 /* nothing to do for CFF2 */
1261 if ( face->is_cff2 )
1262 return FT_Err_Ok;
1263
1264 size->ttmetrics.valid = FALSE;
1265
1266 size_metrics = &size->hinted_metrics;
1267
1268 /* copy the result from base layer */
1269 *size_metrics = size->root.metrics;
1270
1271 if ( size_metrics->x_ppem < 1 || size_metrics->y_ppem < 1 )
1272 return FT_THROW( Invalid_PPem );
1273
1274 /* This bit flag, if set, indicates that the ppems must be */
1275 /* rounded to integers. Nearly all TrueType fonts have this bit */
1276 /* set, as hinting won't work really well otherwise. */
1277 /* */
1278 if ( face->header.Flags & 8 )
1279 {
1280 /* the TT spec always asks for ROUND, not FLOOR or CEIL */
1281 size_metrics->ascender = FT_PIX_ROUND(
1282 FT_MulFix( face->root.ascender,
1283 size_metrics->y_scale ) );
1284 size_metrics->descender = FT_PIX_ROUND(
1285 FT_MulFix( face->root.descender,
1286 size_metrics->y_scale ) );
1287 size_metrics->height = FT_PIX_ROUND(
1288 FT_MulFix( face->root.height,
1289 size_metrics->y_scale ) );
1290 }
1291
1292 size->ttmetrics.valid = TRUE;
1293
1294 if ( only_height )
1295 {
1296 /* we must not recompute the scaling values here since */
1297 /* `tt_size_reset' was already called (with only_height = 0) */
1298 return FT_Err_Ok;
1299 }
1300
1301 if ( face->header.Flags & 8 )
1302 {
1303 /* base scaling values on integer ppem values, */
1304 /* as mandated by the TrueType specification */
1305 size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6,
1306 face->root.units_per_EM );
1307 size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6,
1308 face->root.units_per_EM );
1309
1310 size_metrics->max_advance = FT_PIX_ROUND(
1311 FT_MulFix( face->root.max_advance_width,
1312 size_metrics->x_scale ) );
1313 }
1314
1315 /* compute new transformation */
1316 if ( size_metrics->x_ppem >= size_metrics->y_ppem )
1317 {
1318 size->ttmetrics.scale = size_metrics->x_scale;
1319 size->ttmetrics.ppem = size_metrics->x_ppem;
1320 size->ttmetrics.x_ratio = 0x10000L;
1321 size->ttmetrics.y_ratio = FT_DivFix( size_metrics->y_ppem,
1322 size_metrics->x_ppem );
1323 }
1324 else
1325 {
1326 size->ttmetrics.scale = size_metrics->y_scale;
1327 size->ttmetrics.ppem = size_metrics->y_ppem;
1328 size->ttmetrics.x_ratio = FT_DivFix( size_metrics->x_ppem,
1329 size_metrics->y_ppem );
1330 size->ttmetrics.y_ratio = 0x10000L;
1331 }
1332
1333 size->metrics = size_metrics;
1334
1335#ifdef TT_USE_BYTECODE_INTERPRETER
1336 size->cvt_ready = -1;
1337#endif /* TT_USE_BYTECODE_INTERPRETER */
1338
1339 return FT_Err_Ok;
1340 }
#define TRUE
Definition: types.h:120
WORD face[3]
Definition: mesh.c:4747
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:608
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:509
#define FT_PIX_ROUND(x)
Definition: ftobjs.h:93
FT_Fixed y_scale
Definition: freetype.h:1644
FT_Fixed x_scale
Definition: freetype.h:1643
FT_Pos descender
Definition: freetype.h:1647
FT_UShort x_ppem
Definition: freetype.h:1640
FT_UShort y_ppem
Definition: freetype.h:1641
FT_Pos max_advance
Definition: freetype.h:1649

Referenced by tt_size_request().

◆ tt_slot_init()

tt_slot_init ( FT_GlyphSlot  slot)

Definition at line 1416 of file ttobjs.c.

1417 {
1418 return FT_GlyphLoader_CreateExtra( slot->internal->loader );
1419 }
FT_GlyphLoader_CreateExtra(FT_GlyphLoader loader)
Definition: ftgloadr.c:166
Definition: vfat.h:185