sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
fttypes.h
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* fttypes.h
4
*
5
* FreeType simple types definitions (specification only).
6
*
7
* Copyright (C) 1996-2025 by
8
* David Turner, Robert Wilhelm, and Werner Lemberg.
9
*
10
* This file is part of the FreeType project, and may only be used,
11
* modified, and distributed under the terms of the FreeType project
12
* license, LICENSE.TXT. By continuing to use, modify, or distribute
13
* this file you indicate that you have read the license and
14
* understand and accept it fully.
15
*
16
*/
17
18
23
#ifndef FTTYPES_H_
24
#define FTTYPES_H_
25
26
27
#include <
ft2build.h
>
28
#include FT_CONFIG_CONFIG_H
29
#include <
freetype/ftsystem.h
>
30
#include <
freetype/ftimage.h
>
31
32
#include <stddef.h>
33
34
35
FT_BEGIN_HEADER
36
37
38
/**************************************************************************
39
*
40
* @section:
41
* basic_types
42
*
43
* @title:
44
* Basic Data Types
45
*
46
* @abstract:
47
* The basic data types defined by the library.
48
*
49
* @description:
50
* This section contains the basic data types defined by FreeType~2,
51
* ranging from simple scalar types to bitmap descriptors. More
52
* font-specific structures are defined in a different section. Note
53
* that FreeType does not use floating-point data types. Fractional
54
* values are represented by fixed-point integers, with lower bits
55
* storing the fractional part.
56
*
57
* @order:
58
* FT_Byte
59
* FT_Bytes
60
* FT_Char
61
* FT_Int
62
* FT_UInt
63
* FT_Int16
64
* FT_UInt16
65
* FT_Int32
66
* FT_UInt32
67
* FT_Int64
68
* FT_UInt64
69
* FT_Short
70
* FT_UShort
71
* FT_Long
72
* FT_ULong
73
* FT_Bool
74
* FT_Offset
75
* FT_PtrDist
76
* FT_String
77
* FT_Tag
78
* FT_Error
79
* FT_Fixed
80
* FT_Pointer
81
* FT_Pos
82
* FT_Vector
83
* FT_BBox
84
* FT_Matrix
85
* FT_FWord
86
* FT_UFWord
87
* FT_F2Dot14
88
* FT_UnitVector
89
* FT_F26Dot6
90
* FT_Data
91
*
92
* FT_MAKE_TAG
93
*
94
* FT_Generic
95
* FT_Generic_Finalizer
96
*
97
* FT_Bitmap
98
* FT_Pixel_Mode
99
* FT_Palette_Mode
100
* FT_Glyph_Format
101
* FT_IMAGE_TAG
102
*
103
*/
104
105
106
/**************************************************************************
107
*
108
* @type:
109
* FT_Bool
110
*
111
* @description:
112
* A typedef of unsigned char, used for simple booleans. As usual,
113
* values 1 and~0 represent true and false, respectively.
114
*/
115
typedef
unsigned
char
FT_Bool;
116
117
118
/**************************************************************************
119
*
120
* @type:
121
* FT_FWord
122
*
123
* @description:
124
* A signed 16-bit integer used to store a distance in original font
125
* units.
126
*/
127
typedef
signed
short
FT_FWord;
/* distance in FUnits */
128
129
130
/**************************************************************************
131
*
132
* @type:
133
* FT_UFWord
134
*
135
* @description:
136
* An unsigned 16-bit integer used to store a distance in original font
137
* units.
138
*/
139
typedef
unsigned
short
FT_UFWord;
/* unsigned distance */
140
141
142
/**************************************************************************
143
*
144
* @type:
145
* FT_Char
146
*
147
* @description:
148
* A simple typedef for the _signed_ char type.
149
*/
150
typedef
signed
char
FT_Char;
151
152
153
/**************************************************************************
154
*
155
* @type:
156
* FT_Byte
157
*
158
* @description:
159
* A simple typedef for the _unsigned_ char type.
160
*/
161
typedef
unsigned
char
FT_Byte;
162
163
164
/**************************************************************************
165
*
166
* @type:
167
* FT_Bytes
168
*
169
* @description:
170
* A typedef for constant memory areas.
171
*/
172
typedef
const
FT_Byte* FT_Bytes;
173
174
175
/**************************************************************************
176
*
177
* @type:
178
* FT_Tag
179
*
180
* @description:
181
* A typedef for 32-bit tags (as used in the SFNT format).
182
*/
183
typedef
FT_UInt32 FT_Tag;
184
185
186
/**************************************************************************
187
*
188
* @type:
189
* FT_String
190
*
191
* @description:
192
* A simple typedef for the char type, usually used for strings.
193
*/
194
typedef
char
FT_String;
195
196
197
/**************************************************************************
198
*
199
* @type:
200
* FT_Short
201
*
202
* @description:
203
* A typedef for signed short.
204
*/
205
typedef
signed
short
FT_Short;
206
207
208
/**************************************************************************
209
*
210
* @type:
211
* FT_UShort
212
*
213
* @description:
214
* A typedef for unsigned short.
215
*/
216
typedef
unsigned
short
FT_UShort;
217
218
219
/**************************************************************************
220
*
221
* @type:
222
* FT_Int
223
*
224
* @description:
225
* A typedef for the int type.
226
*/
227
typedef
signed
int
FT_Int;
228
229
230
/**************************************************************************
231
*
232
* @type:
233
* FT_UInt
234
*
235
* @description:
236
* A typedef for the unsigned int type.
237
*/
238
typedef
unsigned
int
FT_UInt;
239
240
241
/**************************************************************************
242
*
243
* @type:
244
* FT_Long
245
*
246
* @description:
247
* A typedef for signed long.
248
*/
249
typedef
signed
long
FT_Long;
250
251
252
/**************************************************************************
253
*
254
* @type:
255
* FT_ULong
256
*
257
* @description:
258
* A typedef for unsigned long.
259
*/
260
typedef
unsigned
long
FT_ULong;
261
262
263
/**************************************************************************
264
*
265
* @type:
266
* FT_F2Dot14
267
*
268
* @description:
269
* A signed 2.14 fixed-point type used for unit vectors.
270
*/
271
typedef
signed
short
FT_F2Dot14;
272
273
274
/**************************************************************************
275
*
276
* @type:
277
* FT_F26Dot6
278
*
279
* @description:
280
* A signed 26.6 fixed-point type used for vectorial pixel coordinates.
281
*/
282
typedef
signed
long
FT_F26Dot6;
283
284
285
/**************************************************************************
286
*
287
* @type:
288
* FT_Fixed
289
*
290
* @description:
291
* This type is used to store 16.16 fixed-point values, like scaling
292
* values or matrix coefficients.
293
*/
294
typedef
signed
long
FT_Fixed;
295
296
297
/**************************************************************************
298
*
299
* @type:
300
* FT_Error
301
*
302
* @description:
303
* The FreeType error code type. A value of~0 is always interpreted as a
304
* successful operation.
305
*/
306
typedef
int
FT_Error;
307
308
309
/**************************************************************************
310
*
311
* @type:
312
* FT_Pointer
313
*
314
* @description:
315
* A simple typedef for a typeless pointer.
316
*/
317
typedef
void
* FT_Pointer;
318
319
320
/**************************************************************************
321
*
322
* @type:
323
* FT_Offset
324
*
325
* @description:
326
* This is equivalent to the ANSI~C `size_t` type, i.e., the largest
327
* _unsigned_ integer type used to express a file size or position, or a
328
* memory block size.
329
*/
330
typedef
size_t
FT_Offset;
331
332
333
/**************************************************************************
334
*
335
* @type:
336
* FT_PtrDist
337
*
338
* @description:
339
* This is equivalent to the ANSI~C `ptrdiff_t` type, i.e., the largest
340
* _signed_ integer type used to express the distance between two
341
* pointers.
342
*/
343
typedef
ft_ptrdiff_t FT_PtrDist;
344
345
346
/**************************************************************************
347
*
348
* @struct:
349
* FT_UnitVector
350
*
351
* @description:
352
* A simple structure used to store a 2D vector unit vector. Uses
353
* FT_F2Dot14 types.
354
*
355
* @fields:
356
* x ::
357
* Horizontal coordinate.
358
*
359
* y ::
360
* Vertical coordinate.
361
*/
362
typedef
struct
FT_UnitVector_
363
{
364
FT_F2Dot14 x;
365
FT_F2Dot14 y;
366
367
} FT_UnitVector;
368
369
370
/**************************************************************************
371
*
372
* @struct:
373
* FT_Matrix
374
*
375
* @description:
376
* A simple structure used to store a 2x2 matrix. Coefficients are in
377
* 16.16 fixed-point format. The computation performed is:
378
*
379
* ```
380
* x' = x*xx + y*xy
381
* y' = x*yx + y*yy
382
* ```
383
*
384
* @fields:
385
* xx ::
386
* Matrix coefficient.
387
*
388
* xy ::
389
* Matrix coefficient.
390
*
391
* yx ::
392
* Matrix coefficient.
393
*
394
* yy ::
395
* Matrix coefficient.
396
*/
397
typedef
struct
FT_Matrix_
398
{
399
FT_Fixed xx, xy;
400
FT_Fixed yx, yy;
401
402
} FT_Matrix;
403
404
405
/**************************************************************************
406
*
407
* @struct:
408
* FT_Data
409
*
410
* @description:
411
* Read-only binary data represented as a pointer and a length.
412
*
413
* @fields:
414
* pointer ::
415
* The data.
416
*
417
* length ::
418
* The length of the data in bytes.
419
*/
420
typedef
struct
FT_Data_
421
{
422
const
FT_Byte* pointer;
423
FT_UInt length;
424
425
} FT_Data;
426
427
428
/**************************************************************************
429
*
430
* @functype:
431
* FT_Generic_Finalizer
432
*
433
* @description:
434
* Describe a function used to destroy the 'client' data of any FreeType
435
* object. See the description of the @FT_Generic type for details of
436
* usage.
437
*
438
* @input:
439
* The address of the FreeType object that is under finalization. Its
440
* client data is accessed through its `generic` field.
441
*/
442
typedef
void (*FT_Generic_Finalizer)(
void
* object );
443
444
445
/**************************************************************************
446
*
447
* @struct:
448
* FT_Generic
449
*
450
* @description:
451
* Client applications often need to associate their own data to a
452
* variety of FreeType core objects. For example, a text layout API
453
* might want to associate a glyph cache to a given size object.
454
*
455
* Some FreeType object contains a `generic` field, of type `FT_Generic`,
456
* which usage is left to client applications and font servers.
457
*
458
* It can be used to store a pointer to client-specific data, as well as
459
* the address of a 'finalizer' function, which will be called by
460
* FreeType when the object is destroyed (for example, the previous
461
* client example would put the address of the glyph cache destructor in
462
* the `finalizer` field).
463
*
464
* @fields:
465
* data ::
466
* A typeless pointer to any client-specified data. This field is
467
* completely ignored by the FreeType library.
468
*
469
* finalizer ::
470
* A pointer to a 'generic finalizer' function, which will be called
471
* when the object is destroyed. If this field is set to `NULL`, no
472
* code will be called.
473
*/
474
typedef
struct
FT_Generic_
475
{
476
void
* data;
477
FT_Generic_Finalizer finalizer;
478
479
} FT_Generic;
480
481
482
/**************************************************************************
483
*
484
* @macro:
485
* FT_MAKE_TAG
486
*
487
* @description:
488
* This macro converts four-letter tags that are used to label TrueType
489
* tables into an `FT_Tag` type, to be used within FreeType.
490
*
491
* @note:
492
* The produced values **must** be 32-bit integers. Don't redefine this
493
* macro.
494
*/
495
#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
496
( ( FT_STATIC_BYTE_CAST( FT_Tag, _x1 ) << 24 ) | \
497
( FT_STATIC_BYTE_CAST( FT_Tag, _x2 ) << 16 ) | \
498
( FT_STATIC_BYTE_CAST( FT_Tag, _x3 ) << 8 ) | \
499
FT_STATIC_BYTE_CAST( FT_Tag, _x4 ) )
500
501
502
/*************************************************************************/
503
/*************************************************************************/
504
/* */
505
/* L I S T M A N A G E M E N T */
506
/* */
507
/*************************************************************************/
508
/*************************************************************************/
509
510
511
/**************************************************************************
512
*
513
* @section:
514
* list_processing
515
*
516
*/
517
518
519
/**************************************************************************
520
*
521
* @type:
522
* FT_ListNode
523
*
524
* @description:
525
* Many elements and objects in FreeType are listed through an @FT_List
526
* record (see @FT_ListRec). As its name suggests, an FT_ListNode is a
527
* handle to a single list element.
528
*/
529
typedef
struct
FT_ListNodeRec_
* FT_ListNode;
530
531
532
/**************************************************************************
533
*
534
* @type:
535
* FT_List
536
*
537
* @description:
538
* A handle to a list record (see @FT_ListRec).
539
*/
540
typedef
struct
FT_ListRec_
* FT_List;
541
542
543
/**************************************************************************
544
*
545
* @struct:
546
* FT_ListNodeRec
547
*
548
* @description:
549
* A structure used to hold a single list element.
550
*
551
* @fields:
552
* prev ::
553
* The previous element in the list. `NULL` if first.
554
*
555
* next ::
556
* The next element in the list. `NULL` if last.
557
*
558
* data ::
559
* A typeless pointer to the listed object.
560
*/
561
typedef
struct
FT_ListNodeRec_
562
{
563
FT_ListNode prev;
564
FT_ListNode next;
565
void
* data;
566
567
} FT_ListNodeRec;
568
569
570
/**************************************************************************
571
*
572
* @struct:
573
* FT_ListRec
574
*
575
* @description:
576
* A structure used to hold a simple doubly-linked list. These are used
577
* in many parts of FreeType.
578
*
579
* @fields:
580
* head ::
581
* The head (first element) of doubly-linked list.
582
*
583
* tail ::
584
* The tail (last element) of doubly-linked list.
585
*/
586
typedef
struct
FT_ListRec_
587
{
588
FT_ListNode head;
589
FT_ListNode tail;
590
591
} FT_ListRec;
592
593
/* */
594
595
596
#define FT_IS_EMPTY( list ) ( (list).head == 0 )
597
#define FT_BOOL( x ) FT_STATIC_CAST( FT_Bool, (x) != 0 )
598
599
/* concatenate C tokens */
600
#define FT_ERR_XCAT( x, y ) x ## y
601
#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
602
603
/* see `ftmoderr.h` for descriptions of the following macros */
604
605
#define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )
606
607
#define FT_ERROR_BASE( x ) ( (x) & 0xFF )
608
#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
609
610
#define FT_ERR_EQ( x, e ) \
611
( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )
612
#define FT_ERR_NEQ( x, e ) \
613
( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )
614
615
616
FT_END_HEADER
617
618
#endif
/* FTTYPES_H_ */
619
620
621
/* END */
ft2build.h
ftimage.h
ftsystem.h
FT_Data_
Definition
fttypes.h:421
FT_Generic_
Definition
fttypes.h:475
FT_ListNodeRec_
Definition
fttypes.h:562
FT_ListRec_
Definition
fttypes.h:587
FT_Matrix_
Definition
fttypes.h:398
FT_UnitVector_
Definition
fttypes.h:363
freetype
include
freetype
fttypes.h
Generated by
1.18.0