[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.
This commit is contained in:
Werner Lemberg 2013-12-31 08:16:57 +01:00
parent 44aa7e0af5
commit c9d9947c68
5 changed files with 54 additions and 22 deletions

View File

@ -1,3 +1,13 @@
2013-12-31 Werner Lemberg <wl@gnu.org>
[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 <wl@gnu.org>
[autofit] Don't combine multiple features into one set.

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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 );
/* */