[aat] Further improvements on feat (#948)

This commit is contained in:
Ebrahim Byagowi 2018-04-01 12:16:42 +04:30 committed by GitHub
parent 93dad9ade7
commit d3984b45b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 27 deletions

View File

@ -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 \

View File

@ -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<UnsizedArrayOf<SettingName> >
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 */

View File

@ -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.