[>64k:layout] Templatize SingleSubst

This commit is contained in:
Behdad Esfahbod 2022-07-06 13:11:53 -06:00
parent ca5c8a6419
commit e3caf8d50a
3 changed files with 14 additions and 11 deletions

View File

@ -13,9 +13,9 @@ struct SingleSubst
{ {
protected: protected:
union { union {
HBUINT16 format; /* Format identifier */ HBUINT16 format; /* Format identifier */
SingleSubstFormat1 format1; SingleSubstFormat1_3<SmallTypes> format1;
SingleSubstFormat2 format2; SingleSubstFormat2_4<SmallTypes> format2;
} u; } u;
public: public:

View File

@ -7,18 +7,20 @@ namespace OT {
namespace Layout { namespace Layout {
namespace GSUB_impl { namespace GSUB_impl {
struct SingleSubstFormat1 template <typename Types>
struct SingleSubstFormat1_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 Substitution table */ * beginning of Substitution table */
HBUINT16 deltaGlyphID; /* Add to original GlyphID to get typename Types::HBUINT
deltaGlyphID; /* Add to original GlyphID to get
* substitute GlyphID, modulo 0x10000 */ * substitute GlyphID, modulo 0x10000 */
public: public:
DEFINE_SIZE_STATIC (6); DEFINE_SIZE_STATIC (2 + 2 * Types::size);
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {

View File

@ -7,19 +7,20 @@ namespace OT {
namespace Layout { namespace Layout {
namespace GSUB_impl { namespace GSUB_impl {
struct SingleSubstFormat2 template <typename Types>
struct SingleSubstFormat2_4
{ {
protected: protected:
HBUINT16 format; /* Format identifier--format = 2 */ HBUINT16 format; /* Format identifier--format = 2 */
Offset16To<Coverage> typename Types::template OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from coverage; /* Offset to Coverage table--from
* beginning of Substitution table */ * beginning of Substitution table */
Array16Of<HBGlyphID16> Array16Of<typename Types::HBGlyphID>
substitute; /* Array of substitute substitute; /* Array of substitute
* GlyphIDs--ordered by Coverage Index */ * GlyphIDs--ordered by Coverage Index */
public: public:
DEFINE_SIZE_ARRAY (6, substitute); DEFINE_SIZE_ARRAY (4 + Types::size, substitute);
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {