[autofit] Add standard character to `AF_ScriptClassRec' structure.

* src/autofit/aftypes.h (AF_ScriptClassRec): Add `standard_char'
member.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Use it.
(af_latin_metrics_init, af_latin_script_class): Updated.

* src/autofit/aflatin.c (af_latin2_metrics_init_widths): Use it.
(af_latin2_metrics_init, af_latin2_script_class): Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Use it.
(af_cjk_metrics_init, af_cjk_script_class): Updated.

* src/autofit/afindic.c(af_indic_metrics_init,
af_indic_script_class): Updated.

* src/autofit/afcjk.h, src/autofit/aflatin.h: Updated.

* src/autofit/afdummy.c: Updated.
This commit is contained in:
Werner Lemberg 2012-10-24 14:22:14 +02:00
Родитель 118c6025b7
Коммит 553bb3c3ca
11 изменённых файлов: 74 добавлений и 43 удалений

Просмотреть файл

@ -1,9 +1,33 @@
2012-10-24 Werner Lemberg <wl@gnu.org>
[autofit] Add standard character to `AF_ScriptClassRec' structure.
* src/autofit/aftypes.h (AF_ScriptClassRec): Add `standard_char'
member.
(AF_DEFINE_SCRIPT_CLASS): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths): Use it.
(af_latin_metrics_init, af_latin_script_class): Updated.
* src/autofit/aflatin.c (af_latin2_metrics_init_widths): Use it.
(af_latin2_metrics_init, af_latin2_script_class): Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Use it.
(af_cjk_metrics_init, af_cjk_script_class): Updated.
* src/autofit/afindic.c (af_indic_metrics_init,
af_indic_script_class): Updated.
* src/autofit/afcjk.h, src/autofit/aflatin.h: Updated.
* src/autofit/afdummy.c: Updated.
2012-10-24 Werner Lemberg <wl@gnu.org>
[autofit] Only use Unicode CMap.
* src/autofit/aflatin.c (af_latin_metrics_init): Implement it, to be
in sync with `af_face_globals_compute_script_coverage)'.
in sync with `af_face_globals_compute_script_coverage'.
2012-10-21 Werner Lemberg <wl@gnu.org>

Просмотреть файл

@ -67,8 +67,7 @@
FT_LOCAL_DEF( void )
af_cjk_metrics_init_widths( AF_CJKMetrics metrics,
FT_Face face,
FT_ULong charcode )
FT_Face face )
{
/* scan the array of segments in each direction */
AF_GlyphHintsRec hints[1];
@ -87,7 +86,8 @@
AF_Scaler scaler = &dummy->root.scaler;
glyph_index = FT_Get_Char_Index( face, charcode );
glyph_index = FT_Get_Char_Index( face,
metrics->root.clazz->standard_char );
if ( glyph_index == 0 )
goto Exit;
@ -559,7 +559,7 @@
face->charmap = NULL;
else
{
af_cjk_metrics_init_widths( metrics, face, 0x7530 );
af_cjk_metrics_init_widths( metrics, face );
af_cjk_metrics_init_blues( metrics, face, af_cjk_hani_blue_chars );
af_cjk_metrics_check_digits( metrics, face );
}
@ -2232,6 +2232,7 @@
AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class,
AF_SCRIPT_CJK,
af_cjk_uniranges,
0x7530, /* 田 */
sizeof ( AF_CJKMetricsRec ),
@ -2254,6 +2255,7 @@
AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class,
AF_SCRIPT_CJK,
af_cjk_uniranges,
0,
sizeof ( AF_CJKMetricsRec ),

Просмотреть файл

@ -28,7 +28,7 @@ FT_BEGIN_HEADER
/* the CJK-specific script class */
AF_DECLARE_SCRIPT_CLASS(af_cjk_script_class)
AF_DECLARE_SCRIPT_CLASS( af_cjk_script_class )
/* CJK (global) metrics management */
@ -121,15 +121,14 @@ FT_BEGIN_HEADER
FT_Outline* outline,
AF_CJKMetrics metrics );
/* Shared. called from afindic.c */
/* shared; called from afindic.c */
FT_LOCAL( void )
af_cjk_metrics_check_digits( AF_CJKMetrics metrics,
FT_Face face );
FT_LOCAL( void )
af_cjk_metrics_init_widths( AF_CJKMetrics metrics,
FT_Face face,
FT_ULong charcode );
FT_Face face );
#endif /* AF_CONFIG_OPTION_CJK */

Просмотреть файл

@ -46,6 +46,7 @@
AF_DEFINE_SCRIPT_CLASS( af_dummy_script_class,
AF_SCRIPT_DUMMY,
NULL,
0,
sizeof ( AF_ScriptMetricsRec ),

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for Indic scripts (body). */
/* */
/* Copyright 2007, 2011 by */
/* Copyright 2007, 2011, 2012 by */
/* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -46,7 +46,7 @@
face->charmap = NULL;
else
{
af_cjk_metrics_init_widths( metrics, face, 0x7530 );
af_cjk_metrics_init_widths( metrics, face );
#if 0
/* either need indic specific blue_chars[] or just skip blue zones */
af_cjk_metrics_init_blues( metrics, face, af_cjk_blue_chars );
@ -116,6 +116,7 @@
AF_DEFINE_SCRIPT_CLASS( af_indic_script_class,
AF_SCRIPT_INDIC,
af_indic_uniranges,
'o', /* XXX */
sizeof ( AF_CJKMetricsRec ),
@ -138,6 +139,7 @@
AF_DEFINE_SCRIPT_CLASS( af_indic_script_class,
AF_SCRIPT_INDIC,
af_indic_uniranges,
0,
sizeof ( AF_CJKMetricsRec ),

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for Indic scripts (specification). */
/* */
/* Copyright 2007 by */
/* Copyright 2007, 2012 by */
/* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -27,7 +27,7 @@ FT_BEGIN_HEADER
/* the Indic-specific script class */
AF_DECLARE_SCRIPT_CLASS(af_indic_script_class)
AF_DECLARE_SCRIPT_CLASS( af_indic_script_class )
/* */

Просмотреть файл

@ -54,8 +54,7 @@
FT_LOCAL_DEF( void )
af_latin_metrics_init_widths( AF_LatinMetrics metrics,
FT_Face face,
FT_ULong charcode )
FT_Face face )
{
/* scan the array of segments in each direction */
AF_GlyphHintsRec hints[1];
@ -67,14 +66,15 @@
metrics->axis[AF_DIMENSION_VERT].width_count = 0;
{
FT_Error error;
FT_UInt glyph_index;
int dim;
AF_LatinMetricsRec dummy[1];
AF_Scaler scaler = &dummy->root.scaler;
FT_Error error;
FT_UInt glyph_index;
int dim;
AF_LatinMetricsRec dummy[1];
AF_Scaler scaler = &dummy->root.scaler;
glyph_index = FT_Get_Char_Index( face, charcode );
glyph_index = FT_Get_Char_Index( face,
metrics->root.clazz->standard_char );
if ( glyph_index == 0 )
goto Exit;
@ -530,8 +530,7 @@
if ( !FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )
{
/* For now, compute the standard width and height from the `o'. */
af_latin_metrics_init_widths( metrics, face, 'o' );
af_latin_metrics_init_widths( metrics, face );
af_latin_metrics_init_blues( metrics, face );
af_latin_metrics_check_digits( metrics, face );
}
@ -2404,6 +2403,7 @@
AF_DEFINE_SCRIPT_CLASS( af_latin_script_class,
AF_SCRIPT_LATIN,
af_latin_uniranges,
'o',
sizeof ( AF_LatinMetricsRec ),

Просмотреть файл

@ -27,7 +27,7 @@ FT_BEGIN_HEADER
/* the latin-specific script class */
AF_DECLARE_SCRIPT_CLASS(af_latin_script_class)
AF_DECLARE_SCRIPT_CLASS( af_latin_script_class )
/* constants are given with units_per_em == 2048 in mind */
@ -133,8 +133,7 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
af_latin_metrics_init_widths( AF_LatinMetrics metrics,
FT_Face face,
FT_ULong charcode );
FT_Face face );
FT_LOCAL( void )
af_latin_metrics_check_digits( AF_LatinMetrics metrics,

Просмотреть файл

@ -57,8 +57,7 @@
FT_LOCAL_DEF( void )
af_latin2_metrics_init_widths( AF_LatinMetrics metrics,
FT_Face face,
FT_ULong charcode )
FT_Face face )
{
/* scan the array of segments in each direction */
AF_GlyphHintsRec hints[1];
@ -77,7 +76,8 @@
AF_Scaler scaler = &dummy->root.scaler;
glyph_index = FT_Get_Char_Index( face, charcode );
glyph_index = FT_Get_Char_Index( face,
metrics->root.clazz->standard_char );
if ( glyph_index == 0 )
goto Exit;
@ -501,8 +501,7 @@
if ( !error )
{
/* For now, compute the standard width and height from the `o'. */
af_latin2_metrics_init_widths( metrics, face, 'o' );
af_latin2_metrics_init_widths( metrics, face );
af_latin2_metrics_init_blues( metrics, face );
af_latin2_metrics_check_digits( metrics, face );
}
@ -2388,6 +2387,7 @@
AF_DEFINE_SCRIPT_CLASS( af_latin2_script_class,
AF_SCRIPT_LATIN2,
af_latin2_uniranges,
'o',
sizeof ( AF_LatinMetricsRec ),

Просмотреть файл

@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for latin script (specification). */
/* */
/* Copyright 2003, 2004, 2005, 2006, 2007 by */
/* Copyright 2003-2007, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -27,7 +27,7 @@ FT_BEGIN_HEADER
/* the latin-specific script class */
AF_DECLARE_SCRIPT_CLASS(af_latin2_script_class)
AF_DECLARE_SCRIPT_CLASS( af_latin2_script_class )
/* */

Просмотреть файл

@ -298,8 +298,9 @@ extern void* _af_debug_hints;
typedef struct AF_ScriptClassRec_
{
AF_Script script;
AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */
AF_Script script;
AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */
FT_UInt32 standard_char; /* for default width and height */
FT_Offset script_metrics_size;
AF_Script_InitMetricsFunc script_metrics_init;
@ -319,13 +320,14 @@ extern void* _af_debug_hints;
FT_CALLBACK_TABLE const AF_ScriptClassRec \
script_class;
#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, m_size, \
#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char, \
m_size, \
m_init, m_scale, m_done, h_init, h_apply ) \
FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec \
script_class = \
FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec script_class = \
{ \
script_, \
ranges, \
def_char, \
\
m_size, \
\
@ -339,17 +341,19 @@ extern void* _af_debug_hints;
#else /* FT_CONFIG_OPTION_PIC */
#define AF_DECLARE_SCRIPT_CLASS( script_class ) \
FT_LOCAL( void ) \
FT_Init_Class_##script_class( AF_ScriptClassRec* ac );
#define AF_DECLARE_SCRIPT_CLASS( script_class ) \
FT_LOCAL( void ) \
FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac );
#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, m_size, \
#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char, \
m_size, \
m_init, m_scale, m_done, h_init, h_apply ) \
FT_LOCAL_DEF( void ) \
FT_Init_Class_##script_class( AF_ScriptClassRec* ac ) \
FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \
{ \
ac->script = script_; \
ac->script_uni_ranges = ranges; \
ac->default_char = def_char; \
\
ac->script_metrics_size = m_size; \
\