Commit d8324571f11f44776ee55c213d9503c367952dc1

Werner Lemberg 2013-12-19T15:45:24

[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'.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
diff --git a/ChangeLog b/ChangeLog
index 617bf4c..e3b88e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2013-12-19  Werner Lemberg  <wl@gnu.org>
+
+	[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  <wl@gnu.org>
 
 	[autofit] More code orthogonality.
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index ca32bc9..e29a9e1 100644
--- 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 */
diff --git a/src/autofit/afcjk.h b/src/autofit/afcjk.h
index 889d491..a260b09 100644
--- a/src/autofit/afcjk.h
+++ b/src/autofit/afcjk.h
@@ -31,11 +31,6 @@ FT_BEGIN_HEADER
   AF_DECLARE_WRITING_SYSTEM_CLASS( af_cjk_writing_system_class )
 
 
-  /* the CJK-specific script classes */
-
-  AF_DECLARE_SCRIPT_CLASS( af_hani_script_class )
-
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
diff --git a/src/autofit/afdummy.c b/src/autofit/afdummy.c
index 6a07c4e..f8702a1 100644
--- 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 */
diff --git a/src/autofit/afdummy.h b/src/autofit/afdummy.h
index 9a4d3c2..75efd94 100644
--- a/src/autofit/afdummy.h
+++ b/src/autofit/afdummy.h
@@ -31,8 +31,6 @@ FT_BEGIN_HEADER
 
   AF_DECLARE_WRITING_SYSTEM_CLASS( af_dummy_writing_system_class )
 
-  AF_DECLARE_SCRIPT_CLASS( af_none_script_class )
-
 /* */
 
 FT_END_HEADER
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index 4a25f03..e3bbdb9 100644
--- 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[] =
diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h
index f358714..cc0ed2d 100644
--- a/src/autofit/afglobal.h
+++ b/src/autofit/afglobal.h
@@ -31,6 +31,12 @@ FT_BEGIN_HEADER
   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[];
 
diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c
index 75ce646..197881b 100644
--- 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 */
diff --git a/src/autofit/afindic.h b/src/autofit/afindic.h
index 9ec026a..9e13cf7 100644
--- a/src/autofit/afindic.h
+++ b/src/autofit/afindic.h
@@ -31,11 +31,6 @@ FT_BEGIN_HEADER
   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
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 9a3b51e..e42c305 100644
--- 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 */
diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h
index 440103a..99c4482 100644
--- a/src/autofit/aflatin.h
+++ b/src/autofit/aflatin.h
@@ -30,17 +30,6 @@ FT_BEGIN_HEADER
   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 )
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index ae82915..e3d17ac 100644
--- 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 */
diff --git a/src/autofit/aflatin2.h b/src/autofit/aflatin2.h
index a2fa72f..b5d252a 100644
--- a/src/autofit/aflatin2.h
+++ b/src/autofit/aflatin2.h
@@ -31,17 +31,6 @@ FT_BEGIN_HEADER
   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
diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c
index 92d696d..997f216 100644
--- 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++] );
 
diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c
new file mode 100644
index 0000000..607733c
--- /dev/null
+++ b/src/autofit/afranges.c
@@ -0,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 */
diff --git a/src/autofit/afranges.h b/src/autofit/afranges.h
new file mode 100644
index 0000000..99d2799
--- /dev/null
+++ b/src/autofit/afranges.h
@@ -0,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 */
diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h
index 32ec2ca..7b93fdf 100644
--- 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
 
 
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index 0a8da0d..8ca708c 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -303,7 +303,7 @@ extern void*  _af_debug_hints;
    */
 
 #undef  SCRIPT
-#define SCRIPT( s, S, d ) \
+#define SCRIPT( s, S, d, ss, ws, dc ) \
           AF_SCRIPT_ ## S,
 
   /* The list of known scripts. */
diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c
index b23374a..930387c 100644
--- 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
diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk
index 745adab..7bcecfc 100644
--- a/src/autofit/rules.mk
+++ b/src/autofit/rules.mk
@@ -36,6 +36,7 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \
                  $(AUTOF_DIR)/afloader.c \
                  $(AUTOF_DIR)/afmodule.c \
                  $(AUTOF_DIR)/afpic.c    \
+                 $(AUTOF_DIR)/afranges.c \
                  $(AUTOF_DIR)/afwarp.c
 
 # AUTOF driver headers