提交 dacebcad 编写于 作者: B Behdad Esfahbod

Simplify unions

上级 fd671e02
...@@ -153,7 +153,7 @@ struct TTCHeader ...@@ -153,7 +153,7 @@ struct TTCHeader
{ {
switch (u.header.version) { switch (u.header.version) {
case 2: /* version 2 is compatible with version 1 */ case 2: /* version 2 is compatible with version 1 */
case 1: return u.version1->get_face_count (); case 1: return u.version1.get_face_count ();
default:return 0; default:return 0;
} }
} }
...@@ -161,7 +161,7 @@ struct TTCHeader ...@@ -161,7 +161,7 @@ struct TTCHeader
{ {
switch (u.header.version) { switch (u.header.version) {
case 2: /* version 2 is compatible with version 1 */ case 2: /* version 2 is compatible with version 1 */
case 1: return u.version1->get_face (i); case 1: return u.version1.get_face (i);
default:return Null(OpenTypeFontFace); default:return Null(OpenTypeFontFace);
} }
} }
...@@ -171,7 +171,7 @@ struct TTCHeader ...@@ -171,7 +171,7 @@ struct TTCHeader
if (!u.header.version.sanitize (context)) return false; if (!u.header.version.sanitize (context)) return false;
switch (u.header.version) { switch (u.header.version) {
case 2: /* version 2 is compatible with version 1 */ case 2: /* version 2 is compatible with version 1 */
case 1: return u.version1->sanitize (context); case 1: return u.version1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -183,7 +183,7 @@ struct TTCHeader ...@@ -183,7 +183,7 @@ struct TTCHeader
FixedVersion version; /* Version of the TTC Header (1.0 or 2.0), FixedVersion version; /* Version of the TTC Header (1.0 or 2.0),
* 0x00010000 or 0x00020000 */ * 0x00010000 or 0x00020000 */
} header; } header;
TTCHeaderVersion1 version1[VAR]; TTCHeaderVersion1 version1;
} u; } u;
}; };
...@@ -209,7 +209,7 @@ struct OpenTypeFontFile ...@@ -209,7 +209,7 @@ struct OpenTypeFontFile
case TrueTag: case TrueTag:
case Typ1Tag: case Typ1Tag:
case TrueTypeTag: return 1; case TrueTypeTag: return 1;
case TTCTag: return u.ttcHeader->get_face_count (); case TTCTag: return u.ttcHeader.get_face_count ();
default: return 0; default: return 0;
} }
} }
...@@ -222,8 +222,8 @@ struct OpenTypeFontFile ...@@ -222,8 +222,8 @@ struct OpenTypeFontFile
case CFFTag: /* All the non-collection tags */ case CFFTag: /* All the non-collection tags */
case TrueTag: case TrueTag:
case Typ1Tag: case Typ1Tag:
case TrueTypeTag: return u.fontFace[0]; case TrueTypeTag: return u.fontFace;
case TTCTag: return u.ttcHeader->get_face (i); case TTCTag: return u.ttcHeader.get_face (i);
default: return Null(OpenTypeFontFace); default: return Null(OpenTypeFontFace);
} }
} }
...@@ -235,8 +235,8 @@ struct OpenTypeFontFile ...@@ -235,8 +235,8 @@ struct OpenTypeFontFile
case CFFTag: /* All the non-collection tags */ case CFFTag: /* All the non-collection tags */
case TrueTag: case TrueTag:
case Typ1Tag: case Typ1Tag:
case TrueTypeTag: return u.fontFace->sanitize (context); case TrueTypeTag: return u.fontFace.sanitize (context);
case TTCTag: return u.ttcHeader->sanitize (context); case TTCTag: return u.ttcHeader.sanitize (context);
default: return true; default: return true;
} }
} }
...@@ -244,9 +244,11 @@ struct OpenTypeFontFile ...@@ -244,9 +244,11 @@ struct OpenTypeFontFile
private: private:
union { union {
Tag tag; /* 4-byte identifier. */ Tag tag; /* 4-byte identifier. */
OpenTypeFontFace fontFace[VAR]; OpenTypeFontFace fontFace;
TTCHeader ttcHeader[VAR]; TTCHeader ttcHeader;
} u; } u;
public:
DEFINE_SIZE_UNION (4, tag);
}; };
......
...@@ -420,8 +420,8 @@ struct Coverage ...@@ -420,8 +420,8 @@ struct Coverage
inline unsigned int get_coverage (hb_codepoint_t glyph_id) const inline unsigned int get_coverage (hb_codepoint_t glyph_id) const
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1->get_coverage(glyph_id); case 1: return u.format1.get_coverage(glyph_id);
case 2: return u.format2->get_coverage(glyph_id); case 2: return u.format2.get_coverage(glyph_id);
default:return NOT_COVERED; default:return NOT_COVERED;
} }
} }
...@@ -430,8 +430,8 @@ struct Coverage ...@@ -430,8 +430,8 @@ struct Coverage
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
case 2: return u.format2->sanitize (context); case 2: return u.format2.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -439,8 +439,8 @@ struct Coverage ...@@ -439,8 +439,8 @@ struct Coverage
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
CoverageFormat1 format1[VAR]; CoverageFormat1 format1;
CoverageFormat2 format2[VAR]; CoverageFormat2 format2;
} u; } u;
public: public:
DEFINE_SIZE_UNION (2, format); DEFINE_SIZE_UNION (2, format);
...@@ -542,8 +542,8 @@ struct ClassDef ...@@ -542,8 +542,8 @@ struct ClassDef
inline hb_ot_layout_class_t get_class (hb_codepoint_t glyph_id) const inline hb_ot_layout_class_t get_class (hb_codepoint_t glyph_id) const
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1->get_class(glyph_id); case 1: return u.format1.get_class(glyph_id);
case 2: return u.format2->get_class(glyph_id); case 2: return u.format2.get_class(glyph_id);
default:return 0; default:return 0;
} }
} }
...@@ -552,8 +552,8 @@ struct ClassDef ...@@ -552,8 +552,8 @@ struct ClassDef
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
case 2: return u.format2->sanitize (context); case 2: return u.format2.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -561,8 +561,8 @@ struct ClassDef ...@@ -561,8 +561,8 @@ struct ClassDef
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
ClassDefFormat1 format1[VAR]; ClassDefFormat1 format1;
ClassDefFormat2 format2[VAR]; ClassDefFormat2 format2;
} u; } u;
public: public:
DEFINE_SIZE_UNION (2, format); DEFINE_SIZE_UNION (2, format);
......
...@@ -170,9 +170,9 @@ struct CaretValue ...@@ -170,9 +170,9 @@ struct CaretValue
inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1->get_caret_value (context, glyph_id); case 1: return u.format1.get_caret_value (context, glyph_id);
case 2: return u.format2->get_caret_value (context, glyph_id); case 2: return u.format2.get_caret_value (context, glyph_id);
case 3: return u.format3->get_caret_value (context, glyph_id); case 3: return u.format3.get_caret_value (context, glyph_id);
default:return 0; default:return 0;
} }
} }
...@@ -181,9 +181,9 @@ struct CaretValue ...@@ -181,9 +181,9 @@ struct CaretValue
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
case 2: return u.format2->sanitize (context); case 2: return u.format2.sanitize (context);
case 3: return u.format3->sanitize (context); case 3: return u.format3.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -191,9 +191,9 @@ struct CaretValue ...@@ -191,9 +191,9 @@ struct CaretValue
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
CaretValueFormat1 format1[VAR]; CaretValueFormat1 format1;
CaretValueFormat2 format2[VAR]; CaretValueFormat2 format2;
CaretValueFormat3 format3[VAR]; CaretValueFormat3 format3;
} u; } u;
public: public:
DEFINE_SIZE_UNION (2, format); DEFINE_SIZE_UNION (2, format);
...@@ -292,7 +292,7 @@ struct MarkGlyphSets ...@@ -292,7 +292,7 @@ struct MarkGlyphSets
inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1->covers (set_index, glyph_id); case 1: return u.format1.covers (set_index, glyph_id);
default:return false; default:return false;
} }
} }
...@@ -301,7 +301,7 @@ struct MarkGlyphSets ...@@ -301,7 +301,7 @@ struct MarkGlyphSets
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -309,7 +309,7 @@ struct MarkGlyphSets ...@@ -309,7 +309,7 @@ struct MarkGlyphSets
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
MarkGlyphSetsFormat1 format1[VAR]; MarkGlyphSetsFormat1 format1;
} u; } u;
public: public:
DEFINE_SIZE_UNION (2, format); DEFINE_SIZE_UNION (2, format);
......
...@@ -310,9 +310,9 @@ struct Anchor ...@@ -310,9 +310,9 @@ struct Anchor
{ {
*x = *y = 0; *x = *y = 0;
switch (u.format) { switch (u.format) {
case 1: u.format1->get_anchor (layout, glyph_id, x, y); return; case 1: u.format1.get_anchor (layout, glyph_id, x, y); return;
case 2: u.format2->get_anchor (layout, glyph_id, x, y); return; case 2: u.format2.get_anchor (layout, glyph_id, x, y); return;
case 3: u.format3->get_anchor (layout, glyph_id, x, y); return; case 3: u.format3.get_anchor (layout, glyph_id, x, y); return;
default: return; default: return;
} }
} }
...@@ -321,9 +321,9 @@ struct Anchor ...@@ -321,9 +321,9 @@ struct Anchor
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
case 2: return u.format2->sanitize (context); case 2: return u.format2.sanitize (context);
case 3: return u.format3->sanitize (context); case 3: return u.format3.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -331,9 +331,9 @@ struct Anchor ...@@ -331,9 +331,9 @@ struct Anchor
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
AnchorFormat1 format1[VAR]; AnchorFormat1 format1;
AnchorFormat2 format2[VAR]; AnchorFormat2 format2;
AnchorFormat3 format3[VAR]; AnchorFormat3 format3;
} u; } u;
public: public:
DEFINE_SIZE_UNION (2, format); DEFINE_SIZE_UNION (2, format);
...@@ -518,8 +518,8 @@ struct SinglePos ...@@ -518,8 +518,8 @@ struct SinglePos
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
case 2: return u.format2->apply (context); case 2: return u.format2.apply (context);
default:return false; default:return false;
} }
} }
...@@ -528,8 +528,8 @@ struct SinglePos ...@@ -528,8 +528,8 @@ struct SinglePos
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
case 2: return u.format2->sanitize (context); case 2: return u.format2.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -537,8 +537,8 @@ struct SinglePos ...@@ -537,8 +537,8 @@ struct SinglePos
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
SinglePosFormat1 format1[VAR]; SinglePosFormat1 format1;
SinglePosFormat2 format2[VAR]; SinglePosFormat2 format2;
} u; } u;
}; };
...@@ -771,8 +771,8 @@ struct PairPos ...@@ -771,8 +771,8 @@ struct PairPos
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
case 2: return u.format2->apply (context); case 2: return u.format2.apply (context);
default:return false; default:return false;
} }
} }
...@@ -781,8 +781,8 @@ struct PairPos ...@@ -781,8 +781,8 @@ struct PairPos
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
case 2: return u.format2->sanitize (context); case 2: return u.format2.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -790,8 +790,8 @@ struct PairPos ...@@ -790,8 +790,8 @@ struct PairPos
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
PairPosFormat1 format1[VAR]; PairPosFormat1 format1;
PairPosFormat2 format2[VAR]; PairPosFormat2 format2;
} u; } u;
}; };
...@@ -1026,7 +1026,7 @@ struct CursivePos ...@@ -1026,7 +1026,7 @@ struct CursivePos
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
default:return false; default:return false;
} }
} }
...@@ -1035,7 +1035,7 @@ struct CursivePos ...@@ -1035,7 +1035,7 @@ struct CursivePos
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -1043,7 +1043,7 @@ struct CursivePos ...@@ -1043,7 +1043,7 @@ struct CursivePos
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
CursivePosFormat1 format1[VAR]; CursivePosFormat1 format1;
} u; } u;
}; };
...@@ -1123,7 +1123,7 @@ struct MarkBasePos ...@@ -1123,7 +1123,7 @@ struct MarkBasePos
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
default:return false; default:return false;
} }
} }
...@@ -1132,7 +1132,7 @@ struct MarkBasePos ...@@ -1132,7 +1132,7 @@ struct MarkBasePos
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -1140,7 +1140,7 @@ struct MarkBasePos ...@@ -1140,7 +1140,7 @@ struct MarkBasePos
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
MarkBasePosFormat1 format1[VAR]; MarkBasePosFormat1 format1;
} u; } u;
}; };
...@@ -1247,7 +1247,7 @@ struct MarkLigPos ...@@ -1247,7 +1247,7 @@ struct MarkLigPos
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
default:return false; default:return false;
} }
} }
...@@ -1256,7 +1256,7 @@ struct MarkLigPos ...@@ -1256,7 +1256,7 @@ struct MarkLigPos
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -1264,7 +1264,7 @@ struct MarkLigPos ...@@ -1264,7 +1264,7 @@ struct MarkLigPos
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
MarkLigPosFormat1 format1[VAR]; MarkLigPosFormat1 format1;
} u; } u;
}; };
...@@ -1352,7 +1352,7 @@ struct MarkMarkPos ...@@ -1352,7 +1352,7 @@ struct MarkMarkPos
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
default:return false; default:return false;
} }
} }
...@@ -1361,7 +1361,7 @@ struct MarkMarkPos ...@@ -1361,7 +1361,7 @@ struct MarkMarkPos
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -1369,7 +1369,7 @@ struct MarkMarkPos ...@@ -1369,7 +1369,7 @@ struct MarkMarkPos
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
MarkMarkPosFormat1 format1[VAR]; MarkMarkPosFormat1 format1;
} u; } u;
}; };
...@@ -1445,15 +1445,15 @@ struct PosLookupSubTable ...@@ -1445,15 +1445,15 @@ struct PosLookupSubTable
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (lookup_type) { switch (lookup_type) {
case Single: return u.single->apply (context); case Single: return u.single.apply (context);
case Pair: return u.pair->apply (context); case Pair: return u.pair.apply (context);
case Cursive: return u.cursive->apply (context); case Cursive: return u.cursive.apply (context);
case MarkBase: return u.markBase->apply (context); case MarkBase: return u.markBase.apply (context);
case MarkLig: return u.markLig->apply (context); case MarkLig: return u.markLig.apply (context);
case MarkMark: return u.markMark->apply (context); case MarkMark: return u.markMark.apply (context);
case Context: return u.context->apply (context); case Context: return u.context.apply (context);
case ChainContext: return u.chainContext->apply (context); case ChainContext: return u.chainContext.apply (context);
case Extension: return u.extension->apply (context); case Extension: return u.extension.apply (context);
default:return false; default:return false;
} }
} }
...@@ -1462,15 +1462,15 @@ struct PosLookupSubTable ...@@ -1462,15 +1462,15 @@ struct PosLookupSubTable
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case Single: return u.single->sanitize (context); case Single: return u.single.sanitize (context);
case Pair: return u.pair->sanitize (context); case Pair: return u.pair.sanitize (context);
case Cursive: return u.cursive->sanitize (context); case Cursive: return u.cursive.sanitize (context);
case MarkBase: return u.markBase->sanitize (context); case MarkBase: return u.markBase.sanitize (context);
case MarkLig: return u.markLig->sanitize (context); case MarkLig: return u.markLig.sanitize (context);
case MarkMark: return u.markMark->sanitize (context); case MarkMark: return u.markMark.sanitize (context);
case Context: return u.context->sanitize (context); case Context: return u.context.sanitize (context);
case ChainContext: return u.chainContext->sanitize (context); case ChainContext: return u.chainContext.sanitize (context);
case Extension: return u.extension->sanitize (context); case Extension: return u.extension.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -1478,15 +1478,15 @@ struct PosLookupSubTable ...@@ -1478,15 +1478,15 @@ struct PosLookupSubTable
private: private:
union { union {
USHORT format; USHORT format;
SinglePos single[VAR]; SinglePos single;
PairPos pair[VAR]; PairPos pair;
CursivePos cursive[VAR]; CursivePos cursive;
MarkBasePos markBase[VAR]; MarkBasePos markBase;
MarkLigPos markLig[VAR]; MarkLigPos markLig;
MarkMarkPos markMark[VAR]; MarkMarkPos markMark;
ContextPos context[VAR]; ContextPos context;
ChainContextPos chainContext[VAR]; ChainContextPos chainContext;
ExtensionPos extension[VAR]; ExtensionPos extension;
} u; } u;
public: public:
DEFINE_SIZE_UNION (2, format); DEFINE_SIZE_UNION (2, format);
......
...@@ -130,8 +130,8 @@ struct SingleSubst ...@@ -130,8 +130,8 @@ struct SingleSubst
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
case 2: return u.format2->apply (context); case 2: return u.format2.apply (context);
default:return false; default:return false;
} }
} }
...@@ -140,8 +140,8 @@ struct SingleSubst ...@@ -140,8 +140,8 @@ struct SingleSubst
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
case 2: return u.format2->sanitize (context); case 2: return u.format2.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -149,8 +149,8 @@ struct SingleSubst ...@@ -149,8 +149,8 @@ struct SingleSubst
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
SingleSubstFormat1 format1[VAR]; SingleSubstFormat1 format1;
SingleSubstFormat2 format2[VAR]; SingleSubstFormat2 format2;
} u; } u;
}; };
...@@ -243,7 +243,7 @@ struct MultipleSubst ...@@ -243,7 +243,7 @@ struct MultipleSubst
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
default:return false; default:return false;
} }
} }
...@@ -252,7 +252,7 @@ struct MultipleSubst ...@@ -252,7 +252,7 @@ struct MultipleSubst
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -260,7 +260,7 @@ struct MultipleSubst ...@@ -260,7 +260,7 @@ struct MultipleSubst
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
MultipleSubstFormat1 format1[VAR]; MultipleSubstFormat1 format1;
} u; } u;
}; };
...@@ -339,7 +339,7 @@ struct AlternateSubst ...@@ -339,7 +339,7 @@ struct AlternateSubst
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
default:return false; default:return false;
} }
} }
...@@ -348,7 +348,7 @@ struct AlternateSubst ...@@ -348,7 +348,7 @@ struct AlternateSubst
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -356,7 +356,7 @@ struct AlternateSubst ...@@ -356,7 +356,7 @@ struct AlternateSubst
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
AlternateSubstFormat1 format1[VAR]; AlternateSubstFormat1 format1;
} u; } u;
}; };
...@@ -526,7 +526,7 @@ struct LigatureSubst ...@@ -526,7 +526,7 @@ struct LigatureSubst
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
default:return false; default:return false;
} }
} }
...@@ -535,7 +535,7 @@ struct LigatureSubst ...@@ -535,7 +535,7 @@ struct LigatureSubst
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -543,7 +543,7 @@ struct LigatureSubst ...@@ -543,7 +543,7 @@ struct LigatureSubst
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
LigatureSubstFormat1 format1[VAR]; LigatureSubstFormat1 format1;
} u; } u;
}; };
...@@ -672,7 +672,7 @@ struct ReverseChainSingleSubst ...@@ -672,7 +672,7 @@ struct ReverseChainSingleSubst
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context); case 1: return u.format1.apply (context);
default:return false; default:return false;
} }
} }
...@@ -681,7 +681,7 @@ struct ReverseChainSingleSubst ...@@ -681,7 +681,7 @@ struct ReverseChainSingleSubst
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -689,7 +689,7 @@ struct ReverseChainSingleSubst ...@@ -689,7 +689,7 @@ struct ReverseChainSingleSubst
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
ReverseChainSingleSubstFormat1 format1[VAR]; ReverseChainSingleSubstFormat1 format1;
} u; } u;
}; };
...@@ -718,14 +718,14 @@ struct SubstLookupSubTable ...@@ -718,14 +718,14 @@ struct SubstLookupSubTable
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (lookup_type) { switch (lookup_type) {
case Single: return u.single->apply (context); case Single: return u.single.apply (context);
case Multiple: return u.multiple->apply (context); case Multiple: return u.multiple.apply (context);
case Alternate: return u.alternate->apply (context); case Alternate: return u.alternate.apply (context);
case Ligature: return u.ligature->apply (context); case Ligature: return u.ligature.apply (context);
case Context: return u.context->apply (context); case Context: return u.context.apply (context);
case ChainContext: return u.chainContext->apply (context); case ChainContext: return u.chainContext.apply (context);
case Extension: return u.extension->apply (context); case Extension: return u.extension.apply (context);
case ReverseChainSingle: return u.reverseChainContextSingle->apply (context); case ReverseChainSingle: return u.reverseChainContextSingle.apply (context);
default:return false; default:return false;
} }
} }
...@@ -734,14 +734,14 @@ struct SubstLookupSubTable ...@@ -734,14 +734,14 @@ struct SubstLookupSubTable
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case Single: return u.single->sanitize (context); case Single: return u.single.sanitize (context);
case Multiple: return u.multiple->sanitize (context); case Multiple: return u.multiple.sanitize (context);
case Alternate: return u.alternate->sanitize (context); case Alternate: return u.alternate.sanitize (context);
case Ligature: return u.ligature->sanitize (context); case Ligature: return u.ligature.sanitize (context);
case Context: return u.context->sanitize (context); case Context: return u.context.sanitize (context);
case ChainContext: return u.chainContext->sanitize (context); case ChainContext: return u.chainContext.sanitize (context);
case Extension: return u.extension->sanitize (context); case Extension: return u.extension.sanitize (context);
case ReverseChainSingle: return u.reverseChainContextSingle->sanitize (context); case ReverseChainSingle: return u.reverseChainContextSingle.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -749,14 +749,14 @@ struct SubstLookupSubTable ...@@ -749,14 +749,14 @@ struct SubstLookupSubTable
private: private:
union { union {
USHORT format; USHORT format;
SingleSubst single[VAR]; SingleSubst single;
MultipleSubst multiple[VAR]; MultipleSubst multiple;
AlternateSubst alternate[VAR]; AlternateSubst alternate;
LigatureSubst ligature[VAR]; LigatureSubst ligature;
ContextSubst context[VAR]; ContextSubst context;
ChainContextSubst chainContext[VAR]; ChainContextSubst chainContext;
ExtensionSubst extension[VAR]; ExtensionSubst extension;
ReverseChainSingleSubst reverseChainContextSingle[VAR]; ReverseChainSingleSubst reverseChainContextSingle;
} u; } u;
public: public:
DEFINE_SIZE_UNION (2, format); DEFINE_SIZE_UNION (2, format);
...@@ -805,9 +805,9 @@ struct SubstLookup : Lookup ...@@ -805,9 +805,9 @@ struct SubstLookup : Lookup
* This is rather slow to do this here for every glyph, * This is rather slow to do this here for every glyph,
* but it's easiest, and who uses extension lookups anyway?!*/ * but it's easiest, and who uses extension lookups anyway?!*/
unsigned int count = get_subtable_count (); unsigned int count = get_subtable_count ();
unsigned int type = get_subtable(0).u.extension->get_type (); unsigned int type = get_subtable(0).u.extension.get_type ();
for (unsigned int i = 1; i < count; i++) for (unsigned int i = 1; i < count; i++)
if (get_subtable(i).u.extension->get_type () != type) if (get_subtable(i).u.extension.get_type () != type)
return false; return false;
} }
......
...@@ -477,9 +477,9 @@ struct Context ...@@ -477,9 +477,9 @@ struct Context
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context, apply_func); case 1: return u.format1.apply (context, apply_func);
case 2: return u.format2->apply (context, apply_func); case 2: return u.format2.apply (context, apply_func);
case 3: return u.format3->apply (context, apply_func); case 3: return u.format3.apply (context, apply_func);
default:return false; default:return false;
} }
} }
...@@ -488,9 +488,9 @@ struct Context ...@@ -488,9 +488,9 @@ struct Context
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
case 2: return u.format2->sanitize (context); case 2: return u.format2.sanitize (context);
case 3: return u.format3->sanitize (context); case 3: return u.format3.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -498,9 +498,9 @@ struct Context ...@@ -498,9 +498,9 @@ struct Context
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
ContextFormat1 format1[VAR]; ContextFormat1 format1;
ContextFormat2 format2[VAR]; ContextFormat2 format2;
ContextFormat3 format3[VAR]; ContextFormat3 format3;
} u; } u;
}; };
...@@ -796,9 +796,9 @@ struct ChainContext ...@@ -796,9 +796,9 @@ struct ChainContext
{ {
TRACE_APPLY (); TRACE_APPLY ();
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (context, apply_func); case 1: return u.format1.apply (context, apply_func);
case 2: return u.format2->apply (context, apply_func); case 2: return u.format2.apply (context, apply_func);
case 3: return u.format3->apply (context, apply_func); case 3: return u.format3.apply (context, apply_func);
default:return false; default:return false;
} }
} }
...@@ -807,9 +807,9 @@ struct ChainContext ...@@ -807,9 +807,9 @@ struct ChainContext
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
case 2: return u.format2->sanitize (context); case 2: return u.format2.sanitize (context);
case 3: return u.format3->sanitize (context); case 3: return u.format3.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -817,9 +817,9 @@ struct ChainContext ...@@ -817,9 +817,9 @@ struct ChainContext
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
ChainContextFormat1 format1[VAR]; ChainContextFormat1 format1;
ChainContextFormat2 format2[VAR]; ChainContextFormat2 format2;
ChainContextFormat3 format3[VAR]; ChainContextFormat3 format3;
} u; } u;
}; };
...@@ -853,14 +853,14 @@ struct Extension ...@@ -853,14 +853,14 @@ struct Extension
inline unsigned int get_type (void) const inline unsigned int get_type (void) const
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1->get_type (); case 1: return u.format1.get_type ();
default:return 0; default:return 0;
} }
} }
inline unsigned int get_offset (void) const inline unsigned int get_offset (void) const
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1->get_offset (); case 1: return u.format1.get_offset ();
default:return 0; default:return 0;
} }
} }
...@@ -869,7 +869,7 @@ struct Extension ...@@ -869,7 +869,7 @@ struct Extension
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.format.sanitize (context)) return false;
switch (u.format) { switch (u.format) {
case 1: return u.format1->sanitize (context); case 1: return u.format1.sanitize (context);
default:return true; default:return true;
} }
} }
...@@ -877,7 +877,7 @@ struct Extension ...@@ -877,7 +877,7 @@ struct Extension
private: private:
union { union {
USHORT format; /* Format identifier */ USHORT format; /* Format identifier */
ExtensionFormat1 format1[VAR]; ExtensionFormat1 format1;
} u; } u;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册