From bf2ae3f0ca19c0e18741c39ca19fc2a88d2e972b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 16 Dec 2022 11:26:24 -0700 Subject: [PATCH] [open-type] Add static_assert for NO_VARIATION --- src/hb-open-type.hh | 1 + src/hb-ot-color-colr-table.hh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index d15f20a23..4ff69c7a3 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -212,6 +212,7 @@ typedef Index NameID; struct VarIdx : HBUINT32 { static constexpr unsigned NO_VARIATION = 0xFFFFFFFFu; + static_assert (NO_VARIATION == HB_OT_LAYOUT_NO_VARIATIONS_INDEX, ""); VarIdx& operator = (uint32_t i) { HBUINT32::operator= (i); return *this; } }; DECLARE_NULL_NAMESPACE_BYTES (OT, VarIdx); diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index db56674f6..43f17c01a 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -940,7 +940,7 @@ struct ClipBox int ymin = u.format1.yMin; int xmax = u.format1.xMax; int ymax = u.format1.yMax; - if (u.format == 2 && instancer && u.format2.varIdxBase != HB_OT_LAYOUT_NO_VARIATIONS_INDEX) + if (u.format == 2 && instancer && u.format2.varIdxBase != VarIdx::NO_VARIATION) { uint32_t varIdx = u.format2.varIdxBase; xmin += _hb_roundf (instancer (varIdx+0));