From d3984b45b5d110f34febbb9e1d8a9c2203080a1b Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sun, 1 Apr 2018 12:16:42 +0430 Subject: [PATCH] [aat] Further improvements on feat (#948) --- src/Makefile.sources | 2 +- ...t-table.hh => hb-aat-layout-feat-table.hh} | 48 +++++++++---------- src/hb-aat-layout.cc | 2 +- 3 files changed, 25 insertions(+), 27 deletions(-) rename src/{hb-aat-feat-table.hh => hb-aat-layout-feat-table.hh} (81%) diff --git a/src/Makefile.sources b/src/Makefile.sources index dc105e586..1ed64fec6 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -83,11 +83,11 @@ HB_OT_sources = \ hb-aat-layout-common-private.hh \ hb-aat-layout-ankr-table.hh \ hb-aat-layout-bsln-table.hh \ + hb-aat-layout-feat-table.hh \ hb-aat-layout-kerx-table.hh \ hb-aat-layout-morx-table.hh \ hb-aat-layout-trak-table.hh \ hb-aat-layout-private.hh \ - hb-aat-feat-table.hh \ hb-aat-fmtx-table.hh \ hb-aat-gcid-table.hh \ hb-aat-ltag-table.hh \ diff --git a/src/hb-aat-feat-table.hh b/src/hb-aat-layout-feat-table.hh similarity index 81% rename from src/hb-aat-feat-table.hh rename to src/hb-aat-layout-feat-table.hh index 15f9060ef..63355470b 100644 --- a/src/hb-aat-feat-table.hh +++ b/src/hb-aat-layout-feat-table.hh @@ -22,8 +22,8 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -#ifndef HB_AAT_FEAT_TABLE_HH -#define HB_AAT_FEAT_TABLE_HH +#ifndef HB_AAT_LAYOUT_FEAT_TABLE_HH +#define HB_AAT_LAYOUT_FEAT_TABLE_HH #include "hb-aat-layout-common-private.hh" @@ -32,13 +32,28 @@ namespace AAT { -struct FeatureName { +struct SettingName +{ + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + } + protected: + HBUINT16 setting; /* The setting. */ + NameID nameIndex; /* The name table index for the setting's name. */ + public: + DEFINE_SIZE_STATIC (4); +}; + +struct FeatureName +{ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const { TRACE_SANITIZE (this); return_trace (c->check_struct (this) && - (base+settingTable).sanitize (c, nSettings, base)); + (base+settingTable).sanitize (c, nSettings)); } enum { @@ -55,28 +70,11 @@ struct FeatureName { * as the default. */ }; - struct SettingName - { - inline bool sanitize (hb_sanitize_context_t *c, const void *base HB_UNUSED) const - { - TRACE_SANITIZE (this); - return_trace (c->check_struct (this) && - nameIndex > 255 && nameIndex < 32768); - } - - protected: - HBUINT16 setting; /* The setting. */ - NameID nameIndex; /* The name table index for the setting's name. - * The nameIndex must be greater than 255 and less than 32768. */ - public: - DEFINE_SIZE_STATIC (4); - }; - protected: HBUINT16 feature; /* Feature type. */ HBUINT16 nSettings; /* The number of records in the setting name array. */ LOffsetTo > - settingTable; /* Offset in bytes from the beginning of this table to + settingTable; /* Offset in bytes from the beginning of this table to * this feature's setting name array. The actual type of * record this offset refers to will depend on the * exclusivity value, as described below. */ @@ -90,7 +88,7 @@ struct FeatureName { /* * feat -- Feature name - * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fmtx.html + * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6feat.html */ struct feat @@ -101,7 +99,7 @@ struct feat { TRACE_SANITIZE (this); return_trace (c->check_struct (this) && - names.sanitize (c, featureNameCount, this)); + names.sanitize (c, featureNameCount, this)); } protected: @@ -119,4 +117,4 @@ struct feat } /* namespace AAT */ -#endif /* HB_AAT_FEAT_TABLE_HH */ +#endif /* HB_AAT_LAYOUT_FEAT_TABLE_HH */ diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index c55b9b689..ad8584955 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -32,10 +32,10 @@ #include "hb-aat-layout-private.hh" #include "hb-aat-layout-ankr-table.hh" #include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise. +#include "hb-aat-layout-feat-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-layout-kerx-table.hh" #include "hb-aat-layout-morx-table.hh" #include "hb-aat-layout-trak-table.hh" -#include "hb-aat-feat-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-fmtx-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-gcid-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-ltag-table.hh" // Just so we compile it; unused otherwise.