Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 1 | /***************************************************************************/ |
| 2 | /* */ |
| 3 | /* aftypes.h */ |
| 4 | /* */ |
| 5 | /* Auto-fitter types (specification only). */ |
| 6 | /* */ |
Werner Lemberg | 332da87 | 2011-01-23 12:42:23 +0100 | [diff] [blame] | 7 | /* Copyright 2003-2009, 2011 by */ |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 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 | |
Werner Lemberg | d1d4bff | 2006-02-10 22:15:22 +0000 | [diff] [blame] | 19 | /************************************************************************* |
| 20 | * |
| 21 | * The auto-fitter is a complete rewrite of the old auto-hinter. |
| 22 | * Its main feature is the ability to differentiate between different |
| 23 | * scripts in order to apply language-specific rules. |
| 24 | * |
Werner Lemberg | 689dd66 | 2007-01-30 23:08:50 +0000 | [diff] [blame] | 25 | * The code has also been compartmentized into several entities that |
Werner Lemberg | d1d4bff | 2006-02-10 22:15:22 +0000 | [diff] [blame] | 26 | * should make algorithmic experimentation easier than with the old |
| 27 | * code. |
| 28 | * |
| 29 | * Finally, we get rid of the Catharon license, since this code is |
| 30 | * released under the FreeType one. |
| 31 | * |
| 32 | *************************************************************************/ |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 33 | |
| 34 | |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 35 | #ifndef __AFTYPES_H__ |
| 36 | #define __AFTYPES_H__ |
| 37 | |
| 38 | #include <ft2build.h> |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 39 | |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 40 | #include FT_FREETYPE_H |
| 41 | #include FT_OUTLINE_H |
| 42 | #include FT_INTERNAL_OBJECTS_H |
| 43 | #include FT_INTERNAL_DEBUG_H |
| 44 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 45 | |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 46 | FT_BEGIN_HEADER |
| 47 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 48 | /*************************************************************************/ |
| 49 | /*************************************************************************/ |
| 50 | /***** *****/ |
| 51 | /***** D E B U G G I N G *****/ |
| 52 | /***** *****/ |
| 53 | /*************************************************************************/ |
| 54 | /*************************************************************************/ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 55 | |
Werner Lemberg | d503b1b | 2011-04-18 19:05:28 +0200 | [diff] [blame] | 56 | #ifdef FT_DEBUG_AUTOFIT |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 57 | |
Werner Lemberg | 24d72a1 | 2009-01-13 17:34:48 +0000 | [diff] [blame] | 58 | #include FT_CONFIG_STANDARD_LIBRARY_H |
| 59 | |
Werner Lemberg | 111b5ae | 2006-11-03 09:40:12 +0000 | [diff] [blame] | 60 | extern int _af_debug_disable_horz_hints; |
| 61 | extern int _af_debug_disable_vert_hints; |
| 62 | extern int _af_debug_disable_blue_hints; |
David Turner | 4060474 | 2006-11-02 16:37:35 +0000 | [diff] [blame] | 63 | extern void* _af_debug_hints; |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 64 | |
Werner Lemberg | d503b1b | 2011-04-18 19:05:28 +0200 | [diff] [blame] | 65 | #endif /* FT_DEBUG_AUTOFIT */ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 66 | |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 67 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 68 | /*************************************************************************/ |
| 69 | /*************************************************************************/ |
| 70 | /***** *****/ |
| 71 | /***** U T I L I T Y S T U F F *****/ |
| 72 | /***** *****/ |
| 73 | /*************************************************************************/ |
| 74 | /*************************************************************************/ |
| 75 | |
| 76 | typedef struct AF_WidthRec_ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 77 | { |
| 78 | FT_Pos org; /* original position/width in font units */ |
| 79 | FT_Pos cur; /* current/scaled position/width in device sub-pixels */ |
| 80 | FT_Pos fit; /* current/fitted position/width in device sub-pixels */ |
| 81 | |
| 82 | } AF_WidthRec, *AF_Width; |
| 83 | |
| 84 | |
| 85 | FT_LOCAL( void ) |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 86 | af_sort_pos( FT_UInt count, |
| 87 | FT_Pos* table ); |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 88 | |
| 89 | FT_LOCAL( void ) |
| 90 | af_sort_widths( FT_UInt count, |
| 91 | AF_Width widths ); |
| 92 | |
| 93 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 94 | /*************************************************************************/ |
| 95 | /*************************************************************************/ |
| 96 | /***** *****/ |
| 97 | /***** A N G L E T Y P E S *****/ |
| 98 | /***** *****/ |
| 99 | /*************************************************************************/ |
| 100 | /*************************************************************************/ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 101 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 102 | /* |
| 103 | * The auto-fitter doesn't need a very high angular accuracy; |
| 104 | * this allows us to speed up some computations considerably with a |
| 105 | * light Cordic algorithm (see afangles.c). |
| 106 | */ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 107 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 108 | typedef FT_Int AF_Angle; |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 109 | |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 110 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 111 | #define AF_ANGLE_PI 256 |
| 112 | #define AF_ANGLE_2PI ( AF_ANGLE_PI * 2 ) |
| 113 | #define AF_ANGLE_PI2 ( AF_ANGLE_PI / 2 ) |
| 114 | #define AF_ANGLE_PI4 ( AF_ANGLE_PI / 4 ) |
| 115 | |
| 116 | |
David Turner | 281679d | 2006-05-17 13:34:21 +0000 | [diff] [blame] | 117 | #if 0 |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 118 | /* |
| 119 | * compute the angle of a given 2-D vector |
| 120 | */ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 121 | FT_LOCAL( AF_Angle ) |
| 122 | af_angle_atan( FT_Pos dx, |
| 123 | FT_Pos dy ); |
| 124 | |
| 125 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 126 | /* |
| 127 | * compute `angle2 - angle1'; the result is always within |
| 128 | * the range [-AF_ANGLE_PI .. AF_ANGLE_PI - 1] |
| 129 | */ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 130 | FT_LOCAL( AF_Angle ) |
| 131 | af_angle_diff( AF_Angle angle1, |
| 132 | AF_Angle angle2 ); |
Werner Lemberg | 4309edc | 2005-11-11 15:49:14 +0000 | [diff] [blame] | 133 | #endif /* 0 */ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 134 | |
Werner Lemberg | 4309edc | 2005-11-11 15:49:14 +0000 | [diff] [blame] | 135 | |
| 136 | #define AF_ANGLE_DIFF( result, angle1, angle2 ) \ |
| 137 | FT_BEGIN_STMNT \ |
| 138 | AF_Angle _delta = (angle2) - (angle1); \ |
| 139 | \ |
| 140 | \ |
| 141 | _delta %= AF_ANGLE_2PI; \ |
| 142 | if ( _delta < 0 ) \ |
| 143 | _delta += AF_ANGLE_2PI; \ |
| 144 | \ |
| 145 | if ( _delta > AF_ANGLE_PI ) \ |
| 146 | _delta -= AF_ANGLE_2PI; \ |
| 147 | \ |
| 148 | result = _delta; \ |
David Turner | 9fbd2ab | 2005-10-28 16:14:14 +0000 | [diff] [blame] | 149 | FT_END_STMNT |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 150 | |
Werner Lemberg | 4309edc | 2005-11-11 15:49:14 +0000 | [diff] [blame] | 151 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 152 | /* opaque handle to glyph-specific hints -- see `afhints.h' for more |
| 153 | * details |
| 154 | */ |
| 155 | typedef struct AF_GlyphHintsRec_* AF_GlyphHints; |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 156 | |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 157 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 158 | /*************************************************************************/ |
| 159 | /*************************************************************************/ |
| 160 | /***** *****/ |
| 161 | /***** S C A L E R S *****/ |
| 162 | /***** *****/ |
| 163 | /*************************************************************************/ |
| 164 | /*************************************************************************/ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 165 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 166 | /* |
| 167 | * A scaler models the target pixel device that will receive the |
| 168 | * auto-hinted glyph image. |
| 169 | */ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 170 | |
Werner Lemberg | 2b0b422 | 2008-05-28 22:17:28 +0000 | [diff] [blame] | 171 | typedef enum AF_ScalerFlags_ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 172 | { |
| 173 | AF_SCALER_FLAG_NO_HORIZONTAL = 1, /* disable horizontal hinting */ |
| 174 | AF_SCALER_FLAG_NO_VERTICAL = 2, /* disable vertical hinting */ |
| 175 | AF_SCALER_FLAG_NO_ADVANCE = 4 /* disable advance hinting */ |
| 176 | |
| 177 | } AF_ScalerFlags; |
| 178 | |
| 179 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 180 | typedef struct AF_ScalerRec_ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 181 | { |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 182 | FT_Face face; /* source font face */ |
| 183 | FT_Fixed x_scale; /* from font units to 1/64th device pixels */ |
| 184 | FT_Fixed y_scale; /* from font units to 1/64th device pixels */ |
| 185 | FT_Pos x_delta; /* in 1/64th device pixels */ |
| 186 | FT_Pos y_delta; /* in 1/64th device pixels */ |
| 187 | FT_Render_Mode render_mode; /* monochrome, anti-aliased, LCD, etc. */ |
| 188 | FT_UInt32 flags; /* additional control flags, see above */ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 189 | |
| 190 | } AF_ScalerRec, *AF_Scaler; |
| 191 | |
| 192 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 193 | #define AF_SCALER_EQUAL_SCALES( a, b ) \ |
| 194 | ( (a)->x_scale == (b)->x_scale && \ |
| 195 | (a)->y_scale == (b)->y_scale && \ |
| 196 | (a)->x_delta == (b)->x_delta && \ |
| 197 | (a)->y_delta == (b)->y_delta ) |
David Turner | e664efa | 2004-06-04 17:41:59 +0000 | [diff] [blame] | 198 | |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 199 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 200 | /*************************************************************************/ |
| 201 | /*************************************************************************/ |
| 202 | /***** *****/ |
| 203 | /***** S C R I P T S *****/ |
| 204 | /***** *****/ |
| 205 | /*************************************************************************/ |
| 206 | /*************************************************************************/ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 207 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 208 | /* |
Werner Lemberg | 332da87 | 2011-01-23 12:42:23 +0100 | [diff] [blame] | 209 | * The list of known scripts. Each different script corresponds to the |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 210 | * following information: |
| 211 | * |
| 212 | * - A set of Unicode ranges to test whether the face supports the |
| 213 | * script. |
| 214 | * |
| 215 | * - A specific global analyzer that will compute global metrics |
| 216 | * specific to the script. |
| 217 | * |
| 218 | * - A specific glyph analyzer that will compute segments and |
| 219 | * edges for each glyph covered by the script. |
| 220 | * |
| 221 | * - A specific grid-fitting algorithm that will distort the |
| 222 | * scaled glyph outline according to the results of the glyph |
| 223 | * analyzer. |
| 224 | * |
| 225 | * Note that a given analyzer and/or grid-fitting algorithm can be |
| 226 | * used by more than one script. |
| 227 | */ |
| 228 | |
Werner Lemberg | 2b0b422 | 2008-05-28 22:17:28 +0000 | [diff] [blame] | 229 | typedef enum AF_Script_ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 230 | { |
| 231 | AF_SCRIPT_NONE = 0, |
| 232 | AF_SCRIPT_LATIN = 1, |
Wu, Chia-I (吳佳一) | 4cdb45c | 2006-02-09 14:17:04 +0000 | [diff] [blame] | 233 | AF_SCRIPT_CJK = 2, |
Werner Lemberg | 7723dc3 | 2007-06-26 04:44:35 +0000 | [diff] [blame] | 234 | AF_SCRIPT_INDIC = 3, |
David Turner | b792017 | 2007-06-11 05:37:35 +0000 | [diff] [blame] | 235 | #ifdef FT_OPTION_AUTOFIT2 |
| 236 | AF_SCRIPT_LATIN2, |
| 237 | #endif |
Werner Lemberg | 7723dc3 | 2007-06-26 04:44:35 +0000 | [diff] [blame] | 238 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 239 | /* add new scripts here. Don't forget to update the list in */ |
| 240 | /* `afglobal.c'. */ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 241 | |
| 242 | AF_SCRIPT_MAX /* do not remove */ |
| 243 | |
| 244 | } AF_Script; |
| 245 | |
| 246 | |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 247 | typedef struct AF_ScriptClassRec_ const* AF_ScriptClass; |
| 248 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 249 | typedef struct AF_ScriptMetricsRec_ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 250 | { |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 251 | AF_ScriptClass clazz; |
| 252 | AF_ScalerRec scaler; |
Werner Lemberg | 8b84c9d | 2009-04-27 19:40:35 +0200 | [diff] [blame] | 253 | FT_Bool digits_have_same_width; |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 254 | |
| 255 | } AF_ScriptMetricsRec, *AF_ScriptMetrics; |
| 256 | |
| 257 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 258 | /* This function parses an FT_Face to compute global metrics for |
| 259 | * a specific script. |
| 260 | */ |
| 261 | typedef FT_Error |
| 262 | (*AF_Script_InitMetricsFunc)( AF_ScriptMetrics metrics, |
| 263 | FT_Face face ); |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 264 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 265 | typedef void |
| 266 | (*AF_Script_ScaleMetricsFunc)( AF_ScriptMetrics metrics, |
| 267 | AF_Scaler scaler ); |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 268 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 269 | typedef void |
| 270 | (*AF_Script_DoneMetricsFunc)( AF_ScriptMetrics metrics ); |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 271 | |
| 272 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 273 | typedef FT_Error |
| 274 | (*AF_Script_InitHintsFunc)( AF_GlyphHints hints, |
| 275 | AF_ScriptMetrics metrics ); |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 276 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 277 | typedef void |
| 278 | (*AF_Script_ApplyHintsFunc)( AF_GlyphHints hints, |
| 279 | FT_Outline* outline, |
| 280 | AF_ScriptMetrics metrics ); |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 281 | |
| 282 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 283 | typedef struct AF_Script_UniRangeRec_ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 284 | { |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 285 | FT_UInt32 first; |
| 286 | FT_UInt32 last; |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 287 | |
| 288 | } AF_Script_UniRangeRec; |
| 289 | |
suzuki toshiya | 38e480b | 2009-08-01 00:30:21 +0900 | [diff] [blame] | 290 | #define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) } |
| 291 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 292 | typedef const AF_Script_UniRangeRec *AF_Script_UniRange; |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 293 | |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 294 | |
| 295 | typedef struct AF_ScriptClassRec_ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 296 | { |
| 297 | AF_Script script; |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 298 | AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 299 | |
suzuki toshiya | b566802 | 2009-08-01 00:32:07 +0900 | [diff] [blame] | 300 | FT_Offset script_metrics_size; |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 301 | AF_Script_InitMetricsFunc script_metrics_init; |
| 302 | AF_Script_ScaleMetricsFunc script_metrics_scale; |
| 303 | AF_Script_DoneMetricsFunc script_metrics_done; |
| 304 | |
| 305 | AF_Script_InitHintsFunc script_hints_init; |
| 306 | AF_Script_ApplyHintsFunc script_hints_apply; |
| 307 | |
| 308 | } AF_ScriptClassRec; |
| 309 | |
Werner Lemberg | 332da87 | 2011-01-23 12:42:23 +0100 | [diff] [blame] | 310 | |
| 311 | /* Declare and define vtables for classes */ |
Oran Agra | 59b4af8 | 2009-04-05 18:23:38 +0300 | [diff] [blame] | 312 | #ifndef FT_CONFIG_OPTION_PIC |
| 313 | |
Werner Lemberg | 332da87 | 2011-01-23 12:42:23 +0100 | [diff] [blame] | 314 | #define AF_DECLARE_SCRIPT_CLASS( script_class ) \ |
| 315 | FT_CALLBACK_TABLE const AF_ScriptClassRec \ |
Oran Agra | 59b4af8 | 2009-04-05 18:23:38 +0300 | [diff] [blame] | 316 | script_class; |
| 317 | |
Werner Lemberg | 332da87 | 2011-01-23 12:42:23 +0100 | [diff] [blame] | 318 | #define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, m_size, \ |
| 319 | m_init, m_scale, m_done, h_init, h_apply ) \ |
| 320 | FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec \ |
| 321 | script_class = \ |
| 322 | { \ |
| 323 | script_, \ |
| 324 | ranges, \ |
| 325 | \ |
| 326 | m_size, \ |
| 327 | \ |
| 328 | m_init, \ |
| 329 | m_scale, \ |
| 330 | m_done, \ |
| 331 | \ |
| 332 | h_init, \ |
| 333 | h_apply \ |
Oran Agra | 59b4af8 | 2009-04-05 18:23:38 +0300 | [diff] [blame] | 334 | }; |
| 335 | |
Werner Lemberg | 332da87 | 2011-01-23 12:42:23 +0100 | [diff] [blame] | 336 | #else /* FT_CONFIG_OPTION_PIC */ |
Oran Agra | 59b4af8 | 2009-04-05 18:23:38 +0300 | [diff] [blame] | 337 | |
Werner Lemberg | 332da87 | 2011-01-23 12:42:23 +0100 | [diff] [blame] | 338 | #define AF_DECLARE_SCRIPT_CLASS( script_class ) \ |
| 339 | FT_LOCAL( void ) \ |
| 340 | FT_Init_Class_##script_class( AF_ScriptClassRec* ac ); |
Oran Agra | 59b4af8 | 2009-04-05 18:23:38 +0300 | [diff] [blame] | 341 | |
Werner Lemberg | 332da87 | 2011-01-23 12:42:23 +0100 | [diff] [blame] | 342 | #define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, m_size, \ |
| 343 | m_init, m_scale, m_done, h_init, h_apply ) \ |
| 344 | FT_LOCAL_DEF( void ) \ |
| 345 | FT_Init_Class_##script_class( AF_ScriptClassRec* ac ) \ |
| 346 | { \ |
| 347 | ac->script = script_; \ |
| 348 | ac->script_uni_ranges = ranges; \ |
| 349 | \ |
| 350 | ac->script_metrics_size = m_size; \ |
| 351 | \ |
| 352 | ac->script_metrics_init = m_init; \ |
| 353 | ac->script_metrics_scale = m_scale; \ |
| 354 | ac->script_metrics_done = m_done; \ |
| 355 | \ |
| 356 | ac->script_hints_init = h_init; \ |
| 357 | ac->script_hints_apply = h_apply; \ |
Oran Agra | 59b4af8 | 2009-04-05 18:23:38 +0300 | [diff] [blame] | 358 | } |
Werner Lemberg | 332da87 | 2011-01-23 12:42:23 +0100 | [diff] [blame] | 359 | |
| 360 | #endif /* FT_CONFIG_OPTION_PIC */ |
Oran Agra | 59b4af8 | 2009-04-05 18:23:38 +0300 | [diff] [blame] | 361 | |
Werner Lemberg | 8bb07e6 | 2004-03-27 08:43:17 +0000 | [diff] [blame] | 362 | |
| 363 | /* */ |
| 364 | |
| 365 | FT_END_HEADER |
| 366 | |
| 367 | #endif /* __AFTYPES_H__ */ |
Werner Lemberg | f13516c | 2005-03-03 17:09:08 +0000 | [diff] [blame] | 368 | |
| 369 | |
| 370 | /* END */ |