From c9d9947c68d56b10b25015d40002e874d4299583 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 31 Dec 2013 08:16:57 +0100 Subject: [PATCH] [autofit] Fix interface of `af_get_char_index'. * src/autofit/hbshim.c (af_get_char_index): Return error value. Add argument for y offset (to be used in a yet-to-come patch). * src/autofit/hbshim.h, src/autofit/afcjk.c, src/autofit/aflatin.c: Updated. --- ChangeLog | 10 ++++++++++ src/autofit/afcjk.c | 19 ++++++++++++------- src/autofit/aflatin.c | 19 ++++++++++++------- src/autofit/hbshim.c | 22 ++++++++++++++++------ src/autofit/hbshim.h | 6 ++++-- 5 files changed, 54 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79398369d..181cbe3c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-12-31 Werner Lemberg + + [autofit] Fix interface of `af_get_char_index'. + + * src/autofit/hbshim.c (af_get_char_index): Return error value. + Add argument for y offset (to be used in a yet-to-come patch). + + * src/autofit/hbshim.h, src/autofit/afcjk.c, + src/autofit/aflatin.c: Updated. + 2013-12-30 Werner Lemberg [autofit] Don't combine multiple features into one set. diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index f27e72a1f..c396d696d 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -87,7 +87,8 @@ { FT_Error error; - FT_UInt glyph_index; + FT_ULong glyph_index; + FT_Long y_offset; int dim; AF_CJKMetricsRec dummy[1]; AF_Scaler scaler = &dummy->root.scaler; @@ -101,8 +102,10 @@ [style_class->script]; - glyph_index = af_get_char_index( &metrics->root, - script_class->standard_char ); + af_get_char_index( &metrics->root, + script_class->standard_char, + &glyph_index, + &y_offset ); if ( glyph_index == 0 ) goto Exit; @@ -289,7 +292,8 @@ while ( *p ) { FT_ULong ch; - FT_UInt glyph_index; + FT_ULong glyph_index; + FT_Long y_offset; FT_Pos best_pos; /* same as points.y or points.x, resp. */ FT_Int best_point; FT_Vector* points; @@ -298,7 +302,7 @@ GET_UTF8_CHAR( ch, p ); /* load the character in the face -- skip unknown or empty ones */ - glyph_index = af_get_char_index( &metrics->root, ch ); + af_get_char_index( &metrics->root, ch, &glyph_index, &y_offset ); if ( glyph_index == 0 ) { FT_TRACE5(( " U+%04lX unavailable\n", ch )); @@ -477,10 +481,11 @@ /* digit `0' is 0x30 in all supported charmaps */ for ( i = 0x30; i <= 0x39; i++ ) { - FT_UInt glyph_index; + FT_ULong glyph_index; + FT_Long y_offset; - glyph_index = af_get_char_index( &metrics->root, i ); + af_get_char_index( &metrics->root, i, &glyph_index, &y_offset ); if ( glyph_index == 0 ) continue; diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 0b4709a17..279953f77 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -74,7 +74,8 @@ { FT_Error error; - FT_UInt glyph_index; + FT_ULong glyph_index; + FT_Long y_offset; int dim; AF_LatinMetricsRec dummy[1]; AF_Scaler scaler = &dummy->root.scaler; @@ -88,8 +89,10 @@ [style_class->script]; - glyph_index = af_get_char_index( &metrics->root, - script_class->standard_char ); + af_get_char_index( &metrics->root, + script_class->standard_char, + &glyph_index, + &y_offset ); if ( glyph_index == 0 ) goto Exit; @@ -287,7 +290,8 @@ while ( *p ) { FT_ULong ch; - FT_UInt glyph_index; + FT_ULong glyph_index; + FT_Long y_offset; FT_Pos best_y; /* same as points.y */ FT_Int best_point, best_contour_first, best_contour_last; FT_Vector* points; @@ -297,7 +301,7 @@ GET_UTF8_CHAR( ch, p ); /* load the character in the face -- skip unknown or empty ones */ - glyph_index = af_get_char_index( &metrics->root, ch ); + af_get_char_index( &metrics->root, ch, &glyph_index, &y_offset ); if ( glyph_index == 0 ) { FT_TRACE5(( " U+%04lX unavailable\n", ch )); @@ -743,10 +747,11 @@ /* digit `0' is 0x30 in all supported charmaps */ for ( i = 0x30; i <= 0x39; i++ ) { - FT_UInt glyph_index; + FT_ULong glyph_index; + FT_Long y_offset; - glyph_index = af_get_char_index( &metrics->root, i ); + af_get_char_index( &metrics->root, i, &glyph_index, &y_offset ); if ( glyph_index == 0 ) continue; diff --git a/src/autofit/hbshim.c b/src/autofit/hbshim.c index c9e21cb9a..d280e5556 100644 --- a/src/autofit/hbshim.c +++ b/src/autofit/hbshim.c @@ -230,9 +230,11 @@ } - FT_UInt + FT_Error af_get_char_index( AF_StyleMetrics metrics, - FT_ULong charcode ) + FT_ULong charcode, + FT_ULong *codepoint, + FT_Long *y_offset ) { FT_Face face; @@ -242,7 +244,10 @@ face = metrics->globals->face; - return FT_Get_Char_Index( face, charcode ); + *codepoint = FT_Get_Char_Index( face, charcode ); + *y_offset = 0; + + return FT_Err_Ok; } @@ -262,9 +267,11 @@ } - FT_UInt + FT_Error af_get_char_index( AF_StyleMetrics metrics, - FT_ULong charcode ) + FT_ULong charcode, + FT_ULong *codepoint, + FT_Long *y_offset ) { FT_Face face; @@ -274,7 +281,10 @@ face = metrics->globals->face; - return FT_Get_Char_Index( face, charcode ); + *codepoint = FT_Get_Char_Index( face, charcode ); + *y_offset = 0; + + return FT_Err_Ok; } diff --git a/src/autofit/hbshim.h b/src/autofit/hbshim.h index 52b67c45d..02f1513f6 100644 --- a/src/autofit/hbshim.h +++ b/src/autofit/hbshim.h @@ -40,9 +40,11 @@ FT_BEGIN_HEADER AF_StyleClass style_class, FT_Byte* gstyles ); - FT_UInt + FT_Error af_get_char_index( AF_StyleMetrics metrics, - FT_ULong charcode ); + FT_ULong charcode, + FT_ULong *codepoint, + FT_Long *y_offset ); /* */