[config/avar2] add HB_NO_VARIATIONS2

This commit is contained in:
Behdad Esfahbod 2022-07-22 22:38:08 -06:00
parent 5a9c7930ef
commit 17863bd16b
2 changed files with 12 additions and 3 deletions

View File

@ -100,6 +100,7 @@
#ifdef HB_NO_BORING_EXPANSION #ifdef HB_NO_BORING_EXPANSION
#define HB_NO_BEYOND_64K #define HB_NO_BEYOND_64K
#define HB_NO_VARIATIONS2
#endif #endif
#ifdef HB_DISABLE_DEPRECATED #ifdef HB_DISABLE_DEPRECATED

View File

@ -141,9 +141,13 @@ struct avar
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!(version.sanitize (c) && if (!(version.sanitize (c) &&
(version.major == 1 || version.major == 2) && (version.major == 1
c->check_struct (this)))) #ifndef HB_NO_VARIATIONS2
|| version.major == 2
#endif
) &&
c->check_struct (this)))
return_trace (false); return_trace (false);
const SegmentMaps *map = &firstAxisSegmentMaps; const SegmentMaps *map = &firstAxisSegmentMaps;
@ -155,12 +159,14 @@ struct avar
map = &StructAfter<SegmentMaps> (*map); map = &StructAfter<SegmentMaps> (*map);
} }
#ifndef HB_NO_VARIATIONS2
if (version.major == 2) if (version.major == 2)
{ {
const auto *v2 = (const avarV2Tail *) map; const auto *v2 = (const avarV2Tail *) map;
if (unlikely (!v2->sanitize (c, this))) if (unlikely (!v2->sanitize (c, this)))
return_trace (false); return_trace (false);
} }
#endif
return_trace (true); return_trace (true);
} }
@ -176,6 +182,7 @@ struct avar
map = &StructAfter<SegmentMaps> (*map); map = &StructAfter<SegmentMaps> (*map);
} }
#ifndef HB_NO_VARIATIONS2
if (version.major < 2) if (version.major < 2)
return; return;
@ -201,6 +208,7 @@ struct avar
for (unsigned i = 0; i < coords_length; i++) for (unsigned i = 0; i < coords_length; i++)
coords[i] = out[i]; coords[i] = out[i];
#endif
} }
void unmap_coords (int *coords, unsigned int coords_length) const void unmap_coords (int *coords, unsigned int coords_length) const