[BASE] Minor
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 26 Feb 2018 00:32:17 +0000 (16:32 -0800)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 26 Feb 2018 00:32:17 +0000 (16:32 -0800)
src/Makefile.sources
src/hb-ot-base.cc [deleted file]
src/hb-ot-layout-base-table.hh
src/hb-ot-layout.cc
src/hb-ot-layout.h

index cecd644..4968500 100644 (file)
@@ -87,7 +87,6 @@ HB_OT_sources = \
        hb-aat-layout-kerx-table.hh \
        hb-aat-layout-trak-table.hh \
        hb-aat-layout-private.hh \
-       hb-ot-base.cc \
        hb-ot-font.cc \
        hb-ot-layout.cc \
        hb-ot-layout-base-table.hh \
diff --git a/src/hb-ot-base.cc b/src/hb-ot-base.cc
deleted file mode 100644 (file)
index 27e0b20..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright © 2017 Elie Roux<elie.roux@telecom-bretagne.eu>
- *
- *  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.
- *
- */
-
-#include "hb-open-type-private.hh"
-
-#include "hb-ot-layout-private.hh"
-#include "hb-ot-layout-base-table.hh"
-
-static inline const OT::BASE&
-_get_base (hb_face_t *face)
-{
-  if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::BASE);
-  hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
-  return *(layout->base.get ());
-}
-
-/*
- * OT::BASE
- */
-
-/**
- * hb_ot_base_has_data:
- * @face: #hb_face_t to test
- *
- * This function allows to verify the presence of an OpenType BASE table on the
- * face.
- *
- * Return value: true if face has a BASE table, false otherwise
- *
- * Since: XXX
- **/
-hb_bool_t
-hb_ot_base_has_data (hb_face_t *face)
-{
-  return &_get_base (face) != &OT::Null(OT::BASE);
-}
index 7801860..169a13f 100644 (file)
@@ -221,40 +221,39 @@ struct MinMax {
 
 };
 
-struct BaseLangSysRecord {
-
+struct BaseLangSysRecord
+{
   inline Tag get_tag(void) const
   { return baseLangSysTag; }
 
   inline unsigned int get_feature_tag_index (Tag featureTableTag) const
-  { (this+minMax).get_feature_tag_index(featureTableTag); }
+  { return (this+minMax).get_feature_tag_index(featureTableTag); }
 
   inline HBINT16 get_min_value (unsigned int featureTableTagIndex) const
-  { (this+minMax).get_min_value(featureTableTagIndex); }
+  { return (this+minMax).get_min_value(featureTableTagIndex); }
 
   inline HBINT16 get_max_value (unsigned int featureTableTagIndex) const
-  { (this+minMax).get_max_value(featureTableTagIndex); }
+  { return (this+minMax).get_max_value(featureTableTagIndex); }
 
   inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
-      minMax != Null(OffsetTo<MinMax>) &&
-      minMax.sanitize (c, base));
+                 minMax != Null(OffsetTo<MinMax>) &&
+                 minMax.sanitize (c, base));
   }
 
   protected:
-  Tag               baseLangSysTag;
-  OffsetTo<MinMax>  minMax; // not supposed to be NULL
-
+  Tag                  baseLangSysTag;
+  OffsetTo<MinMax>     minMax;
   public:
-  DEFINE_SIZE_STATIC (6); 
+  DEFINE_SIZE_STATIC (6);
 
 };
 
-struct BaseValues {
-
-  inline const unsigned int get_default_base_tag_index (void) const
+struct BaseValues
+{
+  inline unsigned int get_default_base_tag_index (void) const
   { return defaultIndex; }
 
   inline HBINT16 get_base_coord (unsigned int baselineTagIndex) const
@@ -272,10 +271,9 @@ struct BaseValues {
   }
 
   protected:
-  Index                     defaultIndex;
-  HBUINT16                    baseCoordCount;
-  OffsetArrayOf<BaseCoord>  baseCoords;
-
+  Index                                defaultIndex;
+  HBUINT16                     baseCoordCount;
+  OffsetArrayOf<BaseCoord>     baseCoords;
   public:
   DEFINE_SIZE_ARRAY (6, baseCoords);
 
@@ -711,26 +709,66 @@ struct BASE
   inline unsigned int get_horiz_lang_tag_index (unsigned int baseScriptIndex, Tag baseLangSysTag) const
   { return u.format1_0.get_horiz_lang_tag_index(baseScriptIndex, baseLangSysTag); }
 
-  inline unsigned int get_horiz_feature_tag_index (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, Tag featureTableTag) const
-  { return u.format1_0.get_horiz_feature_tag_index(baseScriptIndex, baseLangSysIndex, featureTableTag); }
+  inline unsigned int get_horiz_feature_tag_index (unsigned int baseScriptIndex,
+                                                  unsigned int baseLangSysIndex,
+                                                  Tag featureTableTag) const
+  {
+    return u.format1_0.get_horiz_feature_tag_index (baseScriptIndex,
+                                                   baseLangSysIndex,
+                                                   featureTableTag);
+  }
 
-  inline HBINT16 get_horiz_max_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
-  { return u.format1_0.get_horiz_max_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex); }
+  inline HBINT16 get_horiz_max_value (unsigned int baseScriptIndex,
+                                     unsigned int baseLangSysIndex,
+                                     unsigned int featureTableTagIndex) const
+  {
+    return u.format1_0.get_horiz_max_value (baseScriptIndex,
+                                           baseLangSysIndex,
+                                           featureTableTagIndex);
+  }
 
-  inline HBINT16 get_horiz_min_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
-  { return u.format1_0.get_horiz_min_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex); }
+  inline HBINT16 get_horiz_min_value (unsigned int baseScriptIndex,
+                                     unsigned int baseLangSysIndex,
+                                     unsigned int featureTableTagIndex) const
+  {
+    return u.format1_0.get_horiz_min_value (baseScriptIndex,
+                                           baseLangSysIndex,
+                                           featureTableTagIndex);
+  }
 
-  inline unsigned int get_vert_lang_tag_index (unsigned int baseScriptIndex, Tag baseLangSysTag) const
-  { return u.format1_0.get_vert_lang_tag_index(baseScriptIndex, baseLangSysTag); }
+  inline unsigned int get_vert_lang_tag_index (unsigned int baseScriptIndex,
+                                              Tag baseLangSysTag) const
+  {
+    return u.format1_0.get_vert_lang_tag_index (baseScriptIndex,
+                                               baseLangSysTag);
+  }
 
-  inline unsigned int get_vert_feature_tag_index (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, Tag featureTableTag) const
-  { return u.format1_0.get_vert_feature_tag_index(baseScriptIndex, baseLangSysIndex, featureTableTag); }
+  inline unsigned int get_vert_feature_tag_index (unsigned int baseScriptIndex,
+                                                 unsigned int baseLangSysIndex,
+                                                 Tag featureTableTag) const
+  {
+    return u.format1_0.get_vert_feature_tag_index (baseScriptIndex,
+                                                  baseLangSysIndex,
+                                                  featureTableTag);
+  }
 
-  inline HBINT16 get_vert_max_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
-  { return u.format1_0.get_vert_max_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex); }
+  inline HBINT16 get_vert_max_value (unsigned int baseScriptIndex,
+                                    unsigned int baseLangSysIndex,
+                                    unsigned int featureTableTagIndex) const
+  {
+    return u.format1_0.get_vert_max_value (baseScriptIndex,
+                                          baseLangSysIndex,
+                                          featureTableTagIndex);
+  }
 
-  inline HBINT16 get_vert_min_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const
-  { return u.format1_0.get_vert_min_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex); }
+  inline HBINT16 get_vert_min_value (unsigned int baseScriptIndex,
+                                    unsigned int baseLangSysIndex,
+                                    unsigned int featureTableTagIndex) const
+  {
+    return u.format1_0.get_vert_min_value (baseScriptIndex,
+                                          baseLangSysIndex,
+                                          featureTableTagIndex);
+  }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -750,7 +788,6 @@ struct BASE
     BASEFormat1_0   format1_0;
     BASEFormat1_1   format1_1;
   } u;
-
   public:
   DEFINE_SIZE_UNION (4, version);
 };
index 68eb125..3a13321 100644 (file)
@@ -222,6 +222,14 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
   free (layout);
 }
 
+static inline const OT::BASE&
+_get_base (hb_face_t *face)
+{
+  if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::BASE);
+  hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+  return *(layout->base.get ());
+}
+
 static inline const OT::GDEF&
 _get_gdef (hb_face_t *face)
 {
@@ -1267,3 +1275,29 @@ hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c,
 {
   apply_string<GSUBProxy> (c, lookup, accel);
 }
+
+
+
+
+/*
+ * OT::BASE
+ */
+
+#if 0
+/**
+ * hb_ot_base_has_data:
+ * @face: #hb_face_t to test
+ *
+ * This function allows to verify the presence of an OpenType BASE table on the
+ * face.
+ *
+ * Return value: true if face has a BASE table, false otherwise
+ *
+ * Since: XXX
+ **/
+hb_bool_t
+hb_ot_base_has_data (hb_face_t *face)
+{
+  return &_get_base (face) != &OT::Null(OT::BASE);
+}
+#endif
index 9861f0f..077644c 100644 (file)
@@ -38,6 +38,7 @@
 HB_BEGIN_DECLS
 
 
+#define HB_OT_TAG_BASE HB_TAG('B','A','S','E')
 #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')