[subset] Move 2 experimental public api methods to be private methods in GSUB/GPOS.
2 methods are: hb_ot_layout_closure_lookups and hb_ot_layout_closure_features
This commit is contained in:
parent
62de2f749c
commit
973c47f6c9
|
@ -552,8 +552,6 @@ HB_OT_TAG_GPOS
|
|||
HB_OT_TAG_GSUB
|
||||
HB_OT_TAG_JSTF
|
||||
hb_ot_layout_baseline_tag_t
|
||||
hb_ot_layout_closure_lookups
|
||||
hb_ot_layout_closure_features
|
||||
hb_ot_layout_collect_lookups
|
||||
hb_ot_layout_collect_features
|
||||
hb_ot_layout_feature_get_characters
|
||||
|
|
|
@ -37,9 +37,7 @@ hb_draw_funcs_set_line_to_func
|
|||
hb_draw_funcs_set_move_to_func
|
||||
hb_draw_funcs_set_quadratic_to_func
|
||||
hb_style_get_value
|
||||
hb_font_get_var_coords_design
|
||||
hb_ot_layout_closure_lookups
|
||||
hb_ot_layout_closure_features""".splitlines ()
|
||||
hb_font_get_var_coords_design""".splitlines ()
|
||||
symbols = [x for x in symbols if x not in experimental_symbols]
|
||||
symbols = "\n".join (symbols)
|
||||
|
||||
|
|
|
@ -2572,6 +2572,11 @@ struct GPOS : GSUBGPOS
|
|||
}
|
||||
}
|
||||
|
||||
void closure_lookups (hb_face_t *face,
|
||||
const hb_set_t *glyphs,
|
||||
hb_set_t *lookup_indexes /* IN/OUT */) const
|
||||
{ GSUBGPOS::closure_lookups<PosLookup> (face, glyphs, lookup_indexes); }
|
||||
|
||||
typedef GSUBGPOS::accelerator_t<GPOS> accelerator_t;
|
||||
};
|
||||
|
||||
|
|
|
@ -1550,6 +1550,11 @@ struct GSUB : GSUBGPOS
|
|||
HB_INTERNAL bool is_blocklisted (hb_blob_t *blob,
|
||||
hb_face_t *face) const;
|
||||
|
||||
void closure_lookups (hb_face_t *face,
|
||||
const hb_set_t *glyphs,
|
||||
hb_set_t *lookup_indexes /* IN/OUT */) const
|
||||
{ GSUBGPOS::closure_lookups<SubstLookup> (face, glyphs, lookup_indexes); }
|
||||
|
||||
typedef GSUBGPOS::accelerator_t<GSUB> accelerator_t;
|
||||
};
|
||||
|
||||
|
|
|
@ -3276,6 +3276,21 @@ struct GSUBGPOS
|
|||
#endif
|
||||
}
|
||||
|
||||
template <typename TLookup>
|
||||
void closure_lookups (hb_face_t *face,
|
||||
const hb_set_t *glyphs,
|
||||
hb_set_t *lookup_indexes /* IN/OUT */) const
|
||||
{
|
||||
hb_set_t visited_lookups, inactive_lookups;
|
||||
OT::hb_closure_lookups_context_t c (face, glyphs, &visited_lookups, &inactive_lookups);
|
||||
|
||||
for (unsigned lookup_index : + hb_iter (lookup_indexes))
|
||||
reinterpret_cast<const TLookup &> (get_lookup (lookup_index)).closure_lookups (&c, lookup_index);
|
||||
|
||||
hb_set_union (lookup_indexes, &visited_lookups);
|
||||
hb_set_subtract (lookup_indexes, &inactive_lookups);
|
||||
}
|
||||
|
||||
template <typename TLookup>
|
||||
bool subset (hb_subset_layout_context_t *c) const
|
||||
{
|
||||
|
|
|
@ -1202,72 +1202,6 @@ hb_ot_layout_collect_lookups (hb_face_t *face,
|
|||
g.feature_variation_collect_lookups (&feature_indexes, lookup_indexes);
|
||||
}
|
||||
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
/**
|
||||
* hb_ot_layout_closure_lookups:
|
||||
* @face: #hb_face_t to work upon
|
||||
* @table_tag: HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
|
||||
* @lookup_indexes: (inout): lookup_indices collected from feature
|
||||
* list
|
||||
*
|
||||
* Returns all inactive lookups reachable from lookup_indices
|
||||
*
|
||||
* Since: EXPERIMENTAL
|
||||
**/
|
||||
void
|
||||
hb_ot_layout_closure_lookups (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
const hb_set_t *glyphs,
|
||||
hb_set_t *lookup_indexes /* IN/OUT */)
|
||||
{
|
||||
hb_set_t visited_lookups, inactive_lookups;
|
||||
OT::hb_closure_lookups_context_t c (face, glyphs, &visited_lookups, &inactive_lookups);
|
||||
|
||||
for (unsigned lookup_index : + hb_iter (lookup_indexes))
|
||||
{
|
||||
switch (table_tag)
|
||||
{
|
||||
case HB_OT_TAG_GSUB:
|
||||
{
|
||||
const OT::SubstLookup& l = face->table.GSUB->table->get_lookup (lookup_index);
|
||||
l.closure_lookups (&c, lookup_index);
|
||||
break;
|
||||
}
|
||||
case HB_OT_TAG_GPOS:
|
||||
{
|
||||
const OT::PosLookup& l = face->table.GPOS->table->get_lookup (lookup_index);
|
||||
l.closure_lookups (&c, lookup_index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hb_set_union (lookup_indexes, &visited_lookups);
|
||||
hb_set_subtract (lookup_indexes, &inactive_lookups);
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_ot_layout_closure_features:
|
||||
* @face: #hb_face_t to work upon
|
||||
* @table_tag: HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
|
||||
* @lookup_indexes: (in): collected active lookup_indices
|
||||
* @feature_indexes: (out): all active feature indexes collected
|
||||
*
|
||||
* Returns all active feature indexes
|
||||
*
|
||||
* Since: EXPERIMENTAL
|
||||
**/
|
||||
void
|
||||
hb_ot_layout_closure_features (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
const hb_map_t *lookup_indexes, /* IN */
|
||||
hb_set_t *feature_indexes /* OUT */)
|
||||
{
|
||||
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
|
||||
g.closure_features (lookup_indexes, feature_indexes);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HB_NO_LAYOUT_COLLECT_GLYPHS
|
||||
/**
|
||||
|
|
|
@ -262,20 +262,6 @@ hb_ot_layout_collect_lookups (hb_face_t *face,
|
|||
const hb_tag_t *features,
|
||||
hb_set_t *lookup_indexes /* OUT */);
|
||||
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
HB_EXTERN void
|
||||
hb_ot_layout_closure_lookups (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
const hb_set_t *glyphs,
|
||||
hb_set_t *lookup_indexes /* IN/OUT */);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_ot_layout_closure_features (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
const hb_map_t *lookup_indexes, /* IN */
|
||||
hb_set_t *feature_indexes /* OUT */);
|
||||
#endif
|
||||
|
||||
HB_EXTERN void
|
||||
hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "hb-ot-glyf-table.hh"
|
||||
#include "hb-ot-layout-gdef-table.hh"
|
||||
#include "hb-ot-layout-gpos-table.hh"
|
||||
#include "hb-ot-layout-gsub-table.hh"
|
||||
#include "hb-ot-cff1-table.hh"
|
||||
#include "hb-ot-color-colr-table.hh"
|
||||
#include "hb-ot-var-fvar-table.hh"
|
||||
|
@ -54,7 +55,6 @@ _add_cff_seac_components (const OT::cff1::accelerator_t &cff,
|
|||
#endif
|
||||
|
||||
#ifndef HB_NO_SUBSET_LAYOUT
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
static void
|
||||
_remap_indexes (const hb_set_t *indexes,
|
||||
hb_map_t *mapping /* OUT */)
|
||||
|
@ -65,7 +65,6 @@ _remap_indexes (const hb_set_t *indexes,
|
|||
mapping->set (_.first, _.second);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
_gsub_closure_glyphs_lookups_features (hb_face_t *face,
|
||||
|
@ -83,21 +82,17 @@ _gsub_closure_glyphs_lookups_features (hb_face_t *face,
|
|||
hb_ot_layout_lookups_substitute_closure (face,
|
||||
&lookup_indices,
|
||||
gids_to_retain);
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
hb_ot_layout_closure_lookups (face,
|
||||
HB_OT_TAG_GSUB,
|
||||
hb_blob_ptr_t<OT::GSUB> gsub = hb_sanitize_context_t ().reference_table<OT::GSUB> (face);
|
||||
gsub->closure_lookups (face,
|
||||
gids_to_retain,
|
||||
&lookup_indices);
|
||||
_remap_indexes (&lookup_indices, gsub_lookups);
|
||||
|
||||
//closure features
|
||||
hb_set_t feature_indices;
|
||||
hb_ot_layout_closure_features (face,
|
||||
HB_OT_TAG_GSUB,
|
||||
gsub_lookups,
|
||||
&feature_indices);
|
||||
gsub->closure_features (gsub_lookups, &feature_indices);
|
||||
_remap_indexes (&feature_indices, gsub_features);
|
||||
#endif
|
||||
gsub.destroy ();
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -113,21 +108,17 @@ _gpos_closure_lookups_features (hb_face_t *face,
|
|||
nullptr,
|
||||
nullptr,
|
||||
&lookup_indices);
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
hb_ot_layout_closure_lookups (face,
|
||||
HB_OT_TAG_GPOS,
|
||||
hb_blob_ptr_t<OT::GPOS> gpos = hb_sanitize_context_t ().reference_table<OT::GPOS> (face);
|
||||
gpos->closure_lookups (face,
|
||||
gids_to_retain,
|
||||
&lookup_indices);
|
||||
_remap_indexes (&lookup_indices, gpos_lookups);
|
||||
|
||||
//closure features
|
||||
hb_set_t feature_indices;
|
||||
hb_ot_layout_closure_features (face,
|
||||
HB_OT_TAG_GPOS,
|
||||
gpos_lookups,
|
||||
&feature_indices);
|
||||
gpos->closure_features (gpos_lookups, &feature_indices);
|
||||
_remap_indexes (&feature_indices, gpos_features);
|
||||
#endif
|
||||
gpos.destroy ();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -85,16 +85,10 @@ test_font (hb_font_t *font, hb_codepoint_t cp)
|
|||
|
||||
hb_set_t *lookup_indexes = hb_set_create ();
|
||||
hb_set_add (lookup_indexes, 0);
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
hb_ot_layout_closure_lookups (face, HB_OT_TAG_GSUB, set, lookup_indexes);
|
||||
#endif
|
||||
|
||||
hb_map_t *lookup_mapping = hb_map_create ();
|
||||
hb_map_set (lookup_mapping, 0, 0);
|
||||
hb_set_t *feature_indices = hb_set_create ();
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
hb_ot_layout_closure_features (face, HB_OT_TAG_GSUB, lookup_mapping, feature_indices);
|
||||
#endif
|
||||
hb_set_destroy (lookup_indexes);
|
||||
hb_set_destroy (feature_indices);
|
||||
hb_map_destroy (lookup_mapping);
|
||||
|
|
|
@ -9,9 +9,6 @@ TESTS = \
|
|||
tests/sbix.tests \
|
||||
tests/colr.tests \
|
||||
tests/cbdt.tests \
|
||||
$(NULL)
|
||||
|
||||
DISABLED_TESTS = \
|
||||
tests/layout.tests \
|
||||
tests/layout.gpos.tests \
|
||||
tests/layout.gpos2.tests \
|
||||
|
|
|
@ -29,11 +29,6 @@ run_test = find_program('run-tests.py')
|
|||
foreach t : tests
|
||||
fname = '@0@.tests'.format(t)
|
||||
|
||||
# layout test are enabled only under experimental API flag for now
|
||||
if t.contains('layout') and not get_option('experimental_api')
|
||||
continue
|
||||
endif
|
||||
|
||||
test(t, run_test,
|
||||
args: [
|
||||
hb_subset,
|
||||
|
|
Loading…
Reference in New Issue