OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftobjs.h */ | 3 /* ftobjs.h */ |
4 /* */ | 4 /* */ |
5 /* The FreeType private base classes (specification). */ | 5 /* The FreeType private base classes (specification). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2006, 2008, 2010, 2012-2013 by */ | 7 /* Copyright 1996-2006, 2008, 2010, 2012-2013 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 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 */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 | 18 |
19 /*************************************************************************/ | 19 /*************************************************************************/ |
20 /* */ | 20 /* */ |
21 /* This file contains the definition of all internal FreeType classes. */ | 21 /* This file contains the definition of all internal FreeType classes. */ |
22 /* */ | 22 /* */ |
23 /*************************************************************************/ | 23 /*************************************************************************/ |
24 | 24 |
25 | 25 |
26 #ifndef __FTOBJS_H__ | 26 #ifndef __FTOBJS_H__ |
27 #define __FTOBJS_H__ | 27 #define __FTOBJS_H__ |
28 | 28 |
29 #include "../../ft2build.h" | 29 #include <ft2build.h> |
30 #include "../ftrender.h" | 30 #include FT_RENDER_H |
31 #include "../ftsizes.h" | 31 #include FT_SIZES_H |
32 #include "../ftlcdfil.h" | 32 #include FT_LCD_FILTER_H |
33 #include "ftmemory.h" | 33 #include FT_INTERNAL_MEMORY_H |
34 #include "ftgloadr.h" | 34 #include FT_INTERNAL_GLYPH_LOADER_H |
35 #include "ftdriver.h" | 35 #include FT_INTERNAL_DRIVER_H |
36 #include "autohint.h" | 36 #include FT_INTERNAL_AUTOHINT_H |
37 #include "ftserv.h" | 37 #include FT_INTERNAL_SERVICE_H |
38 #include "ftpic.h" | 38 #include FT_INTERNAL_PIC_H |
39 | 39 |
40 #ifdef FT_CONFIG_OPTION_INCREMENTAL | 40 #ifdef FT_CONFIG_OPTION_INCREMENTAL |
41 #include "../ftincrem.h" | 41 #include FT_INCREMENTAL_H |
42 #endif | 42 #endif |
43 | 43 |
44 | 44 |
45 FT_BEGIN_HEADER | 45 FT_BEGIN_HEADER |
46 | 46 |
47 | 47 |
48 /*************************************************************************/ | 48 /*************************************************************************/ |
49 /* */ | 49 /* */ |
50 /* Some generic definitions. */ | 50 /* Some generic definitions. */ |
51 /* */ | 51 /* */ |
(...skipping 13 matching lines...) Expand all Loading... |
65 /*************************************************************************/ | 65 /*************************************************************************/ |
66 /* */ | 66 /* */ |
67 /* The min and max functions missing in C. As usual, be careful not to */ | 67 /* The min and max functions missing in C. As usual, be careful not to */ |
68 /* write things like FT_MIN( a++, b++ ) to avoid side effects. */ | 68 /* write things like FT_MIN( a++, b++ ) to avoid side effects. */ |
69 /* */ | 69 /* */ |
70 #define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) ) | 70 #define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) ) |
71 #define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) ) | 71 #define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) ) |
72 | 72 |
73 #define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) ) | 73 #define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) ) |
74 | 74 |
| 75 /* |
| 76 * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' |
| 77 * algorithm. We use alpha = 1, beta = 3/8, giving us results with a |
| 78 * largest error less than 7% compared to the exact value. |
| 79 */ |
| 80 #define FT_HYPOT( x, y ) \ |
| 81 ( x = FT_ABS( x ), \ |
| 82 y = FT_ABS( y ), \ |
| 83 x > y ? x + ( 3 * y >> 3 ) \ |
| 84 : y + ( 3 * x >> 3 ) ) |
75 | 85 |
76 #define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) ) | 86 #define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) ) |
77 #define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) | 87 #define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) |
78 #define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n ) | 88 #define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n ) |
79 | 89 |
80 #define FT_PIX_FLOOR( x ) ( (x) & ~63 ) | 90 #define FT_PIX_FLOOR( x ) ( (x) & ~63 ) |
81 #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) | 91 #define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) |
82 #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) | 92 #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) |
83 | 93 |
84 | 94 |
85 /* | 95 /* |
86 * Return the highest power of 2 that is <= value; this correspond to | |
87 * the highest bit in a given 32-bit value. | |
88 */ | |
89 FT_BASE( FT_UInt32 ) | |
90 ft_highpow2( FT_UInt32 value ); | |
91 | |
92 | |
93 /* | |
94 * character classification functions -- since these are used to parse | 96 * character classification functions -- since these are used to parse |
95 * font files, we must not use those in <ctypes.h> which are | 97 * font files, we must not use those in <ctypes.h> which are |
96 * locale-dependent | 98 * locale-dependent |
97 */ | 99 */ |
98 #define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U ) | 100 #define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U ) |
99 | 101 |
100 #define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \ | 102 #define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \ |
101 ( (unsigned)(x) - 'a' ) < 6U || \ | 103 ( (unsigned)(x) - 'a' ) < 6U || \ |
102 ( (unsigned)(x) - 'A' ) < 6U ) | 104 ( (unsigned)(x) - 'A' ) < 6U ) |
103 | 105 |
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 | 1562 |
1561 #endif /* FT_CONFIG_OPTION_PIC */ | 1563 #endif /* FT_CONFIG_OPTION_PIC */ |
1562 | 1564 |
1563 | 1565 |
1564 FT_END_HEADER | 1566 FT_END_HEADER |
1565 | 1567 |
1566 #endif /* __FTOBJS_H__ */ | 1568 #endif /* __FTOBJS_H__ */ |
1567 | 1569 |
1568 | 1570 |
1569 /* END */ | 1571 /* END */ |
OLD | NEW |