ReactOS 0.4.15-dev-7942-gd23573b
ttdriver.c File Reference
#include <ft2build.h>
#include "ttdriver.h"
#include "ttgload.h"
#include "ttpload.h"
#include "tterrors.h"
#include "ttpic.h"
Include dependency graph for ttdriver.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_ttdriver
 
#define TT_HINTER_FLAG   0
 
#define TT_SIZE_SELECT   0
 

Functions

static FT_Error tt_property_set (FT_Module module, const char *property_name, const void *value, FT_Bool value_is_string)
 
static FT_Error tt_property_get (FT_Module module, const char *property_name, const void *value)
 
 FT_DEFINE_SERVICE_PROPERTIESREC (tt_service_properties,(FT_Properties_SetFunc) tt_property_set,(FT_Properties_GetFunc) tt_property_get) static FT_Error tt_get_kerning(FT_Face ttface
 
 if (sfnt)
 
static FT_Error tt_size_request (FT_Size size, FT_Size_Request req)
 
static FT_Error tt_glyph_load (FT_GlyphSlot ttslot, FT_Size ttsize, FT_UInt glyph_index, FT_Int32 load_flags)
 
 FT_DEFINE_SERVICE_TTGLYFREC (tt_service_truetype_glyf,(TT_Glyf_GetLocationFunc) tt_face_get_location) FT_DEFINE_SERVICEDESCREC4(tt_services
 
&TT_SERVICE_PROPERTIES_GET tt_get_interface (FT_Module driver, const char *tt_interface)
 

Variables

FT_UInt left_glyph
 
FT_UInt FT_UInt right_glyph
 
FT_UInt FT_UInt FT_Vectorkerning
 
SFNT_Service sfnt = (SFNT_Service)face->sfnt
 
kerning x = 0
 
kerning y = 0
 
static const FT_Service_TrueTypeEngineRec tt_service_truetype_engine
 
 FT_SERVICE_ID_FONT_FORMAT
 
 FT_FONT_FORMAT_TRUETYPE
 
 FT_SERVICE_ID_TRUETYPE_ENGINE
 
 FT_SERVICE_ID_TT_GLYF
 
TT_SERVICE_TRUETYPE_GLYF_GET
 
 FT_SERVICE_ID_PROPERTIES
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_ttdriver

Definition at line 55 of file ttdriver.c.

◆ TT_HINTER_FLAG

#define TT_HINTER_FLAG   0

Definition at line 616 of file ttdriver.c.

◆ TT_SIZE_SELECT

#define TT_SIZE_SELECT   0

Definition at line 622 of file ttdriver.c.

Function Documentation

◆ FT_DEFINE_SERVICE_PROPERTIESREC()

FT_DEFINE_SERVICE_PROPERTIESREC ( tt_service_properties  ,
(FT_Properties_SetFunc tt_property_set,
(FT_Properties_GetFunc tt_property_get 
)

◆ FT_DEFINE_SERVICE_TTGLYFREC()

FT_DEFINE_SERVICE_TTGLYFREC ( tt_service_truetype_glyf  ,
(TT_Glyf_GetLocationFunc tt_face_get_location 
)

◆ if()

if ( sfnt  )

Definition at line 212 of file ttdriver.c.

225 {
226 FT_UInt nn;
227 TT_Face face = (TT_Face)ttface;
228
229
230 /* XXX: TODO: check for sbits */
231
233 {
234#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
235 /* no fast retrieval for blended MM fonts without VVAR table */
236 if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) &&
237 !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
238 return FT_THROW( Unimplemented_Feature );
239#endif
240
241 for ( nn = 0; nn < count; nn++ )
242 {
243 FT_Short tsb;
244 FT_UShort ah;
245
246
247 /* since we don't need `tsb', we use zero for `yMax' parameter */
248 TT_Get_VMetrics( face, start + nn, 0, &tsb, &ah );
249 advances[nn] = ah;
250 }
251 }
252 else
253 {
254#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
255 /* no fast retrieval for blended MM fonts without HVAR table */
256 if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) &&
257 !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
258 return FT_THROW( Unimplemented_Feature );
259#endif
260
261 for ( nn = 0; nn < count; nn++ )
262 {
263 FT_Short lsb;
264 FT_UShort aw;
265
266
267 TT_Get_HMetrics( face, start + nn, &lsb, &aw );
268 advances[nn] = aw;
269 }
270 }
271
272 return FT_Err_Ok;
273 }
#define FT_LOAD_VERTICAL_LAYOUT
Definition: freetype.h:3013
#define FT_IS_VARIATION(face)
Definition: freetype.h:1442
#define FT_IS_NAMED_INSTANCE(face)
Definition: freetype.h:1424
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_THROW(e)
Definition: ftdebug.h:213
unsigned short FT_UShort
Definition: fttypes.h:209
signed short FT_Short
Definition: fttypes.h:198
unsigned int FT_UInt
Definition: fttypes.h:231
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLbitfield flags
Definition: glext.h:7161
TT_Get_HMetrics(TT_Face face, FT_UInt idx, FT_Short *lsb, FT_UShort *aw)
Definition: ttgload.c:75
TT_Get_VMetrics(TT_Face face, FT_UInt idx, FT_Pos yMax, FT_Short *tsb, FT_UShort *ah)
Definition: ttgload.c:93
#define TT_FACE_FLAG_VAR_HADVANCE
Definition: tttypes.h:1113
struct TT_FaceRec_ * TT_Face
Definition: tttypes.h:973
#define TT_FACE_FLAG_VAR_VADVANCE
Definition: tttypes.h:1118

◆ tt_get_interface()

&TT_SERVICE_PROPERTIES_GET tt_get_interface ( FT_Module  driver,
const char tt_interface 
)

Definition at line 568 of file ttdriver.c.

570 {
573 FT_Module sfntd;
575
576
577 /* TT_SERVICES_GET dereferences `library' in PIC mode */
578#ifdef FT_CONFIG_OPTION_PIC
579 if ( !driver )
580 return NULL;
581 library = driver->library;
582 if ( !library )
583 return NULL;
584#endif
585
587 if ( result )
588 return result;
589
590#ifndef FT_CONFIG_OPTION_PIC
591 if ( !driver )
592 return NULL;
593 library = driver->library;
594 if ( !library )
595 return NULL;
596#endif
597
598 /* only return the default interface from the SFNT module */
599 sfntd = FT_Get_Module( library, "sfnt" );
600 if ( sfntd )
601 {
603 if ( sfnt )
604 return sfnt->get_interface( driver, tt_interface );
605 }
606
607 return 0;
608 }
FT_Library library
Definition: cffdrivr.c:654
#define NULL
Definition: types.h:112
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4837
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:98
GLuint64EXT * result
Definition: glext.h:11304
struct @1669::@1670 driver
SFNT_Interface * SFNT_Service
Definition: sfnt.h:628
FT_Module_Class * clazz
Definition: ftobjs.h:535
const void * module_interface
Definition: ftmodapi.h:225
FT_Module_Requester get_interface
Definition: sfnt.h:569
SFNT_Service sfnt
Definition: ttdriver.c:206
#define TT_SERVICES_GET
Definition: ttpic.h:28

◆ tt_glyph_load()

static FT_Error tt_glyph_load ( FT_GlyphSlot  ttslot,
FT_Size  ttsize,
FT_UInt  glyph_index,
FT_Int32  load_flags 
)
static

Definition at line 414 of file ttdriver.c.

418 {
420 TT_Size size = (TT_Size)ttsize;
421 FT_Face face = ttslot->face;
423
424
425 if ( !slot )
426 return FT_THROW( Invalid_Slot_Handle );
427
428 if ( !size )
429 return FT_THROW( Invalid_Size_Handle );
430
431 if ( !face )
432 return FT_THROW( Invalid_Face_Handle );
433
434#ifdef FT_CONFIG_OPTION_INCREMENTAL
435 if ( glyph_index >= (FT_UInt)face->num_glyphs &&
436 !face->internal->incremental_interface )
437#else
438 if ( glyph_index >= (FT_UInt)face->num_glyphs )
439#endif
440 return FT_THROW( Invalid_Argument );
441
442 if ( load_flags & FT_LOAD_NO_HINTING )
443 {
444 /* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT */
445 /* are necessary to disable hinting for tricky fonts */
446
447 if ( FT_IS_TRICKY( face ) )
448 load_flags &= ~FT_LOAD_NO_HINTING;
449
450 if ( load_flags & FT_LOAD_NO_AUTOHINT )
451 load_flags |= FT_LOAD_NO_HINTING;
452 }
453
454 if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
455 {
456 load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;
457
458 if ( !FT_IS_TRICKY( face ) )
459 load_flags |= FT_LOAD_NO_HINTING;
460 }
461
462 /* use hinted metrics only if we load a glyph with hinting */
463 size->metrics = ( load_flags & FT_LOAD_NO_HINTING )
464 ? &ttsize->metrics
465 : &size->hinted_metrics;
466
467 /* now load the glyph outline if necessary */
468 error = TT_Load_Glyph( size, slot, glyph_index, load_flags );
469
470 /* force drop-out mode to 2 - irrelevant now */
471 /* slot->outline.dropout_mode = 2; */
472
473 return error;
474 }
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
#define FT_LOAD_NO_SCALE
Definition: freetype.h:3009
#define FT_LOAD_NO_RECURSE
Definition: freetype.h:3018
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3010
#define FT_LOAD_NO_AUTOHINT
Definition: freetype.h:3022
#define FT_IS_TRICKY(face)
Definition: freetype.h:1474
int FT_Error
Definition: fttypes.h:300
GLsizeiptr size
Definition: glext.h:5919
#define error(str)
Definition: mkdosfs.c:1605
FT_Size_Metrics metrics
Definition: freetype.h:1677
Definition: vfat.h:185
TT_Load_Glyph(TT_Size size, TT_GlyphSlot glyph, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ttgload.c:2687
FT_GlyphSlot TT_GlyphSlot
Definition: ttobjs.h:54
struct TT_SizeRec_ * TT_Size
Definition: tttypes.h:1631

◆ tt_property_get()

static FT_Error tt_property_get ( FT_Module  module,
const char property_name,
const void value 
)
static

Definition at line 120 of file ttdriver.c.

123 {
126
127 FT_UInt interpreter_version = driver->interpreter_version;
128
129
130 if ( !ft_strcmp( property_name, "interpreter-version" ) )
131 {
133
134
135 *val = interpreter_version;
136
137 return error;
138 }
139
140 FT_TRACE0(( "tt_property_get: missing property `%s'\n",
141 property_name ));
142 return FT_THROW( Missing_Property );
143 }
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
#define ft_strcmp
Definition: ftstdlib.h:86
GLuint GLfloat * val
Definition: glext.h:7180
typedefFT_BEGIN_HEADER struct TT_DriverRec_ * TT_Driver
Definition: ttobjs.h:39
Definition: pdh_main.c:94

◆ tt_property_set()

static FT_Error tt_property_set ( FT_Module  module,
const char property_name,
const void value,
FT_Bool  value_is_string 
)
static

Definition at line 63 of file ttdriver.c.

67 {
70
71#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
72 FT_UNUSED( value_is_string );
73#endif
74
75
76 if ( !ft_strcmp( property_name, "interpreter-version" ) )
77 {
78 FT_UInt interpreter_version;
79
80
81#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
82 if ( value_is_string )
83 {
84 const char* s = (const char*)value;
85
86
87 interpreter_version = (FT_UInt)ft_strtol( s, NULL, 10 );
88 }
89 else
90#endif
91 {
92 FT_UInt* iv = (FT_UInt*)value;
93
94
95 interpreter_version = *iv;
96 }
97
98 if ( interpreter_version == TT_INTERPRETER_VERSION_35
100 || interpreter_version == TT_INTERPRETER_VERSION_38
101#endif
103 || interpreter_version == TT_INTERPRETER_VERSION_40
104#endif
105 )
106 driver->interpreter_version = interpreter_version;
107 else
108 error = FT_ERR( Unimplemented_Feature );
109
110 return error;
111 }
112
113 FT_TRACE0(( "tt_property_set: missing property `%s'\n",
114 property_name ));
115 return FT_THROW( Missing_Property );
116 }
#define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
Definition: ftoption.h:887
#define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
Definition: ftoption.h:883
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#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
#define ft_strtol
Definition: ftstdlib.h:145
#define FT_ERR(e)
Definition: fttypes.h:586
GLdouble s
Definition: gl.h:2039

◆ tt_size_request()

static FT_Error tt_size_request ( FT_Size  size,
FT_Size_Request  req 
)
static

Definition at line 329 of file ttdriver.c.

331 {
332 TT_Size ttsize = (TT_Size)size;
334
335
336#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
337
338 if ( FT_HAS_FIXED_SIZES( size->face ) )
339 {
340 TT_Face ttface = (TT_Face)size->face;
342 FT_ULong strike_index;
343
344
345 error = sfnt->set_sbit_strike( ttface, req, &strike_index );
346
347 if ( error )
348 ttsize->strike_index = 0xFFFFFFFFUL;
349 else
350 return tt_size_select( size, strike_index );
351 }
352
353#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
354
355 FT_Request_Metrics( size->face, req );
356
357 if ( FT_IS_SCALABLE( size->face ) )
358 {
359 error = tt_size_reset( ttsize, 0 );
360
361#ifdef TT_USE_BYTECODE_INTERPRETER
362 /* for the `MPS' bytecode instruction we need the point size */
363 if ( !error )
364 {
365 FT_UInt resolution =
366 ttsize->metrics->x_ppem > ttsize->metrics->y_ppem
367 ? req->horiResolution
368 : req->vertResolution;
369
370
371 /* if we don't have a resolution value, assume 72dpi */
372 if ( req->type == FT_SIZE_REQUEST_TYPE_SCALES ||
373 !resolution )
374 resolution = 72;
375
376 ttsize->point_size = FT_MulDiv( ttsize->ttmetrics.ppem,
377 64 * 72,
378 resolution );
379 }
380#endif
381 }
382
383 return error;
384 }
@ FT_SIZE_REQUEST_TYPE_SCALES
Definition: freetype.h:2574
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1361
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:416
FT_Request_Metrics(FT_Face face, FT_Size_Request req)
Definition: ftobjs.c:3028
unsigned long FT_ULong
Definition: fttypes.h:253
FT_UShort x_ppem
Definition: freetype.h:1640
FT_UShort y_ppem
Definition: freetype.h:1641
FT_UInt horiResolution
Definition: freetype.h:2622
FT_Size_Request_Type type
Definition: freetype.h:2619
FT_UInt vertResolution
Definition: freetype.h:2623
TT_Set_SBit_Strike_Func set_sbit_strike
Definition: sfnt.h:616
void * sfnt
Definition: tttypes.h:1428
FT_Size_Metrics * metrics
Definition: ttobjs.h:281
TT_Size_Metrics ttmetrics
Definition: ttobjs.h:284
FT_ULong strike_index
Definition: ttobjs.h:286
FT_UShort ppem
Definition: ttobjs.h:257
tt_size_reset(TT_Size size, FT_Bool only_height)
Definition: ttobjs.c:1251

Variable Documentation

◆ FT_FONT_FORMAT_TRUETYPE

FT_FONT_FORMAT_TRUETYPE

Definition at line 560 of file ttdriver.c.

◆ FT_SERVICE_ID_FONT_FORMAT

FT_SERVICE_ID_FONT_FORMAT

Definition at line 560 of file ttdriver.c.

◆ FT_SERVICE_ID_PROPERTIES

FT_SERVICE_ID_PROPERTIES

Definition at line 563 of file ttdriver.c.

◆ FT_SERVICE_ID_TRUETYPE_ENGINE

FT_SERVICE_ID_TRUETYPE_ENGINE

Definition at line 561 of file ttdriver.c.

◆ FT_SERVICE_ID_TT_GLYF

FT_SERVICE_ID_TT_GLYF

Definition at line 562 of file ttdriver.c.

◆ kerning

◆ left_glyph

FT_UInt left_glyph

Definition at line 201 of file ttdriver.c.

Referenced by cff_get_kerning(), FT_Get_Kerning(), Get_Kerning(), and tt_face_get_kerning().

◆ right_glyph

FT_UInt FT_UInt right_glyph

Definition at line 202 of file ttdriver.c.

Referenced by cff_get_kerning(), FT_Get_Kerning(), Get_Kerning(), and tt_face_get_kerning().

◆ sfnt

◆ tt_service_truetype_engine

& tt_service_truetype_engine
static
Initial value:
=
{
}
@ FT_TRUETYPE_ENGINE_TYPE_NONE
Definition: ftmodapi.h:673

Definition at line 525 of file ttdriver.c.

◆ TT_SERVICE_TRUETYPE_GLYF_GET

& TT_SERVICE_TRUETYPE_GLYF_GET

Definition at line 562 of file ttdriver.c.

◆ x

kerning x = 0

Definition at line 209 of file ttdriver.c.

◆ y

kerning y = 0

Definition at line 210 of file ttdriver.c.