未验证 提交 d3984b45 编写于 作者: E Ebrahim Byagowi 提交者: GitHub

[aat] Further improvements on feat (#948)

上级 93dad9ad
......@@ -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 \
......
......@@ -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 */
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册