summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-common.h
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-01-24 19:41:33 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-01-25 08:41:05 +0100
commit3de9bc9cb1dc96ea803e6190de9b6fb6fe00e307 (patch)
treeb0754571e5efd71440ecdbd6bea9f1f7c82b6d3e /src/3rdparty/harfbuzz-ng/src/hb-common.h
parent3c1e16df757888988498a92146ac35ceba83dabf (diff)
Update bundled HarfBuzz-NG to 0.9.38
Most important changes: * Fixes for Arabic, Hangul, Hebrew, Indic, Mandaic, Myanmar, and New Tai Lue shapers. * Fixed out-of-bounds access in Indic shaper. * Build and stability fixes, various optimizations. Change-Id: I4f0e32c017f62fe576bee41a430d3da6d571de80 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-common.h')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-common.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-common.h b/src/3rdparty/harfbuzz-ng/src/hb-common.h
index b24cbb33ba..b6ce3f724d 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-common.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-common.h
@@ -95,6 +95,7 @@ typedef uint32_t hb_tag_t;
#define HB_TAG_NONE HB_TAG(0,0,0,0)
#define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff)
+#define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff)
/* len=-1 means str is NUL-terminated. */
hb_tag_t
@@ -122,12 +123,13 @@ hb_direction_from_string (const char *str, int len);
const char *
hb_direction_to_string (hb_direction_t direction);
+#define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4)
+/* Direction must be valid for the following */
#define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4)
#define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6)
#define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4)
#define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5)
-#define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4)
-#define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)) ^ 1)) /* Direction must be valid */
+#define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)) ^ 1))
/* hb_language_t */
@@ -295,11 +297,17 @@ typedef enum
/*7.0*/ HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'),
/* No script set. */
- /*---*/ HB_SCRIPT_INVALID = HB_TAG_NONE,
-
- /* Dummy value to ensure any hb_tag_t value can be passed/stored as hb_script_t
- * without risking undefined behavior. */
- /*---*/ _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX
+ HB_SCRIPT_INVALID = HB_TAG_NONE,
+
+ /* Dummy values to ensure any hb_tag_t value can be passed/stored as hb_script_t
+ * without risking undefined behavior. Include both a signed and unsigned max,
+ * since technically enums are int, and indeed, hb_script_t ends up being signed.
+ * See this thread for technicalities:
+ *
+ * http://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html
+ */
+ _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/
+ _HB_SCRIPT_MAX_VALUE_SIGNED = HB_TAG_MAX_SIGNED /*< skip >*/
} hb_script_t;
@@ -309,7 +317,7 @@ typedef enum
hb_script_t
hb_script_from_iso15924_tag (hb_tag_t tag);
-/* suger for tag_from_string() then script_from_iso15924_tag */
+/* sugar for tag_from_string() then script_from_iso15924_tag */
/* len=-1 means s is NUL-terminated */
hb_script_t
hb_script_from_string (const char *s, int len);