Bringing apdf from vendor into main branch.
[AROS-Contrib.git] / apdf / freetype2 / include / freetype / fttypes.h
blob757817f56393b8167c2029548521efd97576c949
1 /***************************************************************************/
2 /* */
3 /* fttypes.h */
4 /* */
5 /* FreeType simple types definitions (specification only). */
6 /* */
7 /* Copyright 1996-2001 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 /***************************************************************************/
19 #ifndef __FTTYPES_H__
20 #define __FTTYPES_H__
23 #include <ft2build.h>
24 #include FT_SYSTEM_H
25 #include FT_IMAGE_H
27 #include <stddef.h>
30 FT_BEGIN_HEADER
33 /*************************************************************************/
34 /* */
35 /* <Section> */
36 /* basic_types */
37 /* */
38 /* <Title> */
39 /* Basic Data Types */
40 /* */
41 /* <Abstract> */
42 /* The basic data types defined by the library. */
43 /* */
44 /* <Description> */
45 /* This section contains the basic data types defined by FreeType 2, */
46 /* ranging from simple scalar types to bitmap descriptors. More */
47 /* font-specific structures are defined in a different section. */
48 /* */
49 /* <Order> */
50 /* FT_Byte */
51 /* FT_Char */
52 /* FT_Int */
53 /* FT_UInt */
54 /* FT_Short */
55 /* FT_UShort */
56 /* FT_Long */
57 /* FT_ULong */
58 /* FT_Bool */
59 /* FT_Offset */
60 /* FT_PtrDist */
61 /* FT_String */
62 /* FT_Error */
63 /* FT_Fixed */
64 /* FT_Pointer */
65 /* FT_Pos */
66 /* FT_Vector */
67 /* FT_BBox */
68 /* FT_Matrix */
69 /* FT_FWord */
70 /* FT_UFWord */
71 /* FT_F2Dot14 */
72 /* FT_UnitVector */
73 /* FT_F26Dot6 */
74 /* */
75 /* */
76 /* FT_Generic */
77 /* FT_Generic_Finalizer */
78 /* */
79 /* FT_Bitmap */
80 /* FT_Pixel_Mode */
81 /* FT_Palette_Mode */
82 /* FT_Glyph_Format */
83 /* FT_IMAGE_TAG */
84 /* */
85 /*************************************************************************/
88 /*************************************************************************/
89 /* */
90 /* <Type> */
91 /* FT_Bool */
92 /* */
93 /* <Description> */
94 /* A typedef of unsigned char, used for simple booleans. */
95 /* */
96 typedef unsigned char FT_Bool;
99 /*************************************************************************/
100 /* */
101 /* <Type> */
102 /* FT_FWord */
103 /* */
104 /* <Description> */
105 /* A signed 16-bit integer used to store a distance in original font */
106 /* units. */
107 /* */
108 typedef signed short FT_FWord; /* distance in FUnits */
111 /*************************************************************************/
112 /* */
113 /* <Type> */
114 /* FT_UFWord */
115 /* */
116 /* <Description> */
117 /* An unsigned 16-bit integer used to store a distance in original */
118 /* font units. */
119 /* */
120 typedef unsigned short FT_UFWord; /* unsigned distance */
123 /*************************************************************************/
124 /* */
125 /* <Type> */
126 /* FT_Char */
127 /* */
128 /* <Description> */
129 /* A simple typedef for the _signed_ char type. */
130 /* */
131 typedef signed char FT_Char;
134 /*************************************************************************/
135 /* */
136 /* <Type> */
137 /* FT_Byte */
138 /* */
139 /* <Description> */
140 /* A simple typedef for the _unsigned_ char type. */
141 /* */
142 typedef unsigned char FT_Byte;
145 /*************************************************************************/
146 /* */
147 /* <Type> */
148 /* FT_String */
149 /* */
150 /* <Description> */
151 /* A simple typedef for the char type, usually used for strings. */
152 /* */
153 typedef char FT_String;
156 /*************************************************************************/
157 /* */
158 /* <Type> */
159 /* FT_Short */
160 /* */
161 /* <Description> */
162 /* A typedef for signed short. */
163 /* */
164 typedef signed short FT_Short;
167 /*************************************************************************/
168 /* */
169 /* <Type> */
170 /* FT_UShort */
171 /* */
172 /* <Description> */
173 /* A typedef for unsigned short. */
174 /* */
175 typedef unsigned short FT_UShort;
178 /*************************************************************************/
179 /* */
180 /* <Type> */
181 /* FT_Int */
182 /* */
183 /* <Description> */
184 /* A typedef for the int type. */
185 /* */
186 typedef int FT_Int;
189 /*************************************************************************/
190 /* */
191 /* <Type> */
192 /* FT_UInt */
193 /* */
194 /* <Description> */
195 /* A typedef for the unsigned int type. */
196 /* */
197 typedef unsigned int FT_UInt;
200 /*************************************************************************/
201 /* */
202 /* <Type> */
203 /* FT_Long */
204 /* */
205 /* <Description> */
206 /* A typedef for signed long. */
207 /* */
208 typedef signed long FT_Long;
211 /*************************************************************************/
212 /* */
213 /* <Type> */
214 /* FT_ULong */
215 /* */
216 /* <Description> */
217 /* A typedef for unsigned long. */
218 /* */
219 typedef unsigned long FT_ULong;
222 /*************************************************************************/
223 /* */
224 /* <Type> */
225 /* FT_F2Dot14 */
226 /* */
227 /* <Description> */
228 /* A signed 2.14 fixed float type used for unit vectors. */
229 /* */
230 typedef signed short FT_F2Dot14;
233 /*************************************************************************/
234 /* */
235 /* <Type> */
236 /* FT_F26Dot6 */
237 /* */
238 /* <Description> */
239 /* A signed 26.6 fixed float type used for vectorial pixel */
240 /* coordinates. */
241 /* */
242 typedef signed long FT_F26Dot6;
245 /*************************************************************************/
246 /* */
247 /* <Type> */
248 /* FT_Fixed */
249 /* */
250 /* <Description> */
251 /* This type is used to store 16.16 fixed float values, like scales */
252 /* or matrix coefficients. */
253 /* */
254 typedef signed long FT_Fixed;
257 /*************************************************************************/
258 /* */
259 /* <Type> */
260 /* FT_Error */
261 /* */
262 /* <Description> */
263 /* The FreeType error code type. A value of 0 is always interpreted */
264 /* as a successful operation. */
265 /* */
266 typedef int FT_Error;
269 /*************************************************************************/
270 /* */
271 /* <Type> */
272 /* FT_Pointer */
273 /* */
274 /* <Description> */
275 /* A simple typedef for a typeless pointer. */
276 /* */
277 typedef void* FT_Pointer;
280 /*************************************************************************/
281 /* */
282 /* <Type> */
283 /* FT_Offset */
284 /* */
285 /* <Description> */
286 /* This is equivalent to the ANSI C `size_t' type, i.e. the largest */
287 /* _unsigned_ integer type used to express a file size or position, */
288 /* or a memory block size. */
289 /* */
290 typedef size_t FT_Offset;
293 /*************************************************************************/
294 /* */
295 /* <Type> */
296 /* FT_PtrDist */
297 /* */
298 /* <Description> */
299 /* This is equivalent to the ANSI C `ptrdiff_t' type, i.e. the */
300 /* largest _signed_ integer type used to express the distance */
301 /* between two pointers. */
302 /* */
303 typedef size_t FT_PtrDist;
306 /*************************************************************************/
307 /* */
308 /* <Struct> */
309 /* FT_UnitVector */
310 /* */
311 /* <Description> */
312 /* A simple structure used to store a 2D vector unit vector. Uses */
313 /* FT_F2Dot14 types. */
314 /* */
315 /* <Fields> */
316 /* x :: Horizontal coordinate. */
317 /* */
318 /* y :: Vertical coordinate. */
319 /* */
320 typedef struct FT_UnitVector_
322 FT_F2Dot14 x;
323 FT_F2Dot14 y;
325 } FT_UnitVector;
328 /*************************************************************************/
329 /* */
330 /* <Struct> */
331 /* FT_Matrix */
332 /* */
333 /* <Description> */
334 /* A simple structure used to store a 2x2 matrix. Coefficients are */
335 /* in 16.16 fixed float format. The computation performed is: */
336 /* */
337 /* { */
338 /* x' = x*xx + y*xy */
339 /* y' = x*yx + y*yy */
340 /* } */
341 /* */
342 /* <Fields> */
343 /* xx :: Matrix coefficient. */
344 /* */
345 /* xy :: Matrix coefficient. */
346 /* */
347 /* yx :: Matrix coefficient. */
348 /* */
349 /* yy :: Matrix coefficient. */
350 /* */
351 typedef struct FT_Matrix_
353 FT_Fixed xx, xy;
354 FT_Fixed yx, yy;
356 } FT_Matrix;
359 /*************************************************************************/
360 /* */
361 /* <FuncType> */
362 /* FT_Generic_Finalizer */
363 /* */
364 /* <Description> */
365 /* Describes a function used to destroy the `client' data of any */
366 /* FreeType object. See the description of the FT_Generic type for */
367 /* details of usage. */
368 /* */
369 /* <Input> */
370 /* The address of the FreeType object which is under finalization. */
371 /* Its client data is accessed through its `generic' field. */
372 /* */
373 typedef void (*FT_Generic_Finalizer)(void* object);
376 /*************************************************************************/
377 /* */
378 /* <Struct> */
379 /* FT_Generic */
380 /* */
381 /* <Description> */
382 /* Client applications often need to associate their own data to a */
383 /* variety of FreeType core objects. For example, a text layout API */
384 /* might want to associate a glyph cache to a given size object. */
385 /* */
386 /* Most FreeType object contains a `generic' field, of type */
387 /* FT_Generic, which usage is left to client applications and font */
388 /* servers. */
389 /* */
390 /* It can be used to store a pointer to client-specific data, as well */
391 /* as the address of a `finalizer' function, which will be called by */
392 /* FreeType when the object is destroyed (for example, the previous */
393 /* client example would put the address of the glyph cache destructor */
394 /* in the `finalizer' field). */
395 /* */
396 /* <Fields> */
397 /* data :: A typeless pointer to any client-specified data. This */
398 /* field is completely ignored by the FreeType library. */
399 /* */
400 /* finalizer :: A pointer to a `generic finalizer' function, which */
401 /* will be called when the object is destroyed. If this */
402 /* field is set to NULL, no code will be called. */
403 /* */
404 typedef struct FT_Generic_
406 void* data;
407 FT_Generic_Finalizer finalizer;
409 } FT_Generic;
412 /*************************************************************************/
413 /* */
414 /* <Macro> */
415 /* FT_MAKE_TAG */
416 /* */
417 /* <Description> */
418 /* This macro converts four letter tags which are used to label */
419 /* TrueType tables into an unsigned long to be used within FreeType. */
420 /* */
421 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
422 ( ( (FT_ULong)_x1 << 24 ) | \
423 ( (FT_ULong)_x2 << 16 ) | \
424 ( (FT_ULong)_x3 << 8 ) | \
425 (FT_ULong)_x4 )
428 /*************************************************************************/
429 /*************************************************************************/
430 /* */
431 /* L I S T M A N A G E M E N T */
432 /* */
433 /*************************************************************************/
434 /*************************************************************************/
437 /*************************************************************************/
438 /* */
439 /* <Section> */
440 /* list_processing */
441 /* */
442 /*************************************************************************/
445 /*************************************************************************/
446 /* */
447 /* <Type> */
448 /* FT_ListNode */
449 /* */
450 /* <Description> */
451 /* Many elements and objects in FreeType are listed through a */
452 /* FT_List record (see FT_ListRec). As its name suggests, a */
453 /* FT_ListNode is a handle to a single list element. */
454 /* */
455 typedef struct FT_ListNodeRec_* FT_ListNode;
458 /*************************************************************************/
459 /* */
460 /* <Type> */
461 /* FT_List */
462 /* */
463 /* <Description> */
464 /* A handle to a list record (see FT_ListRec). */
465 /* */
466 typedef struct FT_ListRec_* FT_List;
469 /*************************************************************************/
470 /* */
471 /* <Struct> */
472 /* FT_ListNodeRec */
473 /* */
474 /* <Description> */
475 /* A structure used to hold a single list element. */
476 /* */
477 /* <Fields> */
478 /* prev :: The previous element in the list. NULL if first. */
479 /* */
480 /* next :: The next element in the list. NULL if last. */
481 /* */
482 /* data :: A typeless pointer to the listed object. */
483 /* */
484 typedef struct FT_ListNodeRec_
486 FT_ListNode prev;
487 FT_ListNode next;
488 void* data;
490 } FT_ListNodeRec;
493 /*************************************************************************/
494 /* */
495 /* <Struct> */
496 /* FT_ListRec */
497 /* */
498 /* <Description> */
499 /* A structure used to hold a simple doubly-linked list. These are */
500 /* used in many parts of FreeType. */
501 /* */
502 /* <Fields> */
503 /* head :: The head (first element) of doubly-linked list. */
504 /* */
505 /* tail :: The tail (last element) of doubly-linked list. */
506 /* */
507 typedef struct FT_ListRec_
509 FT_ListNode head;
510 FT_ListNode tail;
512 } FT_ListRec;
515 /* */
517 #define FT_IS_EMPTY( list ) ( (list).head == 0 )
519 /* return base error code (without module-specific prefix) */
520 #define FT_ERROR_BASE( x ) ( (x) & 0xFF )
522 /* return module error code */
523 #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
525 #define FT_BOOL( x ) ( (FT_Bool)( x ) )
527 FT_END_HEADER
529 #endif /* __FTTYPES_H__ */
532 /* END */