[subset] GDEF MarkGlyphSets subsetting support
This commit is contained in:
parent
fcd7f33bbb
commit
5ad761b943
|
@ -288,6 +288,34 @@ struct MarkGlyphSetsFormat1
|
||||||
bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
|
bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
|
||||||
{ return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
|
{ return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
|
||||||
|
|
||||||
|
bool subset (hb_subset_context_t *c) const
|
||||||
|
{
|
||||||
|
TRACE_SUBSET (this);
|
||||||
|
auto *out = c->serializer->start_embed (*this);
|
||||||
|
if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
|
||||||
|
out->format = format;
|
||||||
|
|
||||||
|
bool ret = true;
|
||||||
|
for (const LOffsetTo<Coverage>& offset : coverage.iter ())
|
||||||
|
{
|
||||||
|
auto *o = out->coverage.serialize_append (c->serializer);
|
||||||
|
if (unlikely (!o))
|
||||||
|
{
|
||||||
|
ret = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//not using o->serialize_subset (c, offset, this, out) here because
|
||||||
|
//OTS doesn't allow null offset.
|
||||||
|
//See issue: https://github.com/khaledhosny/ots/issues/172
|
||||||
|
c->serializer->push ();
|
||||||
|
c->dispatch (this+offset);
|
||||||
|
c->serializer->add_link (*o, c->serializer->pop_pack (), out);
|
||||||
|
}
|
||||||
|
|
||||||
|
return_trace (ret && out->coverage.len);
|
||||||
|
}
|
||||||
|
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
|
@ -313,6 +341,15 @@ struct MarkGlyphSets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool subset (hb_subset_context_t *c) const
|
||||||
|
{
|
||||||
|
TRACE_SUBSET (this);
|
||||||
|
switch (u.format) {
|
||||||
|
case 1: return_trace (u.format1.subset (c));
|
||||||
|
default:return_trace (false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
|
@ -448,7 +485,11 @@ struct GDEF
|
||||||
out->markAttachClassDef.serialize_subset (c, markAttachClassDef, this, out);
|
out->markAttachClassDef.serialize_subset (c, markAttachClassDef, this, out);
|
||||||
|
|
||||||
if (version.to_int () >= 0x00010002u)
|
if (version.to_int () >= 0x00010002u)
|
||||||
out->markGlyphSetsDef = 0;// TODO(subset) serialize_subset (c, markGlyphSetsDef, this, out);
|
{
|
||||||
|
if (!out->markGlyphSetsDef.serialize_subset (c, markGlyphSetsDef, this, out) &&
|
||||||
|
version.to_int () == 0x00010002u)
|
||||||
|
out->version.minor = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (version.to_int () >= 0x00010003u)
|
if (version.to_int () >= 0x00010003u)
|
||||||
out->varStore = 0;// TODO(subset) serialize_subset (c, varStore, this, out);
|
out->varStore = 0;// TODO(subset) serialize_subset (c, varStore, this, out);
|
||||||
|
|
|
@ -20,6 +20,7 @@ EXTRA_DIST += \
|
||||||
expected/layout.gpos6 \
|
expected/layout.gpos6 \
|
||||||
expected/layout.gsub3 \
|
expected/layout.gsub3 \
|
||||||
expected/layout.gsub6 \
|
expected/layout.gsub6 \
|
||||||
|
expected/layout.gdef \
|
||||||
expected/cmap \
|
expected/cmap \
|
||||||
expected/cmap14 \
|
expected/cmap14 \
|
||||||
expected/sbix \
|
expected/sbix \
|
||||||
|
|
|
@ -12,6 +12,7 @@ TESTS = \
|
||||||
tests/layout.gpos6.tests \
|
tests/layout.gpos6.tests \
|
||||||
tests/layout.gsub3.tests \
|
tests/layout.gsub3.tests \
|
||||||
tests/layout.gsub6.tests \
|
tests/layout.gsub6.tests \
|
||||||
|
tests/layout.gdef.tests \
|
||||||
tests/cmap.tests \
|
tests/cmap.tests \
|
||||||
tests/cmap14.tests \
|
tests/cmap14.tests \
|
||||||
tests/sbix.tests \
|
tests/sbix.tests \
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,14 @@
|
||||||
|
FONTS:
|
||||||
|
Roboto-Regular.ttf
|
||||||
|
|
||||||
|
PROFILES:
|
||||||
|
default.txt
|
||||||
|
drop-hints.txt
|
||||||
|
keep-gdef.txt
|
||||||
|
|
||||||
|
SUBSETS:
|
||||||
|
Ḁ̃
|
||||||
|
̣
|
||||||
|
̃
|
||||||
|
̉ ̏
|
||||||
|
ABC
|
Loading…
Reference in New Issue