[HarfBuzz] harfbuzz: Branch 'master' - 3 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Jan 11 21:47:33 UTC 2018


 src/hb-aat-layout-common-private.hh                     |   55 +------
 src/hb-aat-layout-morx-table.hh                         |  122 ++++------------
 test/shaping/data/text-rendering-tests/Makefile.sources |    1 
 test/shaping/data/text-rendering-tests/README           |    3 
 4 files changed, 49 insertions(+), 132 deletions(-)

New commits:
commit 0d39ac224c680b1f0134b58e78391497fbe47370
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jan 11 22:47:08 2018 +0100

    [test/text-rendering-tests] Update README

diff --git a/test/shaping/data/text-rendering-tests/README b/test/shaping/data/text-rendering-tests/README
index 351f8301..c46d3ffd 100644
--- a/test/shaping/data/text-rendering-tests/README
+++ b/test/shaping/data/text-rendering-tests/README
@@ -2,3 +2,6 @@ Tests in this directory are automatically imported from the
 text-rendering-tests repository owned by Unicode Consortium:
 
   https://github.com/unicode-org/text-rendering-tests
+
+To import the latest version of that test suite just run
+"make update" from a build in a git checkout.
commit 17a66f133c7e523403b6c90b011fcf0acb6356c6
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jan 11 22:46:19 2018 +0100

    [test] Disable MORX-12
    
    Ouch. I need a better workflow for this.

diff --git a/test/shaping/data/text-rendering-tests/Makefile.sources b/test/shaping/data/text-rendering-tests/Makefile.sources
index a3acf276..3e834243 100644
--- a/test/shaping/data/text-rendering-tests/Makefile.sources
+++ b/test/shaping/data/text-rendering-tests/Makefile.sources
@@ -28,7 +28,6 @@ TESTS = \
 	tests/HVAR-2.tests \
 	tests/KERN-1.tests \
 	tests/KERN-2.tests \
-	tests/MORX-12.tests \
 	tests/SHBALI-3.tests \
 	tests/SHKNDA-1.tests \
 	$(NULL)
commit 1f1c85a54aad8a25a67041cbb9c4277d28c1c761
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jan 11 22:43:57 2018 +0100

    [aat] Remove 'mort' support
    
    It's dead, Jim!

diff --git a/src/hb-aat-layout-common-private.hh b/src/hb-aat-layout-common-private.hh
index fca74ea2..2462701c 100644
--- a/src/hb-aat-layout-common-private.hh
+++ b/src/hb-aat-layout-common-private.hh
@@ -477,33 +477,8 @@ struct Lookup
 };
 
 
-struct ClassTable
-{
-  inline unsigned int get_class (hb_codepoint_t glyph_id) const
-  {
-    return firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount ? classArrayZ[glyph_id - firstGlyph] : 1;
-  }
-
-  inline bool sanitize (hb_sanitize_context_t *c) const
-  {
-    TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && classArrayZ.sanitize (c, glyphCount));
-  }
-
-  protected:
-  GlyphID	firstGlyph;	/* First glyph index included in the trimmed array. */
-  HBUINT16	glyphCount;	/* Total number of glyphs (equivalent to the last
-				 * glyph minus the value of firstGlyph plus 1). */
-  UnsizedArrayOf<HBUINT8>
-		classArrayZ;	/* The class codes (indexed by glyph index minus
-				 * firstGlyph). */
-  public:
-  DEFINE_SIZE_ARRAY (4, classArrayZ);
-};
-
-
 /*
- * (Extended) State Table
+ * Extended State Table
  */
 
 template <typename T>
@@ -545,16 +520,14 @@ struct Entry<void>
   DEFINE_SIZE_STATIC (4);
 };
 
-template <typename Types, typename Extra>
+template <typename Extra>
 struct StateTable
 {
-  typedef typename Types::HBUINT HBUINT;
-  typedef typename Types::HBUSHORT HBUSHORT;
-  typedef typename Types::ClassType ClassType;
-
   inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
-  { return (this+classTable).get_class (glyph_id, num_glyphs); }
-
+  {
+    const HBUINT16 *v = (this+classTable).get_value (glyph_id, num_glyphs);
+    return v ? *v : 1;
+  }
 
   inline const Entry<Extra> *get_entries () const
   {
@@ -565,7 +538,7 @@ struct StateTable
   {
     if (unlikely (klass >= nClasses)) return nullptr;
 
-    const HBUSHORT *states = (this+stateArrayTable).arrayZ;
+    const HBUINT16 *states = (this+stateArrayTable).arrayZ;
     const Entry<Extra> *entries = (this+entryTable).arrayZ;
 
     unsigned int entry = states[state * nClasses + klass];
@@ -579,7 +552,7 @@ struct StateTable
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this))) return_trace (false);
 
-    const HBUSHORT *states = (this+stateArrayTable).arrayZ;
+    const HBUINT16 *states = (this+stateArrayTable).arrayZ;
     const Entry<Extra> *entries = (this+entryTable).arrayZ;
 
     unsigned int num_states = 1;
@@ -594,8 +567,8 @@ struct StateTable
 				     nClasses * (num_states - state))))
 	return_trace (false);
       { /* Sweep new states. */
-	const HBUSHORT *stop = &states[num_states * nClasses];
-	for (const HBUSHORT *p = &states[state * nClasses]; p < stop; p++)
+	const HBUINT16 *stop = &states[num_states * nClasses];
+	for (const HBUINT16 *p = &states[state * nClasses]; p < stop; p++)
 	  num_entries = MAX<unsigned int> (num_entries, *p + 1);
 	state = num_states;
       }
@@ -619,13 +592,13 @@ struct StateTable
   }
 
   protected:
-  HBUINT	nClasses;	/* Number of classes, which is the number of indices
+  HBUINT32	nClasses;	/* Number of classes, which is the number of indices
 				 * in a single line in the state array. */
-  OffsetTo<ClassType, HBUINT>
+  OffsetTo<Lookup<HBUINT16>, HBUINT32>
 		classTable;	/* Offset to the class table. */
-  OffsetTo<UnsizedArrayOf<HBUSHORT>, HBUINT>
+  OffsetTo<UnsizedArrayOf<HBUINT16>, HBUINT32>
 		stateArrayTable;/* Offset to the state array. */
-  OffsetTo<UnsizedArrayOf<Entry<Extra> >, HBUINT>
+  OffsetTo<UnsizedArrayOf<Entry<Extra> >, HBUINT32>
 		entryTable;	/* Offset to the entry array. */
 
   public:
diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index cc15fddb..95f4245d 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -30,7 +30,6 @@
 #include "hb-open-type-private.hh"
 #include "hb-aat-layout-common-private.hh"
 
-#define HB_AAT_TAG_MORT HB_TAG('m','o','r','t')
 #define HB_AAT_TAG_MORX HB_TAG('m','o','r','x')
 
 
@@ -39,7 +38,6 @@ namespace AAT {
 using namespace OT;
 
 
-template <typename Types>
 struct RearrangementSubtable
 {
   enum Flags {
@@ -171,16 +169,13 @@ struct RearrangementSubtable
   }
 
   protected:
-  StateTable<Types, void>	machine;
+  StateTable<void>	machine;
   public:
   DEFINE_SIZE_MIN (2);
 };
 
-template <typename Types>
 struct ContextualSubtable
 {
-  typedef typename Types::HBUINT HBUINT;
-
   enum Flags {
     SetMark	= 0x8000,	/* If set, make the current glyph the marked glyph. */
     DontAdvance	= 0x4000,	/* If set, don't advance to the next glyph before
@@ -206,7 +201,7 @@ struct ContextualSubtable
     bool ret = false;
     unsigned int num_glyphs = c->face->get_num_glyphs ();
 
-    const UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT> &subs = this+substitutionTables;
+    const UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT32> &subs = this+substitutionTables;
 
     unsigned int state = 0;
     unsigned int last_zero = 0;
@@ -290,14 +285,13 @@ struct ContextualSubtable
   }
 
   protected:
-  StateTable<Types, EntryData>	machine;
-  OffsetTo<UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT>, HBUINT>
-				substitutionTables;
+  StateTable<EntryData>	machine;
+  OffsetTo<UnsizedOffsetListOf<Lookup<GlyphID>, HBUINT32>, HBUINT32>
+			substitutionTables;
   public:
   DEFINE_SIZE_MIN (2);
 };
 
-template <typename Types>
 struct LigatureSubtable
 {
   inline bool apply (hb_apply_context_t *c) const
@@ -315,7 +309,6 @@ struct LigatureSubtable
   }
 };
 
-template <typename Types>
 struct NoncontextualSubtable
 {
   inline bool apply (hb_apply_context_t *c) const
@@ -352,7 +345,6 @@ struct NoncontextualSubtable
   DEFINE_SIZE_MIN (2);
 };
 
-template <typename Types>
 struct InsertionSubtable
 {
   inline bool apply (hb_apply_context_t *c) const
@@ -392,13 +384,9 @@ struct Feature
 };
 
 
-template <typename Types>
 struct ChainSubtable
 {
-  template <typename> struct Chain;
-  friend struct Chain<Types>;
-
-  typedef typename Types::HBUINT HBUINT;
+  friend struct Chain;
 
   inline unsigned int get_size (void) const { return length; }
   inline unsigned int get_type (void) const { return coverage & 0xFF; }
@@ -443,33 +431,30 @@ struct ChainSubtable
   }
 
   protected:
-  HBUINT		length;		/* Total subtable length, including this header. */
-  HBUINT		coverage;	/* Coverage flags and subtable type. */
-  HBUINT32		subFeatureFlags;/* The 32-bit mask identifying which subtable this is. */
+  HBUINT32	length;		/* Total subtable length, including this header. */
+  HBUINT32	coverage;	/* Coverage flags and subtable type. */
+  HBUINT32	subFeatureFlags;/* The 32-bit mask identifying which subtable this is. */
   union {
-  RearrangementSubtable<Types>	rearrangement;
-  ContextualSubtable<Types>	contextual;
-  LigatureSubtable<Types>	ligature;
-  NoncontextualSubtable<Types>	noncontextual;
-  InsertionSubtable<Types>	insertion;
+  RearrangementSubtable		rearrangement;
+  ContextualSubtable		contextual;
+  LigatureSubtable		ligature;
+  NoncontextualSubtable		noncontextual;
+  InsertionSubtable		insertion;
   } u;
   public:
-  DEFINE_SIZE_MIN (2 * sizeof (HBUINT) + 4);
+  DEFINE_SIZE_MIN (2 * sizeof (HBUINT32) + 4);
 };
 
-template <typename Types>
 struct Chain
 {
-  typedef typename Types::HBUINT HBUINT;
-
   inline void apply (hb_apply_context_t *c) const
   {
-    const ChainSubtable<Types> *subtable = &StructAtOffset<ChainSubtable<Types> > (featureZ, featureZ[0].static_size * featureCount);
+    const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (featureZ, featureZ[0].static_size * featureCount);
     unsigned int count = subtableCount;
     for (unsigned int i = 0; i < count; i++)
     {
       subtable->apply (c);
-      subtable = &StructAfter<ChainSubtable<Types> > (*subtable);
+      subtable = &StructAfter<ChainSubtable> (*subtable);
     }
   }
 
@@ -486,13 +471,13 @@ struct Chain
     if (!c->check_array (featureZ, featureZ[0].static_size, featureCount))
       return_trace (false);
 
-    const ChainSubtable<Types> *subtable = &StructAtOffset<ChainSubtable<Types> > (featureZ, featureZ[0].static_size * featureCount);
+    const ChainSubtable *subtable = &StructAtOffset<ChainSubtable> (featureZ, featureZ[0].static_size * featureCount);
     unsigned int count = subtableCount;
     for (unsigned int i = 0; i < count; i++)
     {
       if (!subtable->sanitize (c))
 	return_trace (false);
-      subtable = &StructAfter<ChainSubtable<Types> > (*subtable);
+      subtable = &StructAfter<ChainSubtable> (*subtable);
     }
 
     return_trace (true);
@@ -501,15 +486,15 @@ struct Chain
   protected:
   HBUINT32	defaultFlags;	/* The default specification for subtables. */
   HBUINT32	length;		/* Total byte count, including this header. */
-  HBUINT		featureCount;	/* Number of feature subtable entries. */
-  HBUINT		subtableCount;	/* The number of subtables in the chain. */
+  HBUINT32	featureCount;	/* Number of feature subtable entries. */
+  HBUINT32	subtableCount;	/* The number of subtables in the chain. */
 
-  Feature		featureZ[VAR];	/* Features. */
-  ChainSubtable<Types>	subtableX[VAR];	/* Subtables. */
+  Feature	featureZ[VAR];	/* Features. */
+  ChainSubtable	subtableX[VAR];	/* Subtables. */
   // subtableGlyphCoverageArray if major == 3
 
   public:
-  DEFINE_SIZE_MIN (8 + 2 * sizeof (HBUINT));
+  DEFINE_SIZE_MIN (8 + 2 * sizeof (HBUINT32));
 };
 
 
@@ -517,22 +502,18 @@ struct Chain
  * The 'mort'/'morx' Tables
  */
 
-template <typename Types>
-struct mortmorx
+struct morx
 {
-  static const hb_tag_t mortTag	= HB_AAT_TAG_MORT;
-  static const hb_tag_t morxTag	= HB_AAT_TAG_MORX;
-
-  typedef typename Types::HBUINT HBUINT;
+  static const hb_tag_t tableTag = HB_AAT_TAG_MORX;
 
   inline void apply (hb_apply_context_t *c) const
   {
-    const Chain<Types> *chain = chains;
+    const Chain *chain = chains;
     unsigned int count = chainCount;
     for (unsigned int i = 0; i < count; i++)
     {
       chain->apply (c);
-      chain = &StructAfter<Chain<Types> > (*chain);
+      chain = &StructAfter<Chain> (*chain);
     }
   }
 
@@ -540,17 +521,17 @@ struct mortmorx
   {
     TRACE_SANITIZE (this);
     if (!version.sanitize (c) ||
-	(version.major >> (sizeof (HBUINT) == 4 ? 1 : 0)) != 1 ||
+	(version.major >> (sizeof (HBUINT32) == 4 ? 1 : 0)) != 1 ||
 	!chainCount.sanitize (c))
       return_trace (false);
 
-    const Chain<Types> *chain = chains;
+    const Chain *chain = chains;
     unsigned int count = chainCount;
     for (unsigned int i = 0; i < count; i++)
     {
       if (!chain->sanitize (c, version.major))
 	return_trace (false);
-      chain = &StructAfter<Chain<Types> > (*chain);
+      chain = &StructAfter<Chain> (*chain);
     }
 
     return_trace (true);
@@ -561,51 +542,12 @@ struct mortmorx
 				 * 1 for mort, 2 or 3 for morx. */
   HBUINT32	chainCount;	/* Number of metamorphosis chains contained in this
 				 * table. */
-  Chain<Types>	chains[VAR];	/* Chains. */
+  Chain		chains[VAR];	/* Chains. */
 
   public:
   DEFINE_SIZE_MIN (8);
 };
 
-struct MortTypes
-{
-  static const bool extended = false;
-  typedef HBUINT16 HBUINT;
-  typedef HBUINT8 HBUSHORT;
-  struct ClassType : ClassTable
-  {
-    inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs HB_UNUSED) const
-    {
-      return ClassTable::get_class (glyph_id);
-    }
-  };
-};
-struct MorxTypes
-{
-  static const bool extended = true;
-  typedef HBUINT32 HBUINT;
-  typedef HBUINT16 HBUSHORT;
-  struct ClassType : Lookup<HBUINT16>
-  {
-    inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
-    {
-      const HBUINT16 *v = get_value (glyph_id, num_glyphs);
-      return v ? *v : 1;
-    }
-  };
-};
-
-struct mort : mortmorx<MortTypes>
-{
-  static const hb_tag_t tableTag	= HB_AAT_TAG_MORT;
-};
-
-struct morx : mortmorx<MorxTypes>
-{
-  static const hb_tag_t tableTag	= HB_AAT_TAG_MORX;
-};
-
-
 } /* namespace AAT */
 
 


More information about the HarfBuzz mailing list