[>64k:layout] Templatize PairPosFormat1

This commit is contained in:
Behdad Esfahbod 2022-07-07 16:27:49 -06:00
parent e9f8010fd0
commit 298ee47c55
4 changed files with 18 additions and 7 deletions

View File

@ -13,7 +13,7 @@ struct PairPos
protected:
union {
HBUINT16 format; /* Format identifier */
PairPosFormat1 format1;
PairPosFormat1_3<SmallTypes> format1;
PairPosFormat2_4<SmallTypes> format2;
#ifndef HB_NO_BORING_EXPANSION
PairPosFormat2_4<MediumTypes> format4;

View File

@ -8,8 +8,12 @@ namespace Layout {
namespace GPOS_impl {
struct PairPosFormat1
template <typename Types>
struct PairPosFormat1_3
{
using PairSet = GPOS_impl::PairSet<Types>;
using PairValueRecord = GPOS_impl::PairValueRecord<Types>;
protected:
HBUINT16 format; /* Format identifier--format = 1 */
Offset16To<Coverage>
@ -35,7 +39,7 @@ struct PairPosFormat1
unsigned int len1 = valueFormat[0].get_len ();
unsigned int len2 = valueFormat[1].get_len ();
PairSet::sanitize_closure_t closure =
typename PairSet::sanitize_closure_t closure =
{
valueFormat,
len1,

View File

@ -8,9 +8,13 @@ namespace Layout {
namespace GPOS_impl {
template <typename Types>
struct PairSet
{
friend struct PairPosFormat1;
template <typename Types2>
friend struct PairPosFormat1_3;
using PairValueRecord = GPOS_impl::PairValueRecord<Types>;
protected:
HBUINT16 len; /* Number of PairValueRecords */
@ -136,7 +140,7 @@ struct PairSet
unsigned len2 = valueFormats[1].get_len ();
unsigned record_size = HBUINT16::static_size + Value::static_size * (len1 + len2);
PairValueRecord::context_t context =
typename PairValueRecord::context_t context =
{
this,
valueFormats,

View File

@ -6,18 +6,21 @@ namespace Layout {
namespace GPOS_impl {
template <typename Types>
struct PairValueRecord
{
template <typename Types2>
friend struct PairSet;
protected:
HBGlyphID16 secondGlyph; /* GlyphID of second glyph in the
typename Types::HBGlyphID
secondGlyph; /* GlyphID of second glyph in the
* pair--first glyph is listed in the
* Coverage table */
ValueRecord values; /* Positioning data for the first glyph
* followed by for second glyph */
public:
DEFINE_SIZE_ARRAY (2, values);
DEFINE_SIZE_ARRAY (Types::size, values);
int cmp (hb_codepoint_t k) const
{ return secondGlyph.cmp (k); }