[subset] Add maxpV1Tail instead of defining a struct inside maxp for v1 data.
This commit is contained in:
parent
f14d1b64c2
commit
a76344da79
@ -39,6 +39,36 @@ namespace OT {
|
||||
|
||||
#define HB_OT_TAG_maxp HB_TAG('m','a','x','p')
|
||||
|
||||
struct maxpV1Tail
|
||||
{
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
HBUINT16 maxPoints; /* Maximum points in a non-composite glyph. */
|
||||
HBUINT16 maxContours; /* Maximum contours in a non-composite glyph. */
|
||||
HBUINT16 maxCompositePoints; /* Maximum points in a composite glyph. */
|
||||
HBUINT16 maxCompositeContours; /* Maximum contours in a composite glyph. */
|
||||
HBUINT16 maxZones; /* 1 if instructions do not use the twilight zone (Z0),
|
||||
or 2 if instructions do use Z0; should be set to 2 in
|
||||
most cases. */
|
||||
HBUINT16 maxTwilightPoints; /* Maximum points used in Z0. */
|
||||
HBUINT16 maxStorage; /* Number of Storage Area locations. */
|
||||
HBUINT16 maxFunctionDefs; /* Number of FDEFs, equal to the highest function number + 1. */
|
||||
HBUINT16 maxInstructionDefs; /* Number of IDEFs. */
|
||||
HBUINT16 maxStackElements; /* Maximum stack depth. (This includes Font and CVT
|
||||
Programs, as well as the instructions for each glyph.) */
|
||||
HBUINT16 maxSizeOfInstructions; /* Maximum byte count for glyph instructions. */
|
||||
HBUINT16 maxComponentElements; /* Maximum number of components referenced at
|
||||
"top level" for any composite glyph. */
|
||||
HBUINT16 maxComponentDepth; /* Maximum levels of recursion; 1 for simple components. */
|
||||
|
||||
DEFINE_SIZE_STATIC (26);
|
||||
};
|
||||
|
||||
|
||||
struct maxp
|
||||
{
|
||||
static const hb_tag_t tableTag = HB_OT_TAG_maxp;
|
||||
@ -56,9 +86,15 @@ struct maxp
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (c->check_struct (this) &&
|
||||
likely ((version.major == 1 && c->check_range (this, sizeof (maxp))) ||
|
||||
(version.major == 0 && version.minor == 0x5000u)));
|
||||
if (unlikely (!c->check_struct (this)))
|
||||
return_trace (false);
|
||||
|
||||
if (version.major == 1)
|
||||
{
|
||||
const maxpV1Tail &v1 = StructAfter<maxpV1Tail> (*this);
|
||||
return v1.sanitize (c);
|
||||
}
|
||||
return_trace (likely (version.major == 0 && version.minor == 0x5000u));
|
||||
}
|
||||
|
||||
inline bool subset (hb_subset_plan_t *plan) const
|
||||
@ -83,15 +119,16 @@ struct maxp
|
||||
|
||||
static inline void drop_hint_fields (hb_subset_plan_t *plan, OT::maxp *maxp_prime)
|
||||
{
|
||||
maxpV1Tail &v1 = StructAfter<maxpV1Tail> (*maxp_prime);
|
||||
if (maxp_prime->version.major == 1)
|
||||
{
|
||||
maxp_prime->version_1_data.maxZones.set (1);
|
||||
maxp_prime->version_1_data.maxTwilightPoints.set (0);
|
||||
maxp_prime->version_1_data.maxStorage.set (0);
|
||||
maxp_prime->version_1_data.maxFunctionDefs.set (0);
|
||||
maxp_prime->version_1_data.maxInstructionDefs.set (0);
|
||||
maxp_prime->version_1_data.maxStackElements.set (0);
|
||||
maxp_prime->version_1_data.maxSizeOfInstructions.set (0);
|
||||
v1.maxZones.set (1);
|
||||
v1.maxTwilightPoints.set (0);
|
||||
v1.maxStorage.set (0);
|
||||
v1.maxFunctionDefs.set (0);
|
||||
v1.maxInstructionDefs.set (0);
|
||||
v1.maxStackElements.set (0);
|
||||
v1.maxSizeOfInstructions.set (0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,30 +136,10 @@ struct maxp
|
||||
FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0),
|
||||
* 0x00005000u or 0x00010000u. */
|
||||
HBUINT16 numGlyphs; /* The number of glyphs in the font. */
|
||||
|
||||
struct
|
||||
{
|
||||
HBUINT16 maxPoints; /* Maximum points in a non-composite glyph. */
|
||||
HBUINT16 maxContours; /* Maximum contours in a non-composite glyph. */
|
||||
HBUINT16 maxCompositePoints; /* Maximum points in a composite glyph. */
|
||||
HBUINT16 maxCompositeContours; /* Maximum contours in a composite glyph. */
|
||||
HBUINT16 maxZones; /* 1 if instructions do not use the twilight zone (Z0),
|
||||
or 2 if instructions do use Z0; should be set to 2 in
|
||||
most cases. */
|
||||
HBUINT16 maxTwilightPoints; /* Maximum points used in Z0. */
|
||||
HBUINT16 maxStorage; /* Number of Storage Area locations. */
|
||||
HBUINT16 maxFunctionDefs; /* Number of FDEFs, equal to the highest function number + 1. */
|
||||
HBUINT16 maxInstructionDefs; /* Number of IDEFs. */
|
||||
HBUINT16 maxStackElements; /* Maximum stack depth. (This includes Font and CVT
|
||||
Programs, as well as the instructions for each glyph.) */
|
||||
HBUINT16 maxSizeOfInstructions; /* Maximum byte count for glyph instructions. */
|
||||
HBUINT16 maxComponentElements; /* Maximum number of components referenced at
|
||||
"top level" for any composite glyph. */
|
||||
HBUINT16 maxComponentDepth; /* Maximum levels of recursion; 1 for simple components. */
|
||||
} version_1_data;
|
||||
/*maxpV1Tail v1Tail; */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_MIN (6);
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user