Commit 19146a5302a47ee8430a00bfa8c2acaf9539d6a2

Werner Lemberg 2015-01-31T11:01:33

[autofit] Add support for Thai script. Thanks to Ben Mitchell <ben@rosettatype.com> for guidance with blue zone characters! * src/autofit/afblue.dat: Add blue zone data for Thai. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Thai standard characters. * src/autofit/afranges.c: Add Thai data. * src/autofit/afstyles.h: Add Thai data.

diff --git a/ChangeLog b/ChangeLog
index 8229981..15cc4c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2015-01-31  Werner Lemberg  <wl@gnu.org>
+
+	[autofit] Add support for Thai script.
+
+	Thanks to Ben Mitchell <ben@rosettatype.com> for guidance with blue
+	zone characters!
+
+	* src/autofit/afblue.dat: Add blue zone data for Thai.
+
+	* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
+
+	* src/autofit/afscript.h: Add Thai standard characters.
+
+	* src/autofit/afranges.c: Add Thai data.
+
+	* src/autofit/afstyles.h: Add Thai data.
+
 2015-01-23  Behdad Esfahbod  <behdad@behdad.org>
 
 	[raster] Handle `FT_RASTER_FLAG_AA' correctly.
diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c
index 03c276c..1f9869f 100644
--- a/src/autofit/afblue.c
+++ b/src/autofit/afblue.c
@@ -71,6 +71,20 @@
     '\xE0', '\xB0', '\x87', '\xE0', '\xB0', '\x8C', '\xE0', '\xB0', '\x99', '\xE0', '\xB0', '\x9E', '\xE0', '\xB0', '\xA3', '\xE0', '\xB0', '\xB1', '\xE0', '\xB1', '\xAF',  /* ఇ ఌ ఙ ఞ ణ ఱ ౯ */
     '\0',
     '\xE0', '\xB0', '\x85', '\xE0', '\xB0', '\x95', '\xE0', '\xB0', '\x9A', '\xE0', '\xB0', '\xB0', '\xE0', '\xB0', '\xBD', '\xE0', '\xB1', '\xA8', '\xE0', '\xB1', '\xAC',  /* అ క చ ర ఽ ౨ ౬ */
+    '\0',
+    '\xE0', '\xB8', '\x9A', '\xE0', '\xB9', '\x80', '\xE0', '\xB9', '\x81', '\xE0', '\xB8', '\xAD', '\xE0', '\xB8', '\x81', '\xE0', '\xB8', '\xB2',  /* บ เ แ อ ก า */
+    '\0',
+    '\xE0', '\xB8', '\x9A', '\xE0', '\xB8', '\x9B', '\xE0', '\xB8', '\xA9', '\xE0', '\xB8', '\xAF', '\xE0', '\xB8', '\xAD', '\xE0', '\xB8', '\xA2', '\xE0', '\xB8', '\xAE',  /* บ ป ษ ฯ อ ย ฮ */
+    '\0',
+    '\xE0', '\xB8', '\x9B', '\xE0', '\xB8', '\x9D', '\xE0', '\xB8', '\x9F',  /* ป ฝ ฟ */
+    '\0',
+    '\xE0', '\xB9', '\x82', '\xE0', '\xB9', '\x83', '\xE0', '\xB9', '\x84',  /* โ ใ ไ */
+    '\0',
+    '\xE0', '\xB8', '\x8E', '\xE0', '\xB8', '\x8F', '\xE0', '\xB8', '\xA4', '\xE0', '\xB8', '\xA6',  /* ฎ ฏ ฤ ฦ */
+    '\0',
+    '\xE0', '\xB8', '\x8D', '\xE0', '\xB8', '\x90',  /* ญ ฐ */
+    '\0',
+    '\xE0', '\xB9', '\x90', '\xE0', '\xB9', '\x91', '\xE0', '\xB9', '\x93',  /* ๐ ๑ ๓ */
 #ifdef AF_CONFIG_OPTION_CJK
     '\0',
     '\xE4', '\xBB', '\x96', '\xE4', '\xBB', '\xAC', '\xE4', '\xBD', '\xA0', '\xE4', '\xBE', '\x86', '\xE5', '\x80', '\x91', '\xE5', '\x88', '\xB0', '\xE5', '\x92', '\x8C', '\xE5', '\x9C', '\xB0',  /* 他们你來們到和地 */
@@ -160,6 +174,15 @@
     { AF_BLUE_STRING_TELUGU_TOP,    AF_BLUE_PROPERTY_LATIN_TOP },
     { AF_BLUE_STRING_TELUGU_BOTTOM, 0                          },
     { AF_BLUE_STRING_MAX,           0                          },
+    { AF_BLUE_STRING_THAI_TOP,             AF_BLUE_PROPERTY_LATIN_TOP      |
+                                           AF_BLUE_PROPERTY_LATIN_X_HEIGHT   },
+    { AF_BLUE_STRING_THAI_BOTTOM,          0                                 },
+    { AF_BLUE_STRING_THAI_ASCENDER,        AF_BLUE_PROPERTY_LATIN_TOP        },
+    { AF_BLUE_STRING_THAI_LARGE_ASCENDER,  AF_BLUE_PROPERTY_LATIN_TOP        },
+    { AF_BLUE_STRING_THAI_DESCENDER,       0                                 },
+    { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0                                 },
+    { AF_BLUE_STRING_THAI_DIGIT_TOP,       0                                 },
+    { AF_BLUE_STRING_MAX,                  0                                 },
 #ifdef AF_CONFIG_OPTION_CJK
     { AF_BLUE_STRING_CJK_TOP,    AF_BLUE_PROPERTY_CJK_TOP     },
     { AF_BLUE_STRING_CJK_BOTTOM, 0                            },
diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat
index 4d811a4..4c35b22 100644
--- a/src/autofit/afblue.dat
+++ b/src/autofit/afblue.dat
@@ -123,10 +123,25 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
   // this is just for convenience to simplify reading
   AF_BLUE_STRING_TELUGU_TOP
     "ఇ ఌ ఙ ఞ ణ ఱ ౯"
-
   AF_BLUE_STRING_TELUGU_BOTTOM
     "అ క చ ర ఽ ౨ ౬"
 
+  AF_BLUE_STRING_THAI_TOP
+    "บ เ แ อ ก า"
+  AF_BLUE_STRING_THAI_BOTTOM
+    "บ ป ษ ฯ อ ย ฮ"
+  AF_BLUE_STRING_THAI_ASCENDER
+    "ป ฝ ฟ"
+  AF_BLUE_STRING_THAI_LARGE_ASCENDER
+    "โ ใ ไ"
+  AF_BLUE_STRING_THAI_DESCENDER
+    "ฎ ฏ ฤ ฦ"
+  AF_BLUE_STRING_THAI_LARGE_DESCENDER
+    "ญ ฐ"
+  AF_BLUE_STRING_THAI_DIGIT_TOP
+    "๐ ๑ ๓"
+
+
 #ifdef AF_CONFIG_OPTION_CJK
 
   AF_BLUE_STRING_CJK_TOP
@@ -319,6 +334,18 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
     { AF_BLUE_STRING_TELUGU_BOTTOM, 0                          }
     { AF_BLUE_STRING_MAX,           0                          }
 
+  AF_BLUE_STRINGSET_THAI
+    { AF_BLUE_STRING_THAI_TOP,             AF_BLUE_PROPERTY_LATIN_TOP      |
+                                           AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
+    { AF_BLUE_STRING_THAI_BOTTOM,          0                                 }
+    { AF_BLUE_STRING_THAI_ASCENDER,        AF_BLUE_PROPERTY_LATIN_TOP        }
+    { AF_BLUE_STRING_THAI_LARGE_ASCENDER,  AF_BLUE_PROPERTY_LATIN_TOP        }
+    { AF_BLUE_STRING_THAI_DESCENDER,       0                                 }
+    { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0                                 }
+    { AF_BLUE_STRING_THAI_DIGIT_TOP,       0                                 }
+    { AF_BLUE_STRING_MAX,                  0                                 }
+
+
 #ifdef AF_CONFIG_OPTION_CJK
 
   AF_BLUE_STRINGSET_HANI
diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h
index 6119266..6a3f12a 100644
--- a/src/autofit/afblue.h
+++ b/src/autofit/afblue.h
@@ -97,7 +97,14 @@ FT_BEGIN_HEADER
     AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 290,
     AF_BLUE_STRING_TELUGU_TOP = 296,
     AF_BLUE_STRING_TELUGU_BOTTOM = 318,
-    af_blue_1_1 = 339,
+    AF_BLUE_STRING_THAI_TOP = 340,
+    AF_BLUE_STRING_THAI_BOTTOM = 359,
+    AF_BLUE_STRING_THAI_ASCENDER = 381,
+    AF_BLUE_STRING_THAI_LARGE_ASCENDER = 391,
+    AF_BLUE_STRING_THAI_DESCENDER = 401,
+    AF_BLUE_STRING_THAI_LARGE_DESCENDER = 414,
+    AF_BLUE_STRING_THAI_DIGIT_TOP = 421,
+    af_blue_1_1 = 430,
 #ifdef AF_CONFIG_OPTION_CJK
     AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1,
     AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 153,
@@ -148,7 +155,7 @@ FT_BEGIN_HEADER
 #define AF_BLUE_PROPERTY_CJK_RIGHT  AF_BLUE_PROPERTY_CJK_TOP
 
 
-#define AF_BLUE_STRINGSET_MAX_LEN  7
+#define AF_BLUE_STRINGSET_MAX_LEN  8
 
   /* The AF_Blue_Stringset enumeration values are offsets into the */
   /* `af_blue_stringsets' array.                                   */
@@ -161,7 +168,8 @@ FT_BEGIN_HEADER
     AF_BLUE_STRINGSET_HEBR = 19,
     AF_BLUE_STRINGSET_LATN = 23,
     AF_BLUE_STRINGSET_TELU = 30,
-    af_blue_2_1 = 33,
+    AF_BLUE_STRINGSET_THAI = 33,
+    af_blue_2_1 = 41,
 #ifdef AF_CONFIG_OPTION_CJK
     AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
     af_blue_2_1_1 = af_blue_2_1 + 2,
diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c
index 45fdc50..15837b4 100644
--- a/src/autofit/afranges.c
+++ b/src/autofit/afranges.c
@@ -98,6 +98,12 @@
     AF_UNIRANGE_REC(       0UL,       0UL )
   };
 
+  const AF_Script_UniRangeRec  af_thai_uniranges[] =
+  {
+    AF_UNIRANGE_REC(  0x0E00UL,  0x0E7FUL ),  /* Thai */
+    AF_UNIRANGE_REC(       0UL,       0UL )
+  };
+
 #ifdef AF_CONFIG_OPTION_INDIC
 
   const AF_Script_UniRangeRec  af_beng_uniranges[] =
diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h
index 79f9b7b..362c75e 100644
--- a/src/autofit/afscript.h
+++ b/src/autofit/afscript.h
@@ -62,6 +62,11 @@
           HB_SCRIPT_TELUGU,
           0xC66, 0xC67, 0x0 ) /* ౦ ౧ */
 
+  SCRIPT( thai, THAI,
+          "Thai",
+          HB_SCRIPT_THAI,
+          0xE32, 0xE45, 0xE50 ) /* า ๅ ๐ */
+
 #ifdef AF_CONFIG_OPTION_INDIC
 
   SCRIPT( beng, BENG,
diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h
index 20e721c..a65b429 100644
--- a/src/autofit/afstyles.h
+++ b/src/autofit/afstyles.h
@@ -122,6 +122,13 @@
          AF_BLUE_STRINGSET_TELU,
          AF_COVERAGE_DEFAULT )
 
+  STYLE( thai_dflt, THAI_DFLT,
+         "Thai default style",
+         AF_WRITING_SYSTEM_LATIN,
+         AF_SCRIPT_THAI,
+         AF_BLUE_STRINGSET_THAI,
+         AF_COVERAGE_DEFAULT )
+
 #ifdef AF_CONFIG_OPTION_INDIC
 
   /* no blue stringset support for the Indic writing system yet */