[subset] Add subset support for Extension lookups (GPOS 9, GSUB 7).
This commit is contained in:
parent
bbbea3dbd8
commit
08a4997fde
|
@ -3178,6 +3178,24 @@ struct ExtensionFormat1
|
|||
extensionLookupType != T::SubTable::Extension);
|
||||
}
|
||||
|
||||
bool subset (hb_subset_context_t *c) const
|
||||
{
|
||||
TRACE_SUBSET (this);
|
||||
|
||||
auto *out = c->serializer->start_embed (this);
|
||||
if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
|
||||
|
||||
out->format = format;
|
||||
out->extensionLookupType = extensionLookupType;
|
||||
|
||||
const auto& src_offset =
|
||||
reinterpret_cast<const LOffsetTo<typename T::SubTable> &> (extensionOffset);
|
||||
auto& dest_offset =
|
||||
reinterpret_cast<LOffsetTo<typename T::SubTable> &> (out->extensionOffset);
|
||||
|
||||
return_trace (dest_offset.serialize_subset (c, src_offset, this, get_type ()));
|
||||
}
|
||||
|
||||
protected:
|
||||
HBUINT16 format; /* Format identifier. Set to 1. */
|
||||
HBUINT16 extensionLookupType; /* Lookup type of subtable referenced
|
||||
|
@ -3208,6 +3226,18 @@ struct Extension
|
|||
}
|
||||
}
|
||||
|
||||
// Specialization of dispatch for subset. dispatch() normally just
|
||||
// dispatches to the sub table this points too, but for subset
|
||||
// we need to run subset on this subtable too.
|
||||
template <typename ...Ts>
|
||||
typename hb_subset_context_t::return_t dispatch (hb_subset_context_t *c, Ts&&... ds) const
|
||||
{
|
||||
switch (u.format) {
|
||||
case 1: return u.format1.subset (c);
|
||||
default: return c->default_return_value ();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename context_t, typename ...Ts>
|
||||
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ TESTS = \
|
|||
tests/layout.gpos6.tests \
|
||||
tests/layout.gpos8.tests \
|
||||
tests/layout.gpos8.amiri.tests \
|
||||
tests/layout.gpos9.tests \
|
||||
tests/layout.gsub3.tests \
|
||||
tests/layout.gsub6.tests \
|
||||
tests/layout.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.
|
@ -0,0 +1,11 @@
|
|||
FONTS:
|
||||
gpos9_font2.otf
|
||||
|
||||
PROFILES:
|
||||
keep-layout.txt
|
||||
keep-layout-retain-gids.txt
|
||||
|
||||
SUBSETS:
|
||||
A
|
||||
B
|
||||
AB
|
|
@ -13,6 +13,7 @@ tests = [
|
|||
'layout.gpos6',
|
||||
'layout.gpos8',
|
||||
'layout.gpos8.amiri',
|
||||
'layout.gpos9',
|
||||
'layout.gsub3',
|
||||
'layout.gsub6',
|
||||
'layout.gdef',
|
||||
|
|
Loading…
Reference in New Issue