[>64k:layout:PairPos] Implement format 3
Implements rest of https://github.com/be-fonts/boring-expansion-spec/issues/38 Subset does NOT lower format.
This commit is contained in:
parent
298ee47c55
commit
f0d6dda5a6
|
@ -16,6 +16,7 @@ struct PairPos
|
||||||
PairPosFormat1_3<SmallTypes> format1;
|
PairPosFormat1_3<SmallTypes> format1;
|
||||||
PairPosFormat2_4<SmallTypes> format2;
|
PairPosFormat2_4<SmallTypes> format2;
|
||||||
#ifndef HB_NO_BORING_EXPANSION
|
#ifndef HB_NO_BORING_EXPANSION
|
||||||
|
PairPosFormat1_3<MediumTypes> format3;
|
||||||
PairPosFormat2_4<MediumTypes> format4;
|
PairPosFormat2_4<MediumTypes> format4;
|
||||||
#endif
|
#endif
|
||||||
} u;
|
} u;
|
||||||
|
@ -30,7 +31,8 @@ struct PairPos
|
||||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||||
#ifndef HB_NO_BORING_EXPANSION
|
#ifndef HB_NO_BORING_EXPANSION
|
||||||
case 4: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
|
||||||
|
case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
|
||||||
#endif
|
#endif
|
||||||
default:return_trace (c->default_return_value ());
|
default:return_trace (c->default_return_value ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct PairPosFormat1_3
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HBUINT16 format; /* Format identifier--format = 1 */
|
HBUINT16 format; /* Format identifier--format = 1 */
|
||||||
Offset16To<Coverage>
|
typename Types::template OffsetTo<Coverage>
|
||||||
coverage; /* Offset to Coverage table--from
|
coverage; /* Offset to Coverage table--from
|
||||||
* beginning of subtable */
|
* beginning of subtable */
|
||||||
ValueFormat valueFormat[2]; /* [0] Defines the types of data in
|
ValueFormat valueFormat[2]; /* [0] Defines the types of data in
|
||||||
|
@ -25,11 +25,11 @@ struct PairPosFormat1_3
|
||||||
/* [1] Defines the types of data in
|
/* [1] Defines the types of data in
|
||||||
* ValueRecord2--for the second glyph
|
* ValueRecord2--for the second glyph
|
||||||
* in the pair--may be zero (0) */
|
* in the pair--may be zero (0) */
|
||||||
Array16OfOffset16To<PairSet>
|
Array16Of<typename Types::template OffsetTo<PairSet>>
|
||||||
pairSet; /* Array of PairSet tables
|
pairSet; /* Array of PairSet tables
|
||||||
* ordered by Coverage Index */
|
* ordered by Coverage Index */
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_ARRAY (10, pairSet);
|
DEFINE_SIZE_ARRAY (8 + Types::size, pairSet);
|
||||||
|
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ struct PairPosFormat1_3
|
||||||
+ hb_zip (this+coverage, pairSet)
|
+ hb_zip (this+coverage, pairSet)
|
||||||
| hb_filter (*glyphs, hb_first)
|
| hb_filter (*glyphs, hb_first)
|
||||||
| hb_map (hb_second)
|
| hb_map (hb_second)
|
||||||
| hb_map ([glyphs, this] (const Offset16To<PairSet> &_)
|
| hb_map ([glyphs, this] (const typename Types::template OffsetTo<PairSet> &_)
|
||||||
{ return (this+_).intersects (glyphs, valueFormat); })
|
{ return (this+_).intersects (glyphs, valueFormat); })
|
||||||
| hb_any
|
| hb_any
|
||||||
;
|
;
|
||||||
|
@ -131,7 +131,7 @@ struct PairPosFormat1_3
|
||||||
|
|
||||||
+ hb_zip (this+coverage, pairSet)
|
+ hb_zip (this+coverage, pairSet)
|
||||||
| hb_filter (glyphset, hb_first)
|
| hb_filter (glyphset, hb_first)
|
||||||
| hb_filter ([this, c, out] (const Offset16To<PairSet>& _)
|
| hb_filter ([this, c, out] (const typename Types::template OffsetTo<PairSet>& _)
|
||||||
{
|
{
|
||||||
auto snap = c->serializer->snapshot ();
|
auto snap = c->serializer->snapshot ();
|
||||||
auto *o = out->pairSet.serialize_append (c->serializer);
|
auto *o = out->pairSet.serialize_append (c->serializer);
|
||||||
|
@ -164,7 +164,7 @@ struct PairPosFormat1_3
|
||||||
|
|
||||||
unsigned format1 = 0;
|
unsigned format1 = 0;
|
||||||
unsigned format2 = 0;
|
unsigned format2 = 0;
|
||||||
for (const Offset16To<PairSet>& _ :
|
for (const auto & _ :
|
||||||
+ hb_zip (this+coverage, pairSet) | hb_filter (glyphset, hb_first) | hb_map (hb_second))
|
+ hb_zip (this+coverage, pairSet) | hb_filter (glyphset, hb_first) | hb_map (hb_second))
|
||||||
{
|
{
|
||||||
const PairSet& set = (this + _);
|
const PairSet& set = (this + _);
|
||||||
|
|
Loading…
Reference in New Issue