2005-03-03 18:09:08 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* afglobal.c */
|
|
|
|
/* */
|
|
|
|
/* Auto-fitter routines to compute global hinting values (body). */
|
|
|
|
/* */
|
2015-01-17 20:41:43 +01:00
|
|
|
/* Copyright 2003-2015 by */
|
2005-03-03 18:09:08 +01:00
|
|
|
/* 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"
|
2013-12-19 15:45:24 +01:00
|
|
|
#include "afranges.h"
|
2013-12-21 21:31:38 +01:00
|
|
|
#include "hbshim.h"
|
2014-01-16 08:55:40 +01:00
|
|
|
#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
|
2013-08-02 19:51:17 +02:00
|
|
|
|
2013-12-28 08:55:24 +01:00
|
|
|
|
2013-08-02 19:51:17 +02:00
|
|
|
/* get writing system specific header files */
|
|
|
|
#undef WRITING_SYSTEM
|
|
|
|
#define WRITING_SYSTEM( ws, WS ) /* empty */
|
|
|
|
#include "afwrtsys.h"
|
2007-06-26 06:44:35 +02:00
|
|
|
|
2005-03-23 17:45:24 +01:00
|
|
|
#include "aferrors.h"
|
2013-08-02 19:51:17 +02:00
|
|
|
#include "afpic.h"
|
|
|
|
|
2009-04-05 17:23:38 +02:00
|
|
|
|
2013-12-20 18:35:35 +01:00
|
|
|
#undef SCRIPT
|
2015-12-06 09:58:18 +01:00
|
|
|
#define SCRIPT( s, S, d, h, ss ) \
|
2014-01-26 09:45:23 +01:00
|
|
|
AF_DEFINE_SCRIPT_CLASS( \
|
|
|
|
af_ ## s ## _script_class, \
|
|
|
|
AF_SCRIPT_ ## S, \
|
|
|
|
af_ ## s ## _uniranges, \
|
2015-09-30 17:52:42 +02:00
|
|
|
af_ ## s ## _nonbase_uniranges, \
|
2015-12-06 09:58:18 +01:00
|
|
|
ss )
|
2013-12-20 18:35:35 +01:00
|
|
|
|
|
|
|
#include "afscript.h"
|
|
|
|
|
|
|
|
|
|
|
|
#undef STYLE
|
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 )
|
2013-12-20 18:35:35 +01:00
|
|
|
|
|
|
|
#include "afstyles.h"
|
|
|
|
|
|
|
|
|
2013-09-25 23:32:25 +02:00
|
|
|
#ifndef FT_CONFIG_OPTION_PIC
|
2013-07-31 22:49:29 +02:00
|
|
|
|
2013-08-02 19:51:17 +02:00
|
|
|
#undef WRITING_SYSTEM
|
|
|
|
#define WRITING_SYSTEM( ws, WS ) \
|
|
|
|
&af_ ## ws ## _writing_system_class,
|
|
|
|
|
2013-08-02 14:50:23 +02:00
|
|
|
FT_LOCAL_ARRAY_DEF( AF_WritingSystemClass )
|
|
|
|
af_writing_system_classes[] =
|
2013-07-31 22:49:29 +02:00
|
|
|
{
|
2013-08-02 19:51:17 +02:00
|
|
|
|
|
|
|
#include "afwrtsys.h"
|
|
|
|
|
2013-07-31 22:49:29 +02:00
|
|
|
NULL /* do not remove */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-12-19 15:45:24 +01:00
|
|
|
#undef SCRIPT
|
2015-12-06 09:58:18 +01:00
|
|
|
#define SCRIPT( s, S, d, h, ss ) \
|
2013-08-02 20:25:21 +02:00
|
|
|
&af_ ## s ## _script_class,
|
2009-04-05 17:23:38 +02:00
|
|
|
|
2013-08-02 14:50:23 +02:00
|
|
|
FT_LOCAL_ARRAY_DEF( AF_ScriptClass )
|
|
|
|
af_script_classes[] =
|
2003-11-23 22:39:51 +01:00
|
|
|
{
|
2013-08-02 20:25:21 +02: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
|
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 */
|
|
|
|
};
|
|
|
|
|
2011-01-23 12:42:23 +01:00
|
|
|
#endif /* !FT_CONFIG_OPTION_PIC */
|
2009-04-05 17:23:38 +02:00
|
|
|
|
2005-03-03 18:09:08 +01:00
|
|
|
|
2013-08-27 18:37:39 +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
|
2013-12-21 21:31:38 +01:00
|
|
|
#define STYLE( s, S, d, ws, sc, ss, c ) #s,
|
2013-08-27 18:37:39 +02:00
|
|
|
|
|
|
|
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[] =
|
2013-08-27 18:37:39 +02:00
|
|
|
{
|
|
|
|
|
[autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.
* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.
* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.
* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.
* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition. This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.
* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.
* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.
* src/autofit/afranges.h: Updated.
* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
|
|
|
#include "afstyles.h"
|
2013-08-27 18:37:39 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#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
|
|
|
{
|
2013-06-04 10:30:48 +02:00
|
|
|
FT_Error error;
|
2003-11-23 22:39:51 +01:00
|
|
|
FT_Face face = globals->face;
|
|
|
|
FT_CharMap old_charmap = face->charmap;
|
2015-08-30 10:35:21 +02:00
|
|
|
FT_UShort* gstyles = globals->glyph_styles;
|
2012-07-06 19:38:44 +02:00
|
|
|
FT_UInt ss;
|
|
|
|
FT_UInt i;
|
2014-06-13 14:01:20 +02:00
|
|
|
FT_UInt dflt = ~0U; /* a non-valid value */
|
2003-11-23 22:39:51 +01:00
|
|
|
|
2005-03-03 18:09:08 +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' */
|
2015-08-30 10:35:21 +02:00
|
|
|
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?
|
|
|
|
*/
|
2013-03-14 11:21:17 +01:00
|
|
|
error = FT_Err_Ok;
|
2003-11-23 22:39:51 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
[autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.
* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.
* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.
* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.
* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition. This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.
* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.
* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.
* src/autofit/afranges.h: Updated.
* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
|
|
|
/* scan each style in a Unicode charmap */
|
|
|
|
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
|
2003-11-23 22:39:51 +01:00
|
|
|
{
|
[autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.
* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.
* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.
* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.
* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition. This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.
* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.
* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.
* src/autofit/afranges.h: Updated.
* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
|
|
|
AF_StyleClass style_class =
|
|
|
|
AF_STYLE_CLASSES_GET[ss];
|
|
|
|
AF_ScriptClass script_class =
|
|
|
|
AF_SCRIPT_CLASSES_GET[style_class->script];
|
2003-11-23 22:39:51 +01:00
|
|
|
AF_Script_UniRange range;
|
|
|
|
|
2005-03-03 18:09:08 +01:00
|
|
|
|
2013-07-30 23:17:04 +02:00
|
|
|
if ( script_class->script_uni_ranges == NULL )
|
2004-02-23 22:08:37 +01:00
|
|
|
continue;
|
|
|
|
|
2005-03-03 18:09:08 +01:00
|
|
|
/*
|
2012-07-06 19:38:44 +02:00
|
|
|
* 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.
|
2005-03-03 18:09:08 +01:00
|
|
|
*/
|
2013-12-23 16:42:03 +01:00
|
|
|
if ( style_class->coverage == AF_COVERAGE_DEFAULT )
|
2003-11-23 22:39:51 +01:00
|
|
|
{
|
2014-06-13 09:28:00 +02:00
|
|
|
if ( (FT_UInt)style_class->script ==
|
|
|
|
globals->module->default_script )
|
2014-01-03 18:29:41 +01:00
|
|
|
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
|
|
|
|
2005-03-03 18:09:08 +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
|
|
|
|
2015-09-04 10:28:53 +02:00
|
|
|
if ( gindex != 0 &&
|
|
|
|
gindex < (FT_ULong)globals->glyph_count &&
|
|
|
|
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
|
2015-08-30 10:35:21 +02:00
|
|
|
gstyles[gindex] = (FT_UShort)ss;
|
2005-03-03 18:09:08 +01:00
|
|
|
|
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
|
|
|
|
2015-09-04 10:28:53 +02:00
|
|
|
if ( gindex < (FT_ULong)globals->glyph_count &&
|
|
|
|
( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
|
2015-08-30 10:35:21 +02:00
|
|
|
gstyles[gindex] = (FT_UShort)ss;
|
2013-12-23 16:42:03 +01:00
|
|
|
}
|
2003-11-23 22:39:51 +01:00
|
|
|
}
|
2015-09-04 10:28:53 +02:00
|
|
|
|
2015-09-30 17:52:42 +02:00
|
|
|
/* do the same for the script's non-base characters */
|
|
|
|
for ( range = script_class->script_uni_nonbase_ranges;
|
2015-09-04 10:28:53 +02:00
|
|
|
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 )
|
2015-09-30 17:52:42 +02:00
|
|
|
gstyles[gindex] |= AF_NONBASE;
|
2015-09-04 10:28:53 +02:00
|
|
|
|
|
|
|
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 )
|
2015-09-30 17:52:42 +02:00
|
|
|
gstyles[gindex] |= AF_NONBASE;
|
2015-09-04 10:28:53 +02:00
|
|
|
}
|
|
|
|
}
|
2003-11-23 22:39:51 +01:00
|
|
|
}
|
2014-01-03 18:29:41 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* get glyphs not directly addressable by cmap */
|
|
|
|
af_get_coverage( globals, style_class, gstyles );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* handle the default OpenType features of the default script ... */
|
|
|
|
af_get_coverage( globals, AF_STYLE_CLASSES_GET[dflt], gstyles );
|
|
|
|
|
|
|
|
/* ... and the remaining default OpenType features */
|
|
|
|
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
|
|
|
|
{
|
|
|
|
AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss];
|
|
|
|
|
2013-12-21 21:31:38 +01:00
|
|
|
|
2014-01-03 18:29:41 +01:00
|
|
|
if ( ss != dflt && style_class->coverage == AF_COVERAGE_DEFAULT )
|
|
|
|
af_get_coverage( globals, style_class, gstyles );
|
2003-11-23 22:39:51 +01:00
|
|
|
}
|
|
|
|
|
2009-04-27 19:40:35 +02:00
|
|
|
/* mark ASCII digits */
|
|
|
|
for ( i = 0x30; i <= 0x39; i++ )
|
|
|
|
{
|
|
|
|
FT_UInt gindex = FT_Get_Char_Index( face, i );
|
|
|
|
|
|
|
|
|
2009-07-31 17:37:54 +02:00
|
|
|
if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count )
|
2013-12-18 10:39:30 +01:00
|
|
|
gstyles[gindex] |= AF_DIGIT;
|
2009-04-27 19:40:35 +02:00
|
|
|
}
|
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
Exit:
|
2005-03-03 18:09:08 +01:00
|
|
|
/*
|
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?
|
2005-03-03 18:09:08 +01:00
|
|
|
*/
|
2013-12-21 21:31:38 +01:00
|
|
|
if ( globals->module->fallback_style != AF_STYLE_UNASSIGNED )
|
2003-11-23 22:39:51 +01:00
|
|
|
{
|
2009-07-31 17:32:08 +02:00
|
|
|
FT_Long nn;
|
2003-11-23 22:39:51 +01:00
|
|
|
|
2005-03-03 18:09:08 +01:00
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
for ( nn = 0; nn < globals->glyph_count; nn++ )
|
|
|
|
{
|
2015-08-31 08:51:52 +02:00
|
|
|
if ( ( gstyles[nn] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
|
2010-06-15 08:29:30 +02:00
|
|
|
{
|
2015-08-31 08:51:52 +02:00
|
|
|
gstyles[nn] &= ~AF_STYLE_MASK;
|
2013-12-21 21:31:38 +01:00
|
|
|
gstyles[nn] |= globals->module->fallback_style;
|
2010-06-15 08:29:30 +02:00
|
|
|
}
|
2003-11-23 22:39:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-16 08:55:40 +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++ )
|
|
|
|
{
|
2015-08-31 08:51:52 +02:00
|
|
|
if ( ( gstyles[idx] & AF_STYLE_MASK ) == style_class->style )
|
2014-01-16 08:55:40 +01:00
|
|
|
{
|
|
|
|
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,
|
2012-09-15 10:33:43 +02:00
|
|
|
AF_FaceGlobals *aglobals,
|
2012-09-18 15:23:41 +02:00
|
|
|
AF_Module module )
|
2003-11-23 22:39:51 +01:00
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory;
|
2010-07-12 21:13:22 +02:00
|
|
|
AF_FaceGlobals globals = NULL;
|
2003-11-23 22:39:51 +01:00
|
|
|
|
2005-03-03 18:09:08 +01:00
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
memory = face->memory;
|
|
|
|
|
2015-08-30 10:35:21 +02:00
|
|
|
/* we allocate an AF_FaceGlobals structure together */
|
|
|
|
/* with the glyph_styles array */
|
2015-02-19 10:44:18 +01:00
|
|
|
if ( FT_ALLOC( globals,
|
|
|
|
sizeof ( *globals ) +
|
2015-08-30 10:35:21 +02:00
|
|
|
(FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) )
|
2012-07-06 19:38:44 +02:00
|
|
|
goto Exit;
|
2003-11-23 22:39:51 +01:00
|
|
|
|
2015-11-02 09:20:32 +01:00
|
|
|
globals->face = face;
|
|
|
|
globals->glyph_count = face->num_glyphs;
|
2015-08-30 10:35:21 +02:00
|
|
|
/* right after the globals structure come the glyph styles */
|
2015-11-02 09:20:32 +01:00
|
|
|
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;
|
2012-07-06 19:38:44 +02:00
|
|
|
|
2013-12-28 08:55:24 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
|
|
|
|
globals->hb_font = hb_ft_font_create( face, NULL );
|
|
|
|
#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 );
|
2012-07-06 19:38:44 +02:00
|
|
|
if ( error )
|
|
|
|
{
|
|
|
|
af_face_globals_free( globals );
|
|
|
|
globals = NULL;
|
2003-11-23 22:39:51 +01:00
|
|
|
}
|
2014-03-09 06:14:12 +01:00
|
|
|
else
|
|
|
|
globals->increase_x_height = AF_PROP_INCREASE_X_HEIGHT_MAX;
|
2012-09-18 23:26:37 +02:00
|
|
|
|
2012-07-06 19:38:44 +02:00
|
|
|
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;
|
|
|
|
|
2005-03-03 18:09:08 +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
|
|
|
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];
|
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];
|
2005-03-03 18:09:08 +01:00
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
|
2013-12-18 12:53:01 +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] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-28 08:55:24 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
|
|
|
|
hb_font_destroy( globals->hb_font );
|
|
|
|
globals->hb_font = NULL;
|
|
|
|
#endif
|
|
|
|
|
2015-11-02 09:20:32 +01:00
|
|
|
globals->glyph_count = 0;
|
|
|
|
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;
|
|
|
|
/* no need to free this one! */
|
|
|
|
globals->glyph_styles = NULL;
|
|
|
|
globals->face = NULL;
|
2005-03-03 18:09:08 +01:00
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
FT_FREE( globals );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2013-12-18 12:59:35 +01:00
|
|
|
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
|
|
|
{
|
2013-12-18 12:59:35 +01:00
|
|
|
AF_StyleMetrics metrics = NULL;
|
2013-07-31 22:49:29 +02:00
|
|
|
|
2014-01-01 16:34:42 +01:00
|
|
|
AF_Style style = (AF_Style)options;
|
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;
|
2013-07-31 22:49:29 +02:00
|
|
|
|
2013-08-26 09:58:50 +02:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2003-11-23 22:39:51 +01:00
|
|
|
|
2005-03-03 18:09:08 +01:00
|
|
|
|
2009-07-31 17:32:08 +02:00
|
|
|
if ( gindex >= (FT_ULong)globals->glyph_count )
|
2003-11-23 22:39:51 +01:00
|
|
|
{
|
2013-03-14 10:27:35 +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 */
|
2013-12-31 09:45:10 +01:00
|
|
|
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 );
|
2007-06-11 07:37:35 +02:00
|
|
|
|
[autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.
* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.
* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.
* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.
* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition. This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.
* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.
* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.
* src/autofit/afranges.h: Updated.
* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
|
|
|
style_class = AF_STYLE_CLASSES_GET[style];
|
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];
|
2007-06-11 07:37:35 +02:00
|
|
|
|
[autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.
* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.
* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.
* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.
* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition. This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.
* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.
* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.
* src/autofit/afranges.h: Updated.
* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
|
|
|
metrics = globals->metrics[style];
|
2003-11-23 22:39:51 +01:00
|
|
|
if ( metrics == NULL )
|
|
|
|
{
|
2012-07-06 19:38:44 +02:00
|
|
|
/* create the global metrics object if necessary */
|
2004-01-16 10:51:00 +01:00
|
|
|
FT_Memory memory = globals->face->memory;
|
|
|
|
|
2005-03-03 18:09:08 +01:00
|
|
|
|
2013-12-18 12:53:01 +01:00
|
|
|
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
|
|
|
|
2013-12-18 12:53:01 +01:00
|
|
|
if ( writing_system_class->style_metrics_init )
|
2003-11-23 22:39:51 +01:00
|
|
|
{
|
2013-12-18 12:53:01 +01:00
|
|
|
error = writing_system_class->style_metrics_init( metrics,
|
|
|
|
globals->face );
|
2003-11-23 22:39:51 +01:00
|
|
|
if ( error )
|
|
|
|
{
|
2013-12-18 12:53:01 +01:00
|
|
|
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;
|
2005-03-03 18:09:08 +01:00
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
return error;
|
|
|
|
}
|
2005-03-03 18:09:08 +01:00
|
|
|
|
|
|
|
|
2009-04-27 19:40:35 +02:00
|
|
|
FT_LOCAL_DEF( FT_Bool )
|
|
|
|
af_face_globals_is_digit( AF_FaceGlobals globals,
|
|
|
|
FT_UInt gindex )
|
|
|
|
{
|
2009-07-31 17:37:54 +02:00
|
|
|
if ( gindex < (FT_ULong)globals->glyph_count )
|
2013-12-18 10:36:06 +01:00
|
|
|
return (FT_Bool)( globals->glyph_styles[gindex] & AF_DIGIT );
|
2009-04-27 19:40:35 +02:00
|
|
|
|
|
|
|
return (FT_Bool)0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-03 18:09:08 +01:00
|
|
|
/* END */
|