mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-13 08:42:59 +00:00
[subset] Move GDEF subset planning into hb-subset-plan-layout.cc
This commit is contained in:
parent
b33f2e26ee
commit
d3ccdcdd80
3 changed files with 42 additions and 28 deletions
|
@ -35,6 +35,25 @@ using OT::Layout::GPOS;
|
|||
|
||||
#ifndef HB_NO_SUBSET_LAYOUT
|
||||
|
||||
void
|
||||
remap_used_mark_sets (hb_subset_plan_t *plan,
|
||||
hb_map_t& used_mark_sets_map)
|
||||
{
|
||||
hb_blob_ptr_t<OT::GDEF> gdef = plan->source_table<OT::GDEF> ();
|
||||
|
||||
if (!gdef->has_data () || !gdef->has_mark_glyph_sets ())
|
||||
{
|
||||
gdef.destroy ();
|
||||
return;
|
||||
}
|
||||
|
||||
hb_set_t used_mark_sets;
|
||||
gdef->get_mark_glyph_sets ().collect_used_mark_sets (plan->_glyphset_gsub, used_mark_sets);
|
||||
gdef.destroy ();
|
||||
|
||||
remap_indexes (&used_mark_sets, &used_mark_sets_map);
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes all tags from 'tags' that are not in filter. Additionally eliminates any duplicates.
|
||||
* Returns true if anything was removed (not including duplicates).
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "hb-ot-cmap-table.hh"
|
||||
#include "hb-ot-glyf-table.hh"
|
||||
#include "hb-ot-layout-base-table.hh"
|
||||
#include "hb-ot-layout-gdef-table.hh"
|
||||
//#include "hb-ot-layout-gdef-table.hh"
|
||||
#include "hb-ot-cff1-table.hh"
|
||||
#include "hb-ot-cff2-table.hh"
|
||||
#include "OT/Color/COLR/COLR.hh"
|
||||
|
@ -337,25 +337,6 @@ _math_closure (hb_subset_plan_t *plan,
|
|||
math.destroy ();
|
||||
}
|
||||
|
||||
static inline void
|
||||
_remap_used_mark_sets (hb_subset_plan_t *plan,
|
||||
hb_map_t& used_mark_sets_map)
|
||||
{
|
||||
hb_blob_ptr_t<OT::GDEF> gdef = plan->source_table<OT::GDEF> ();
|
||||
|
||||
if (!gdef->has_data () || !gdef->has_mark_glyph_sets ())
|
||||
{
|
||||
gdef.destroy ();
|
||||
return;
|
||||
}
|
||||
|
||||
hb_set_t used_mark_sets;
|
||||
gdef->get_mark_glyph_sets ().collect_used_mark_sets (plan->_glyphset_gsub, used_mark_sets);
|
||||
gdef.destroy ();
|
||||
|
||||
remap_indexes (&used_mark_sets, &used_mark_sets_map);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_remove_invalid_gids (hb_set_t *glyphs,
|
||||
unsigned int num_glyphs)
|
||||
|
@ -1055,8 +1036,10 @@ hb_subset_plan_t::hb_subset_plan_t (hb_face_t *face,
|
|||
for (auto &v : bounds_height_vec)
|
||||
v = 0xFFFFFFFF;
|
||||
|
||||
#ifndef HB_NO_SUBSET_LAYOUT
|
||||
if (!drop_tables.has (HB_OT_TAG_GDEF))
|
||||
_remap_used_mark_sets (this, used_mark_sets_map);
|
||||
remap_used_mark_sets (this, used_mark_sets_map);
|
||||
#endif
|
||||
|
||||
#ifndef HB_NO_VAR
|
||||
#ifndef HB_NO_BASE
|
||||
|
|
|
@ -296,14 +296,21 @@ struct hb_subset_plan_t
|
|||
}
|
||||
};
|
||||
|
||||
void
|
||||
// hb-subset-plan implementation is split into multiple files to keep
|
||||
// compile times more reasonable:
|
||||
// - hb-subset-plan.cc
|
||||
// - hb-subset-plan-layout.cc
|
||||
//
|
||||
// The functions below are those needed to connect the split files
|
||||
// above together.
|
||||
HB_INTERNAL void
|
||||
remap_indexes (const hb_set_t *indexes,
|
||||
hb_map_t *mapping /* OUT */);
|
||||
|
||||
|
||||
#ifndef HB_NO_VAR
|
||||
template<typename ItemVarStore>
|
||||
void
|
||||
HB_INTERNAL void
|
||||
remap_variation_indices (const ItemVarStore &var_store,
|
||||
const hb_set_t &variation_indices,
|
||||
const hb_vector_t<int>& normalized_coords,
|
||||
|
@ -311,7 +318,7 @@ remap_variation_indices (const ItemVarStore &var_store,
|
|||
bool no_variations, /* all axes pinned */
|
||||
hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> &variation_idx_delta_map /* OUT */);
|
||||
|
||||
void
|
||||
HB_INTERNAL void
|
||||
generate_varstore_inner_maps (const hb_set_t& varidx_set,
|
||||
unsigned subtable_count,
|
||||
hb_vector_t<hb_inc_bimap_t> &inner_maps /* OUT */);
|
||||
|
@ -320,14 +327,19 @@ generate_varstore_inner_maps (const hb_set_t& varidx_set,
|
|||
#ifndef HB_NO_SUBSET_LAYOUT
|
||||
typedef hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> script_langsys_map;
|
||||
|
||||
void layout_nameid_closure (hb_subset_plan_t* plan,
|
||||
hb_set_t* drop_tables);
|
||||
HB_INTERNAL void
|
||||
remap_used_mark_sets (hb_subset_plan_t *plan,
|
||||
hb_map_t& used_mark_sets_map);
|
||||
|
||||
void
|
||||
HB_INTERNAL void
|
||||
layout_nameid_closure (hb_subset_plan_t* plan,
|
||||
hb_set_t* drop_tables);
|
||||
|
||||
HB_INTERNAL void
|
||||
layout_populate_gids_to_retain (hb_subset_plan_t* plan,
|
||||
hb_set_t* drop_tables);
|
||||
|
||||
void
|
||||
HB_INTERNAL void
|
||||
collect_layout_variation_indices (hb_subset_plan_t* plan);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue