[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Sep 9 12:55:51 PDT 2013


 src/Makefile.am                |    1 
 src/hb-ot-head-table.hh        |    2 
 src/hb-ot-hhea-table.hh        |    2 
 src/hb-ot-hmtx-table.hh        |    2 
 src/hb-ot-layout-gdef-table.hh |    2 
 src/hb-ot-layout-gpos-table.hh |    2 
 src/hb-ot-layout-gsub-table.hh |    2 
 src/hb-ot-layout-jstf-table.hh |  229 +++++++++++++++++++++++++++++++++++++++++
 src/hb-ot-layout.cc            |    1 
 src/hb-ot-layout.h             |    1 
 src/hb-ot-maxp-table.hh        |    2 
 src/hb-ot-name-table.hh        |    2 
 src/main.cc                    |    2 
 13 files changed, 241 insertions(+), 9 deletions(-)

New commits:
commit 6c48f20eea22c6e686416ab4ec8388be3e8cd0b5
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Sep 9 15:43:10 2013 -0400

    [otlayout] Add structs for JSTF table

diff --git a/src/Makefile.am b/src/Makefile.am
index f5d8cf4..728d2f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -83,6 +83,7 @@ HBSOURCES += \
 	hb-ot-layout-gpos-table.hh \
 	hb-ot-layout-gsubgpos-private.hh \
 	hb-ot-layout-gsub-table.hh \
+	hb-ot-layout-jstf-table.hh \
 	hb-ot-layout-private.hh \
 	hb-ot-map.cc \
 	hb-ot-map-private.hh \
diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh
index 3a94512..0285f0c 100644
--- a/src/hb-ot-head-table.hh
+++ b/src/hb-ot-head-table.hh
@@ -43,7 +43,7 @@ namespace OT {
 
 struct head
 {
-  static const hb_tag_t Tag	= HB_OT_TAG_head;
+  static const hb_tag_t tableTag	= HB_OT_TAG_head;
 
   inline unsigned int get_upem (void) const {
     unsigned int upem = unitsPerEm;
diff --git a/src/hb-ot-hhea-table.hh b/src/hb-ot-hhea-table.hh
index 2b89c4e..611de8a 100644
--- a/src/hb-ot-hhea-table.hh
+++ b/src/hb-ot-hhea-table.hh
@@ -42,7 +42,7 @@ namespace OT {
 
 struct hhea
 {
-  static const hb_tag_t Tag	= HB_OT_TAG_hhea;
+  static const hb_tag_t tableTag	= HB_OT_TAG_hhea;
 
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE (this);
diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh
index b94337d..d107cf9 100644
--- a/src/hb-ot-hmtx-table.hh
+++ b/src/hb-ot-hmtx-table.hh
@@ -50,7 +50,7 @@ struct LongHorMetric
 
 struct hmtx
 {
-  static const hb_tag_t Tag	= HB_OT_TAG_hmtx;
+  static const hb_tag_t tableTag	= HB_OT_TAG_hmtx;
 
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE (this);
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index ff2d09c..d2fd875 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -324,7 +324,7 @@ struct MarkGlyphSets
 
 struct GDEF
 {
-  static const hb_tag_t Tag	= HB_OT_TAG_GDEF;
+  static const hb_tag_t tableTag	= HB_OT_TAG_GDEF;
 
   enum GlyphClasses {
     UnclassifiedGlyph	= 0,
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 2cf90b7..05a6f5e 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1505,7 +1505,7 @@ typedef OffsetListOf<PosLookup> PosLookupList;
 
 struct GPOS : GSUBGPOS
 {
-  static const hb_tag_t Tag	= HB_OT_TAG_GPOS;
+  static const hb_tag_t tableTag	= HB_OT_TAG_GPOS;
 
   inline const PosLookup& get_lookup (unsigned int i) const
   { return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 6ab1a2b..fefc71e 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -1351,7 +1351,7 @@ typedef OffsetListOf<SubstLookup> SubstLookupList;
 
 struct GSUB : GSUBGPOS
 {
-  static const hb_tag_t Tag	= HB_OT_TAG_GSUB;
+  static const hb_tag_t tableTag	= HB_OT_TAG_GSUB;
 
   inline const SubstLookup& get_lookup (unsigned int i) const
   { return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); }
diff --git a/src/hb-ot-layout-jstf-table.hh b/src/hb-ot-layout-jstf-table.hh
new file mode 100644
index 0000000..79eb859
--- /dev/null
+++ b/src/hb-ot-layout-jstf-table.hh
@@ -0,0 +1,229 @@
+/*
+ * Copyright © 2013  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_LAYOUT_JSTF_TABLE_HH
+#define HB_OT_LAYOUT_JSTF_TABLE_HH
+
+#include "hb-open-type-private.hh"
+#include "hb-ot-layout-gpos-table.hh"
+
+
+namespace OT {
+
+
+/*
+ * JstfModList -- Justification Modification List Tables
+ */
+
+typedef IndexArray JstfModList;
+
+
+/*
+ * JstfMax -- Justification Maximum Table
+ */
+
+typedef OffsetListOf<PosLookup> JstfMax;
+
+
+/*
+ * JstfPriority -- Justification Priority Table
+ */
+
+struct JstfPriority
+{
+  inline bool sanitize (hb_sanitize_context_t *c) {
+    TRACE_SANITIZE (this);
+    return TRACE_RETURN (c->check_struct (this) &&
+			 shrinkageEnableGSUB.sanitize (c, this) &&
+			 shrinkageDisableGSUB.sanitize (c, this) &&
+			 shrinkageEnableGPOS.sanitize (c, this) &&
+			 shrinkageDisableGPOS.sanitize (c, this) &&
+			 shrinkageJstfMax.sanitize (c, this) &&
+			 extensionEnableGSUB.sanitize (c, this) &&
+			 extensionDisableGSUB.sanitize (c, this) &&
+			 extensionEnableGPOS.sanitize (c, this) &&
+			 extensionDisableGPOS.sanitize (c, this) &&
+			 extensionJstfMax.sanitize (c, this));
+  }
+
+  protected:
+  OffsetTo<JstfModList>
+		shrinkageEnableGSUB;	/* Offset to Shrinkage Enable GSUB
+					 * JstfModList table--from beginning of
+					 * JstfPriority table--may be NULL */
+  OffsetTo<JstfModList>
+		shrinkageDisableGSUB;	/* Offset to Shrinkage Disable GSUB
+					 * JstfModList table--from beginning of
+					 * JstfPriority table--may be NULL */
+  OffsetTo<JstfModList>
+		shrinkageEnableGPOS;	/* Offset to Shrinkage Enable GPOS
+					 * JstfModList table--from beginning of
+					 * JstfPriority table--may be NULL */
+  OffsetTo<JstfModList>
+		shrinkageDisableGPOS;	/* Offset to Shrinkage Disable GPOS
+					 * JstfModList table--from beginning of
+					 * JstfPriority table--may be NULL */
+  OffsetTo<JstfMax>
+		shrinkageJstfMax;	/* Offset to Shrinkage JstfMax table--
+					 * from beginning of JstfPriority table
+					 * --may be NULL */
+  OffsetTo<JstfModList>
+		extensionEnableGSUB;	/* Offset to Extension Enable GSUB
+					 * JstfModList table--from beginning of
+					 * JstfPriority table--may be NULL */
+  OffsetTo<JstfModList>
+		extensionDisableGSUB;	/* Offset to Extension Disable GSUB
+					 * JstfModList table--from beginning of
+					 * JstfPriority table--may be NULL */
+  OffsetTo<JstfModList>
+		extensionEnableGPOS;	/* Offset to Extension Enable GPOS
+					 * JstfModList table--from beginning of
+					 * JstfPriority table--may be NULL */
+  OffsetTo<JstfModList>
+		extensionDisableGPOS;	/* Offset to Extension Disable GPOS
+					 * JstfModList table--from beginning of
+					 * JstfPriority table--may be NULL */
+  OffsetTo<JstfMax>
+		extensionJstfMax;	/* Offset to Extension JstfMax table--
+					 * from beginning of JstfPriority table
+					 * --may be NULL */
+
+  public:
+  DEFINE_SIZE_STATIC (20);
+};
+
+
+/*
+ * JstfLangSys -- Justification Language System Table
+ */
+
+struct JstfLangSys : OffsetListOf<JstfPriority>
+{
+  inline bool sanitize (hb_sanitize_context_t *c,
+			const Record<JstfLangSys>::sanitize_closure_t * = NULL) {
+    TRACE_SANITIZE (this);
+    return TRACE_RETURN (OffsetListOf<JstfPriority>::sanitize (c));
+  }
+};
+
+
+/*
+ * ExtenderGlyphs -- Extender Glyph Table
+ */
+
+typedef SortedArrayOf<GlyphID> ExtenderGlyphs;
+
+
+/*
+ * JstfScript -- The Justification Table
+ */
+
+struct JstfScript
+{
+  inline unsigned int get_lang_sys_count (void) const
+  { return langSys.len; }
+  inline const Tag& get_lang_sys_tag (unsigned int i) const
+  { return langSys.get_tag (i); }
+  inline unsigned int get_lang_sys_tags (unsigned int start_offset,
+					 unsigned int *lang_sys_count /* IN/OUT */,
+					 hb_tag_t     *lang_sys_tags /* OUT */) const
+  { return langSys.get_tags (start_offset, lang_sys_count, lang_sys_tags); }
+  inline const JstfLangSys& get_lang_sys (unsigned int i) const
+  {
+    if (i == Index::NOT_FOUND_INDEX) return get_default_lang_sys ();
+    return this+langSys[i].offset;
+  }
+  inline bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const
+  { return langSys.find_index (tag, index); }
+
+  inline bool has_default_lang_sys (void) const { return defaultLangSys != 0; }
+  inline const JstfLangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
+
+  inline bool sanitize (hb_sanitize_context_t *c,
+			const Record<JstfScript>::sanitize_closure_t * = NULL) {
+    TRACE_SANITIZE (this);
+    return TRACE_RETURN (extenderGlyphs.sanitize (c, this) &&
+			 defaultLangSys.sanitize (c, this) &&
+			 langSys.sanitize (c, this));
+  }
+
+  protected:
+  OffsetTo<ExtenderGlyphs>
+		extenderGlyphs;	/* Offset to ExtenderGlyph table--from beginning
+				 * of JstfScript table-may be NULL */
+  OffsetTo<JstfLangSys>
+		defaultLangSys;	/* Offset to DefaultJstfLangSys table--from
+				 * beginning of JstfScript table--may be Null */
+  RecordArrayOf<JstfLangSys>
+		langSys;	/* Array of JstfLangSysRecords--listed
+				 * alphabetically by LangSysTag */
+  public:
+  DEFINE_SIZE_ARRAY (6, langSys);
+};
+
+
+/*
+ * JSTF -- The Justification Table
+ */
+
+struct JSTF
+{
+  static const hb_tag_t tableTag	= HB_OT_TAG_JSTF;
+
+  inline unsigned int get_script_count (void) const
+  { return scriptList.len; }
+  inline const Tag& get_script_tag (unsigned int i) const
+  { return scriptList.get_tag (i); }
+  inline unsigned int get_script_tags (unsigned int start_offset,
+				       unsigned int *script_count /* IN/OUT */,
+				       hb_tag_t     *script_tags /* OUT */) const
+  { return scriptList.get_tags (start_offset, script_count, script_tags); }
+  inline const JstfScript& get_script (unsigned int i) const
+  { return this+scriptList[i].offset; }
+  inline bool find_script_index (hb_tag_t tag, unsigned int *index) const
+  { return scriptList.find_index (tag, index); }
+
+  inline bool sanitize (hb_sanitize_context_t *c) {
+    TRACE_SANITIZE (this);
+    return TRACE_RETURN (version.sanitize (c) && likely (version.major == 1) &&
+			 scriptList.sanitize (c, this));
+  }
+
+  protected:
+  FixedVersion	version;	/* Version of the JSTF table--initially set
+				 * to 0x00010000 */
+  RecordArrayOf<JstfScript>
+		scriptList;  	/* Array of JstfScripts--listed
+				 * alphabetically by ScriptTag */
+  public:
+  DEFINE_SIZE_ARRAY (6, scriptList);
+};
+
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_LAYOUT_JSTF_TABLE_HH */
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 520deff..80d92b4 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -33,6 +33,7 @@
 #include "hb-ot-layout-gdef-table.hh"
 #include "hb-ot-layout-gsub-table.hh"
 #include "hb-ot-layout-gpos-table.hh"
+#include "hb-ot-layout-jstf-table.hh"
 
 #include "hb-ot-map-private.hh"
 
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index 134f1a6..d2a314c 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -41,6 +41,7 @@ HB_BEGIN_DECLS
 #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F')
 #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B')
 #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S')
+#define HB_OT_TAG_JSTF HB_TAG('J','S','T','F')
 
 
 /*
diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh
index 0ce3ebc..e6d2555 100644
--- a/src/hb-ot-maxp-table.hh
+++ b/src/hb-ot-maxp-table.hh
@@ -41,7 +41,7 @@ namespace OT {
 
 struct maxp
 {
-  static const hb_tag_t Tag	= HB_OT_TAG_maxp;
+  static const hb_tag_t tableTag	= HB_OT_TAG_maxp;
 
   inline unsigned int get_num_glyphs (void) const {
     return numGlyphs;
diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh
index e36b0f7..07dc056 100644
--- a/src/hb-ot-name-table.hh
+++ b/src/hb-ot-name-table.hh
@@ -74,7 +74,7 @@ struct NameRecord
 
 struct name
 {
-  static const hb_tag_t Tag	= HB_OT_TAG_name;
+  static const hb_tag_t tableTag	= HB_OT_TAG_name;
 
   inline unsigned int get_name (unsigned int platform_id,
 				unsigned int encoding_id,
diff --git a/src/main.cc b/src/main.cc
index b362744..ff75237 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -170,7 +170,7 @@ main (int argc, char **argv)
 	}
 	break;
 
-      case GDEF::Tag:
+      case GDEF::tableTag:
 	{
 
 	const GDEF &gdef = *CastP<GDEF> (font_data + table.offset);



More information about the HarfBuzz mailing list