freetype2/src/autofit/afglobal.c

504 lines
14 KiB
C
Raw Normal View History

/***************************************************************************/
/* */
/* afglobal.c */
/* */
/* Auto-fitter routines to compute global hinting values (body). */
/* */
2018-01-02 09:33:57 +01:00
/* Copyright 2003-2018 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"
#include "afshaper.h"
#include FT_INTERNAL_DEBUG_H
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_afglobal
/* 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
#undef SCRIPT
#define SCRIPT( s, S, d, h, H, ss ) \
AF_DEFINE_SCRIPT_CLASS( \
af_ ## s ## _script_class, \
AF_SCRIPT_ ## S, \
af_ ## s ## _uniranges, \
af_ ## s ## _nonbase_uniranges, \
AF_ ## H, \
ss )
#include "afscript.h"
#undef STYLE
Introduce `coverages'. Coverages are the interface to the HarfBuzz library to access OpenType features for handling glyphs not addressable by the cmap. Right now, compilation of HarfBuzz is only added to the development build. A solution for standard build mode will be delayed until HarfBuzz gets split into two libraries to avoid mutual dependencies between FreeType and HarfBuzz. Note that this is only a first step in handling coverages, basically providing the framework only. Code for handling selected OpenType features (this is, actually using the data in `afcover.h') will follow. * devel/ftoption.h, include/config/ftoption.h (FT_CONFIG_OPTION_USE_HARFBUZZ): New macro. * src/autofit/hbshim.c, src/autofit/hbshim.h, src/autofit/afcover.h: New files. * src/autofit/afscript.h: Add HarfBuzz script name tags. * src/autofit/afstyles.h: Add default coverage enumeration values. * src/autofit/aftypes.h: Update use of `SCRIPT' and `STYLE' macros. (AF_Coverage): New enumeration (generated by `afcover.h'). (AF_StyleClassRec): New member `coverage'. (AF_DEFINE_STYLE_CLASS): Updated. * include/internal/fttrace.h: Add `afharfbuzz' for tracing coverage data. * src/autofit/afglobal.h: Update use of `SCRIPT' and `STYLE' macros. (AF_SCRIPT_FALLBACK): Renamed to ... (AF_STYLE_FALLBACK): ... this. * src/autofit/afglobal.c: Include `hbshim.c'. Update use of `SCRIPT' and `STYLE' macros. (af_face_globals_compute_style_coverage) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call `af_get_coverage'. Update. * src/autofit/afmodule.h (AF_ModuleRec): s/fallback_script/fallback_style/. * src/autofit/afmodule.c (af_property_set): Adapt handling of `fallback-script' property to set a fallback style. (af_property_get, af_autofitter_init): Updated. * src/autofit/afpic.c: Update use of `SCRIPT' and `STYLE' macros. * src/autofit/afranges.h: Update use of `SCRIPT' macro. * src/autofit/autofit.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include `hbshim.c'. * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `hbshim.c'. (AUTOF_DRV_H): Add `afcover.h'. * builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Use pkg-config for all libraries needed by FreeType.
2013-12-21 21:31:38 +01:00
#define STYLE( s, S, d, ws, sc, ss, c ) \
AF_DEFINE_STYLE_CLASS( \
af_ ## s ## _style_class, \
AF_STYLE_ ## S, \
ws, \
sc, \
ss, \
c )
#include "afstyles.h"
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
#define SCRIPT( s, S, d, h, H, ss ) \
&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
Introduce `coverages'. Coverages are the interface to the HarfBuzz library to access OpenType features for handling glyphs not addressable by the cmap. Right now, compilation of HarfBuzz is only added to the development build. A solution for standard build mode will be delayed until HarfBuzz gets split into two libraries to avoid mutual dependencies between FreeType and HarfBuzz. Note that this is only a first step in handling coverages, basically providing the framework only. Code for handling selected OpenType features (this is, actually using the data in `afcover.h') will follow. * devel/ftoption.h, include/config/ftoption.h (FT_CONFIG_OPTION_USE_HARFBUZZ): New macro. * src/autofit/hbshim.c, src/autofit/hbshim.h, src/autofit/afcover.h: New files. * src/autofit/afscript.h: Add HarfBuzz script name tags. * src/autofit/afstyles.h: Add default coverage enumeration values. * src/autofit/aftypes.h: Update use of `SCRIPT' and `STYLE' macros. (AF_Coverage): New enumeration (generated by `afcover.h'). (AF_StyleClassRec): New member `coverage'. (AF_DEFINE_STYLE_CLASS): Updated. * include/internal/fttrace.h: Add `afharfbuzz' for tracing coverage data. * src/autofit/afglobal.h: Update use of `SCRIPT' and `STYLE' macros. (AF_SCRIPT_FALLBACK): Renamed to ... (AF_STYLE_FALLBACK): ... this. * src/autofit/afglobal.c: Include `hbshim.c'. Update use of `SCRIPT' and `STYLE' macros. (af_face_globals_compute_style_coverage) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call `af_get_coverage'. Update. * src/autofit/afmodule.h (AF_ModuleRec): s/fallback_script/fallback_style/. * src/autofit/afmodule.c (af_property_set): Adapt handling of `fallback-script' property to set a fallback style. (af_property_get, af_autofitter_init): Updated. * src/autofit/afpic.c: Update use of `SCRIPT' and `STYLE' macros. * src/autofit/afranges.h: Update use of `SCRIPT' macro. * src/autofit/autofit.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include `hbshim.c'. * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `hbshim.c'. (AUTOF_DRV_H): Add `afcover.h'. * builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Use pkg-config for all libraries needed by FreeType.
2013-12-21 21:31:38 +01:00
#define STYLE( s, S, d, ws, sc, ss, c ) \
[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_ ## 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
Introduce `coverages'. Coverages are the interface to the HarfBuzz library to access OpenType features for handling glyphs not addressable by the cmap. Right now, compilation of HarfBuzz is only added to the development build. A solution for standard build mode will be delayed until HarfBuzz gets split into two libraries to avoid mutual dependencies between FreeType and HarfBuzz. Note that this is only a first step in handling coverages, basically providing the framework only. Code for handling selected OpenType features (this is, actually using the data in `afcover.h') will follow. * devel/ftoption.h, include/config/ftoption.h (FT_CONFIG_OPTION_USE_HARFBUZZ): New macro. * src/autofit/hbshim.c, src/autofit/hbshim.h, src/autofit/afcover.h: New files. * src/autofit/afscript.h: Add HarfBuzz script name tags. * src/autofit/afstyles.h: Add default coverage enumeration values. * src/autofit/aftypes.h: Update use of `SCRIPT' and `STYLE' macros. (AF_Coverage): New enumeration (generated by `afcover.h'). (AF_StyleClassRec): New member `coverage'. (AF_DEFINE_STYLE_CLASS): Updated. * include/internal/fttrace.h: Add `afharfbuzz' for tracing coverage data. * src/autofit/afglobal.h: Update use of `SCRIPT' and `STYLE' macros. (AF_SCRIPT_FALLBACK): Renamed to ... (AF_STYLE_FALLBACK): ... this. * src/autofit/afglobal.c: Include `hbshim.c'. Update use of `SCRIPT' and `STYLE' macros. (af_face_globals_compute_style_coverage) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call `af_get_coverage'. Update. * src/autofit/afmodule.h (AF_ModuleRec): s/fallback_script/fallback_style/. * src/autofit/afmodule.c (af_property_set): Adapt handling of `fallback-script' property to set a fallback style. (af_property_get, af_autofitter_init): Updated. * src/autofit/afpic.c: Update use of `SCRIPT' and `STYLE' macros. * src/autofit/afranges.h: Update use of `SCRIPT' macro. * src/autofit/autofit.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include `hbshim.c'. * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `hbshim.c'. (AUTOF_DRV_H): Add `afcover.h'. * builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Use pkg-config for all libraries needed by FreeType.
2013-12-21 21:31:38 +01:00
#define STYLE( s, S, d, ws, sc, ss, c ) #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;
FT_UShort* gstyles = globals->glyph_styles;
FT_UInt ss;
FT_UInt i;
FT_UInt dflt = ~0U; /* a non-valid value */
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' */
for ( i = 0; i < (FT_UInt)globals->glyph_count; i++ )
gstyles[i] = AF_STYLE_UNASSIGNED;
2003-11-23 22:39:51 +01:00
error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
if ( error )
{
2014-01-03 18:06:45 +01:00
/*
* Ignore this error; we simply use the fallback style.
* XXX: Shouldn't we rather disable hinting?
*/
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 )
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.
*/
2013-12-23 16:42:03 +01:00
if ( style_class->coverage == AF_COVERAGE_DEFAULT )
2003-11-23 22:39:51 +01:00
{
if ( (FT_UInt)style_class->script ==
globals->module->default_script )
dflt = ss;
2013-12-23 16:42:03 +01:00
for ( range = script_class->script_uni_ranges;
range->first != 0;
range++ )
{
FT_ULong charcode = range->first;
FT_UInt gindex;
2003-11-23 22:39:51 +01:00
2013-12-23 16:42:03 +01:00
gindex = FT_Get_Char_Index( face, charcode );
2003-11-23 22:39:51 +01:00
if ( gindex != 0 &&
gindex < (FT_ULong)globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
gstyles[gindex] = (FT_UShort)ss;
2013-12-23 16:42:03 +01:00
for (;;)
{
charcode = FT_Get_Next_Char( face, charcode, &gindex );
2003-11-23 22:39:51 +01:00
2013-12-23 16:42:03 +01:00
if ( gindex == 0 || charcode > range->last )
break;
2003-11-23 22:39:51 +01:00
if ( gindex < (FT_ULong)globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
gstyles[gindex] = (FT_UShort)ss;
2013-12-23 16:42:03 +01:00
}
2003-11-23 22:39:51 +01:00
}
/* do the same for the script's non-base characters */
for ( range = script_class->script_uni_nonbase_ranges;
range->first != 0;
range++ )
{
FT_ULong charcode = range->first;
FT_UInt gindex;
gindex = FT_Get_Char_Index( face, charcode );
if ( gindex != 0 &&
gindex < (FT_ULong)globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
gstyles[gindex] |= AF_NONBASE;
for (;;)
{
charcode = FT_Get_Next_Char( face, charcode, &gindex );
if ( gindex == 0 || charcode > range->last )
break;
if ( gindex < (FT_ULong)globals->glyph_count &&
( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
gstyles[gindex] |= AF_NONBASE;
}
}
2003-11-23 22:39:51 +01:00
}
else
{
/* get glyphs not directly addressable by cmap */
af_shaper_get_coverage( globals, style_class, gstyles, 0 );
}
}
/* handle the remaining default OpenType features ... */
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
{
AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss];
Introduce `coverages'. Coverages are the interface to the HarfBuzz library to access OpenType features for handling glyphs not addressable by the cmap. Right now, compilation of HarfBuzz is only added to the development build. A solution for standard build mode will be delayed until HarfBuzz gets split into two libraries to avoid mutual dependencies between FreeType and HarfBuzz. Note that this is only a first step in handling coverages, basically providing the framework only. Code for handling selected OpenType features (this is, actually using the data in `afcover.h') will follow. * devel/ftoption.h, include/config/ftoption.h (FT_CONFIG_OPTION_USE_HARFBUZZ): New macro. * src/autofit/hbshim.c, src/autofit/hbshim.h, src/autofit/afcover.h: New files. * src/autofit/afscript.h: Add HarfBuzz script name tags. * src/autofit/afstyles.h: Add default coverage enumeration values. * src/autofit/aftypes.h: Update use of `SCRIPT' and `STYLE' macros. (AF_Coverage): New enumeration (generated by `afcover.h'). (AF_StyleClassRec): New member `coverage'. (AF_DEFINE_STYLE_CLASS): Updated. * include/internal/fttrace.h: Add `afharfbuzz' for tracing coverage data. * src/autofit/afglobal.h: Update use of `SCRIPT' and `STYLE' macros. (AF_SCRIPT_FALLBACK): Renamed to ... (AF_STYLE_FALLBACK): ... this. * src/autofit/afglobal.c: Include `hbshim.c'. Update use of `SCRIPT' and `STYLE' macros. (af_face_globals_compute_style_coverage) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call `af_get_coverage'. Update. * src/autofit/afmodule.h (AF_ModuleRec): s/fallback_script/fallback_style/. * src/autofit/afmodule.c (af_property_set): Adapt handling of `fallback-script' property to set a fallback style. (af_property_get, af_autofitter_init): Updated. * src/autofit/afpic.c: Update use of `SCRIPT' and `STYLE' macros. * src/autofit/afranges.h: Update use of `SCRIPT' macro. * src/autofit/autofit.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include `hbshim.c'. * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `hbshim.c'. (AUTOF_DRV_H): Add `afcover.h'. * builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Use pkg-config for all libraries needed by FreeType.
2013-12-21 21:31:38 +01:00
if ( style_class->coverage == AF_COVERAGE_DEFAULT )
af_shaper_get_coverage( globals, style_class, gstyles, 0 );
2003-11-23 22:39:51 +01:00
}
/* ... and finally the default OpenType features of the default script */
af_shaper_get_coverage( globals, AF_STYLE_CLASSES_GET[dflt], gstyles, 1 );
/* 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:
/*
Introduce `coverages'. Coverages are the interface to the HarfBuzz library to access OpenType features for handling glyphs not addressable by the cmap. Right now, compilation of HarfBuzz is only added to the development build. A solution for standard build mode will be delayed until HarfBuzz gets split into two libraries to avoid mutual dependencies between FreeType and HarfBuzz. Note that this is only a first step in handling coverages, basically providing the framework only. Code for handling selected OpenType features (this is, actually using the data in `afcover.h') will follow. * devel/ftoption.h, include/config/ftoption.h (FT_CONFIG_OPTION_USE_HARFBUZZ): New macro. * src/autofit/hbshim.c, src/autofit/hbshim.h, src/autofit/afcover.h: New files. * src/autofit/afscript.h: Add HarfBuzz script name tags. * src/autofit/afstyles.h: Add default coverage enumeration values. * src/autofit/aftypes.h: Update use of `SCRIPT' and `STYLE' macros. (AF_Coverage): New enumeration (generated by `afcover.h'). (AF_StyleClassRec): New member `coverage'. (AF_DEFINE_STYLE_CLASS): Updated. * include/internal/fttrace.h: Add `afharfbuzz' for tracing coverage data. * src/autofit/afglobal.h: Update use of `SCRIPT' and `STYLE' macros. (AF_SCRIPT_FALLBACK): Renamed to ... (AF_STYLE_FALLBACK): ... this. * src/autofit/afglobal.c: Include `hbshim.c'. Update use of `SCRIPT' and `STYLE' macros. (af_face_globals_compute_style_coverage) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call `af_get_coverage'. Update. * src/autofit/afmodule.h (AF_ModuleRec): s/fallback_script/fallback_style/. * src/autofit/afmodule.c (af_property_set): Adapt handling of `fallback-script' property to set a fallback style. (af_property_get, af_autofitter_init): Updated. * src/autofit/afpic.c: Update use of `SCRIPT' and `STYLE' macros. * src/autofit/afranges.h: Update use of `SCRIPT' macro. * src/autofit/autofit.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include `hbshim.c'. * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `hbshim.c'. (AUTOF_DRV_H): Add `afcover.h'. * builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Use pkg-config for all libraries needed by FreeType.
2013-12-21 21:31:38 +01:00
* By default, all uncovered glyphs are set to the fallback style.
2007-01-31 00:08:50 +01:00
* XXX: Shouldn't we disable hinting or do something similar?
*/
Introduce `coverages'. Coverages are the interface to the HarfBuzz library to access OpenType features for handling glyphs not addressable by the cmap. Right now, compilation of HarfBuzz is only added to the development build. A solution for standard build mode will be delayed until HarfBuzz gets split into two libraries to avoid mutual dependencies between FreeType and HarfBuzz. Note that this is only a first step in handling coverages, basically providing the framework only. Code for handling selected OpenType features (this is, actually using the data in `afcover.h') will follow. * devel/ftoption.h, include/config/ftoption.h (FT_CONFIG_OPTION_USE_HARFBUZZ): New macro. * src/autofit/hbshim.c, src/autofit/hbshim.h, src/autofit/afcover.h: New files. * src/autofit/afscript.h: Add HarfBuzz script name tags. * src/autofit/afstyles.h: Add default coverage enumeration values. * src/autofit/aftypes.h: Update use of `SCRIPT' and `STYLE' macros. (AF_Coverage): New enumeration (generated by `afcover.h'). (AF_StyleClassRec): New member `coverage'. (AF_DEFINE_STYLE_CLASS): Updated. * include/internal/fttrace.h: Add `afharfbuzz' for tracing coverage data. * src/autofit/afglobal.h: Update use of `SCRIPT' and `STYLE' macros. (AF_SCRIPT_FALLBACK): Renamed to ... (AF_STYLE_FALLBACK): ... this. * src/autofit/afglobal.c: Include `hbshim.c'. Update use of `SCRIPT' and `STYLE' macros. (af_face_globals_compute_style_coverage) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call `af_get_coverage'. Update. * src/autofit/afmodule.h (AF_ModuleRec): s/fallback_script/fallback_style/. * src/autofit/afmodule.c (af_property_set): Adapt handling of `fallback-script' property to set a fallback style. (af_property_get, af_autofitter_init): Updated. * src/autofit/afpic.c: Update use of `SCRIPT' and `STYLE' macros. * src/autofit/afranges.h: Update use of `SCRIPT' macro. * src/autofit/autofit.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include `hbshim.c'. * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `hbshim.c'. (AUTOF_DRV_H): Add `afcover.h'. * builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Use pkg-config for all libraries needed by FreeType.
2013-12-21 21:31:38 +01:00
if ( globals->module->fallback_style != 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++ )
{
if ( ( gstyles[nn] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
{
gstyles[nn] &= ~AF_STYLE_MASK;
Introduce `coverages'. Coverages are the interface to the HarfBuzz library to access OpenType features for handling glyphs not addressable by the cmap. Right now, compilation of HarfBuzz is only added to the development build. A solution for standard build mode will be delayed until HarfBuzz gets split into two libraries to avoid mutual dependencies between FreeType and HarfBuzz. Note that this is only a first step in handling coverages, basically providing the framework only. Code for handling selected OpenType features (this is, actually using the data in `afcover.h') will follow. * devel/ftoption.h, include/config/ftoption.h (FT_CONFIG_OPTION_USE_HARFBUZZ): New macro. * src/autofit/hbshim.c, src/autofit/hbshim.h, src/autofit/afcover.h: New files. * src/autofit/afscript.h: Add HarfBuzz script name tags. * src/autofit/afstyles.h: Add default coverage enumeration values. * src/autofit/aftypes.h: Update use of `SCRIPT' and `STYLE' macros. (AF_Coverage): New enumeration (generated by `afcover.h'). (AF_StyleClassRec): New member `coverage'. (AF_DEFINE_STYLE_CLASS): Updated. * include/internal/fttrace.h: Add `afharfbuzz' for tracing coverage data. * src/autofit/afglobal.h: Update use of `SCRIPT' and `STYLE' macros. (AF_SCRIPT_FALLBACK): Renamed to ... (AF_STYLE_FALLBACK): ... this. * src/autofit/afglobal.c: Include `hbshim.c'. Update use of `SCRIPT' and `STYLE' macros. (af_face_globals_compute_style_coverage) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call `af_get_coverage'. Update. * src/autofit/afmodule.h (AF_ModuleRec): s/fallback_script/fallback_style/. * src/autofit/afmodule.c (af_property_set): Adapt handling of `fallback-script' property to set a fallback style. (af_property_get, af_autofitter_init): Updated. * src/autofit/afpic.c: Update use of `SCRIPT' and `STYLE' macros. * src/autofit/afranges.h: Update use of `SCRIPT' macro. * src/autofit/autofit.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include `hbshim.c'. * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `hbshim.c'. (AUTOF_DRV_H): Add `afcover.h'. * builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Use pkg-config for all libraries needed by FreeType.
2013-12-21 21:31:38 +01:00
gstyles[nn] |= globals->module->fallback_style;
}
2003-11-23 22:39:51 +01:00
}
}
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE4(( "\n"
"style coverage\n"
"==============\n"
"\n" ));
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
{
AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss];
FT_UInt count = 0;
FT_Long idx;
FT_TRACE4(( "%s:\n", af_style_names[style_class->style] ));
for ( idx = 0; idx < globals->glyph_count; idx++ )
{
if ( ( gstyles[idx] & AF_STYLE_MASK ) == style_class->style )
{
if ( !( count % 10 ) )
FT_TRACE4(( " " ));
FT_TRACE4(( " %d", idx ));
count++;
if ( !( count % 10 ) )
FT_TRACE4(( "\n" ));
}
}
if ( !count )
FT_TRACE4(( " (none)\n" ));
if ( count % 10 )
FT_TRACE4(( "\n" ));
}
#endif /* FT_DEBUG_LEVEL_TRACE */
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;
/* we allocate an AF_FaceGlobals structure together */
/* with the glyph_styles array */
if ( FT_ALLOC( globals,
sizeof ( *globals ) +
(FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) )
goto Exit;
2003-11-23 22:39:51 +01:00
globals->face = face;
globals->glyph_count = face->num_glyphs;
/* right after the globals structure come the glyph styles */
globals->glyph_styles = (FT_UShort*)( globals + 1 );
globals->module = module;
globals->stem_darkening_for_ppem = 0;
globals->darken_x = 0;
globals->darken_y = 0;
globals->standard_vertical_width = 0;
globals->standard_horizontal_width = 0;
globals->scale_down_factor = 0;
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
globals->hb_font = hb_ft_font_create( face, NULL );
globals->hb_buf = hb_buffer_create();
#endif
[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
}
else
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] );
}
}
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
hb_font_destroy( globals->hb_font );
hb_buffer_destroy( globals->hb_buf );
#endif
/* no need to free `globals->glyph_styles'; */
/* it is part of the `globals' array */
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
AF_Style style = (AF_Style)options;
[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_DFLT || style + 1 >= AF_STYLE_MAX )
[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 = (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];
if ( !metrics )
2003-11-23 22:39:51 +01:00
{
/* 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 */