Wrap formats in struct

Part of https://github.com/harfbuzz/harfbuzz/issues/5601

This was done automatically using codex, the ChatGPT coding
agent.
This commit is contained in:
Behdad Esfahbod committed 2025-11-11 12:29:06 -07:00
1 parent 2bcce37ffd
commit 346b8dcf93
24 files changed
+200 -200

No files matched your search

+11 -11
View File
@@ -1613,7 +1613,7 @@ struct ClipBox
const ItemVarStoreInstancer &instancer) const
{
TRACE_SUBSET (this);
switch (u.format) {
switch (u.format.v) {
case 1: return_trace (u.format1.subset (c, instancer, VarIdx::NO_VARIATION));
case 2: return_trace (u.format2.subset (c, instancer));
default:return_trace (c->default_return_value ());
@@ -1622,7 +1622,7 @@ struct ClipBox
void closurev1 (hb_colrv1_closure_context_t* c) const
{
switch (u.format) {
switch (u.format.v) {
case 2: u.format2.closurev1 (c); return;
default:return;
}
@@ -1631,9 +1631,9 @@ struct ClipBox
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
@@ -1644,7 +1644,7 @@ struct ClipBox
const ItemVarStoreInstancer &instancer) const
{
ClipBoxData clip_box;
switch (u.format) {
switch (u.format.v) {
case 1:
u.format1.get_clip_box (clip_box, instancer);
break;
@@ -1664,7 +1664,7 @@ struct ClipBox
protected:
union {
HBUINT8 format; /* Format identifier */
struct { HBUINT8 v; } format; /* Format identifier */
ClipBoxFormat1 format1;
ClipBoxFormat2 format2;
} u;
@@ -1844,9 +1844,9 @@ struct Paint
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.paintformat1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.paintformat2, std::forward<Ts> (ds)...));
case 3: return_trace (c->dispatch (u.paintformat3, std::forward<Ts> (ds)...));
@@ -1885,7 +1885,7 @@ struct Paint
protected:
union {
HBUINT8 format;
struct { HBUINT8 v; } format;
PaintColrLayers paintformat1;
NoVariable<PaintSolid> paintformat2;
Variable<PaintSolid> paintformat3;
+17 -17
View File
@@ -252,7 +252,7 @@ struct CaretValue
hb_codepoint_t glyph_id,
const ItemVariationStore &var_store) const
{
switch (u.format) {
switch (u.format.v) {
case 1: return u.format1.get_caret_value (font, direction);
case 2: return u.format2.get_caret_value (font, direction, glyph_id);
case 3: return u.format3.get_caret_value (font, direction, var_store);
@@ -263,9 +263,9 @@ struct CaretValue
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
@@ -275,7 +275,7 @@ struct CaretValue
void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
{
switch (u.format) {
switch (u.format.v) {
case 1:
case 2:
return;
@@ -289,9 +289,9 @@ struct CaretValue
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 1: return_trace (u.format1.sanitize (c));
case 2: return_trace (u.format2.sanitize (c));
case 3: return_trace (u.format3.sanitize (c));
@@ -301,13 +301,13 @@ struct CaretValue
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
CaretValueFormat1 format1;
CaretValueFormat2 format2;
CaretValueFormat3 format3;
} u;
public:
DEFINE_SIZE_UNION (2, format);
DEFINE_SIZE_UNION (2, format.v);
};
struct LigGlyph
@@ -519,7 +519,7 @@ struct MarkGlyphSets
{
bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
{
switch (u.format) {
switch (u.format.v) {
case 1: return u.format1.covers (set_index, glyph_id);
default:return false;
}
@@ -528,7 +528,7 @@ struct MarkGlyphSets
template <typename set_t>
void collect_coverage (hb_vector_t<set_t> &sets) const
{
switch (u.format) {
switch (u.format.v) {
case 1: u.format1.collect_coverage (sets); return;
default:return;
}
@@ -537,7 +537,7 @@ struct MarkGlyphSets
void collect_used_mark_sets (const hb_set_t& glyph_set,
hb_set_t& used_mark_sets /* OUT */) const
{
switch (u.format) {
switch (u.format.v) {
case 1: u.format1.collect_used_mark_sets (glyph_set, used_mark_sets); return;
default:return;
}
@@ -546,7 +546,7 @@ struct MarkGlyphSets
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
switch (u.format) {
switch (u.format.v) {
case 1: return_trace (u.format1.subset (c));
default:return_trace (false);
}
@@ -555,9 +555,9 @@ struct MarkGlyphSets
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 1: return_trace (u.format1.sanitize (c));
default:return_trace (true);
}
@@ -565,11 +565,11 @@ struct MarkGlyphSets
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
MarkGlyphSetsFormat1 format1;
} u;
public:
DEFINE_SIZE_UNION (2, format);
DEFINE_SIZE_UNION (2, format.v);
};
+7 -7
View File
@@ -13,20 +13,20 @@ struct Anchor
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
AnchorFormat1 format1;
AnchorFormat2 format2;
AnchorFormat3 format3;
} u;
public:
DEFINE_SIZE_UNION (2, format);
DEFINE_SIZE_UNION (2, format.v);
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 1: return_trace (u.format1.sanitize (c));
case 2: return_trace (u.format2.sanitize (c));
case 3: return_trace (u.format3.sanitize (c));
@@ -38,7 +38,7 @@ struct Anchor
float *x, float *y) const
{
*x = *y = 0;
switch (u.format) {
switch (u.format.v) {
case 1: u.format1.get_anchor (c, glyph_id, x, y); return;
case 2: u.format2.get_anchor (c, glyph_id, x, y); return;
case 3: u.format3.get_anchor (c, glyph_id, x, y); return;
@@ -49,7 +49,7 @@ struct Anchor
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
switch (u.format) {
switch (u.format.v) {
case 1: return_trace (bool (reinterpret_cast<Anchor *> (u.format1.copy (c->serializer))));
case 2:
if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
@@ -66,7 +66,7 @@ struct Anchor
void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
{
switch (u.format) {
switch (u.format.v) {
case 1: case 2:
return;
case 3:
+4 -4
View File
@@ -11,7 +11,7 @@ struct CursivePos
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
CursivePosFormat1 format1;
} u;
@@ -19,9 +19,9 @@ struct CursivePos
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
}
+4 -4
View File
@@ -11,7 +11,7 @@ struct MarkBasePos
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
MarkBasePosFormat1_2<SmallTypes> format1;
#ifndef HB_NO_BEYOND_64K
MarkBasePosFormat1_2<MediumTypes> format2;
@@ -22,9 +22,9 @@ struct MarkBasePos
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
+4 -4
View File
@@ -11,7 +11,7 @@ struct MarkLigPos
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
MarkLigPosFormat1_2<SmallTypes> format1;
#ifndef HB_NO_BEYOND_64K
MarkLigPosFormat1_2<MediumTypes> format2;
@@ -22,9 +22,9 @@ struct MarkLigPos
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
+4 -4
View File
@@ -11,7 +11,7 @@ struct MarkMarkPos
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
MarkMarkPosFormat1_2<SmallTypes> format1;
#ifndef HB_NO_BEYOND_64K
MarkMarkPosFormat1_2<MediumTypes> format2;
@@ -22,9 +22,9 @@ struct MarkMarkPos
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
+4 -4
View File
@@ -12,7 +12,7 @@ struct PairPos
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
PairPosFormat1_3<SmallTypes> format1;
PairPosFormat2_4<SmallTypes> format2;
#ifndef HB_NO_BEYOND_64K
@@ -25,9 +25,9 @@ struct PairPos
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
+7 -7
View File
@@ -12,7 +12,7 @@ struct SinglePos
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
SinglePosFormat1 format1;
SinglePosFormat2 format2;
} u;
@@ -41,7 +41,7 @@ struct SinglePos
const hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> *layout_variation_idx_delta_map,
unsigned newFormat)
{
if (unlikely (!c->extend_min (u.format))) return;
if (unlikely (!c->extend_min (u.format.v))) return;
unsigned format = 2;
ValueFormat new_format;
new_format = newFormat;
@@ -49,8 +49,8 @@ struct SinglePos
if (glyph_val_iter_pairs)
format = get_format (glyph_val_iter_pairs);
u.format = format;
switch (u.format) {
u.format.v = format;
switch (u.format.v) {
case 1: u.format1.serialize (c,
src,
glyph_val_iter_pairs,
@@ -70,9 +70,9 @@ struct SinglePos
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
+7 -7
View File
@@ -12,7 +12,7 @@ struct AlternateSubst
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
AlternateSubstFormat1_2<SmallTypes> format1;
#ifndef HB_NO_BEYOND_64K
AlternateSubstFormat1_2<MediumTypes> format2;
@@ -23,9 +23,9 @@ struct AlternateSubst
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
@@ -42,10 +42,10 @@ struct AlternateSubst
hb_array_t<const HBGlyphID16> alternate_glyphs_list)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
if (unlikely (!c->extend_min (u.format.v))) return_trace (false);
unsigned int format = 1;
u.format = format;
switch (u.format) {
u.format.v = format;
switch (u.format.v) {
case 1: return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list));
default:return_trace (false);
}
+7 -7
View File
@@ -12,7 +12,7 @@ struct LigatureSubst
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
LigatureSubstFormat1_2<SmallTypes> format1;
#ifndef HB_NO_BEYOND_64K
LigatureSubstFormat1_2<MediumTypes> format2;
@@ -23,9 +23,9 @@ struct LigatureSubst
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
@@ -45,10 +45,10 @@ struct LigatureSubst
hb_array_t<const HBGlyphID16> component_list /* Starting from second for each ligature */)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
if (unlikely (!c->extend_min (u.format.v))) return_trace (false);
unsigned int format = 1;
u.format = format;
switch (u.format) {
u.format.v = format;
switch (u.format.v) {
case 1: return_trace (u.format1.serialize (c,
first_glyphs,
ligature_per_first_glyph_count_list,
+7 -7
View File
@@ -12,7 +12,7 @@ struct MultipleSubst
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
MultipleSubstFormat1_2<SmallTypes> format1;
#ifndef HB_NO_BEYOND_64K
MultipleSubstFormat1_2<MediumTypes> format2;
@@ -24,9 +24,9 @@ struct MultipleSubst
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
@@ -41,10 +41,10 @@ struct MultipleSubst
Iterator it)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
if (unlikely (!c->extend_min (u.format.v))) return_trace (false);
unsigned int format = 1;
u.format = format;
switch (u.format) {
u.format.v = format;
switch (u.format.v) {
case 1: return_trace (u.format1.serialize (c, it));
default:return_trace (false);
}
@@ -12,7 +12,7 @@ struct ReverseChainSingleSubst
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
ReverseChainSingleSubstFormat1 format1;
} u;
@@ -20,9 +20,9 @@ struct ReverseChainSingleSubst
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
}
+7 -7
View File
@@ -13,7 +13,7 @@ struct SingleSubst
{
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
SingleSubstFormat1_3<SmallTypes> format1;
SingleSubstFormat2_4<SmallTypes> format2;
#ifndef HB_NO_BEYOND_64K
@@ -27,9 +27,9 @@ struct SingleSubst
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
@@ -47,7 +47,7 @@ struct SingleSubst
Iterator glyphs)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false);
if (unlikely (!c->extend_min (u.format.v))) return_trace (false);
unsigned format = 2;
unsigned delta = 0;
if (glyphs)
@@ -71,8 +71,8 @@ struct SingleSubst
if (!hb_all (++(+glyphs), delta, get_delta)) format += 1;
}
u.format = format;
switch (u.format) {
u.format.v = format;
switch (u.format.v) {
case 1: return_trace (u.format1.serialize (c,
+ glyphs
| hb_map_retains_sorting (hb_first),
+1 -1
View File
@@ -117,7 +117,7 @@ struct ClassDef : public OT::ClassDef
int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
if (vertex_len < OT::ClassDef::min_size) return false;
hb_barrier ();
switch (u.format)
switch (u.format.v)
{
case 1: return ((ClassDefFormat1*)this)->sanitize (vertex);
case 2: return ((ClassDefFormat2*)this)->sanitize (vertex);
+3 -3
View File
@@ -471,7 +471,7 @@ struct LigatureSubst : public OT::Layout::GSUB_impl::LigatureSubst
unsigned parent_index,
unsigned this_index)
{
switch (u.format) {
switch (u.format.v) {
case 1:
return ((LigatureSubstFormat1*)(&u.format1))->split_subtables (c, parent_index, this_index);
#ifndef HB_NO_BEYOND_64K
@@ -486,10 +486,10 @@ struct LigatureSubst : public OT::Layout::GSUB_impl::LigatureSubst
bool sanitize (graph_t::vertex_t& vertex) const
{
int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
if (vertex_len < u.format.get_size ()) return false;
if (vertex_len < u.format.v.get_size ()) return false;
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 1:
return ((LigatureSubstFormat1*)(&u.format1))->sanitize (vertex);
#ifndef HB_NO_BEYOND_64K
+3 -3
View File
@@ -481,7 +481,7 @@ struct MarkBasePos : public OT::Layout::GPOS_impl::MarkBasePos
unsigned parent_index,
unsigned this_index)
{
switch (u.format) {
switch (u.format.v) {
case 1:
return ((MarkBasePosFormat1*)(&u.format1))->split_subtables (c, parent_index, this_index);
#ifndef HB_NO_BEYOND_64K
@@ -496,10 +496,10 @@ struct MarkBasePos : public OT::Layout::GPOS_impl::MarkBasePos
bool sanitize (graph_t::vertex_t& vertex) const
{
int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
if (vertex_len < u.format.get_size ()) return false;
if (vertex_len < u.format.v.get_size ()) return false;
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 1:
return ((MarkBasePosFormat1*)(&u.format1))->sanitize (vertex);
#ifndef HB_NO_BEYOND_64K
+3 -3
View File
@@ -610,7 +610,7 @@ struct PairPos : public OT::Layout::GPOS_impl::PairPos
unsigned parent_index,
unsigned this_index)
{
switch (u.format) {
switch (u.format.v) {
case 1:
return ((PairPosFormat1*)(&u.format1))->split_subtables (c, parent_index, this_index);
case 2:
@@ -628,10 +628,10 @@ struct PairPos : public OT::Layout::GPOS_impl::PairPos
bool sanitize (graph_t::vertex_t& vertex) const
{
int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
if (vertex_len < u.format.get_size ()) return false;
if (vertex_len < u.format.v.get_size ()) return false;
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 1:
return ((PairPosFormat1*)(&u.format1))->sanitize (vertex);
case 2:
+10 -10
View File
@@ -692,7 +692,7 @@ struct Lookup
{
const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return u.format0.get_value (glyph_id, num_glyphs);
case 2: hb_barrier (); return u.format2.get_value (glyph_id);
case 4: hb_barrier (); return u.format4.get_value (glyph_id);
@@ -704,7 +704,7 @@ struct Lookup
const typename T::type get_value_or_null (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
{
switch (u.format) {
switch (u.format.v) {
/* Format 10 cannot return a pointer. */
case 10: hb_barrier (); return u.format10.get_value_or_null (glyph_id);
default:
@@ -716,7 +716,7 @@ struct Lookup
template <typename set_t>
void collect_glyphs (set_t &glyphs, unsigned int num_glyphs) const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); u.format0.collect_glyphs (glyphs, num_glyphs); return;
case 2: hb_barrier (); u.format2.collect_glyphs (glyphs); return;
case 4: hb_barrier (); u.format4.collect_glyphs (glyphs); return;
@@ -729,7 +729,7 @@ struct Lookup
template <typename set_t, typename filter_t>
void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); u.format0.collect_glyphs_filtered (glyphs, num_glyphs, filter); return;
case 2: hb_barrier (); u.format2.collect_glyphs_filtered (glyphs, filter); return;
case 4: hb_barrier (); u.format4.collect_glyphs_filtered (glyphs, filter); return;
@@ -751,9 +751,9 @@ struct Lookup
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return_trace (u.format0.sanitize (c));
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
@@ -766,9 +766,9 @@ struct Lookup
bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return_trace (u.format0.sanitize (c, base));
case 2: hb_barrier (); return_trace (u.format2.sanitize (c, base));
case 4: hb_barrier (); return_trace (u.format4.sanitize (c, base));
@@ -781,7 +781,7 @@ struct Lookup
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
LookupFormat0<T> format0;
LookupFormat2<T> format2;
LookupFormat4<T> format4;
@@ -790,7 +790,7 @@ struct Lookup
LookupFormat10<T> format10;
} u;
public:
DEFINE_SIZE_UNION (2, format);
DEFINE_SIZE_UNION (2, format.v);
};
DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 2);
+14 -14
View File
@@ -1487,7 +1487,7 @@ struct CmapSubtable
bool get_glyph (hb_codepoint_t codepoint,
hb_codepoint_t *glyph) const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return u.format0 .get_glyph (codepoint, glyph);
case 4: hb_barrier (); return u.format4 .get_glyph (codepoint, glyph);
case 6: hb_barrier (); return u.format6 .get_glyph (codepoint, glyph);
@@ -1500,7 +1500,7 @@ struct CmapSubtable
}
void collect_unicodes (hb_set_t *out, unsigned int num_glyphs = UINT_MAX) const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); u.format0 .collect_unicodes (out); return;
case 4: hb_barrier (); u.format4 .collect_unicodes (out); return;
case 6: hb_barrier (); u.format6 .collect_unicodes (out); return;
@@ -1516,7 +1516,7 @@ struct CmapSubtable
hb_map_t *mapping, /* OUT */
unsigned num_glyphs = UINT_MAX) const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); u.format0 .collect_mapping (unicodes, mapping); return;
case 4: hb_barrier (); u.format4 .collect_mapping (unicodes, mapping); return;
case 6: hb_barrier (); u.format6 .collect_mapping (unicodes, mapping); return;
@@ -1530,7 +1530,7 @@ struct CmapSubtable
unsigned get_language () const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return u.format0 .get_language ();
case 4: hb_barrier (); return u.format4 .get_language ();
case 6: hb_barrier (); return u.format6 .get_language ();
@@ -1561,9 +1561,9 @@ struct CmapSubtable
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return_trace (u.format0 .sanitize (c));
case 4: hb_barrier (); return_trace (u.format4 .sanitize (c));
case 6: hb_barrier (); return_trace (u.format6 .sanitize (c));
@@ -1577,7 +1577,7 @@ struct CmapSubtable
public:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
CmapSubtableFormat0 format0;
CmapSubtableFormat4 format4;
CmapSubtableFormat6 format6;
@@ -1587,7 +1587,7 @@ struct CmapSubtable
CmapSubtableFormat14 format14;
} u;
public:
DEFINE_SIZE_UNION (2, format);
DEFINE_SIZE_UNION (2, format.v);
};
@@ -1797,7 +1797,7 @@ struct cmap
if (c->in_error ())
return false;
unsigned format = (base+_.subtable).u.format;
unsigned format = (base+_.subtable).u.format.v;
if (format != 4 && format != 12 && format != 14) continue;
const hb_set_t* unicodes_set = unicodes_cache->set_for (&_, local_unicodes_cache);
@@ -1899,7 +1899,7 @@ struct cmap
+ hb_iter (encodingRecord)
| hb_map (&EncodingRecord::subtable)
| hb_map (hb_add (this))
| hb_filter ([&] (const CmapSubtable& _) { return _.u.format == 14; })
| hb_filter ([&] (const CmapSubtable& _) { return _.u.format.v == 14; })
| hb_apply ([=] (const CmapSubtable& _) { _.u.format14.closure_glyphs (unicodes, glyphset); })
;
}
@@ -1924,7 +1924,7 @@ struct cmap
for (const EncodingRecord& _ : encodingrec_iter)
{
unsigned format = (this + _.subtable).u.format;
unsigned format = (this + _.subtable).u.format.v;
if (format == 12) has_format12 = true;
const EncodingRecord *table = std::addressof (_);
@@ -2012,7 +2012,7 @@ struct cmap
this->subtable_uvs = &Null (CmapSubtableFormat14);
{
const CmapSubtable *st = table->find_subtable (0, 5);
if (st && st->u.format == 14)
if (st && st->u.format.v == 14)
subtable_uvs = &st->u.format14;
}
@@ -2056,7 +2056,7 @@ struct cmap
else
#endif
{
switch (subtable->u.format) {
switch (subtable->u.format.v) {
/* Accelerate format 4 and format 12. */
default:
this->get_glyph_funcZ = get_glyph_from<CmapSubtable>;
@@ -2263,7 +2263,7 @@ struct cmap
(_.platformID == 0 && _.encodingID == 4) ||
(_.platformID == 3 && _.encodingID == 1) ||
(_.platformID == 3 && _.encodingID == 10) ||
(cmap + _.subtable).u.format == 14;
(cmap + _.subtable).u.format.v == 14;
}
protected:
+10 -10
View File
@@ -165,13 +165,13 @@ struct BaseCoordFormat3
struct BaseCoord
{
bool has_data () const { return u.format; }
bool has_data () const { return u.format.v; }
hb_position_t get_coord (hb_font_t *font,
const ItemVariationStore &var_store,
hb_direction_t direction) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.get_coord (font, direction);
case 2: hb_barrier (); return u.format2.get_coord (font, direction);
case 3: hb_barrier (); return u.format3.get_coord (font, var_store, direction);
@@ -181,7 +181,7 @@ struct BaseCoord
void collect_variation_indices (hb_set_t& varidx_set /* OUT */) const
{
switch (u.format) {
switch (u.format.v) {
case 3: hb_barrier (); u.format3.collect_variation_indices (varidx_set); return;
default:return;
}
@@ -190,9 +190,9 @@ struct BaseCoord
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
@@ -203,9 +203,9 @@ struct BaseCoord
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (unlikely (!u.format.sanitize (c))) return_trace (false);
if (unlikely (!u.format.v.sanitize (c))) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
@@ -215,13 +215,13 @@ struct BaseCoord
protected:
union {
HBUINT16 format;
struct { HBUINT16 v; } format;
BaseCoordFormat1 format1;
BaseCoordFormat2 format2;
BaseCoordFormat3 format3;
} u;
public:
DEFINE_SIZE_UNION (2, format);
DEFINE_SIZE_UNION (2, format.v);
};
struct FeatMinMaxRecord
+37 -37
View File
@@ -2031,7 +2031,7 @@ struct ClassDef
unsigned int get (hb_codepoint_t k) const { return get_class (k); }
unsigned int get_class (hb_codepoint_t glyph_id) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.get_class (glyph_id);
case 2: hb_barrier (); return u.format2.get_class (glyph_id);
#ifndef HB_NO_BEYOND_64K
@@ -2053,7 +2053,7 @@ struct ClassDef
unsigned get_population () const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.get_population ();
case 2: hb_barrier (); return u.format2.get_population ();
#ifndef HB_NO_BEYOND_64K
@@ -2106,7 +2106,7 @@ struct ClassDef
#ifndef HB_NO_BEYOND_64K
if (glyph_max > 0xFFFFu)
u.format += 2;
u.format.v += 2;
if (unlikely (glyph_max > 0xFFFFFFu))
#else
if (unlikely (glyph_max > 0xFFFFu))
@@ -2116,9 +2116,9 @@ struct ClassDef
return_trace (false);
}
u.format = format;
u.format.v = format;
switch (u.format)
switch (u.format.v)
{
case 1: hb_barrier (); return_trace (u.format1.serialize (c, it));
case 2: hb_barrier (); return_trace (u.format2.serialize (c, it));
@@ -2137,7 +2137,7 @@ struct ClassDef
const Coverage* glyph_filter = nullptr) const
{
TRACE_SUBSET (this);
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return_trace (u.format1.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
case 2: hb_barrier (); return_trace (u.format2.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
#ifndef HB_NO_BEYOND_64K
@@ -2151,9 +2151,9 @@ struct ClassDef
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
#ifndef HB_NO_BEYOND_64K
@@ -2166,7 +2166,7 @@ struct ClassDef
unsigned cost () const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.cost ();
case 2: hb_barrier (); return u.format2.cost ();
#ifndef HB_NO_BEYOND_64K
@@ -2182,7 +2182,7 @@ struct ClassDef
template <typename set_t>
bool collect_coverage (set_t *glyphs) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.collect_coverage (glyphs);
case 2: hb_barrier (); return u.format2.collect_coverage (glyphs);
#ifndef HB_NO_BEYOND_64K
@@ -2198,7 +2198,7 @@ struct ClassDef
template <typename set_t>
bool collect_class (set_t *glyphs, unsigned int klass) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.collect_class (glyphs, klass);
case 2: hb_barrier (); return u.format2.collect_class (glyphs, klass);
#ifndef HB_NO_BEYOND_64K
@@ -2211,7 +2211,7 @@ struct ClassDef
bool intersects (const hb_set_t *glyphs) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.intersects (glyphs);
case 2: hb_barrier (); return u.format2.intersects (glyphs);
#ifndef HB_NO_BEYOND_64K
@@ -2223,7 +2223,7 @@ struct ClassDef
}
bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.intersects_class (glyphs, klass);
case 2: hb_barrier (); return u.format2.intersects_class (glyphs, klass);
#ifndef HB_NO_BEYOND_64K
@@ -2236,7 +2236,7 @@ struct ClassDef
void intersected_class_glyphs (const hb_set_t *glyphs, unsigned klass, hb_set_t *intersect_glyphs) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
case 2: hb_barrier (); return u.format2.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
#ifndef HB_NO_BEYOND_64K
@@ -2249,7 +2249,7 @@ struct ClassDef
void intersected_classes (const hb_set_t *glyphs, hb_set_t *intersect_classes) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.intersected_classes (glyphs, intersect_classes);
case 2: hb_barrier (); return u.format2.intersected_classes (glyphs, intersect_classes);
#ifndef HB_NO_BEYOND_64K
@@ -2263,7 +2263,7 @@ struct ClassDef
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
ClassDefFormat1_3<SmallTypes> format1;
ClassDefFormat2_4<SmallTypes> format2;
#ifndef HB_NO_BEYOND_64K
@@ -2272,7 +2272,7 @@ struct ClassDef
#endif
} u;
public:
DEFINE_SIZE_UNION (2, format);
DEFINE_SIZE_UNION (2, format.v);
};
template<typename Iterator>
@@ -3719,8 +3719,8 @@ struct DeltaSetIndexMap
{
TRACE_SERIALIZE (this);
unsigned length = plan.get_output_map ().length;
u.format = length <= 0xFFFF ? 0 : 1;
switch (u.format) {
u.format.v = length <= 0xFFFF ? 0 : 1;
switch (u.format.v) {
case 0: hb_barrier (); return_trace (u.format0.serialize (c, plan));
case 1: hb_barrier (); return_trace (u.format1.serialize (c, plan));
default:return_trace (false);
@@ -3729,7 +3729,7 @@ struct DeltaSetIndexMap
uint32_t map (unsigned v) const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return (u.format0.map (v));
case 1: hb_barrier (); return (u.format1.map (v));
default:return v;
@@ -3738,7 +3738,7 @@ struct DeltaSetIndexMap
unsigned get_map_count () const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return u.format0.get_map_count ();
case 1: hb_barrier (); return u.format1.get_map_count ();
default:return 0;
@@ -3747,7 +3747,7 @@ struct DeltaSetIndexMap
unsigned get_width () const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return u.format0.get_width ();
case 1: hb_barrier (); return u.format1.get_width ();
default:return 0;
@@ -3756,7 +3756,7 @@ struct DeltaSetIndexMap
unsigned get_inner_bit_count () const
{
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return u.format0.get_inner_bit_count ();
case 1: hb_barrier (); return u.format1.get_inner_bit_count ();
default:return 0;
@@ -3766,9 +3766,9 @@ struct DeltaSetIndexMap
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return_trace (u.format0.sanitize (c));
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
default:return_trace (true);
@@ -3778,7 +3778,7 @@ struct DeltaSetIndexMap
DeltaSetIndexMap* copy (hb_serialize_context_t *c) const
{
TRACE_SERIALIZE (this);
switch (u.format) {
switch (u.format.v) {
case 0: hb_barrier (); return_trace (reinterpret_cast<DeltaSetIndexMap *> (u.format0.copy (c)));
case 1: hb_barrier (); return_trace (reinterpret_cast<DeltaSetIndexMap *> (u.format1.copy (c)));
default:return_trace (nullptr);
@@ -3787,12 +3787,12 @@ struct DeltaSetIndexMap
protected:
union {
HBUINT8 format; /* Format identifier */
struct { HBUINT8 v; } format; /* Format identifier */
DeltaSetIndexMapFormat01<HBUINT16> format0;
DeltaSetIndexMapFormat01<HBUINT32> format1;
} u;
public:
DEFINE_SIZE_UNION (1, format);
DEFINE_SIZE_UNION (1, format.v);
};
@@ -4195,7 +4195,7 @@ struct Condition
bool evaluate (const int *coords, unsigned int coord_len,
Instancer *instancer) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.evaluate (coords, coord_len, instancer);
case 2: hb_barrier (); return u.format2.evaluate (coords, coord_len, instancer);
case 3: hb_barrier (); return u.format3.evaluate (coords, coord_len, instancer);
@@ -4208,7 +4208,7 @@ struct Condition
Cond_with_Var_flag_t keep_with_variations (hb_collect_feature_substitutes_with_var_context_t *c,
hb_map_t *condition_map /* OUT */) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.keep_with_variations (c, condition_map);
// TODO(subset)
default: c->apply = false; return KEEP_COND_WITH_VAR;
@@ -4218,9 +4218,9 @@ struct Condition
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
@@ -4233,9 +4233,9 @@ struct Condition
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
@@ -4247,7 +4247,7 @@ struct Condition
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
ConditionAxisRange format1;
ConditionValue format2;
ConditionAnd format3;
@@ -4255,7 +4255,7 @@ struct Condition
ConditionNegate format5;
} u;
public:
DEFINE_SIZE_UNION (2, format);
DEFINE_SIZE_UNION (2, format.v);
};
template <typename Instancer>
+15 -15
View File
@@ -2926,9 +2926,9 @@ struct Context
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
@@ -2942,7 +2942,7 @@ struct Context
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
ContextFormat1_4<SmallTypes> format1;
ContextFormat2_5<SmallTypes> format2;
ContextFormat3 format3;
@@ -4227,9 +4227,9 @@ struct ChainContext
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
@@ -4243,7 +4243,7 @@ struct ChainContext
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
ChainContextFormat1_4<SmallTypes> format1;
ChainContextFormat2_5<SmallTypes> format2;
ChainContextFormat3 format3;
@@ -4318,7 +4318,7 @@ struct Extension
{
unsigned int get_type () const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.get_type ();
default:return 0;
}
@@ -4326,7 +4326,7 @@ struct Extension
template <typename X>
const X& get_subtable () const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.template get_subtable<typename T::SubTable> ();
default:return Null (typename T::SubTable);
}
@@ -4338,7 +4338,7 @@ struct Extension
template <typename ...Ts>
typename hb_subset_context_t::return_t dispatch (hb_subset_context_t *c, Ts&&... ds) const
{
switch (u.format) {
switch (u.format.v) {
case 1: hb_barrier (); return u.format1.subset (c);
default: return c->default_return_value ();
}
@@ -4347,9 +4347,9 @@ struct Extension
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: hb_barrier (); return_trace (u.format1.dispatch (c, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
}
@@ -4357,7 +4357,7 @@ struct Extension
protected:
union {
HBUINT16 format; /* Format identifier */
struct { HBUINT16 v; } format; /* Format identifier */
ExtensionFormat1<T> format1;
} u;
};
+10 -10
View File
@@ -352,7 +352,7 @@ struct AxisValue
{
float get_value (unsigned int axis_index) const
{
switch (u.format)
switch (u.format.v)
{
case 1: hb_barrier (); return u.format1.get_value ();
case 2: hb_barrier (); return u.format2.get_value ();
@@ -364,7 +364,7 @@ struct AxisValue
unsigned int get_axis_index () const
{
switch (u.format)
switch (u.format.v)
{
case 1: hb_barrier (); return u.format1.get_axis_index ();
case 2: hb_barrier (); return u.format2.get_axis_index ();
@@ -376,7 +376,7 @@ struct AxisValue
hb_ot_name_id_t get_value_name_id () const
{
switch (u.format)
switch (u.format.v)
{
case 1: hb_barrier (); return u.format1.get_value_name_id ();
case 2: hb_barrier (); return u.format2.get_value_name_id ();
@@ -389,9 +389,9 @@ struct AxisValue
template <typename context_t, typename ...Ts>
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
{
if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format);
switch (u.format) {
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
@@ -403,7 +403,7 @@ struct AxisValue
bool keep_axis_value (const hb_array_t<const StatAxisRecord> axis_records,
hb_hashmap_t<hb_tag_t, Triple> *user_axes_location) const
{
switch (u.format)
switch (u.format.v)
{
case 1: hb_barrier (); return u.format1.keep_axis_value (axis_records, user_axes_location);
case 2: hb_barrier (); return u.format2.keep_axis_value (axis_records, user_axes_location);
@@ -420,7 +420,7 @@ struct AxisValue
return_trace (false);
hb_barrier ();
switch (u.format)
switch (u.format.v)
{
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
@@ -433,14 +433,14 @@ struct AxisValue
protected:
union
{
HBUINT16 format;
struct { HBUINT16 v; } format;
AxisValueFormat1 format1;
AxisValueFormat2 format2;
AxisValueFormat3 format3;
AxisValueFormat4 format4;
} u;
public:
DEFINE_SIZE_UNION (2, format);
DEFINE_SIZE_UNION (2, format.v);
};
struct AxisValueOffsetArray: UnsizedArrayOf<Offset16To<AxisValue>>