| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* aftypes.h */ | 3 /* aftypes.h */ |
| 4 /* */ | 4 /* */ |
| 5 /* Auto-fitter types (specification only). */ | 5 /* Auto-fitter types (specification only). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 2003-2009, 2011 by */ | 7 /* Copyright 2003-2009, 2011-2012 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 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 FT_Pos fit; /* current/fitted position/width in device sub-pixels */ | 80 FT_Pos fit; /* current/fitted position/width in device sub-pixels */ |
| 81 | 81 |
| 82 } AF_WidthRec, *AF_Width; | 82 } AF_WidthRec, *AF_Width; |
| 83 | 83 |
| 84 | 84 |
| 85 FT_LOCAL( void ) | 85 FT_LOCAL( void ) |
| 86 af_sort_pos( FT_UInt count, | 86 af_sort_pos( FT_UInt count, |
| 87 FT_Pos* table ); | 87 FT_Pos* table ); |
| 88 | 88 |
| 89 FT_LOCAL( void ) | 89 FT_LOCAL( void ) |
| 90 af_sort_widths( FT_UInt count, | 90 af_sort_and_quantize_widths( FT_UInt* count, |
| 91 AF_Width widths ); | 91 AF_Width widths, |
| 92 FT_Pos threshold ); |
| 92 | 93 |
| 93 | 94 |
| 94 /*************************************************************************/ | 95 /*************************************************************************/ |
| 95 /*************************************************************************/ | 96 /*************************************************************************/ |
| 96 /***** *****/ | 97 /***** *****/ |
| 97 /***** A N G L E T Y P E S *****/ | 98 /***** A N G L E T Y P E S *****/ |
| 98 /***** *****/ | 99 /***** *****/ |
| 99 /*************************************************************************/ | 100 /*************************************************************************/ |
| 100 /*************************************************************************/ | 101 /*************************************************************************/ |
| 101 | 102 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 * - A specific grid-fitting algorithm that will distort the | 222 * - A specific grid-fitting algorithm that will distort the |
| 222 * scaled glyph outline according to the results of the glyph | 223 * scaled glyph outline according to the results of the glyph |
| 223 * analyzer. | 224 * analyzer. |
| 224 * | 225 * |
| 225 * Note that a given analyzer and/or grid-fitting algorithm can be | 226 * Note that a given analyzer and/or grid-fitting algorithm can be |
| 226 * used by more than one script. | 227 * used by more than one script. |
| 227 */ | 228 */ |
| 228 | 229 |
| 229 typedef enum AF_Script_ | 230 typedef enum AF_Script_ |
| 230 { | 231 { |
| 231 AF_SCRIPT_NONE = 0, | 232 AF_SCRIPT_DUMMY = 0, |
| 232 AF_SCRIPT_LATIN = 1, | 233 AF_SCRIPT_LATIN = 1, |
| 233 AF_SCRIPT_CJK = 2, | 234 AF_SCRIPT_CJK = 2, |
| 234 AF_SCRIPT_INDIC = 3, | 235 AF_SCRIPT_INDIC = 3, |
| 235 #ifdef FT_OPTION_AUTOFIT2 | 236 #ifdef FT_OPTION_AUTOFIT2 |
| 236 AF_SCRIPT_LATIN2, | 237 AF_SCRIPT_LATIN2 = 4, |
| 237 #endif | 238 #endif |
| 238 | 239 |
| 239 /* add new scripts here. Don't forget to update the list in */ | 240 /* add new scripts here. Don't forget to update the list in */ |
| 240 /* `afglobal.c'. */ | 241 /* `afglobal.c'. */ |
| 241 | 242 |
| 242 AF_SCRIPT_MAX /* do not remove */ | 243 AF_SCRIPT_MAX /* do not remove */ |
| 243 | 244 |
| 244 } AF_Script; | 245 } AF_Script; |
| 245 | 246 |
| 246 | 247 |
| 247 typedef struct AF_ScriptClassRec_ const* AF_ScriptClass; | 248 typedef struct AF_ScriptClassRec_ const* AF_ScriptClass; |
| 249 typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals; |
| 248 | 250 |
| 249 typedef struct AF_ScriptMetricsRec_ | 251 typedef struct AF_ScriptMetricsRec_ |
| 250 { | 252 { |
| 251 AF_ScriptClass clazz; | 253 AF_ScriptClass clazz; |
| 252 AF_ScalerRec scaler; | 254 AF_ScalerRec scaler; |
| 253 FT_Bool digits_have_same_width; | 255 FT_Bool digits_have_same_width; |
| 254 | 256 |
| 257 AF_FaceGlobals globals; /* to access properties */ |
| 258 |
| 255 } AF_ScriptMetricsRec, *AF_ScriptMetrics; | 259 } AF_ScriptMetricsRec, *AF_ScriptMetrics; |
| 256 | 260 |
| 257 | 261 |
| 258 /* This function parses an FT_Face to compute global metrics for | 262 /* This function parses an FT_Face to compute global metrics for |
| 259 * a specific script. | 263 * a specific script. |
| 260 */ | 264 */ |
| 261 typedef FT_Error | 265 typedef FT_Error |
| 262 (*AF_Script_InitMetricsFunc)( AF_ScriptMetrics metrics, | 266 (*AF_Script_InitMetricsFunc)( AF_ScriptMetrics metrics, |
| 263 FT_Face face ); | 267 FT_Face face ); |
| 264 | 268 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 287 | 291 |
| 288 } AF_Script_UniRangeRec; | 292 } AF_Script_UniRangeRec; |
| 289 | 293 |
| 290 #define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) } | 294 #define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) } |
| 291 | 295 |
| 292 typedef const AF_Script_UniRangeRec *AF_Script_UniRange; | 296 typedef const AF_Script_UniRangeRec *AF_Script_UniRange; |
| 293 | 297 |
| 294 | 298 |
| 295 typedef struct AF_ScriptClassRec_ | 299 typedef struct AF_ScriptClassRec_ |
| 296 { | 300 { |
| 297 AF_Script script; | 301 AF_Script script; |
| 298 AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ | 302 AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ |
| 303 FT_UInt32 standard_char; /* for default width and height */ |
| 299 | 304 |
| 300 FT_Offset script_metrics_size; | 305 FT_Offset script_metrics_size; |
| 301 AF_Script_InitMetricsFunc script_metrics_init; | 306 AF_Script_InitMetricsFunc script_metrics_init; |
| 302 AF_Script_ScaleMetricsFunc script_metrics_scale; | 307 AF_Script_ScaleMetricsFunc script_metrics_scale; |
| 303 AF_Script_DoneMetricsFunc script_metrics_done; | 308 AF_Script_DoneMetricsFunc script_metrics_done; |
| 304 | 309 |
| 305 AF_Script_InitHintsFunc script_hints_init; | 310 AF_Script_InitHintsFunc script_hints_init; |
| 306 AF_Script_ApplyHintsFunc script_hints_apply; | 311 AF_Script_ApplyHintsFunc script_hints_apply; |
| 307 | 312 |
| 308 } AF_ScriptClassRec; | 313 } AF_ScriptClassRec; |
| 309 | 314 |
| 310 | 315 |
| 311 /* Declare and define vtables for classes */ | 316 /* Declare and define vtables for classes */ |
| 312 #ifndef FT_CONFIG_OPTION_PIC | 317 #ifndef FT_CONFIG_OPTION_PIC |
| 313 | 318 |
| 314 #define AF_DECLARE_SCRIPT_CLASS( script_class ) \ | 319 #define AF_DECLARE_SCRIPT_CLASS( script_class ) \ |
| 315 FT_CALLBACK_TABLE const AF_ScriptClassRec \ | 320 FT_CALLBACK_TABLE const AF_ScriptClassRec \ |
| 316 script_class; | 321 script_class; |
| 317 | 322 |
| 318 #define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, m_size, \ | 323 #define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char, \ |
| 324 m_size, \ |
| 319 m_init, m_scale, m_done, h_init, h_apply ) \ | 325 m_init, m_scale, m_done, h_init, h_apply ) \ |
| 320 FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec \ | 326 FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec script_class = \ |
| 321 script_class = \ | |
| 322 { \ | 327 { \ |
| 323 script_, \ | 328 script_, \ |
| 324 ranges, \ | 329 ranges, \ |
| 330 def_char, \ |
| 325 \ | 331 \ |
| 326 m_size, \ | 332 m_size, \ |
| 327 \ | 333 \ |
| 328 m_init, \ | 334 m_init, \ |
| 329 m_scale, \ | 335 m_scale, \ |
| 330 m_done, \ | 336 m_done, \ |
| 331 \ | 337 \ |
| 332 h_init, \ | 338 h_init, \ |
| 333 h_apply \ | 339 h_apply \ |
| 334 }; | 340 }; |
| 335 | 341 |
| 336 #else /* FT_CONFIG_OPTION_PIC */ | 342 #else /* FT_CONFIG_OPTION_PIC */ |
| 337 | 343 |
| 338 #define AF_DECLARE_SCRIPT_CLASS( script_class ) \ | 344 #define AF_DECLARE_SCRIPT_CLASS( script_class ) \ |
| 339 FT_LOCAL( void ) \ | 345 FT_LOCAL( void ) \ |
| 340 FT_Init_Class_##script_class( AF_ScriptClassRec* ac ); | 346 FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ); |
| 341 | 347 |
| 342 #define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, m_size, \ | 348 #define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char, \ |
| 349 m_size, \ |
| 343 m_init, m_scale, m_done, h_init, h_apply ) \ | 350 m_init, m_scale, m_done, h_init, h_apply ) \ |
| 344 FT_LOCAL_DEF( void ) \ | 351 FT_LOCAL_DEF( void ) \ |
| 345 FT_Init_Class_##script_class( AF_ScriptClassRec* ac ) \ | 352 FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \ |
| 346 { \ | 353 { \ |
| 347 ac->script = script_; \ | 354 ac->script = script_; \ |
| 348 ac->script_uni_ranges = ranges; \ | 355 ac->script_uni_ranges = ranges; \ |
| 356 ac->default_char = def_char; \ |
| 349 \ | 357 \ |
| 350 ac->script_metrics_size = m_size; \ | 358 ac->script_metrics_size = m_size; \ |
| 351 \ | 359 \ |
| 352 ac->script_metrics_init = m_init; \ | 360 ac->script_metrics_init = m_init; \ |
| 353 ac->script_metrics_scale = m_scale; \ | 361 ac->script_metrics_scale = m_scale; \ |
| 354 ac->script_metrics_done = m_done; \ | 362 ac->script_metrics_done = m_done; \ |
| 355 \ | 363 \ |
| 356 ac->script_hints_init = h_init; \ | 364 ac->script_hints_init = h_init; \ |
| 357 ac->script_hints_apply = h_apply; \ | 365 ac->script_hints_apply = h_apply; \ |
| 358 } | 366 } |
| 359 | 367 |
| 360 #endif /* FT_CONFIG_OPTION_PIC */ | 368 #endif /* FT_CONFIG_OPTION_PIC */ |
| 361 | 369 |
| 362 | 370 |
| 363 /* */ | 371 /* */ |
| 364 | 372 |
| 365 FT_END_HEADER | 373 FT_END_HEADER |
| 366 | 374 |
| 367 #endif /* __AFTYPES_H__ */ | 375 #endif /* __AFTYPES_H__ */ |
| 368 | 376 |
| 369 | 377 |
| 370 /* END */ | 378 /* END */ |
| OLD | NEW |