shithub: freetype+ttf2subf

Download patch

ref: d8324571f11f44776ee55c213d9503c367952dc1
parent: 459306220771533750ddc5b3fcbf2cc92b445c71
author: Werner Lemberg <[email protected]>
date: Thu Dec 19 10:45:24 EST 2013

[autofit] Factor scripts and uniranges out of writing system files.

* src/autofit/afranges.c, src/autofit/afranges.h: New files.

* src/autofit/afscript.h: Extend `SCRIPT' macro with more
parameters, taking data from the writing system files.

* src/autofit/aftypes.h: Updated.

* src/autofit/afglobal.c: Include `afranges.h'.
Load `afscript.h' to call AF_DEFINE_SCRIPT_CLASS.
* src/autofit/afglobal.c: Include `afranges.h'.
Load `afscript.h' to call AF_DECLARE_SCRIPT_CLASS.

* src/autofit/afcjk.c, src/autofit/afcjk.h: Updated.
* src/autofit/afdummy.c, src/autofit/afdummy.h: Updated.
* src/autofit/afindic.c, src/autofit/afindic.h: Updated.
* src/autofit/aflatin.c, src/autofit/aflatin.h: Updated.
* src/autofit/aflatn2.c, src/autofit/aflatn2.h: Updated.

* src/autofit/afpic.c: Updated.

* src/autofir/autofit.c: Include `afranges.c'.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afranges.c'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2013-12-19  Werner Lemberg  <[email protected]>
+
+	[autofit] Factor scripts and uniranges out of writing system files.
+
+	* src/autofit/afranges.c, src/autofit/afranges.h: New files.
+
+	* src/autofit/afscript.h: Extend `SCRIPT' macro with more
+	parameters, taking data from the writing system files.
+
+	* src/autofit/aftypes.h: Updated.
+
+	* src/autofit/afglobal.c: Include `afranges.h'.
+	Load `afscript.h' to call AF_DEFINE_SCRIPT_CLASS.
+	* src/autofit/afglobal.c: Include `afranges.h'.
+	Load `afscript.h' to call AF_DECLARE_SCRIPT_CLASS.
+
+	* src/autofit/afcjk.c, src/autofit/afcjk.h: Updated.
+	* src/autofit/afdummy.c, src/autofit/afdummy.h: Updated.
+	* src/autofit/afindic.c, src/autofit/afindic.h: Updated.
+	* src/autofit/aflatin.c, src/autofit/aflatin.h: Updated.
+	* src/autofit/aflatn2.c, src/autofit/aflatn2.h: Updated.
+
+	* src/autofit/afpic.c: Updated.
+
+	* src/autofir/autofit.c: Include `afranges.c'.
+	* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afranges.c'.
+
 2013-12-18  Werner Lemberg  <[email protected]>
 
 	[autofit] More code orthogonality.
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -2223,51 +2223,9 @@
   )
 
 
-  /* this corresponds to Unicode 6.0 */
-
-  /* XXX: this should probably fine tuned to differentiate better between */
-  /*      scripts...                                                      */
-
-  static const AF_Script_UniRangeRec  af_hani_uniranges[] =
-  {
-    AF_UNIRANGE_REC(  0x1100UL,  0x11FFUL ),  /* Hangul Jamo                             */
-    AF_UNIRANGE_REC(  0x2E80UL,  0x2EFFUL ),  /* CJK Radicals Supplement                 */
-    AF_UNIRANGE_REC(  0x2F00UL,  0x2FDFUL ),  /* Kangxi Radicals                         */
-    AF_UNIRANGE_REC(  0x2FF0UL,  0x2FFFUL ),  /* Ideographic Description Characters      */
-    AF_UNIRANGE_REC(  0x3000UL,  0x303FUL ),  /* CJK Symbols and Punctuation             */
-    AF_UNIRANGE_REC(  0x3040UL,  0x309FUL ),  /* Hiragana                                */
-    AF_UNIRANGE_REC(  0x30A0UL,  0x30FFUL ),  /* Katakana                                */
-    AF_UNIRANGE_REC(  0x3100UL,  0x312FUL ),  /* Bopomofo                                */
-    AF_UNIRANGE_REC(  0x3130UL,  0x318FUL ),  /* Hangul Compatibility Jamo               */
-    AF_UNIRANGE_REC(  0x3190UL,  0x319FUL ),  /* Kanbun                                  */
-    AF_UNIRANGE_REC(  0x31A0UL,  0x31BFUL ),  /* Bopomofo Extended                       */
-    AF_UNIRANGE_REC(  0x31C0UL,  0x31EFUL ),  /* CJK Strokes                             */
-    AF_UNIRANGE_REC(  0x31F0UL,  0x31FFUL ),  /* Katakana Phonetic Extensions            */
-    AF_UNIRANGE_REC(  0x3200UL,  0x32FFUL ),  /* Enclosed CJK Letters and Months         */
-    AF_UNIRANGE_REC(  0x3300UL,  0x33FFUL ),  /* CJK Compatibility                       */
-    AF_UNIRANGE_REC(  0x3400UL,  0x4DBFUL ),  /* CJK Unified Ideographs Extension A      */
-    AF_UNIRANGE_REC(  0x4DC0UL,  0x4DFFUL ),  /* Yijing Hexagram Symbols                 */
-    AF_UNIRANGE_REC(  0x4E00UL,  0x9FFFUL ),  /* CJK Unified Ideographs                  */
-    AF_UNIRANGE_REC(  0xA960UL,  0xA97FUL ),  /* Hangul Jamo Extended-A                  */
-    AF_UNIRANGE_REC(  0xAC00UL,  0xD7AFUL ),  /* Hangul Syllables                        */
-    AF_UNIRANGE_REC(  0xD7B0UL,  0xD7FFUL ),  /* Hangul Jamo Extended-B                  */
-    AF_UNIRANGE_REC(  0xF900UL,  0xFAFFUL ),  /* CJK Compatibility Ideographs            */
-    AF_UNIRANGE_REC(  0xFE10UL,  0xFE1FUL ),  /* Vertical forms                          */
-    AF_UNIRANGE_REC(  0xFE30UL,  0xFE4FUL ),  /* CJK Compatibility Forms                 */
-    AF_UNIRANGE_REC(  0xFF00UL,  0xFFEFUL ),  /* Halfwidth and Fullwidth Forms           */
-    AF_UNIRANGE_REC( 0x1B000UL, 0x1B0FFUL ),  /* Kana Supplement                         */
-    AF_UNIRANGE_REC( 0x1D300UL, 0x1D35FUL ),  /* Tai Xuan Hing Symbols                   */
-    AF_UNIRANGE_REC( 0x1F200UL, 0x1F2FFUL ),  /* Enclosed Ideographic Supplement         */
-    AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ),  /* CJK Unified Ideographs Extension B      */
-    AF_UNIRANGE_REC( 0x2A700UL, 0x2B73FUL ),  /* CJK Unified Ideographs Extension C      */
-    AF_UNIRANGE_REC( 0x2B740UL, 0x2B81FUL ),  /* CJK Unified Ideographs Extension D      */
-    AF_UNIRANGE_REC( 0x2F800UL, 0x2FA1FUL ),  /* CJK Compatibility Ideographs Supplement */
-    AF_UNIRANGE_REC(       0UL,       0UL )
-  };
-
-
 #else /* !AF_CONFIG_OPTION_CJK */
 
+
   AF_DEFINE_WRITING_SYSTEM_CLASS(
     af_cjk_writing_system_class,
 
@@ -2284,24 +2242,7 @@
   )
 
 
-  static const AF_Script_UniRangeRec  af_hani_uniranges[] =
-  {
-    AF_UNIRANGE_REC( 0UL, 0UL )
-  };
-
 #endif /* !AF_CONFIG_OPTION_CJK */
-
-
-  AF_DEFINE_SCRIPT_CLASS(
-    af_hani_script_class,
-
-    AF_SCRIPT_HANI,
-    AF_BLUE_STRINGSET_HANI,
-    AF_WRITING_SYSTEM_CJK,
-
-    af_hani_uniranges,
-    0x7530 /* 田 */
-  )
 
 
 /* END */
--- a/src/autofit/afcjk.h
+++ b/src/autofit/afcjk.h
@@ -31,11 +31,6 @@
   AF_DECLARE_WRITING_SYSTEM_CLASS( af_cjk_writing_system_class )
 
 
-  /* the CJK-specific script classes */
-
-  AF_DECLARE_SCRIPT_CLASS( af_hani_script_class )
-
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
--- a/src/autofit/afdummy.c
+++ b/src/autofit/afdummy.c
@@ -68,16 +68,4 @@
   )
 
 
-  AF_DEFINE_SCRIPT_CLASS(
-    af_none_script_class,
-
-    AF_SCRIPT_NONE,
-    (AF_Blue_Stringset)0,
-    AF_WRITING_SYSTEM_DUMMY,
-
-    NULL,
-    '\0'
-  )
-
-
 /* END */
--- a/src/autofit/afdummy.h
+++ b/src/autofit/afdummy.h
@@ -31,8 +31,6 @@
 
   AF_DECLARE_WRITING_SYSTEM_CLASS( af_dummy_writing_system_class )
 
-  AF_DECLARE_SCRIPT_CLASS( af_none_script_class )
-
 /* */
 
 FT_END_HEADER
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -17,6 +17,7 @@
 
 
 #include "afglobal.h"
+#include "afranges.h"
 
   /* get writing system specific header files */
 #undef  WRITING_SYSTEM
@@ -44,7 +45,20 @@
 
 
 #undef  SCRIPT
-#define SCRIPT( s, S, d )             \
+#define SCRIPT( s, S, d, ss, ws, dc )  \
+          AF_DEFINE_SCRIPT_CLASS(      \
+            af_ ## s ## _script_class, \
+            AF_SCRIPT_ ## S,           \
+            ss,                        \
+            ws,                        \
+            af_ ## s ## _uniranges,    \
+            dc )
+
+#include "afscript.h"
+
+
+#undef  SCRIPT
+#define SCRIPT( s, S, d, ss, ws, dc ) \
           &af_ ## s ## _script_class,
 
   FT_LOCAL_ARRAY_DEF( AF_ScriptClass )
@@ -62,7 +76,7 @@
 #ifdef FT_DEBUG_LEVEL_TRACE
 
 #undef  SCRIPT
-#define SCRIPT( s, S, d )  #s,
+#define SCRIPT( s, S, d, ss, ws, dc )  #s,
 
   FT_LOCAL_ARRAY_DEF( char* )
   af_script_names[] =
--- a/src/autofit/afglobal.h
+++ b/src/autofit/afglobal.h
@@ -31,6 +31,12 @@
   FT_LOCAL_ARRAY( AF_WritingSystemClass )
   af_writing_system_classes[];
 
+#undef  SCRIPT
+#define SCRIPT( s, S, d, ss, ws, dc )                          \
+          AF_DECLARE_SCRIPT_CLASS( af_ ## s ## _script_class )
+
+#include "afscript.h"
+
   FT_LOCAL_ARRAY( AF_ScriptClass )
   af_script_classes[];
 
--- a/src/autofit/afindic.c
+++ b/src/autofit/afindic.c
@@ -112,24 +112,10 @@
     (AF_WritingSystem_ApplyHintsFunc)  af_indic_hints_apply
   )
 
-  /* XXX: this should probably fine tuned to differentiate better between */
-  /*      scripts...                                                      */
 
-  static const AF_Script_UniRangeRec  af_deva_uniranges[] =
-  {
-    AF_UNIRANGE_REC(  0x0900UL,  0x0DFFUL ),  /* Indic Range  */
-    AF_UNIRANGE_REC(  0x0F00UL,  0x0FFFUL ),  /* Tibetan      */
-    AF_UNIRANGE_REC(  0x1900UL,  0x194FUL ),  /* Limbu        */
-    AF_UNIRANGE_REC(  0x1B80UL,  0x1BBFUL ),  /* Sundanese    */
-    AF_UNIRANGE_REC(  0x1C80UL,  0x1CDFUL ),  /* Meetei Mayak */
-    AF_UNIRANGE_REC(  0xA800UL,  0xA82FUL ),  /* Syloti Nagri */
-    AF_UNIRANGE_REC( 0x11800UL, 0x118DFUL ),  /* Sharada      */
-    AF_UNIRANGE_REC(       0UL,       0UL )
-  };
-
-
 #else /* !AF_CONFIG_OPTION_INDIC */
 
+
   AF_DEFINE_WRITING_SYSTEM_CLASS(
     af_indic_writing_system_class,
 
@@ -146,24 +132,7 @@
   )
 
 
-  static const AF_Script_UniRangeRec  af_deva_uniranges[] =
-  {
-    AF_UNIRANGE_REC( 0UL, 0UL )
-  };
-
 #endif /* !AF_CONFIG_OPTION_INDIC */
-
-
-  AF_DEFINE_SCRIPT_CLASS(
-    af_deva_script_class,
-
-    AF_SCRIPT_DEVA,
-    (AF_Blue_Stringset)0, /* XXX */
-    AF_WRITING_SYSTEM_INDIC,
-
-    af_deva_uniranges,
-    'o' /* XXX */
-  )
 
 
 /* END */
--- a/src/autofit/afindic.h
+++ b/src/autofit/afindic.h
@@ -31,11 +31,6 @@
   AF_DECLARE_WRITING_SYSTEM_CLASS( af_indic_writing_system_class )
 
 
-  /* the indic-specific script classes */
-
-  AF_DECLARE_SCRIPT_CLASS( af_deva_script_class )
-
-
 /* */
 
 FT_END_HEADER
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -2722,103 +2722,4 @@
   )
 
 
-  /* XXX: this should probably fine tuned to differentiate better between */
-  /*      scripts...                                                      */
-
-  static const AF_Script_UniRangeRec  af_latn_uniranges[] =
-  {
-    AF_UNIRANGE_REC(  0x0020UL,  0x007FUL ),  /* Basic Latin (no control chars) */
-    AF_UNIRANGE_REC(  0x00A0UL,  0x00FFUL ),  /* Latin-1 Supplement (no control chars) */
-    AF_UNIRANGE_REC(  0x0100UL,  0x017FUL ),  /* Latin Extended-A */
-    AF_UNIRANGE_REC(  0x0180UL,  0x024FUL ),  /* Latin Extended-B */
-    AF_UNIRANGE_REC(  0x0250UL,  0x02AFUL ),  /* IPA Extensions */
-    AF_UNIRANGE_REC(  0x02B0UL,  0x02FFUL ),  /* Spacing Modifier Letters */
-    AF_UNIRANGE_REC(  0x0300UL,  0x036FUL ),  /* Combining Diacritical Marks */
-    AF_UNIRANGE_REC(  0x1D00UL,  0x1D7FUL ),  /* Phonetic Extensions */
-    AF_UNIRANGE_REC(  0x1D80UL,  0x1DBFUL ),  /* Phonetic Extensions Supplement */
-    AF_UNIRANGE_REC(  0x1DC0UL,  0x1DFFUL ),  /* Combining Diacritical Marks Supplement */
-    AF_UNIRANGE_REC(  0x1E00UL,  0x1EFFUL ),  /* Latin Extended Additional */
-    AF_UNIRANGE_REC(  0x2000UL,  0x206FUL ),  /* General Punctuation */
-    AF_UNIRANGE_REC(  0x2070UL,  0x209FUL ),  /* Superscripts and Subscripts */
-    AF_UNIRANGE_REC(  0x20A0UL,  0x20CFUL ),  /* Currency Symbols */
-    AF_UNIRANGE_REC(  0x2150UL,  0x218FUL ),  /* Number Forms */
-    AF_UNIRANGE_REC(  0x2460UL,  0x24FFUL ),  /* Enclosed Alphanumerics */
-    AF_UNIRANGE_REC(  0x2C60UL,  0x2C7FUL ),  /* Latin Extended-C */
-    AF_UNIRANGE_REC(  0x2E00UL,  0x2E7FUL ),  /* Supplemental Punctuation */
-    AF_UNIRANGE_REC(  0xA720UL,  0xA7FFUL ),  /* Latin Extended-D */
-    AF_UNIRANGE_REC(  0xFB00UL,  0xFB06UL ),  /* Alphab. Present. Forms (Latin Ligs) */
-    AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ),  /* Mathematical Alphanumeric Symbols */
-    AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ),  /* Enclosed Alphanumeric Supplement */
-    AF_UNIRANGE_REC(       0UL,       0UL )
-  };
-
-  static const AF_Script_UniRangeRec  af_grek_uniranges[] =
-  {
-    AF_UNIRANGE_REC(  0x0370UL,  0x03FFUL ),  /* Greek and Coptic */
-    AF_UNIRANGE_REC(  0x1F00UL,  0x1FFFUL ),  /* Greek Extended */
-    AF_UNIRANGE_REC(       0UL,       0UL )
-  };
-
-  static const AF_Script_UniRangeRec  af_cyrl_uniranges[] =
-  {
-    AF_UNIRANGE_REC(  0x0400UL,  0x04FFUL ),  /* Cyrillic */
-    AF_UNIRANGE_REC(  0x0500UL,  0x052FUL ),  /* Cyrillic Supplement */
-    AF_UNIRANGE_REC(  0x2DE0UL,  0x2DFFUL ),  /* Cyrillic Extended-A */
-    AF_UNIRANGE_REC(  0xA640UL,  0xA69FUL ),  /* Cyrillic Extended-B */
-    AF_UNIRANGE_REC(       0UL,       0UL )
-  };
-
-  static const AF_Script_UniRangeRec  af_hebr_uniranges[] =
-  {
-    AF_UNIRANGE_REC(  0x0590UL,  0x05FFUL ),  /* Hebrew */
-    AF_UNIRANGE_REC(  0xFB1DUL,  0xFB4FUL ),  /* Alphab. Present. Forms (Hebrew) */
-    AF_UNIRANGE_REC(       0UL,       0UL )
-  };
-
-
-  AF_DEFINE_SCRIPT_CLASS(
-    af_latn_script_class,
-
-    AF_SCRIPT_LATN,
-    AF_BLUE_STRINGSET_LATN,
-    AF_WRITING_SYSTEM_LATIN,
-
-    af_latn_uniranges,
-    'o'
-  )
-
-  AF_DEFINE_SCRIPT_CLASS(
-    af_grek_script_class,
-
-    AF_SCRIPT_GREK,
-    AF_BLUE_STRINGSET_GREK,
-    AF_WRITING_SYSTEM_LATIN,
-
-    af_grek_uniranges,
-    0x3BF /* ο */
-  )
-
-  AF_DEFINE_SCRIPT_CLASS(
-    af_cyrl_script_class,
-
-    AF_SCRIPT_CYRL,
-    AF_BLUE_STRINGSET_CYRL,
-    AF_WRITING_SYSTEM_LATIN,
-
-    af_cyrl_uniranges,
-    0x43E /* о */
-  )
-
-  AF_DEFINE_SCRIPT_CLASS(
-    af_hebr_script_class,
-
-    AF_SCRIPT_HEBR,
-    AF_BLUE_STRINGSET_HEBR,
-    AF_WRITING_SYSTEM_LATIN,
-
-    af_hebr_uniranges,
-    0x5DD /* ם */
-  )
-
-
 /* END */
--- a/src/autofit/aflatin.h
+++ b/src/autofit/aflatin.h
@@ -30,17 +30,6 @@
   AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin_writing_system_class )
 
 
-  /* the latin-specific script classes */
-
-  AF_DECLARE_SCRIPT_CLASS( af_cyrl_script_class )
-  AF_DECLARE_SCRIPT_CLASS( af_grek_script_class )
-  AF_DECLARE_SCRIPT_CLASS( af_latn_script_class )
-  AF_DECLARE_SCRIPT_CLASS( af_hebr_script_class )
-#if 0
-  AF_DECLARE_SCRIPT_CLASS( af_armn_script_class )
-#endif
-
-
   /* constants are given with units_per_em == 2048 in mind */
 #define AF_LATIN_CONSTANT( metrics, c )                                      \
   ( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -2433,16 +2433,4 @@
   };
 
 
-  AF_DEFINE_SCRIPT_CLASS(
-    af_ltn2_script_class,
-
-    AF_SCRIPT_LTN2,
-    AF_BLUE_STRINGSET_LATN,
-    AF_WRITING_SYSTEM_LATIN2,
-
-    af_ltn2_uniranges,
-    'o'
-  )
-
-
 /* END */
--- a/src/autofit/aflatin2.h
+++ b/src/autofit/aflatin2.h
@@ -31,17 +31,6 @@
   AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin2_writing_system_class )
 
 
-  /* the latin-specific script classes */
-
-  AF_DECLARE_SCRIPT_CLASS( af_ltn2_script_class )  /* XXX */
-#if 0
-  AF_DECLARE_SCRIPT_CLASS( af_arm2_script_class )
-  AF_DECLARE_SCRIPT_CLASS( af_cyr2_script_class )
-  AF_DECLARE_SCRIPT_CLASS( af_grk2_script_class )
-  AF_DECLARE_SCRIPT_CLASS( af_hbr2_script_class )
-#endif
-
-
 /* */
 
 FT_END_HEADER
--- a/src/autofit/afpic.c
+++ b/src/autofit/afpic.c
@@ -116,7 +116,7 @@
 #include "afwrtsys.h"
 
 #undef  SCRIPT
-#define SCRIPT( s, S, d )                            \
+#define SCRIPT( s, S, d, ss, ws, dc )                \
         FT_Init_Class_af_ ## s ## _script_class(     \
           &container->af_script_classes_rec[ss++] );
 
--- /dev/null
+++ b/src/autofit/afranges.c
@@ -1,0 +1,154 @@
+/***************************************************************************/
+/*                                                                         */
+/*  afranges.c                                                             */
+/*                                                                         */
+/*    Auto-fitter Unicode script ranges (body).                            */
+/*                                                                         */
+/*  Copyright 2013 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#include "afranges.h"
+
+
+  /* XXX: this should probably fine tuned to differentiate better between */
+  /*      scripts...                                                      */
+
+  const AF_Script_UniRangeRec  af_cyrl_uniranges[] =
+  {
+    AF_UNIRANGE_REC(  0x0400UL,  0x04FFUL ),  /* Cyrillic */
+    AF_UNIRANGE_REC(  0x0500UL,  0x052FUL ),  /* Cyrillic Supplement */
+    AF_UNIRANGE_REC(  0x2DE0UL,  0x2DFFUL ),  /* Cyrillic Extended-A */
+    AF_UNIRANGE_REC(  0xA640UL,  0xA69FUL ),  /* Cyrillic Extended-B */
+    AF_UNIRANGE_REC(       0UL,       0UL )
+  };
+
+#ifdef AF_CONFIG_OPTION_INDIC
+
+  const AF_Script_UniRangeRec  af_deva_uniranges[] =
+  {
+    AF_UNIRANGE_REC(  0x0900UL,  0x0DFFUL ),  /* Indic Range  */
+    AF_UNIRANGE_REC(  0x0F00UL,  0x0FFFUL ),  /* Tibetan      */
+    AF_UNIRANGE_REC(  0x1900UL,  0x194FUL ),  /* Limbu        */
+    AF_UNIRANGE_REC(  0x1B80UL,  0x1BBFUL ),  /* Sundanese    */
+    AF_UNIRANGE_REC(  0x1C80UL,  0x1CDFUL ),  /* Meetei Mayak */
+    AF_UNIRANGE_REC(  0xA800UL,  0xA82FUL ),  /* Syloti Nagri */
+    AF_UNIRANGE_REC( 0x11800UL, 0x118DFUL ),  /* Sharada      */
+    AF_UNIRANGE_REC(       0UL,       0UL )
+  };
+
+#else /* !AF_CONFIG_OPTION_INDIC */
+
+  const AF_Script_UniRangeRec  af_deva_uniranges[] =
+  {
+    AF_UNIRANGE_REC( 0UL, 0UL )
+  };
+
+#endif /* !AF_CONFIG_OPTION_INDIC */
+
+  const AF_Script_UniRangeRec  af_grek_uniranges[] =
+  {
+    AF_UNIRANGE_REC(  0x0370UL,  0x03FFUL ),  /* Greek and Coptic */
+    AF_UNIRANGE_REC(  0x1F00UL,  0x1FFFUL ),  /* Greek Extended */
+    AF_UNIRANGE_REC(       0UL,       0UL )
+  };
+
+#ifdef AF_CONFIG_OPTION_CJK
+
+  /* this corresponds to Unicode 6.0 */
+
+  const AF_Script_UniRangeRec  af_hani_uniranges[] =
+  {
+    AF_UNIRANGE_REC(  0x1100UL,  0x11FFUL ),  /* Hangul Jamo                             */
+    AF_UNIRANGE_REC(  0x2E80UL,  0x2EFFUL ),  /* CJK Radicals Supplement                 */
+    AF_UNIRANGE_REC(  0x2F00UL,  0x2FDFUL ),  /* Kangxi Radicals                         */
+    AF_UNIRANGE_REC(  0x2FF0UL,  0x2FFFUL ),  /* Ideographic Description Characters      */
+    AF_UNIRANGE_REC(  0x3000UL,  0x303FUL ),  /* CJK Symbols and Punctuation             */
+    AF_UNIRANGE_REC(  0x3040UL,  0x309FUL ),  /* Hiragana                                */
+    AF_UNIRANGE_REC(  0x30A0UL,  0x30FFUL ),  /* Katakana                                */
+    AF_UNIRANGE_REC(  0x3100UL,  0x312FUL ),  /* Bopomofo                                */
+    AF_UNIRANGE_REC(  0x3130UL,  0x318FUL ),  /* Hangul Compatibility Jamo               */
+    AF_UNIRANGE_REC(  0x3190UL,  0x319FUL ),  /* Kanbun                                  */
+    AF_UNIRANGE_REC(  0x31A0UL,  0x31BFUL ),  /* Bopomofo Extended                       */
+    AF_UNIRANGE_REC(  0x31C0UL,  0x31EFUL ),  /* CJK Strokes                             */
+    AF_UNIRANGE_REC(  0x31F0UL,  0x31FFUL ),  /* Katakana Phonetic Extensions            */
+    AF_UNIRANGE_REC(  0x3200UL,  0x32FFUL ),  /* Enclosed CJK Letters and Months         */
+    AF_UNIRANGE_REC(  0x3300UL,  0x33FFUL ),  /* CJK Compatibility                       */
+    AF_UNIRANGE_REC(  0x3400UL,  0x4DBFUL ),  /* CJK Unified Ideographs Extension A      */
+    AF_UNIRANGE_REC(  0x4DC0UL,  0x4DFFUL ),  /* Yijing Hexagram Symbols                 */
+    AF_UNIRANGE_REC(  0x4E00UL,  0x9FFFUL ),  /* CJK Unified Ideographs                  */
+    AF_UNIRANGE_REC(  0xA960UL,  0xA97FUL ),  /* Hangul Jamo Extended-A                  */
+    AF_UNIRANGE_REC(  0xAC00UL,  0xD7AFUL ),  /* Hangul Syllables                        */
+    AF_UNIRANGE_REC(  0xD7B0UL,  0xD7FFUL ),  /* Hangul Jamo Extended-B                  */
+    AF_UNIRANGE_REC(  0xF900UL,  0xFAFFUL ),  /* CJK Compatibility Ideographs            */
+    AF_UNIRANGE_REC(  0xFE10UL,  0xFE1FUL ),  /* Vertical forms                          */
+    AF_UNIRANGE_REC(  0xFE30UL,  0xFE4FUL ),  /* CJK Compatibility Forms                 */
+    AF_UNIRANGE_REC(  0xFF00UL,  0xFFEFUL ),  /* Halfwidth and Fullwidth Forms           */
+    AF_UNIRANGE_REC( 0x1B000UL, 0x1B0FFUL ),  /* Kana Supplement                         */
+    AF_UNIRANGE_REC( 0x1D300UL, 0x1D35FUL ),  /* Tai Xuan Hing Symbols                   */
+    AF_UNIRANGE_REC( 0x1F200UL, 0x1F2FFUL ),  /* Enclosed Ideographic Supplement         */
+    AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ),  /* CJK Unified Ideographs Extension B      */
+    AF_UNIRANGE_REC( 0x2A700UL, 0x2B73FUL ),  /* CJK Unified Ideographs Extension C      */
+    AF_UNIRANGE_REC( 0x2B740UL, 0x2B81FUL ),  /* CJK Unified Ideographs Extension D      */
+    AF_UNIRANGE_REC( 0x2F800UL, 0x2FA1FUL ),  /* CJK Compatibility Ideographs Supplement */
+    AF_UNIRANGE_REC(       0UL,       0UL )
+  };
+
+#else /* !AF_CONFIG_OPTION_CJK */
+
+  const AF_Script_UniRangeRec  af_hani_uniranges[] =
+  {
+    AF_UNIRANGE_REC( 0UL, 0UL )
+  };
+
+#endif /* !AF_CONFIG_OPTION_CJK */
+
+  const AF_Script_UniRangeRec  af_hebr_uniranges[] =
+  {
+    AF_UNIRANGE_REC(  0x0590UL,  0x05FFUL ),  /* Hebrew */
+    AF_UNIRANGE_REC(  0xFB1DUL,  0xFB4FUL ),  /* Alphab. Present. Forms (Hebrew) */
+    AF_UNIRANGE_REC(       0UL,       0UL )
+  };
+
+  const AF_Script_UniRangeRec  af_latn_uniranges[] =
+  {
+    AF_UNIRANGE_REC(  0x0020UL,  0x007FUL ),  /* Basic Latin (no control chars) */
+    AF_UNIRANGE_REC(  0x00A0UL,  0x00FFUL ),  /* Latin-1 Supplement (no control chars) */
+    AF_UNIRANGE_REC(  0x0100UL,  0x017FUL ),  /* Latin Extended-A */
+    AF_UNIRANGE_REC(  0x0180UL,  0x024FUL ),  /* Latin Extended-B */
+    AF_UNIRANGE_REC(  0x0250UL,  0x02AFUL ),  /* IPA Extensions */
+    AF_UNIRANGE_REC(  0x02B0UL,  0x02FFUL ),  /* Spacing Modifier Letters */
+    AF_UNIRANGE_REC(  0x0300UL,  0x036FUL ),  /* Combining Diacritical Marks */
+    AF_UNIRANGE_REC(  0x1D00UL,  0x1D7FUL ),  /* Phonetic Extensions */
+    AF_UNIRANGE_REC(  0x1D80UL,  0x1DBFUL ),  /* Phonetic Extensions Supplement */
+    AF_UNIRANGE_REC(  0x1DC0UL,  0x1DFFUL ),  /* Combining Diacritical Marks Supplement */
+    AF_UNIRANGE_REC(  0x1E00UL,  0x1EFFUL ),  /* Latin Extended Additional */
+    AF_UNIRANGE_REC(  0x2000UL,  0x206FUL ),  /* General Punctuation */
+    AF_UNIRANGE_REC(  0x2070UL,  0x209FUL ),  /* Superscripts and Subscripts */
+    AF_UNIRANGE_REC(  0x20A0UL,  0x20CFUL ),  /* Currency Symbols */
+    AF_UNIRANGE_REC(  0x2150UL,  0x218FUL ),  /* Number Forms */
+    AF_UNIRANGE_REC(  0x2460UL,  0x24FFUL ),  /* Enclosed Alphanumerics */
+    AF_UNIRANGE_REC(  0x2C60UL,  0x2C7FUL ),  /* Latin Extended-C */
+    AF_UNIRANGE_REC(  0x2E00UL,  0x2E7FUL ),  /* Supplemental Punctuation */
+    AF_UNIRANGE_REC(  0xA720UL,  0xA7FFUL ),  /* Latin Extended-D */
+    AF_UNIRANGE_REC(  0xFB00UL,  0xFB06UL ),  /* Alphab. Present. Forms (Latin Ligs) */
+    AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ),  /* Mathematical Alphanumeric Symbols */
+    AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ),  /* Enclosed Alphanumeric Supplement */
+    AF_UNIRANGE_REC(       0UL,       0UL )
+  };
+
+  const AF_Script_UniRangeRec  af_none_uniranges[] =
+  {
+    AF_UNIRANGE_REC( 0UL, 0UL )
+  };
+
+
+/* END */
--- /dev/null
+++ b/src/autofit/afranges.h
@@ -1,0 +1,41 @@
+/***************************************************************************/
+/*                                                                         */
+/*  afranges.h                                                             */
+/*                                                                         */
+/*    Auto-fitter Unicode script ranges (specification).                   */
+/*                                                                         */
+/*  Copyright 2013 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __AFRANGES_H__
+#define __AFRANGES_H__
+
+
+#include "aftypes.h"
+
+
+FT_BEGIN_HEADER
+
+#undef  SCRIPT
+#define SCRIPT( s, S, d, ss, ws, dc ) \
+          extern const AF_Script_UniRangeRec  af_ ## s ## _uniranges[];
+
+#include "afscript.h"
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __AFRANGES_H__ */
+
+
+/* END */
--- a/src/autofit/afscript.h
+++ b/src/autofit/afscript.h
@@ -22,15 +22,54 @@
 
   /* Add new scripts here. */
 
-  SCRIPT( cyrl, CYRL, "Cyrillic" )
-  SCRIPT( deva, DEVA, "Indic scripts" )
-  SCRIPT( none, NONE, "no script" )
-  SCRIPT( grek, GREK, "Greek" )
-  SCRIPT( hani, HANI, "CJKV ideographs" )
-  SCRIPT( hebr, HEBR, "Hebrew" )
-  SCRIPT( latn, LATN, "Latin" )
+  SCRIPT( cyrl, CYRL,
+          "Cyrillic",
+          AF_BLUE_STRINGSET_CYRL,
+          AF_WRITING_SYSTEM_LATIN,
+          0x43E ) /* о */
+
+  SCRIPT( deva, DEVA,
+          "Indic scripts",
+          (AF_Blue_Stringset)0, /* XXX */
+          AF_WRITING_SYSTEM_INDIC,
+          'o' ) /* XXX */
+
+  SCRIPT( none, NONE,
+          "no script",
+          (AF_Blue_Stringset)0,
+          AF_WRITING_SYSTEM_DUMMY,
+          '\0' )
+
+  SCRIPT( grek, GREK,
+          "Greek",
+          AF_BLUE_STRINGSET_GREK,
+          AF_WRITING_SYSTEM_LATIN,
+          0x3BF ) /* ο */
+
+  SCRIPT( hani, HANI,
+          "CJKV ideographs",
+          AF_BLUE_STRINGSET_HANI,
+          AF_WRITING_SYSTEM_CJK,
+          0x7530 ) /* 田 */
+
+  SCRIPT( hebr, HEBR,
+          "Hebrew",
+          AF_BLUE_STRINGSET_HEBR,
+          AF_WRITING_SYSTEM_LATIN,
+          0x5DD ) /* ם */
+
+  SCRIPT( latn, LATN,
+          "Latin",
+          AF_BLUE_STRINGSET_LATN,
+          AF_WRITING_SYSTEM_LATIN,
+          'o' )
+
 #ifdef FT_OPTION_AUTOFIT2
-  SCRIPT( ltn2, LTN2, "Latin 2" )
+  SCRIPT( ltn2, LTN2,
+          "Latin 2",
+          AF_BLUE_STRINGSET_LATN,
+          AF_WRITING_SYSTEM_LATIN2,
+          'o' )
 #endif
 
 
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -303,7 +303,7 @@
    */
 
 #undef  SCRIPT
-#define SCRIPT( s, S, d ) \
+#define SCRIPT( s, S, d, ss, ws, dc ) \
           AF_SCRIPT_ ## S,
 
   /* The list of known scripts. */
--- a/src/autofit/autofit.c
+++ b/src/autofit/autofit.c
@@ -24,6 +24,8 @@
 #include "afglobal.c"
 #include "afhints.c"
 
+#include "afranges.c"
+
 #include "afdummy.c"
 #include "aflatin.c"
 #ifdef FT_OPTION_AUTOFIT2
--- a/src/autofit/rules.mk
+++ b/src/autofit/rules.mk
@@ -36,6 +36,7 @@
                  $(AUTOF_DIR)/afloader.c \
                  $(AUTOF_DIR)/afmodule.c \
                  $(AUTOF_DIR)/afpic.c    \
+                 $(AUTOF_DIR)/afranges.c \
                  $(AUTOF_DIR)/afwarp.c
 
 # AUTOF driver headers