freetype2/src/autofit/afglobal.c

377 lines
9.8 KiB
C
Raw Normal View History

/***************************************************************************/
/* */
/* afglobal.c */
/* */
/* Auto-fitter routines to compute global hinting values (body). */
/* */
/* Copyright 2003-2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
2003-11-23 22:39:51 +01:00
#include "afglobal.h"
#include "afranges.h"
/* get writing system specific header files */
#undef WRITING_SYSTEM
#define WRITING_SYSTEM( ws, WS ) /* empty */
#include "afwrtsys.h"
#include "aferrors.h"
#include "afpic.h"
Position Independent Code (PIC) support in autofit module. * include/freetype/internal/autohint.h add macros to init instances of FT_AutoHinter_ServiceRec. * src/autofit/afmodule.h declare autofit_module_class using macros from ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy functions will be declared. * src/autofit/afmodule.c when FT_CONFIG_OPTION_PIC is defined af_autofitter_service and autofit_module_class structs will have functions to init or create and destroy them instead of being allocated in the global scope. And macros will be used from afpic.h in order to access them. * src/autofit/aftypes.h add macros to init and declare instances of AF_ScriptClassRec. * src/autofit/afcjk.h declare af_cjk_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afcjk.c when FT_CONFIG_OPTION_PIC is defined af_cjk_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/afdummy.h declare af_dummy_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afdummy.c when FT_CONFIG_OPTION_PIC is defined af_dummy_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/afindic.h declare af_indic_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afindic.c when FT_CONFIG_OPTION_PIC is defined af_indic_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/aflatin.h declare af_latin_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/aflatin.c when FT_CONFIG_OPTION_PIC is defined af_latin_script_class struct will have function to init it instead of being allocated in the global scope. Change af_latin_blue_chars to be PIC-compatible by being a two dimentional array rather than array of pointers. * src/autofit/aflatin2.h declare af_latin2_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/aflatin2.c when FT_CONFIG_OPTION_PIC is defined af_latin2_script_class struct will have function to init it instead of being allocated in the global scope. Change af_latin2_blue_chars to be PIC-compatible by being a two dimentional array rather than array of pointers. * src/autofit/afglobal.c when FT_CONFIG_OPTION_PIC is defined af_script_classes array initialization was moved to afpic.c and is later refered using macros defeined in afpic.h. New Files: * src/autofit/afpic.h declare struct to hold PIC globals for autofit module and macros to access them. * src/autofit/afpic.c implement functions to allocate, destroy and initialize PIC globals for autofit module. * src/autofit/autofit.c add new file to build: afpic.c. * src/autofit/jamfile add new files to FT2_MULTI build: afpic.c.
2009-04-05 17:23:38 +02:00
2013-09-25 23:32:25 +02:00
#ifndef FT_CONFIG_OPTION_PIC
[autofit] Introduce `writing systems'. This patch adds a new top level to the auto-hinter's script class hierarchy. It defines `writing systems' which can contain multiple scripts. For example, the `latin' writing system (in file `aflatin.c') is able to support scripts like Latin, Cyrillic, Armenian, etc., which can be handled similarly. Scripts are now named using four-letter OpenType tags. * src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members to... (AF_WritingSystemClassRec): This new structure. It holds pointers to functions which can be shared among related scripts. (AF_WritingSystem): New enumeration. (AF_Script): Revised values using four-letter tags. (AF_DEFINE_WRITING_SYSTEM_CLASS): New macro. (AF_DEFINE_SCRIPT_CLASS): Updated. * src/autofit/afglobal.c (af_writing_system_classes): New global, constant array. (af_script_classes): Updated. (af_face_globals_free): Updated. Remove assertion. (af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (AF_SCRIPT_FALLBACK) [!AF_CONFIG_OPTION_CJK]: Handle this case. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated; initialize structures for both writing systems and scripts. * src/autofit/afpic.h: Updated. (AF_WRITING_SYSTEM_CLASSES_GET): New macro. * src/autofit/afcjk.c (af_cjk_writing_system_class): New writing system. (af_cjk_uniranges): Renamed to... (af_hani_uniranges): This. (af_cjk_script_class): Reduced and renamed to... (af_hani_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/afdummy.c (af_dummy_writing_system_class): New writing system. (af_dummy_script_class): Reduced and renamed to... (af_dflt_script_class): This. * src/autofit/afdummy.h: Updated. * src/autofit/afindic.c (af_indic_writing_system_class): New writing system. (af_indic_uniranges): Renamed to... (af_deva_uniranges): This. (af_indic_script_class): Reduced and renamed to... (af_deva_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/aflatin.c (af_latin_writing_system_class): New writing system. (af_latin_uniranges): Renamed to... (af_latn_uniranges): This. (af_latin_script_class): Reduced and renamed to... (af_latn_script_class): This. * src/autofit/aflatin.h: Updated. * src/autofit/aflatin2.c (af_latin2_writing_system_class): New writing system. (af_latin2_uniranges): Renamed to... (af_ltn2_uniranges): This. Synchronize ranges with `latin'. (af_latin2_script_class): Reduced and renamed to... (af_ltn2_script_class): This. * src/autofit/aflatin2.h: Updated.
2013-07-31 22:49:29 +02:00
#undef WRITING_SYSTEM
#define WRITING_SYSTEM( ws, WS ) \
&af_ ## ws ## _writing_system_class,
FT_LOCAL_ARRAY_DEF( AF_WritingSystemClass )
af_writing_system_classes[] =
[autofit] Introduce `writing systems'. This patch adds a new top level to the auto-hinter's script class hierarchy. It defines `writing systems' which can contain multiple scripts. For example, the `latin' writing system (in file `aflatin.c') is able to support scripts like Latin, Cyrillic, Armenian, etc., which can be handled similarly. Scripts are now named using four-letter OpenType tags. * src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members to... (AF_WritingSystemClassRec): This new structure. It holds pointers to functions which can be shared among related scripts. (AF_WritingSystem): New enumeration. (AF_Script): Revised values using four-letter tags. (AF_DEFINE_WRITING_SYSTEM_CLASS): New macro. (AF_DEFINE_SCRIPT_CLASS): Updated. * src/autofit/afglobal.c (af_writing_system_classes): New global, constant array. (af_script_classes): Updated. (af_face_globals_free): Updated. Remove assertion. (af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (AF_SCRIPT_FALLBACK) [!AF_CONFIG_OPTION_CJK]: Handle this case. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated; initialize structures for both writing systems and scripts. * src/autofit/afpic.h: Updated. (AF_WRITING_SYSTEM_CLASSES_GET): New macro. * src/autofit/afcjk.c (af_cjk_writing_system_class): New writing system. (af_cjk_uniranges): Renamed to... (af_hani_uniranges): This. (af_cjk_script_class): Reduced and renamed to... (af_hani_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/afdummy.c (af_dummy_writing_system_class): New writing system. (af_dummy_script_class): Reduced and renamed to... (af_dflt_script_class): This. * src/autofit/afdummy.h: Updated. * src/autofit/afindic.c (af_indic_writing_system_class): New writing system. (af_indic_uniranges): Renamed to... (af_deva_uniranges): This. (af_indic_script_class): Reduced and renamed to... (af_deva_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/aflatin.c (af_latin_writing_system_class): New writing system. (af_latin_uniranges): Renamed to... (af_latn_uniranges): This. (af_latin_script_class): Reduced and renamed to... (af_latn_script_class): This. * src/autofit/aflatin.h: Updated. * src/autofit/aflatin2.c (af_latin2_writing_system_class): New writing system. (af_latin2_uniranges): Renamed to... (af_ltn2_uniranges): This. Synchronize ranges with `latin'. (af_latin2_script_class): Reduced and renamed to... (af_ltn2_script_class): This. * src/autofit/aflatin2.h: Updated.
2013-07-31 22:49:29 +02:00
{
#include "afwrtsys.h"
[autofit] Introduce `writing systems'. This patch adds a new top level to the auto-hinter's script class hierarchy. It defines `writing systems' which can contain multiple scripts. For example, the `latin' writing system (in file `aflatin.c') is able to support scripts like Latin, Cyrillic, Armenian, etc., which can be handled similarly. Scripts are now named using four-letter OpenType tags. * src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members to... (AF_WritingSystemClassRec): This new structure. It holds pointers to functions which can be shared among related scripts. (AF_WritingSystem): New enumeration. (AF_Script): Revised values using four-letter tags. (AF_DEFINE_WRITING_SYSTEM_CLASS): New macro. (AF_DEFINE_SCRIPT_CLASS): Updated. * src/autofit/afglobal.c (af_writing_system_classes): New global, constant array. (af_script_classes): Updated. (af_face_globals_free): Updated. Remove assertion. (af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (AF_SCRIPT_FALLBACK) [!AF_CONFIG_OPTION_CJK]: Handle this case. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated; initialize structures for both writing systems and scripts. * src/autofit/afpic.h: Updated. (AF_WRITING_SYSTEM_CLASSES_GET): New macro. * src/autofit/afcjk.c (af_cjk_writing_system_class): New writing system. (af_cjk_uniranges): Renamed to... (af_hani_uniranges): This. (af_cjk_script_class): Reduced and renamed to... (af_hani_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/afdummy.c (af_dummy_writing_system_class): New writing system. (af_dummy_script_class): Reduced and renamed to... (af_dflt_script_class): This. * src/autofit/afdummy.h: Updated. * src/autofit/afindic.c (af_indic_writing_system_class): New writing system. (af_indic_uniranges): Renamed to... (af_deva_uniranges): This. (af_indic_script_class): Reduced and renamed to... (af_deva_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/aflatin.c (af_latin_writing_system_class): New writing system. (af_latin_uniranges): Renamed to... (af_latn_uniranges): This. (af_latin_script_class): Reduced and renamed to... (af_latn_script_class): This. * src/autofit/aflatin.h: Updated. * src/autofit/aflatin2.c (af_latin2_writing_system_class): New writing system. (af_latin2_uniranges): Renamed to... (af_ltn2_uniranges): This. Synchronize ranges with `latin'. (af_latin2_script_class): Reduced and renamed to... (af_ltn2_script_class): This. * src/autofit/aflatin2.h: Updated.
2013-07-31 22:49:29 +02:00
NULL /* do not remove */
};
#undef SCRIPT
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
#define SCRIPT( s, S, d, dc ) \
AF_DEFINE_SCRIPT_CLASS( \
af_ ## s ## _script_class, \
AF_SCRIPT_ ## S, \
af_ ## s ## _uniranges, \
dc )
#include "afscript.h"
#undef SCRIPT
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
#define SCRIPT( s, S, d, dc ) \
&af_ ## s ## _script_class,
Position Independent Code (PIC) support in autofit module. * include/freetype/internal/autohint.h add macros to init instances of FT_AutoHinter_ServiceRec. * src/autofit/afmodule.h declare autofit_module_class using macros from ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy functions will be declared. * src/autofit/afmodule.c when FT_CONFIG_OPTION_PIC is defined af_autofitter_service and autofit_module_class structs will have functions to init or create and destroy them instead of being allocated in the global scope. And macros will be used from afpic.h in order to access them. * src/autofit/aftypes.h add macros to init and declare instances of AF_ScriptClassRec. * src/autofit/afcjk.h declare af_cjk_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afcjk.c when FT_CONFIG_OPTION_PIC is defined af_cjk_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/afdummy.h declare af_dummy_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afdummy.c when FT_CONFIG_OPTION_PIC is defined af_dummy_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/afindic.h declare af_indic_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afindic.c when FT_CONFIG_OPTION_PIC is defined af_indic_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/aflatin.h declare af_latin_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/aflatin.c when FT_CONFIG_OPTION_PIC is defined af_latin_script_class struct will have function to init it instead of being allocated in the global scope. Change af_latin_blue_chars to be PIC-compatible by being a two dimentional array rather than array of pointers. * src/autofit/aflatin2.h declare af_latin2_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/aflatin2.c when FT_CONFIG_OPTION_PIC is defined af_latin2_script_class struct will have function to init it instead of being allocated in the global scope. Change af_latin2_blue_chars to be PIC-compatible by being a two dimentional array rather than array of pointers. * src/autofit/afglobal.c when FT_CONFIG_OPTION_PIC is defined af_script_classes array initialization was moved to afpic.c and is later refered using macros defeined in afpic.h. New Files: * src/autofit/afpic.h declare struct to hold PIC globals for autofit module and macros to access them. * src/autofit/afpic.c implement functions to allocate, destroy and initialize PIC globals for autofit module. * src/autofit/autofit.c add new file to build: afpic.c. * src/autofit/jamfile add new files to FT2_MULTI build: afpic.c.
2009-04-05 17:23:38 +02:00
FT_LOCAL_ARRAY_DEF( AF_ScriptClass )
af_script_classes[] =
2003-11-23 22:39:51 +01:00
{
#include "afscript.h"
2003-11-23 22:39:51 +01:00
NULL /* do not remove */
};
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
#undef STYLE
#define STYLE( s, S, d, ws, sc, ss ) \
AF_DEFINE_STYLE_CLASS( \
af_ ## s ## _style_class, \
AF_STYLE_ ## S, \
ws, \
sc, \
ss )
#include "afstyles.h"
#undef STYLE
#define STYLE( s, S, d, ws, sc, ss ) \
&af_ ## s ## _style_class,
FT_LOCAL_ARRAY_DEF( AF_StyleClass )
af_style_classes[] =
{
#include "afstyles.h"
NULL /* do not remove */
};
#endif /* !FT_CONFIG_OPTION_PIC */
Position Independent Code (PIC) support in autofit module. * include/freetype/internal/autohint.h add macros to init instances of FT_AutoHinter_ServiceRec. * src/autofit/afmodule.h declare autofit_module_class using macros from ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy functions will be declared. * src/autofit/afmodule.c when FT_CONFIG_OPTION_PIC is defined af_autofitter_service and autofit_module_class structs will have functions to init or create and destroy them instead of being allocated in the global scope. And macros will be used from afpic.h in order to access them. * src/autofit/aftypes.h add macros to init and declare instances of AF_ScriptClassRec. * src/autofit/afcjk.h declare af_cjk_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afcjk.c when FT_CONFIG_OPTION_PIC is defined af_cjk_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/afdummy.h declare af_dummy_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afdummy.c when FT_CONFIG_OPTION_PIC is defined af_dummy_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/afindic.h declare af_indic_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afindic.c when FT_CONFIG_OPTION_PIC is defined af_indic_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/aflatin.h declare af_latin_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/aflatin.c when FT_CONFIG_OPTION_PIC is defined af_latin_script_class struct will have function to init it instead of being allocated in the global scope. Change af_latin_blue_chars to be PIC-compatible by being a two dimentional array rather than array of pointers. * src/autofit/aflatin2.h declare af_latin2_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/aflatin2.c when FT_CONFIG_OPTION_PIC is defined af_latin2_script_class struct will have function to init it instead of being allocated in the global scope. Change af_latin2_blue_chars to be PIC-compatible by being a two dimentional array rather than array of pointers. * src/autofit/afglobal.c when FT_CONFIG_OPTION_PIC is defined af_script_classes array initialization was moved to afpic.c and is later refered using macros defeined in afpic.h. New Files: * src/autofit/afpic.h declare struct to hold PIC globals for autofit module and macros to access them. * src/autofit/afpic.c implement functions to allocate, destroy and initialize PIC globals for autofit module. * src/autofit/autofit.c add new file to build: afpic.c. * src/autofit/jamfile add new files to FT2_MULTI build: afpic.c.
2009-04-05 17:23:38 +02:00
#ifdef FT_DEBUG_LEVEL_TRACE
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
#undef STYLE
#define STYLE( s, S, d, ws, sc, ss ) #s,
FT_LOCAL_ARRAY_DEF( char* )
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
af_style_names[] =
{
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
#include "afstyles.h"
};
#endif /* FT_DEBUG_LEVEL_TRACE */
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
/* Compute the style index of each glyph within a given face. */
2003-11-23 22:39:51 +01:00
static FT_Error
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
af_face_globals_compute_style_coverage( AF_FaceGlobals globals )
2003-11-23 22:39:51 +01:00
{
FT_Error error;
2003-11-23 22:39:51 +01:00
FT_Face face = globals->face;
FT_CharMap old_charmap = face->charmap;
2013-12-18 10:39:30 +01:00
FT_Byte* gstyles = globals->glyph_styles;
FT_UInt ss;
FT_UInt i;
2003-11-23 22:39:51 +01:00
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
/* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */
FT_MEM_SET( globals->glyph_styles,
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
AF_STYLE_UNASSIGNED,
2003-11-23 22:39:51 +01:00
globals->glyph_count );
error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
if ( error )
{
/*
* Ignore this error; we simply use the fallback script.
* XXX: Shouldn't we rather disable hinting?
2003-11-23 22:39:51 +01:00
*/
error = FT_Err_Ok;
2003-11-23 22:39:51 +01:00
goto Exit;
}
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
/* scan each style in a Unicode charmap */
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
2003-11-23 22:39:51 +01:00
{
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
AF_StyleClass style_class =
AF_STYLE_CLASSES_GET[ss];
AF_ScriptClass script_class =
AF_SCRIPT_CLASSES_GET[style_class->script];
2003-11-23 22:39:51 +01:00
AF_Script_UniRange range;
if ( script_class->script_uni_ranges == NULL )
continue;
/*
* Scan all Unicode points in the range and set the corresponding
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
* glyph style index.
*/
for ( range = script_class->script_uni_ranges;
range->first != 0;
range++ )
2003-11-23 22:39:51 +01:00
{
FT_ULong charcode = range->first;
FT_UInt gindex;
2003-11-23 22:39:51 +01:00
gindex = FT_Get_Char_Index( face, charcode );
2013-12-18 10:39:30 +01:00
if ( gindex != 0 &&
gindex < (FT_ULong)globals->glyph_count &&
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
gstyles[gindex] == AF_STYLE_UNASSIGNED )
2013-12-18 10:39:30 +01:00
gstyles[gindex] = (FT_Byte)ss;
2003-11-23 22:39:51 +01:00
for (;;)
{
charcode = FT_Get_Next_Char( face, charcode, &gindex );
if ( gindex == 0 || charcode > range->last )
break;
2013-12-18 10:39:30 +01:00
if ( gindex < (FT_ULong)globals->glyph_count &&
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
gstyles[gindex] == AF_STYLE_UNASSIGNED )
2013-12-18 10:39:30 +01:00
gstyles[gindex] = (FT_Byte)ss;
2003-11-23 22:39:51 +01:00
}
}
}
/* mark ASCII digits */
for ( i = 0x30; i <= 0x39; i++ )
{
FT_UInt gindex = FT_Get_Char_Index( face, i );
if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count )
2013-12-18 10:39:30 +01:00
gstyles[gindex] |= AF_DIGIT;
}
2003-11-23 22:39:51 +01:00
Exit:
/*
* By default, all uncovered glyphs are set to the fallback script.
2007-01-31 00:08:50 +01:00
* XXX: Shouldn't we disable hinting or do something similar?
*/
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
if ( globals->module->fallback_script != AF_STYLE_UNASSIGNED )
2003-11-23 22:39:51 +01:00
{
FT_Long nn;
2003-11-23 22:39:51 +01:00
2003-11-23 22:39:51 +01:00
for ( nn = 0; nn < globals->glyph_count; nn++ )
{
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
if ( ( gstyles[nn] & ~AF_DIGIT ) == AF_STYLE_UNASSIGNED )
{
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
gstyles[nn] &= ~AF_STYLE_UNASSIGNED;
2013-12-18 10:39:30 +01:00
gstyles[nn] |= globals->module->fallback_script;
}
2003-11-23 22:39:51 +01:00
}
}
FT_Set_Charmap( face, old_charmap );
return error;
}
FT_LOCAL_DEF( FT_Error )
af_face_globals_new( FT_Face face,
AF_FaceGlobals *aglobals,
AF_Module module )
2003-11-23 22:39:51 +01:00
{
FT_Error error;
FT_Memory memory;
AF_FaceGlobals globals = NULL;
2003-11-23 22:39:51 +01:00
2003-11-23 22:39:51 +01:00
memory = face->memory;
if ( FT_ALLOC( globals, sizeof ( *globals ) +
face->num_glyphs * sizeof ( FT_Byte ) ) )
goto Exit;
2003-11-23 22:39:51 +01:00
globals->face = face;
globals->glyph_count = face->num_glyphs;
globals->glyph_styles = (FT_Byte*)( globals + 1 );
globals->module = module;
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
error = af_face_globals_compute_style_coverage( globals );
if ( error )
{
af_face_globals_free( globals );
globals = NULL;
2003-11-23 22:39:51 +01:00
}
globals->increase_x_height = AF_PROP_INCREASE_X_HEIGHT_MAX;
Exit:
2003-11-23 22:39:51 +01:00
*aglobals = globals;
return error;
}
FT_LOCAL_DEF( void )
af_face_globals_free( AF_FaceGlobals globals )
{
if ( globals )
{
FT_Memory memory = globals->face->memory;
FT_UInt nn;
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
for ( nn = 0; nn < AF_STYLE_MAX; nn++ )
2003-11-23 22:39:51 +01:00
{
if ( globals->metrics[nn] )
{
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
AF_StyleClass style_class =
AF_STYLE_CLASSES_GET[nn];
[autofit] Introduce `writing systems'. This patch adds a new top level to the auto-hinter's script class hierarchy. It defines `writing systems' which can contain multiple scripts. For example, the `latin' writing system (in file `aflatin.c') is able to support scripts like Latin, Cyrillic, Armenian, etc., which can be handled similarly. Scripts are now named using four-letter OpenType tags. * src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members to... (AF_WritingSystemClassRec): This new structure. It holds pointers to functions which can be shared among related scripts. (AF_WritingSystem): New enumeration. (AF_Script): Revised values using four-letter tags. (AF_DEFINE_WRITING_SYSTEM_CLASS): New macro. (AF_DEFINE_SCRIPT_CLASS): Updated. * src/autofit/afglobal.c (af_writing_system_classes): New global, constant array. (af_script_classes): Updated. (af_face_globals_free): Updated. Remove assertion. (af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (AF_SCRIPT_FALLBACK) [!AF_CONFIG_OPTION_CJK]: Handle this case. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated; initialize structures for both writing systems and scripts. * src/autofit/afpic.h: Updated. (AF_WRITING_SYSTEM_CLASSES_GET): New macro. * src/autofit/afcjk.c (af_cjk_writing_system_class): New writing system. (af_cjk_uniranges): Renamed to... (af_hani_uniranges): This. (af_cjk_script_class): Reduced and renamed to... (af_hani_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/afdummy.c (af_dummy_writing_system_class): New writing system. (af_dummy_script_class): Reduced and renamed to... (af_dflt_script_class): This. * src/autofit/afdummy.h: Updated. * src/autofit/afindic.c (af_indic_writing_system_class): New writing system. (af_indic_uniranges): Renamed to... (af_deva_uniranges): This. (af_indic_script_class): Reduced and renamed to... (af_deva_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/aflatin.c (af_latin_writing_system_class): New writing system. (af_latin_uniranges): Renamed to... (af_latn_uniranges): This. (af_latin_script_class): Reduced and renamed to... (af_latn_script_class): This. * src/autofit/aflatin.h: Updated. * src/autofit/aflatin2.c (af_latin2_writing_system_class): New writing system. (af_latin2_uniranges): Renamed to... (af_ltn2_uniranges): This. Synchronize ranges with `latin'. (af_latin2_script_class): Reduced and renamed to... (af_ltn2_script_class): This. * src/autofit/aflatin2.h: Updated.
2013-07-31 22:49:29 +02:00
AF_WritingSystemClass writing_system_class =
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system];
2003-11-23 22:39:51 +01:00
if ( writing_system_class->style_metrics_done )
writing_system_class->style_metrics_done( globals->metrics[nn] );
2003-11-23 22:39:51 +01:00
FT_FREE( globals->metrics[nn] );
}
}
globals->glyph_count = 0;
globals->glyph_styles = NULL; /* no need to free this one! */
globals->face = NULL;
2003-11-23 22:39:51 +01:00
FT_FREE( globals );
}
}
FT_LOCAL_DEF( FT_Error )
af_face_globals_get_metrics( AF_FaceGlobals globals,
FT_UInt gindex,
FT_UInt options,
AF_StyleMetrics *ametrics )
2003-11-23 22:39:51 +01:00
{
AF_StyleMetrics metrics = NULL;
[autofit] Introduce `writing systems'. This patch adds a new top level to the auto-hinter's script class hierarchy. It defines `writing systems' which can contain multiple scripts. For example, the `latin' writing system (in file `aflatin.c') is able to support scripts like Latin, Cyrillic, Armenian, etc., which can be handled similarly. Scripts are now named using four-letter OpenType tags. * src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members to... (AF_WritingSystemClassRec): This new structure. It holds pointers to functions which can be shared among related scripts. (AF_WritingSystem): New enumeration. (AF_Script): Revised values using four-letter tags. (AF_DEFINE_WRITING_SYSTEM_CLASS): New macro. (AF_DEFINE_SCRIPT_CLASS): Updated. * src/autofit/afglobal.c (af_writing_system_classes): New global, constant array. (af_script_classes): Updated. (af_face_globals_free): Updated. Remove assertion. (af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (AF_SCRIPT_FALLBACK) [!AF_CONFIG_OPTION_CJK]: Handle this case. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated; initialize structures for both writing systems and scripts. * src/autofit/afpic.h: Updated. (AF_WRITING_SYSTEM_CLASSES_GET): New macro. * src/autofit/afcjk.c (af_cjk_writing_system_class): New writing system. (af_cjk_uniranges): Renamed to... (af_hani_uniranges): This. (af_cjk_script_class): Reduced and renamed to... (af_hani_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/afdummy.c (af_dummy_writing_system_class): New writing system. (af_dummy_script_class): Reduced and renamed to... (af_dflt_script_class): This. * src/autofit/afdummy.h: Updated. * src/autofit/afindic.c (af_indic_writing_system_class): New writing system. (af_indic_uniranges): Renamed to... (af_deva_uniranges): This. (af_indic_script_class): Reduced and renamed to... (af_deva_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/aflatin.c (af_latin_writing_system_class): New writing system. (af_latin_uniranges): Renamed to... (af_latn_uniranges): This. (af_latin_script_class): Reduced and renamed to... (af_latn_script_class): This. * src/autofit/aflatin.h: Updated. * src/autofit/aflatin2.c (af_latin2_writing_system_class): New writing system. (af_latin2_uniranges): Renamed to... (af_ltn2_uniranges): This. Synchronize ranges with `latin'. (af_latin2_script_class): Reduced and renamed to... (af_ltn2_script_class): This. * src/autofit/aflatin2.h: Updated.
2013-07-31 22:49:29 +02:00
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
AF_Style style = (AF_Style)( options & 15 );
[autofit] Introduce `writing systems'. This patch adds a new top level to the auto-hinter's script class hierarchy. It defines `writing systems' which can contain multiple scripts. For example, the `latin' writing system (in file `aflatin.c') is able to support scripts like Latin, Cyrillic, Armenian, etc., which can be handled similarly. Scripts are now named using four-letter OpenType tags. * src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members to... (AF_WritingSystemClassRec): This new structure. It holds pointers to functions which can be shared among related scripts. (AF_WritingSystem): New enumeration. (AF_Script): Revised values using four-letter tags. (AF_DEFINE_WRITING_SYSTEM_CLASS): New macro. (AF_DEFINE_SCRIPT_CLASS): Updated. * src/autofit/afglobal.c (af_writing_system_classes): New global, constant array. (af_script_classes): Updated. (af_face_globals_free): Updated. Remove assertion. (af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (AF_SCRIPT_FALLBACK) [!AF_CONFIG_OPTION_CJK]: Handle this case. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated; initialize structures for both writing systems and scripts. * src/autofit/afpic.h: Updated. (AF_WRITING_SYSTEM_CLASSES_GET): New macro. * src/autofit/afcjk.c (af_cjk_writing_system_class): New writing system. (af_cjk_uniranges): Renamed to... (af_hani_uniranges): This. (af_cjk_script_class): Reduced and renamed to... (af_hani_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/afdummy.c (af_dummy_writing_system_class): New writing system. (af_dummy_script_class): Reduced and renamed to... (af_dflt_script_class): This. * src/autofit/afdummy.h: Updated. * src/autofit/afindic.c (af_indic_writing_system_class): New writing system. (af_indic_uniranges): Renamed to... (af_deva_uniranges): This. (af_indic_script_class): Reduced and renamed to... (af_deva_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/aflatin.c (af_latin_writing_system_class): New writing system. (af_latin_uniranges): Renamed to... (af_latn_uniranges): This. (af_latin_script_class): Reduced and renamed to... (af_latn_script_class): This. * src/autofit/aflatin.h: Updated. * src/autofit/aflatin2.c (af_latin2_writing_system_class): New writing system. (af_latin2_uniranges): Renamed to... (af_ltn2_uniranges): This. Synchronize ranges with `latin'. (af_latin2_script_class): Reduced and renamed to... (af_ltn2_script_class): This. * src/autofit/aflatin2.h: Updated.
2013-07-31 22:49:29 +02:00
AF_WritingSystemClass writing_system_class;
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
AF_StyleClass style_class;
[autofit] Introduce `writing systems'. This patch adds a new top level to the auto-hinter's script class hierarchy. It defines `writing systems' which can contain multiple scripts. For example, the `latin' writing system (in file `aflatin.c') is able to support scripts like Latin, Cyrillic, Armenian, etc., which can be handled similarly. Scripts are now named using four-letter OpenType tags. * src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members to... (AF_WritingSystemClassRec): This new structure. It holds pointers to functions which can be shared among related scripts. (AF_WritingSystem): New enumeration. (AF_Script): Revised values using four-letter tags. (AF_DEFINE_WRITING_SYSTEM_CLASS): New macro. (AF_DEFINE_SCRIPT_CLASS): Updated. * src/autofit/afglobal.c (af_writing_system_classes): New global, constant array. (af_script_classes): Updated. (af_face_globals_free): Updated. Remove assertion. (af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (AF_SCRIPT_FALLBACK) [!AF_CONFIG_OPTION_CJK]: Handle this case. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated; initialize structures for both writing systems and scripts. * src/autofit/afpic.h: Updated. (AF_WRITING_SYSTEM_CLASSES_GET): New macro. * src/autofit/afcjk.c (af_cjk_writing_system_class): New writing system. (af_cjk_uniranges): Renamed to... (af_hani_uniranges): This. (af_cjk_script_class): Reduced and renamed to... (af_hani_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/afdummy.c (af_dummy_writing_system_class): New writing system. (af_dummy_script_class): Reduced and renamed to... (af_dflt_script_class): This. * src/autofit/afdummy.h: Updated. * src/autofit/afindic.c (af_indic_writing_system_class): New writing system. (af_indic_uniranges): Renamed to... (af_deva_uniranges): This. (af_indic_script_class): Reduced and renamed to... (af_deva_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/aflatin.c (af_latin_writing_system_class): New writing system. (af_latin_uniranges): Renamed to... (af_latn_uniranges): This. (af_latin_script_class): Reduced and renamed to... (af_latn_script_class): This. * src/autofit/aflatin.h: Updated. * src/autofit/aflatin2.c (af_latin2_writing_system_class): New writing system. (af_latin2_uniranges): Renamed to... (af_ltn2_uniranges): This. Synchronize ranges with `latin'. (af_latin2_script_class): Reduced and renamed to... (af_ltn2_script_class): This. * src/autofit/aflatin2.h: Updated.
2013-07-31 22:49:29 +02:00
FT_Error error = FT_Err_Ok;
2003-11-23 22:39:51 +01:00
if ( gindex >= (FT_ULong)globals->glyph_count )
2003-11-23 22:39:51 +01:00
{
error = FT_THROW( Invalid_Argument );
2003-11-23 22:39:51 +01:00
goto Exit;
}
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
/* if we have a forced style (via `options'), use it, */
/* otherwise look into `glyph_styles' array */
if ( style == AF_STYLE_NONE_DEFAULT || style + 1 >= AF_STYLE_MAX )
style = (AF_Style)( globals->glyph_styles[gindex] &
AF_STYLE_UNASSIGNED );
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
style_class = AF_STYLE_CLASSES_GET[style];
[autofit] Introduce `writing systems'. This patch adds a new top level to the auto-hinter's script class hierarchy. It defines `writing systems' which can contain multiple scripts. For example, the `latin' writing system (in file `aflatin.c') is able to support scripts like Latin, Cyrillic, Armenian, etc., which can be handled similarly. Scripts are now named using four-letter OpenType tags. * src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members to... (AF_WritingSystemClassRec): This new structure. It holds pointers to functions which can be shared among related scripts. (AF_WritingSystem): New enumeration. (AF_Script): Revised values using four-letter tags. (AF_DEFINE_WRITING_SYSTEM_CLASS): New macro. (AF_DEFINE_SCRIPT_CLASS): Updated. * src/autofit/afglobal.c (af_writing_system_classes): New global, constant array. (af_script_classes): Updated. (af_face_globals_free): Updated. Remove assertion. (af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (AF_SCRIPT_FALLBACK) [!AF_CONFIG_OPTION_CJK]: Handle this case. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated; initialize structures for both writing systems and scripts. * src/autofit/afpic.h: Updated. (AF_WRITING_SYSTEM_CLASSES_GET): New macro. * src/autofit/afcjk.c (af_cjk_writing_system_class): New writing system. (af_cjk_uniranges): Renamed to... (af_hani_uniranges): This. (af_cjk_script_class): Reduced and renamed to... (af_hani_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/afdummy.c (af_dummy_writing_system_class): New writing system. (af_dummy_script_class): Reduced and renamed to... (af_dflt_script_class): This. * src/autofit/afdummy.h: Updated. * src/autofit/afindic.c (af_indic_writing_system_class): New writing system. (af_indic_uniranges): Renamed to... (af_deva_uniranges): This. (af_indic_script_class): Reduced and renamed to... (af_deva_script_class): This. * src/autofit/afcjk.h: Updated. * src/autofit/aflatin.c (af_latin_writing_system_class): New writing system. (af_latin_uniranges): Renamed to... (af_latn_uniranges): This. (af_latin_script_class): Reduced and renamed to... (af_latn_script_class): This. * src/autofit/aflatin.h: Updated. * src/autofit/aflatin2.c (af_latin2_writing_system_class): New writing system. (af_latin2_uniranges): Renamed to... (af_ltn2_uniranges): This. Synchronize ranges with `latin'. (af_latin2_script_class): Reduced and renamed to... (af_ltn2_script_class): This. * src/autofit/aflatin2.h: Updated.
2013-07-31 22:49:29 +02:00
writing_system_class = AF_WRITING_SYSTEM_CLASSES_GET
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
[style_class->writing_system];
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
metrics = globals->metrics[style];
2003-11-23 22:39:51 +01:00
if ( metrics == NULL )
{
/* create the global metrics object if necessary */
2004-01-16 10:51:00 +01:00
FT_Memory memory = globals->face->memory;
if ( FT_ALLOC( metrics, writing_system_class->style_metrics_size ) )
2003-11-23 22:39:51 +01:00
goto Exit;
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
metrics->style_class = style_class;
metrics->globals = globals;
2003-11-23 22:39:51 +01:00
if ( writing_system_class->style_metrics_init )
2003-11-23 22:39:51 +01:00
{
error = writing_system_class->style_metrics_init( metrics,
globals->face );
2003-11-23 22:39:51 +01:00
if ( error )
{
if ( writing_system_class->style_metrics_done )
writing_system_class->style_metrics_done( metrics );
2003-11-23 22:39:51 +01:00
FT_FREE( metrics );
goto Exit;
}
}
[autofit] Introduce `styles'. This is the new top-level structure for handling glyph input data; scripts are now defined separately. * src/autofit/aftypes.h (SCRIPT): Updated. (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' members to ... (AF_Style_ClassRec): ... this new structure. (AF_Style): New enumeration. (AF_StyleMetricsRec): Replace `script' enumeration with `style_class' pointer. (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. * src/autofit/afstyles.h: New file, using data from `afscript.h'. * src/autofit/afscript.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. * src/autofit/afglobal.c (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... (af_style_names): ... this array. (af_face_globals_compute_script_coverage): Renamed to... (af_face_globals_compute_style_coverage): ... this. Updated. (af_face_globals_new, af_face_globals_free, af_face_globals_get_metrics): Updated. * src/autofit/afglobal.h (SCRIPT): Updated. (STYLE): Redefine macro to load `afstyles.h'. (AF_SCRIPT_FALLBACK): Update definition. This will get more refinements with later on. (AF_SCRIPT_UNASSIGNED): Replace with... (AF_STYLE_UNASSIGNED): ... this macro. (AF_FaceGlobalsRec): Updated. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. (af_ltn2_uniranges): Removed. * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): Updated. * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' members. * src/autofit/afranges.h: Updated. * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
globals->metrics[style] = metrics;
2003-11-23 22:39:51 +01:00
}
Exit:
*ametrics = metrics;
2003-11-23 22:39:51 +01:00
return error;
}
FT_LOCAL_DEF( FT_Bool )
af_face_globals_is_digit( AF_FaceGlobals globals,
FT_UInt gindex )
{
if ( gindex < (FT_ULong)globals->glyph_count )
return (FT_Bool)( globals->glyph_styles[gindex] & AF_DIGIT );
return (FT_Bool)0;
}
/* END */