[subset] GDEF AttachList subsetting support

pull/2429/head
Qunxin Liu 5 years ago committed by Garret Rieger
parent 368ca30641
commit 3c5bdd9bb8
  1. 41
      src/hb-ot-layout-gdef-table.hh
  2. 1
      test/subset/data/Makefile.am
  3. 1
      test/subset/data/Makefile.sources
  4. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.default.A01.ttf
  5. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.default.A05,A06.ttf
  6. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.default.A07,A1B.ttf
  7. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.default.retain-all-codepoint.ttf
  8. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.drop-hints.A01.ttf
  9. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.drop-hints.A05,A06.ttf
  10. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.drop-hints.A07,A1B.ttf
  11. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.drop-hints.retain-all-codepoint.ttf
  12. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.keep-gdef.A01.ttf
  13. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.keep-gdef.A05,A06.ttf
  14. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.keep-gdef.A07,A1B.ttf
  15. BIN
      test/subset/data/expected/layout.gdef-attachlist/IndicTestJalandhar-Regular.keep-gdef.retain-all-codepoint.ttf
  16. BIN
      test/subset/data/fonts/IndicTestJalandhar-Regular.ttf
  17. 13
      test/subset/data/tests/layout.gdef-attachlist.tests

@ -41,8 +41,18 @@ namespace OT {
* Attachment List Table
*/
typedef ArrayOf<HBUINT16> AttachPoint; /* Array of contour point indices--in
* increasing numerical order */
/* Array of contour point indices--in increasing numerical order */
struct AttachPoint : ArrayOf<HBUINT16>
{
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
auto *out = c->serializer->start_embed (*this);
if (unlikely (!out)) return_trace (false);
return_trace (out->serialize (c->serializer, + iter ()));
}
};
struct AttachList
{
@ -72,6 +82,28 @@ struct AttachList
return points.len;
}
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
const hb_set_t &glyphset = *c->plan->glyphset ();
const hb_map_t &glyph_map = *c->plan->glyph_map;
auto *out = c->serializer->start_embed (*this);
if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
hb_sorted_vector_t<hb_codepoint_t> new_coverage;
+ hb_zip (this+coverage, attachPoint)
| hb_filter (glyphset, hb_first)
| hb_filter (subset_offset_array (c, out->attachPoint, this), hb_second)
| hb_map (hb_first)
| hb_map (glyph_map)
| hb_sink (new_coverage)
;
out->coverage.serialize (c->serializer, out)
.serialize (c->serializer, new_coverage.iter ());
return_trace (bool (new_coverage));
}
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@ -613,7 +645,7 @@ struct GDEF
if (unlikely (!out)) return_trace (false);
bool subset_glyphclassdef = out->glyphClassDef.serialize_subset (c, glyphClassDef, this);
out->attachList = 0;//TODO(subset) serialize_subset (c, attachList, this);
bool subset_attachlist = out->attachList.serialize_subset (c, attachList, this);
bool subset_ligcaretlist = out->ligCaretList.serialize_subset (c, ligCaretList, this);
bool subset_markattachclassdef = out->markAttachClassDef.serialize_subset (c, markAttachClassDef, this);
@ -634,7 +666,8 @@ struct GDEF
out->version.minor = 2;
}
return_trace (subset_glyphclassdef || subset_ligcaretlist || subset_markattachclassdef ||
return_trace (subset_glyphclassdef || subset_attachlist ||
subset_ligcaretlist || subset_markattachclassdef ||
(out->version.to_int () >= 0x00010002u && subset_markglyphsetsdef) ||
(out->version.to_int () >= 0x00010003u && subset_varstore));
}

@ -24,6 +24,7 @@ EXTRA_DIST += \
expected/layout.gdef \
expected/layout.context \
expected/layout.gdef-varstore \
expected/layout.gdef-attachlist \
expected/cmap \
expected/cmap14 \
expected/sbix \

@ -24,6 +24,7 @@ DISABLED_TESTS = \
tests/layout.gdef.tests \
tests/layout.context.tests \
tests/layout.gdef-varstore.tests \
tests/layout.gdef-attachlist.tests \
$(NULL)
XFAIL_TESTS = \

@ -0,0 +1,13 @@
FONTS:
IndicTestJalandhar-Regular.ttf
PROFILES:
default.txt
drop-hints.txt
keep-gdef.txt
SUBSETS:
ਅਆ
ਇਛ
*
Loading…
Cancel
Save