[layout] Rename _get_alternates to _get_glyph_alternates

This commit is contained in:
Ebrahim Byagowi 2020-06-18 22:56:07 +04:30
parent d3c169792b
commit 1bac85828c
5 changed files with 36 additions and 36 deletions

View File

@ -574,7 +574,7 @@ hb_ot_layout_language_get_feature_indexes
hb_ot_layout_language_get_feature_tags hb_ot_layout_language_get_feature_tags
hb_ot_layout_language_get_required_feature hb_ot_layout_language_get_required_feature
hb_ot_layout_lookup_collect_glyphs hb_ot_layout_lookup_collect_glyphs
hb_ot_layout_lookup_get_alternates hb_ot_layout_lookup_get_glyph_alternates
hb_ot_layout_lookup_substitute_closure hb_ot_layout_lookup_substitute_closure
hb_ot_layout_lookups_substitute_closure hb_ot_layout_lookups_substitute_closure
hb_ot_layout_lookup_would_substitute hb_ot_layout_lookup_would_substitute

View File

@ -557,9 +557,9 @@ struct AlternateSet
} }
unsigned unsigned
get_alternates (unsigned start_offset, get_glyph_alternates (unsigned start_offset,
unsigned *alternate_count /* IN/OUT. May be NULL. */, unsigned *alternate_count /* IN/OUT. May be NULL. */,
hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) const hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) const
{ {
if (alternate_count) if (alternate_count)
{ {
@ -646,11 +646,11 @@ struct AlternateSubstFormat1
{ return (this+coverage).get_coverage (gid); } { return (this+coverage).get_coverage (gid); }
unsigned unsigned
get_alternates (unsigned index, get_glyph_alternates (unsigned index,
unsigned start_offset, unsigned start_offset,
unsigned *alternate_count /* IN/OUT. May be NULL. */, unsigned *alternate_count /* IN/OUT. May be NULL. */,
hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) const hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) const
{ return (this+alternateSet[index]).get_alternates (start_offset, alternate_count, alternate_glyphs); } { return (this+alternateSet[index]).get_glyph_alternates (start_offset, alternate_count, alternate_glyphs); }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -749,13 +749,13 @@ struct AlternateSubst
} }
unsigned unsigned
get_alternates (unsigned index, get_glyph_alternates (unsigned index,
unsigned start_offset, unsigned start_offset,
unsigned *alternate_count /* IN/OUT. May be NULL. */, unsigned *alternate_count /* IN/OUT. May be NULL. */,
hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) const hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) const
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1.get_alternates (index, start_offset, alternate_count, alternate_glyphs); case 1: return u.format1.get_glyph_alternates (index, start_offset, alternate_count, alternate_glyphs);
default:assert (0); return 0; default:assert (0); return 0;
} }
} }
@ -1509,10 +1509,10 @@ struct SubstLookup : Lookup
} }
unsigned unsigned
get_alternates (hb_codepoint_t gid, get_glyph_alternates (hb_codepoint_t gid,
unsigned start_offset, unsigned start_offset,
unsigned *alternate_count /* IN/OUT. May be NULL. */, unsigned *alternate_count /* IN/OUT. May be NULL. */,
hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) const hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) const
{ {
if (get_type () == SubTable::Alternate) if (get_type () == SubTable::Alternate)
{ {
@ -1522,7 +1522,7 @@ struct SubstLookup : Lookup
const AlternateSubst &alternate_subtable = get_subtable (i).u.alternate; const AlternateSubst &alternate_subtable = get_subtable (i).u.alternate;
unsigned index = alternate_subtable.get_coverage_index (gid); unsigned index = alternate_subtable.get_coverage_index (gid);
if (index != NOT_COVERED) if (index != NOT_COVERED)
return alternate_subtable.get_alternates (index, start_offset, alternate_count, alternate_glyphs); return alternate_subtable.get_glyph_alternates (index, start_offset, alternate_count, alternate_glyphs);
} }
} }
if (alternate_count) *alternate_count = 0; if (alternate_count) *alternate_count = 0;

View File

@ -1971,7 +1971,7 @@ hb_ot_layout_get_baseline (hb_font_t *font,
#endif #endif
/** /**
* hb_ot_layout_lookup_get_alternates: * hb_ot_layout_lookup_get_glyph_alternates:
* @face: a face. * @face: a face.
* @lookup_index: index of the feature lookup to query. * @lookup_index: index of the feature lookup to query.
* @glyph: a glyph id. * @glyph: a glyph id.
@ -1988,15 +1988,15 @@ hb_ot_layout_get_baseline (hb_font_t *font,
* Since: REPLACEME * Since: REPLACEME
**/ **/
HB_EXTERN unsigned HB_EXTERN unsigned
hb_ot_layout_lookup_get_alternates (hb_face_t *face, hb_ot_layout_lookup_get_glyph_alternates (hb_face_t *face,
unsigned lookup_index, unsigned lookup_index,
hb_codepoint_t glyph, hb_codepoint_t glyph,
unsigned start_offset, unsigned start_offset,
unsigned *alternate_count /* IN/OUT. May be NULL. */, unsigned *alternate_count /* IN/OUT. May be NULL. */,
hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */)
{ {
const OT::SubstLookup &lookup = face->table.GSUB->table->get_lookup (lookup_index); const OT::SubstLookup &lookup = face->table.GSUB->table->get_lookup (lookup_index);
return lookup.get_alternates (glyph, start_offset, alternate_count, alternate_glyphs); return lookup.get_glyph_alternates (glyph, start_offset, alternate_count, alternate_glyphs);
} }
#endif #endif

View File

@ -450,12 +450,12 @@ hb_ot_layout_get_baseline (hb_font_t *font,
hb_position_t *coord /* OUT. May be NULL. */); hb_position_t *coord /* OUT. May be NULL. */);
HB_EXTERN unsigned HB_EXTERN unsigned
hb_ot_layout_lookup_get_alternates (hb_face_t *face, hb_ot_layout_lookup_get_glyph_alternates (hb_face_t *face,
unsigned lookup_index, unsigned lookup_index,
hb_codepoint_t glyph, hb_codepoint_t glyph,
unsigned start_offset, unsigned start_offset,
unsigned *alternate_count /* IN/OUT */, unsigned *alternate_count /* IN/OUT */,
hb_codepoint_t *alternate_glyphs); hb_codepoint_t *alternate_glyphs);
HB_END_DECLS HB_END_DECLS

View File

@ -28,13 +28,13 @@
#include <hb-ot.h> #include <hb-ot.h>
static void static void
test_ot_layout_lookup_get_alternates (void) test_ot_layout_lookup_get_glyph_alternates (void)
{ {
hb_face_t *face = hb_test_open_font_file ("fonts/SourceSansPro-Regular.otf"); hb_face_t *face = hb_test_open_font_file ("fonts/SourceSansPro-Regular.otf");
hb_codepoint_t alternates[3]; hb_codepoint_t alternates[3];
unsigned alternates_count = 3; unsigned alternates_count = 3;
g_assert_cmpuint (7, ==, hb_ot_layout_lookup_get_alternates (face, 1, 1091, 2, &alternates_count, alternates)); g_assert_cmpuint (7, ==, hb_ot_layout_lookup_get_glyph_alternates (face, 1, 1091, 2, &alternates_count, alternates));
g_assert_cmpuint (3, ==, alternates_count); g_assert_cmpuint (3, ==, alternates_count);
g_assert_cmpuint (1606, ==, alternates[0]); g_assert_cmpuint (1606, ==, alternates[0]);
@ -48,6 +48,6 @@ int
main (int argc, char **argv) main (int argc, char **argv)
{ {
hb_test_init (&argc, &argv); hb_test_init (&argc, &argv);
hb_test_add (test_ot_layout_lookup_get_alternates); hb_test_add (test_ot_layout_lookup_get_glyph_alternates);
return hb_test_run (); return hb_test_run ();
} }