diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 850ea965c..656d31dca 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -702,6 +702,42 @@ struct Lookup return_trace (true); } + template + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + struct Lookup *out = c->serializer->embed (*this); + if (unlikely (!out)) return_trace (false); + + /* Subset the actual subtables. */ + /* TODO Drop empty ones, either by calling intersects() beforehand, + * or just dropping null offsets after. */ + const OffsetArrayOf& subtables = get_subtables (); + OffsetArrayOf& out_subtables = out->get_subtables (); + unsigned int count = subTable.len; + for (unsigned int i = 0; i < count; i++) + { + struct Wrapper + { + inline Wrapper (const TSubTable &subtable_, + unsigned int lookup_type_) : + subtable (subtable_), + lookup_type (lookup_type_) {} + + inline bool subset (hb_subset_context_t *c) const + { return subtable.dispatch (c, lookup_type); } + + private: + const TSubTable &subtable; + unsigned int lookup_type; + } wrapper (this+subtables[i], get_type ()); + + out_subtables[i].serialize_subset (c, wrapper, out); + } + + return_trace (true); + } + template inline bool sanitize (hb_sanitize_context_t *c) const { diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 912bf85fc..5847306d6 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -484,6 +484,13 @@ struct SinglePosFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -537,6 +544,13 @@ struct SinglePosFormat2 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -742,6 +756,13 @@ struct PairPosFormat1 return_trace ((this+pairSet[index]).apply (c, valueFormat, skippy_iter.idx)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -828,6 +849,13 @@ struct PairPosFormat2 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1040,6 +1068,13 @@ struct CursivePosFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1140,6 +1175,13 @@ struct MarkBasePosFormat1 return_trace ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, skippy_iter.idx)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1259,6 +1301,13 @@ struct MarkLigPosFormat1 return_trace ((this+markArray).apply (c, mark_index, comp_index, lig_attach, classCount, j)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1375,6 +1424,13 @@ struct MarkMarkPosFormat1 return_trace ((this+mark1Array).apply (c, mark1_index, mark2_index, this+mark2Array, classCount, j)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1543,6 +1599,9 @@ struct PosLookup : Lookup inline typename context_t::return_t dispatch (context_t *c) const { return Lookup::dispatch (c); } + inline bool subset (hb_subset_context_t *c) const + { return Lookup::subset (c); } + inline bool sanitize (hb_sanitize_context_t *c) const { return Lookup::sanitize (c); } }; @@ -1563,11 +1622,11 @@ struct GPOS : GSUBGPOS static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer); static inline void position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer); + inline bool subset (hb_subset_context_t *c) const + { return GSUBGPOS::subset (c); } + inline bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - return_trace (GSUBGPOS::sanitize (c)); - } + { return GSUBGPOS::sanitize (c); } typedef GSUBGPOS::accelerator_t accelerator_t; }; diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index d2a720933..b5ac08baf 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -102,6 +102,13 @@ struct SingleSubstFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -184,6 +191,13 @@ struct SingleSubstFormat2 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -387,6 +401,13 @@ struct MultipleSubstFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -570,6 +591,13 @@ struct AlternateSubstFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -911,6 +939,13 @@ struct LigatureSubstFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1101,6 +1136,13 @@ struct ReverseChainSingleSubstFormat1 return_trace (false); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1367,7 +1409,7 @@ struct SubstLookup : Lookup { return Lookup::dispatch (c); } inline bool subset (hb_subset_context_t *c) const - { return false; }//XXX Lookup::subset (c); } + { return Lookup::subset (c); } inline bool sanitize (hb_sanitize_context_t *c) const { return Lookup::sanitize (c); } @@ -1386,16 +1428,10 @@ struct GSUB : GSUBGPOS { return CastR (GSUBGPOS::get_lookup (i)); } inline bool subset (hb_subset_context_t *c) const - { - TRACE_SUBSET (this); - return_trace (GSUBGPOS::subset (c)); - } + { return GSUBGPOS::subset (c); } inline bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - return_trace (GSUBGPOS::sanitize (c)); - } + { return GSUBGPOS::sanitize (c); } typedef GSUBGPOS::accelerator_t accelerator_t; }; diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 5ccc5febf..315951a34 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -1435,6 +1435,13 @@ struct ContextFormat1 return_trace (rule_set.apply (c, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1547,6 +1554,13 @@ struct ContextFormat2 return_trace (rule_set.apply (c, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1648,6 +1662,13 @@ struct ContextFormat3 return_trace (context_apply_lookup (c, glyphCount, (const HBUINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -2076,6 +2097,13 @@ struct ChainContextFormat1 return_trace (rule_set.apply (c, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -2209,6 +2237,13 @@ struct ChainContextFormat2 return_trace (rule_set.apply (c, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -2352,6 +2387,13 @@ struct ChainContextFormat3 lookup.len, lookup.arrayZ, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this);