3030#include " hb-open-type-private.hh"
3131#include " hb-aat-layout-common-private.hh"
3232
33- #define HB_AAT_TAG_MORT HB_TAG (' m' ,' o' ,' r' ,' t' )
3433#define HB_AAT_TAG_MORX HB_TAG (' m' ,' o' ,' r' ,' x' )
3534
3635
@@ -39,7 +38,6 @@ namespace AAT {
3938using namespace OT ;
4039
4140
42- template <typename Types>
4341struct RearrangementSubtable
4442{
4543 enum Flags {
@@ -171,16 +169,13 @@ struct RearrangementSubtable
171169 }
172170
173171 protected:
174- StateTable<Types, void > machine;
172+ StateTable<void > machine;
175173 public:
176174 DEFINE_SIZE_MIN (2 );
177175};
178176
179- template <typename Types>
180177struct ContextualSubtable
181178{
182- typedef typename Types::HBUINT HBUINT;
183-
184179 enum Flags {
185180 SetMark = 0x8000 , /* If set, make the current glyph the marked glyph. */
186181 DontAdvance = 0x4000 , /* If set, don't advance to the next glyph before
@@ -206,7 +201,7 @@ struct ContextualSubtable
206201 bool ret = false ;
207202 unsigned int num_glyphs = c->face ->get_num_glyphs ();
208203
209- const UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT > &subs = this +substitutionTables;
204+ const UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT32 > &subs = this +substitutionTables;
210205
211206 unsigned int state = 0 ;
212207 unsigned int last_zero = 0 ;
@@ -290,14 +285,13 @@ struct ContextualSubtable
290285 }
291286
292287 protected:
293- StateTable<Types, EntryData> machine;
294- OffsetTo<UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT >, HBUINT >
295- substitutionTables;
288+ StateTable<EntryData> machine;
289+ OffsetTo<UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT32 >, HBUINT32 >
290+ substitutionTables;
296291 public:
297292 DEFINE_SIZE_MIN (2 );
298293};
299294
300- template <typename Types>
301295struct LigatureSubtable
302296{
303297 inline bool apply (hb_apply_context_t *c) const
@@ -315,7 +309,6 @@ struct LigatureSubtable
315309 }
316310};
317311
318- template <typename Types>
319312struct NoncontextualSubtable
320313{
321314 inline bool apply (hb_apply_context_t *c) const
@@ -352,7 +345,6 @@ struct NoncontextualSubtable
352345 DEFINE_SIZE_MIN (2 );
353346};
354347
355- template <typename Types>
356348struct InsertionSubtable
357349{
358350 inline bool apply (hb_apply_context_t *c) const
@@ -392,13 +384,9 @@ struct Feature
392384};
393385
394386
395- template <typename Types>
396387struct ChainSubtable
397388{
398- template <typename > struct Chain ;
399- friend struct Chain <Types>;
400-
401- typedef typename Types::HBUINT HBUINT;
389+ friend struct Chain ;
402390
403391 inline unsigned int get_size (void ) const { return length; }
404392 inline unsigned int get_type (void ) const { return coverage & 0xFF ; }
@@ -443,33 +431,30 @@ struct ChainSubtable
443431 }
444432
445433 protected:
446- HBUINT length; /* Total subtable length, including this header. */
447- HBUINT coverage; /* Coverage flags and subtable type. */
448- HBUINT32 subFeatureFlags;/* The 32-bit mask identifying which subtable this is. */
434+ HBUINT32 length; /* Total subtable length, including this header. */
435+ HBUINT32 coverage; /* Coverage flags and subtable type. */
436+ HBUINT32 subFeatureFlags;/* The 32-bit mask identifying which subtable this is. */
449437 union {
450- RearrangementSubtable<Types> rearrangement;
451- ContextualSubtable<Types> contextual;
452- LigatureSubtable<Types> ligature;
453- NoncontextualSubtable<Types> noncontextual;
454- InsertionSubtable<Types> insertion;
438+ RearrangementSubtable rearrangement;
439+ ContextualSubtable contextual;
440+ LigatureSubtable ligature;
441+ NoncontextualSubtable noncontextual;
442+ InsertionSubtable insertion;
455443 } u;
456444 public:
457- DEFINE_SIZE_MIN (2 * sizeof (HBUINT ) + 4 );
445+ DEFINE_SIZE_MIN (2 * sizeof (HBUINT32 ) + 4 );
458446};
459447
460- template <typename Types>
461448struct Chain
462449{
463- typedef typename Types::HBUINT HBUINT;
464-
465450 inline void apply (hb_apply_context_t *c) const
466451 {
467- const ChainSubtable<Types> *subtable = &StructAtOffset<ChainSubtable<Types> > (featureZ, featureZ[0 ].static_size * featureCount);
452+ const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (featureZ, featureZ[0 ].static_size * featureCount);
468453 unsigned int count = subtableCount;
469454 for (unsigned int i = 0 ; i < count; i++)
470455 {
471456 subtable->apply (c);
472- subtable = &StructAfter<ChainSubtable<Types> > (*subtable);
457+ subtable = &StructAfter<ChainSubtable> (*subtable);
473458 }
474459 }
475460
@@ -486,13 +471,13 @@ struct Chain
486471 if (!c->check_array (featureZ, featureZ[0 ].static_size , featureCount))
487472 return_trace (false );
488473
489- const ChainSubtable<Types> *subtable = &StructAtOffset<ChainSubtable<Types> > (featureZ, featureZ[0 ].static_size * featureCount);
474+ const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (featureZ, featureZ[0 ].static_size * featureCount);
490475 unsigned int count = subtableCount;
491476 for (unsigned int i = 0 ; i < count; i++)
492477 {
493478 if (!subtable->sanitize (c))
494479 return_trace (false );
495- subtable = &StructAfter<ChainSubtable<Types> > (*subtable);
480+ subtable = &StructAfter<ChainSubtable> (*subtable);
496481 }
497482
498483 return_trace (true );
@@ -501,56 +486,52 @@ struct Chain
501486 protected:
502487 HBUINT32 defaultFlags; /* The default specification for subtables. */
503488 HBUINT32 length; /* Total byte count, including this header. */
504- HBUINT featureCount; /* Number of feature subtable entries. */
505- HBUINT subtableCount; /* The number of subtables in the chain. */
489+ HBUINT32 featureCount; /* Number of feature subtable entries. */
490+ HBUINT32 subtableCount; /* The number of subtables in the chain. */
506491
507- Feature featureZ[VAR]; /* Features. */
508- ChainSubtable<Types> subtableX[VAR]; /* Subtables. */
492+ Feature featureZ[VAR]; /* Features. */
493+ ChainSubtable subtableX[VAR]; /* Subtables. */
509494 // subtableGlyphCoverageArray if major == 3
510495
511496 public:
512- DEFINE_SIZE_MIN (8 + 2 * sizeof (HBUINT ));
497+ DEFINE_SIZE_MIN (8 + 2 * sizeof (HBUINT32 ));
513498};
514499
515500
516501/*
517502 * The 'mort'/'morx' Tables
518503 */
519504
520- template <typename Types>
521- struct mortmorx
505+ struct morx
522506{
523- static const hb_tag_t mortTag = HB_AAT_TAG_MORT;
524- static const hb_tag_t morxTag = HB_AAT_TAG_MORX;
525-
526- typedef typename Types::HBUINT HBUINT;
507+ static const hb_tag_t tableTag = HB_AAT_TAG_MORX;
527508
528509 inline void apply (hb_apply_context_t *c) const
529510 {
530- const Chain<Types> *chain = chains;
511+ const Chain *chain = chains;
531512 unsigned int count = chainCount;
532513 for (unsigned int i = 0 ; i < count; i++)
533514 {
534515 chain->apply (c);
535- chain = &StructAfter<Chain<Types> > (*chain);
516+ chain = &StructAfter<Chain> (*chain);
536517 }
537518 }
538519
539520 inline bool sanitize (hb_sanitize_context_t *c) const
540521 {
541522 TRACE_SANITIZE (this );
542523 if (!version.sanitize (c) ||
543- (version.major >> (sizeof (HBUINT ) == 4 ? 1 : 0 )) != 1 ||
524+ (version.major >> (sizeof (HBUINT32 ) == 4 ? 1 : 0 )) != 1 ||
544525 !chainCount.sanitize (c))
545526 return_trace (false );
546527
547- const Chain<Types> *chain = chains;
528+ const Chain *chain = chains;
548529 unsigned int count = chainCount;
549530 for (unsigned int i = 0 ; i < count; i++)
550531 {
551532 if (!chain->sanitize (c, version.major ))
552533 return_trace (false );
553- chain = &StructAfter<Chain<Types> > (*chain);
534+ chain = &StructAfter<Chain> (*chain);
554535 }
555536
556537 return_trace (true );
@@ -561,51 +542,12 @@ struct mortmorx
561542 * 1 for mort, 2 or 3 for morx. */
562543 HBUINT32 chainCount; /* Number of metamorphosis chains contained in this
563544 * table. */
564- Chain<Types> chains[VAR]; /* Chains. */
545+ Chain chains[VAR]; /* Chains. */
565546
566547 public:
567548 DEFINE_SIZE_MIN (8 );
568549};
569550
570- struct MortTypes
571- {
572- static const bool extended = false ;
573- typedef HBUINT16 HBUINT;
574- typedef HBUINT8 HBUSHORT;
575- struct ClassType : ClassTable
576- {
577- inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs HB_UNUSED) const
578- {
579- return ClassTable::get_class (glyph_id);
580- }
581- };
582- };
583- struct MorxTypes
584- {
585- static const bool extended = true ;
586- typedef HBUINT32 HBUINT;
587- typedef HBUINT16 HBUSHORT;
588- struct ClassType : Lookup<HBUINT16>
589- {
590- inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
591- {
592- const HBUINT16 *v = get_value (glyph_id, num_glyphs);
593- return v ? *v : 1 ;
594- }
595- };
596- };
597-
598- struct mort : mortmorx<MortTypes>
599- {
600- static const hb_tag_t tableTag = HB_AAT_TAG_MORT;
601- };
602-
603- struct morx : mortmorx<MorxTypes>
604- {
605- static const hb_tag_t tableTag = HB_AAT_TAG_MORX;
606- };
607-
608-
609551} /* namespace AAT */
610552
611553
0 commit comments