ref: 17af586e0589df2c0bded15c13b5da24873426ab
parent: 6af01a04b1fb6db7f6fadf19211d24b893c1c6bc
author: Werner Lemberg <[email protected]>
date: Sat Dec 28 05:33:01 EST 2013
[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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2013-12-28 Werner Lemberg <[email protected]>
+ [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 <[email protected]>
+
[autofit] Use `global' HarfBuzz font object.
We now use `hb_font' instead of `hb_face' since yet-to-come changes
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -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;
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -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;
--- a/src/autofit/hbshim.c
+++ b/src/autofit/hbshim.c
@@ -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 */
--- a/src/autofit/hbshim.h
+++ b/src/autofit/hbshim.h
@@ -38,12 +38,22 @@
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__ */