[Glyph] Minor change type of type to enum type

Say that thrice.
This commit is contained in:
Behdad Esfahbod 2023-04-20 13:59:49 -06:00
parent 317e3693da
commit a2e8ecf996
1 changed files with 21 additions and 9 deletions

View File

@ -46,8 +46,10 @@ struct Glyph
const hb_bytes_t trim_padding () const const hb_bytes_t trim_padding () const
{ {
switch (type) { switch (type) {
case VAR_COMPOSITE: return bytes; // TODO
case COMPOSITE: return CompositeGlyph (*header, bytes).trim_padding (); case COMPOSITE: return CompositeGlyph (*header, bytes).trim_padding ();
case SIMPLE: return SimpleGlyph (*header, bytes).trim_padding (); case SIMPLE: return SimpleGlyph (*header, bytes).trim_padding ();
case EMPTY: return bytes;
default: return bytes; default: return bytes;
} }
} }
@ -55,27 +57,30 @@ struct Glyph
void drop_hints () void drop_hints ()
{ {
switch (type) { switch (type) {
case VAR_COMPOSITE: return;
case COMPOSITE: CompositeGlyph (*header, bytes).drop_hints (); return; case COMPOSITE: CompositeGlyph (*header, bytes).drop_hints (); return;
case SIMPLE: SimpleGlyph (*header, bytes).drop_hints (); return; case SIMPLE: SimpleGlyph (*header, bytes).drop_hints (); return;
default: return; case EMPTY: return;
} }
} }
void set_overlaps_flag () void set_overlaps_flag ()
{ {
switch (type) { switch (type) {
case VAR_COMPOSITE: return;
case COMPOSITE: CompositeGlyph (*header, bytes).set_overlaps_flag (); return; case COMPOSITE: CompositeGlyph (*header, bytes).set_overlaps_flag (); return;
case SIMPLE: SimpleGlyph (*header, bytes).set_overlaps_flag (); return; case SIMPLE: SimpleGlyph (*header, bytes).set_overlaps_flag (); return;
default: return; case EMPTY: return;
} }
} }
void drop_hints_bytes (hb_bytes_t &dest_start, hb_bytes_t &dest_end) const void drop_hints_bytes (hb_bytes_t &dest_start, hb_bytes_t &dest_end) const
{ {
switch (type) { switch (type) {
case VAR_COMPOSITE: return;
case COMPOSITE: CompositeGlyph (*header, bytes).drop_hints_bytes (dest_start); return; case COMPOSITE: CompositeGlyph (*header, bytes).drop_hints_bytes (dest_start); return;
case SIMPLE: SimpleGlyph (*header, bytes).drop_hints_bytes (dest_start, dest_end); return; case SIMPLE: SimpleGlyph (*header, bytes).drop_hints_bytes (dest_start, dest_end); return;
default: return; case EMPTY: return;
} }
} }
@ -209,8 +214,14 @@ struct Glyph
} }
//dont compile bytes when pinned at default, just recalculate bounds //dont compile bytes when pinned at default, just recalculate bounds
if (!plan->pinned_at_default) { if (!plan->pinned_at_default)
switch (type) { {
switch (type)
{
case VAR_COMPOSITE:
// TODO
return false;
case COMPOSITE: case COMPOSITE:
if (!CompositeGlyph (*header, bytes).compile_bytes_with_deltas (dest_start, if (!CompositeGlyph (*header, bytes).compile_bytes_with_deltas (dest_start,
deltas, deltas,
@ -223,7 +234,7 @@ struct Glyph
dest_end)) dest_end))
return false; return false;
break; break;
default: case EMPTY:
/* set empty bytes for empty glyph /* set empty bytes for empty glyph
* do not use source glyph's pointers */ * do not use source glyph's pointers */
dest_start = hb_bytes_t (); dest_start = hb_bytes_t ();
@ -299,7 +310,7 @@ struct Glyph
if (unlikely (!item.get_points (points))) return false; if (unlikely (!item.get_points (points))) return false;
} }
#endif #endif
default: case EMPTY:
break; break;
} }
@ -477,7 +488,7 @@ struct Glyph
all_points.extend (phantoms); all_points.extend (phantoms);
} break; } break;
#endif #endif
default: case EMPTY:
all_points.extend (phantoms); all_points.extend (phantoms);
break; break;
} }
@ -503,6 +514,7 @@ struct Glyph
} }
hb_bytes_t get_bytes () const { return bytes; } hb_bytes_t get_bytes () const { return bytes; }
glyph_type_t get_type () const { return type; }
Glyph () : bytes (), Glyph () : bytes (),
header (bytes.as<GlyphHeader> ()), header (bytes.as<GlyphHeader> ()),
@ -526,7 +538,7 @@ struct Glyph
hb_bytes_t bytes; hb_bytes_t bytes;
const GlyphHeader *header; const GlyphHeader *header;
hb_codepoint_t gid; hb_codepoint_t gid;
unsigned type; glyph_type_t type;
}; };