Commit 38e480b4c66b192e9661b060370c1c57483a1877

suzuki toshiya 2009-08-01T00:30:21

autofit: Improve Unicode range definitions.

diff --git a/ChangeLog b/ChangeLog
index d67663d..2fc961d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
 
+	autofit: Improve Unicode range definitions.
+
+	* src/autofit/aftypes.h (AF_UNIRANGE_REC): New macro
+	to declare a range by two unsigned 32-bit integer,
+	to avoid 64-bit range definition on LP64 platforms.
+
+	* src/autofit/aflatin.c (af_latin_uniranges): Ditto.
+
+	* src/autofit/aflatin2.c (af_latin2_uniranges): Ditto.
+
+	* src/autofit/afindic.c (af_indic_uniranges): Ditto.
+
+	* src/autofit/afcjk.c (af_cjk_uniranges): Declare
+	the ranges by AF_UNIRANGE_REC.
+
+2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
 	smooth: Fix a data type mismatching with its source.
 
 	* src/smooth/ftgrays.c (gray_sweep): The type of
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 9a473f4..9e0cea8 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -1444,29 +1444,29 @@
   static const AF_Script_UniRangeRec  af_cjk_uniranges[] =
   {
 #if 0
-    {  0x0100UL,  0xFFFFUL },  /* why this? */
+    AF_UNIRANGE_REC(  0x0100UL,  0xFFFFUL ),  /* why this? */
 #endif
-    {  0x2E80UL,  0x2EFFUL },  /* CJK Radicals Supplement                 */
-    {  0x2F00UL,  0x2FDFUL },  /* Kangxi Radicals                         */
-    {  0x3000UL,  0x303FUL },  /* CJK Symbols and Punctuation             */
-    {  0x3040UL,  0x309FUL },  /* Hiragana                                */
-    {  0x30A0UL,  0x30FFUL },  /* Katakana                                */
-    {  0x3100UL,  0x312FUL },  /* Bopomofo                                */
-    {  0x3130UL,  0x318FUL },  /* Hangul Compatibility Jamo               */
-    {  0x31A0UL,  0x31BFUL },  /* Bopomofo Extended                       */
-    {  0x31C0UL,  0x31EFUL },  /* CJK Strokes                             */
-    {  0x31F0UL,  0x31FFUL },  /* Katakana Phonetic Extensions            */
-    {  0x3200UL,  0x32FFUL },  /* Enclosed CJK Letters and Months         */
-    {  0x3300UL,  0x33FFUL },  /* CJK Compatibility                       */
-    {  0x3400UL,  0x4DBFUL },  /* CJK Unified Ideographs Extension A      */
-    {  0x4DC0UL,  0x4DFFUL },  /* Yijing Hexagram Symbols                 */
-    {  0x4E00UL,  0x9FFFUL },  /* CJK Unified Ideographs                  */
-    {  0xF900UL,  0xFAFFUL },  /* CJK Compatibility Ideographs            */
-    {  0xFE30UL,  0xFE4FUL },  /* CJK Compatibility Forms                 */
-    {  0xFF00UL,  0xFFEFUL },  /* Halfwidth and Fullwidth Forms           */
-    { 0x20000UL, 0x2A6DFUL },  /* CJK Unified Ideographs Extension B      */
-    { 0x2F800UL, 0x2FA1FUL },  /* CJK Compatibility Ideographs Supplement */
-    {       0UL,       0UL }
+    AF_UNIRANGE_REC(  0x2E80UL,  0x2EFFUL ),  /* CJK Radicals Supplement                 */
+    AF_UNIRANGE_REC(  0x2F00UL,  0x2FDFUL ),  /* Kangxi Radicals                         */
+    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(  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(  0xF900UL,  0xFAFFUL ),  /* CJK Compatibility Ideographs            */
+    AF_UNIRANGE_REC(  0xFE30UL,  0xFE4FUL ),  /* CJK Compatibility Forms                 */
+    AF_UNIRANGE_REC(  0xFF00UL,  0xFFEFUL ),  /* Halfwidth and Fullwidth Forms           */
+    AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ),  /* CJK Unified Ideographs Extension B      */
+    AF_UNIRANGE_REC( 0x2F800UL, 0x2FA1FUL ),  /* CJK Compatibility Ideographs Supplement */
+    AF_UNIRANGE_REC(       0UL,       0UL )
   };
 
 
@@ -1488,7 +1488,7 @@
 
   static const AF_Script_UniRangeRec  af_cjk_uniranges[] =
   {
-    { 0, 0 }
+    AF_UNIRANGE_REC( 0UL, 0UL )
   };
 
 
diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c
index e1bb481..1d9e9ea 100644
--- a/src/autofit/afindic.c
+++ b/src/autofit/afindic.c
@@ -81,10 +81,10 @@
   static const AF_Script_UniRangeRec  af_indic_uniranges[] =
   {
 #if 0
-    { 0x0100,  0xFFFF },  /* why this? */
+    AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ),  /* why this? */
 #endif
-    { 0x0900, 0x0DFF},    /* Indic Range */
-    { 0,       0 }
+    AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL),    /* Indic Range */
+    AF_UNIRANGE_REC(      0UL,      0UL)
   };
 
 
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 2c8226c..062f863 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -2177,33 +2177,33 @@
 
   static const AF_Script_UniRangeRec  af_latin_uniranges[] =
   {
-    {  0x0020  ,  0x007F   },  /* Basic Latin (no control chars) */
-    {  0x00A0  ,  0x00FF   },  /* Latin-1 Supplement (no control chars) */
-    {  0x0100  ,  0x017F   },  /* Latin Extended-A */
-    {  0x0180  ,  0x024F   },  /* Latin Extended-B */
-    {  0x0250  ,  0x02AF   },  /* IPA Extensions */
-    {  0x02B0  ,  0x02FF   },  /* Spacing Modifier Letters */
-    {  0x0300  ,  0x036F   },  /* Combining Diacritical Marks */
-    {  0x0370  ,  0x03FF   },  /* Greek and Coptic */
-    {  0x0400  ,  0x04FF   },  /* Cyrillic */
-    {  0x0500  ,  0x052F   },  /* Cyrillic Supplement */
-    {  0x1D00  ,  0x1D7F   },  /* Phonetic Extensions */
-    {  0x1D80  ,  0x1DBF   },  /* Phonetic Extensions Supplement */
-    {  0x1DC0  ,  0x1DFF   },  /* Combining Diacritical Marks Supplement */
-    {  0x1E00  ,  0x1EFF   },  /* Latin Extended Additional */
-    {  0x1F00  ,  0x1FFF   },  /* Greek Extended */
-    {  0x2000  ,  0x206F   },  /* General Punctuation */
-    {  0x2070  ,  0x209F   },  /* Superscripts and Subscripts */
-    {  0x20A0  ,  0x20CF   },  /* Currency Symbols */
-    {  0x2150  ,  0x218F   },  /* Number Forms */
-    {  0x2460  ,  0x24FF   },  /* Enclosed Alphanumerics */
-    {  0x2C60  ,  0x2C7F   },  /* Latin Extended-C */
-    {  0x2DE0  ,  0x2DFF   },  /* Cyrillic Extended-A */
-    {  0xA640U ,  0xA69FU  },  /* Cyrillic Extended-B */
-    {  0xA720U ,  0xA7FFU  },  /* Latin Extended-D */
-    {  0xFB00U ,  0xFB06U  },  /* Alphab. Present. Forms (Latin Ligs) */
-    { 0x1D400UL, 0x1D7FFUL },  /* Mathematical Alphanumeric Symbols */
-    { 0        , 0         }
+    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(  0x0370UL,  0x03FFUL ),  /* Greek and Coptic */
+    AF_UNIRANGE_REC(  0x0400UL,  0x04FFUL ),  /* Cyrillic */
+    AF_UNIRANGE_REC(  0x0500UL,  0x052FUL ),  /* Cyrillic Supplement */
+    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(  0x1F00UL,  0x1FFFUL ),  /* Greek Extended */
+    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(  0x2DE0UL,  0x2DFFUL ),  /* Cyrillic Extended-A */
+    AF_UNIRANGE_REC(  0xA640UL,  0xA69FUL ),  /* Cyrillic Extended-B */
+    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(       0UL,       0UL )
   };
 
 
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index 8894c0b..5e2ad48 100644
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -2320,9 +2320,9 @@
 
   static const AF_Script_UniRangeRec  af_latin2_uniranges[] =
   {
-    { 32,  127 },    /* XXX: TODO: Add new Unicode ranges here! */
-    { 160, 255 },
-    { 0,   0 }
+    AF_UNIRANGE_REC( 32UL,  127UL ),    /* XXX: TODO: Add new Unicode ranges here! */
+    AF_UNIRANGE_REC( 160UL, 255UL ),
+    AF_UNIRANGE_REC( 0UL,   0UL )
   };
 
 
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index 5972f2e..71c9bad 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -322,6 +322,8 @@ extern void*  _af_debug_hints;
 
   } AF_Script_UniRangeRec;
 
+#define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) }
+
   typedef const AF_Script_UniRangeRec  *AF_Script_UniRange;