[autofit] Thinko.

* src/autofit/hbshim.c (af_get_char_index): Similar to
`af_get_coverage', reject glyphs which are not substituted.
This commit is contained in:
Werner Lemberg 2014-01-03 20:49:31 +01:00
parent 1b5bc89754
commit ecdb0e35c3
3 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2014-01-03 Werner Lemberg <wl@gnu.org>
[autofit] Thinko.
* src/autofit/hbshim.c (af_get_char_index): Similar to
`af_get_coverage', reject glyphs which are not substituted.
2014-01-03 Werner Lemberg <wl@gnu.org>
[autofit] Fix handling of default coverages.

View File

@ -89,6 +89,9 @@
[style_class->script];
/* XXX: Extend this with a list of possible standard characters: */
/* Especially in non-default coverages, a singe standard */
/* character may not be available. */
af_get_char_index( &metrics->root,
script_class->standard_char,
&glyph_index,

View File

@ -410,10 +410,14 @@
const hb_feature_t* feature;
FT_ULong in_idx, out_idx;
if ( !metrics )
return FT_THROW( Invalid_Argument );
in_idx = FT_Get_Char_Index( metrics->globals->face, charcode );
style_class = metrics->style_class;
feature = features[style_class->coverage];
@ -448,8 +452,20 @@
ginfo = hb_buffer_get_glyph_infos( buf, &gcount );
gpos = hb_buffer_get_glyph_positions( buf, &gcount );
*codepoint = ginfo[0].codepoint;
*y_offset = gpos[0].y_offset;
out_idx = ginfo[0].codepoint;
/* getting the same index indicates no substitution, */
/* which means that the glyph isn't available in the feature */
if ( in_idx == out_idx )
{
*codepoint = 0;
*y_offset = 0;
}
else
{
*codepoint = out_idx;
*y_offset = gpos[0].y_offset;
}
hb_buffer_destroy( buf );
@ -461,7 +477,7 @@
}
else
{
*codepoint = FT_Get_Char_Index( metrics->globals->face, charcode );
*codepoint = in_idx;
*y_offset = 0;
}