summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2018-02-25 16:32:17 -0800
committerBehdad Esfahbod <behdad@behdad.org>2018-02-25 16:32:17 -0800
commit551fa2d200a06d00d054f2c8e7aad1cb4d25249b (patch)
tree49ec988684b09cf91e6a1924af55f0d471e18991
parent05699fd996ed9c0e5dde8918388ac188e58df1a7 (diff)
[BASE] MinorBASE
-rw-r--r--src/Makefile.sources1
-rw-r--r--src/hb-ot-base.cc58
-rw-r--r--src/hb-ot-layout-base-table.hh103
-rw-r--r--src/hb-ot-layout.cc34
-rw-r--r--src/hb-ot-layout.h1
5 files changed, 105 insertions, 92 deletions
diff --git a/src/Makefile.sources b/src/Makefile.sources
index cecd6447..49685008 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -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
index 27e0b208..00000000
--- a/src/hb-ot-base.cc
+++ /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);
-}
diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh
index 78018604..169a13f3 100644
--- a/src/hb-ot-layout-base-table.hh
+++ b/src/hb-ot-layout-base-table.hh
@@ -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);
};
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 68eb125d..3a133212 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -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
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index 9861f0fc..077644c5 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -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')