[autofit] Add wrapper function for `FT_Get_Char_Index'.

Yet-to-come changes will provide HarfBuzz functionality for the new
function.

* src/autofit/hbshim.c (af_get_char_index): New function.
* src/autofit/hbshim.h: Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits):
Updated.
This commit is contained in:
Werner Lemberg 2013-12-28 10:33:01 +01:00
parent 6af01a04b1
commit 17af586e05
5 changed files with 73 additions and 8 deletions

View File

@ -1,3 +1,20 @@
2013-12-28 Werner Lemberg <wl@gnu.org>
[autofit] Add wrapper function for `FT_Get_Char_Index'.
Yet-to-come changes will provide HarfBuzz functionality for the new
function.
* src/autofit/hbshim.c (af_get_char_index): New function.
* src/autofit/hbshim.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits):
Updated.
2013-12-28 Werner Lemberg <wl@gnu.org>
[autofit] Use `global' HarfBuzz font object.

View File

@ -101,7 +101,8 @@
[style_class->script];
glyph_index = FT_Get_Char_Index( face, script_class->standard_char );
glyph_index = af_get_char_index( &metrics->root,
script_class->standard_char );
if ( glyph_index == 0 )
goto Exit;
@ -297,7 +298,7 @@
GET_UTF8_CHAR( ch, p );
/* load the character in the face -- skip unknown or empty ones */
glyph_index = FT_Get_Char_Index( face, ch );
glyph_index = af_get_char_index( &metrics->root, ch );
if ( glyph_index == 0 )
{
FT_TRACE5(( " U+%04lX unavailable\n", ch ));
@ -479,7 +480,7 @@
FT_UInt glyph_index;
glyph_index = FT_Get_Char_Index( face, i );
glyph_index = af_get_char_index( &metrics->root, i );
if ( glyph_index == 0 )
continue;

View File

@ -88,7 +88,8 @@
[style_class->script];
glyph_index = FT_Get_Char_Index( face, script_class->standard_char );
glyph_index = af_get_char_index( &metrics->root,
script_class->standard_char );
if ( glyph_index == 0 )
goto Exit;
@ -296,7 +297,7 @@
GET_UTF8_CHAR( ch, p );
/* load the character in the face -- skip unknown or empty ones */
glyph_index = FT_Get_Char_Index( face, ch );
glyph_index = af_get_char_index( &metrics->root, ch );
if ( glyph_index == 0 )
{
FT_TRACE5(( " U+%04lX unavailable\n", ch ));
@ -745,7 +746,7 @@
FT_UInt glyph_index;
glyph_index = FT_Get_Char_Index( face, i );
glyph_index = af_get_char_index( &metrics->root, i );
if ( glyph_index == 0 )
continue;

View File

@ -267,6 +267,22 @@
}
FT_UInt
af_get_char_index( AF_StyleMetrics metrics,
FT_ULong charcode )
{
FT_Face face;
if ( !metrics )
return FT_THROW( Invalid_Argument );
face = metrics->globals->face;
return FT_Get_Char_Index( face, charcode );
}
#if 0
/* to be always excluded */
COVERAGE(nalt, 'n', 'a', 'l', 't'); /* Alternate Annotation Forms (?) */
@ -274,7 +290,27 @@
/* COVERAGE(ruby, 'r', 'u', 'b', 'y') */ /* (only for Japanese) */
#endif
#endif /* FT_CONFIG_OPTION_USE_HARFBUZZ */
#else /* !FT_CONFIG_OPTION_USE_HARDBUZZ */
FT_UInt
af_get_char_index( AF_StyleMetrics metrics,
FT_ULong charcode )
{
FT_Face face;
if ( !metrics )
return FT_THROW( Invalid_Argument );
face = metrics->globals->face;
return FT_Get_Char_Index( face, charcode );
}
#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */
/* END */

View File

@ -38,12 +38,22 @@ FT_BEGIN_HEADER
AF_StyleClass style_class,
FT_Byte* gstyles );
FT_UInt
af_get_char_index( AF_StyleMetrics metrics,
FT_ULong charcode );
/* */
FT_END_HEADER
#endif /* FT_CONFIG_OPTION_USE_HARFBUZZ */
#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */
FT_UInt
af_get_char_index( AF_StyleMetrics metrics,
FT_ULong charcode );
#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */
#endif /* __HBSHIM_H__ */