Initialize Tizen 2.3
[framework/graphics/freetype.git] / src / gxvalid / gxvfgen.c
1 /***************************************************************************/
2 /*                                                                         */
3 /*  gxfgen.c                                                               */
4 /*                                                                         */
5 /*    Generate feature registry data for gxv `feat' validator.             */
6 /*    This program is derived from gxfeatreg.c in gxlayout.                */
7 /*                                                                         */
8 /*  Copyright 2004, 2005, 2006 by Masatake YAMATO and Redhat K.K.          */
9 /*                                                                         */
10 /*  This file may only be used,                                            */
11 /*  modified, and distributed under the terms of the FreeType project      */
12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
13 /*  this file you indicate that you have read the license and              */
14 /*  understand and accept it fully.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17
18 /***************************************************************************/
19 /*                                                                         */
20 /*  gxfeatreg.c                                                            */
21 /*                                                                         */
22 /*    Database of font features pre-defined by Apple Computer, Inc.        */
23 /*    http://developer.apple.com/fonts/Registry/                           */
24 /*    (body).                                                              */
25 /*                                                                         */
26 /*  Copyright 2003 by                                                      */
27 /*  Masatake YAMATO and Redhat K.K.                                        */
28 /*                                                                         */
29 /*  This file may only be used,                                            */
30 /*  modified, and distributed under the terms of the FreeType project      */
31 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
32 /*  this file you indicate that you have read the license and              */
33 /*  understand and accept it fully.                                        */
34 /*                                                                         */
35 /***************************************************************************/
36
37 /***************************************************************************/
38 /*                                                                         */
39 /* Development of gxfeatreg.c is supported by                              */
40 /* Information-technology Promotion Agency, Japan.                         */
41 /*                                                                         */
42 /***************************************************************************/
43
44
45 /***************************************************************************/
46 /*                                                                         */
47 /* This file is compiled as a stand-alone executable.                      */
48 /* This file is never compiled into `libfreetype2'.                        */
49 /* The output of this file is used in `gxvfeat.c'.                         */
50 /* ----------------------------------------------------------------------- */
51 /* Compile: gcc `pkg-config --cflags freetype2` gxvfgen.c -o gxvfgen       */
52 /* Run: ./gxvfgen > tmp.c                                                  */
53 /*                                                                         */
54 /***************************************************************************/
55
56   /*******************************************************************/
57   /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
58   /*******************************************************************/
59
60   /*
61    * If you add a new setting to a feature, check the number of settings
62    * in the feature.  If the number is greater than the value defined as
63    * FEATREG_MAX_SETTING, update the value.
64    */
65 #define FEATREG_MAX_SETTING  12
66
67   /*******************************************************************/
68   /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
69   /*******************************************************************/
70
71
72 #include <stdio.h>
73 #include <string.h>
74
75
76   /*************************************************************************/
77   /*************************************************************************/
78   /*****                                                               *****/
79   /*****                      Data and Types                           *****/
80   /*****                                                               *****/
81   /*************************************************************************/
82   /*************************************************************************/
83
84 #define APPLE_RESERVED         "Apple Reserved"
85 #define APPLE_RESERVED_LENGTH  14
86
87   typedef struct  GX_Feature_RegistryRec_
88   {
89     const char*  feat_name;
90     char         exclusive;
91     char*        setting_name[FEATREG_MAX_SETTING];
92
93   } GX_Feature_RegistryRec;
94
95
96 #define EMPTYFEAT {0, 0, {NULL}}
97
98
99   static GX_Feature_RegistryRec featreg_table[] = {
100     {                                       /* 0 */
101       "All Typographic Features",
102       0,
103       {
104         "All Type Features",
105         NULL
106       }
107     }, {                                    /* 1 */
108       "Ligatures",
109       0,
110       {
111         "Required Ligatures",
112         "Common Ligatures",
113         "Rare Ligatures",
114         "Logos",
115         "Rebus Pictures",
116         "Diphthong Ligatures",
117         "Squared Ligatures",
118         "Squared Ligatures, Abbreviated",
119         NULL
120       }
121     }, {                                    /* 2 */
122       "Cursive Connection",
123       1,
124       {
125         "Unconnected",
126         "Partially Connected",
127         "Cursive",
128         NULL
129       }
130     }, {                                    /* 3 */
131       "Letter Case",
132       1,
133       {
134         "Upper & Lower Case",
135         "All Caps",
136         "All Lower Case",
137         "Small Caps",
138         "Initial Caps",
139         "Initial Caps & Small Caps",
140         NULL
141       }
142     }, {                                    /* 4 */
143       "Vertical Substitution",
144       0,
145       {
146         /* "Substitute Vertical Forms", */
147         "Turns on the feature",
148         NULL
149       }
150     }, {                                    /* 5 */
151       "Linguistic Rearrangement",
152       0,
153       {
154         /* "Linguistic Rearrangement", */
155         "Turns on the feature",
156         NULL
157       }
158     }, {                                    /* 6 */
159       "Number Spacing",
160       1,
161       {
162         "Monospaced Numbers",
163         "Proportional Numbers",
164         NULL
165       }
166     }, {                                    /* 7 */
167       APPLE_RESERVED " 1",
168       0,
169       {NULL}
170     }, {                                    /* 8 */
171       "Smart Swashes",
172       0,
173       {
174         "Word Initial Swashes",
175         "Word Final Swashes",
176         "Line Initial Swashes",
177         "Line Final Swashes",
178         "Non-Final Swashes",
179         NULL
180       }
181     }, {                                    /* 9 */
182       "Diacritics",
183       1,
184       {
185         "Show Diacritics",
186         "Hide Diacritics",
187         "Decompose Diacritics",
188         NULL
189       }
190     }, {                                    /* 10 */
191       "Vertical Position",
192       1,
193       {
194         /* "Normal Position", */
195         "No Vertical Position",
196         "Superiors",
197         "Inferiors",
198         "Ordinals",
199         NULL
200       }
201     }, {                                    /* 11 */
202       "Fractions",
203       1,
204       {
205         "No Fractions",
206         "Vertical Fractions",
207         "Diagonal Fractions",
208         NULL
209       }
210     }, {                                    /* 12 */
211       APPLE_RESERVED " 2",
212       0,
213       {NULL}
214     }, {                                    /* 13 */
215       "Overlapping Characters",
216       0,
217       {
218         /* "Prevent Overlap", */
219         "Turns on the feature",
220         NULL
221       }
222     }, {                                    /* 14 */
223       "Typographic Extras",
224       0,
225       {
226         "Hyphens to Em Dash",
227         "Hyphens to En Dash",
228         "Unslashed Zero",
229         "Form Interrobang",
230         "Smart Quotes",
231         "Periods to Ellipsis",
232         NULL
233       }
234     }, {                                    /* 15 */
235       "Mathematical Extras",
236       0,
237       {
238         "Hyphens to Minus",
239         "Asterisk to Multiply",
240         "Slash to Divide",
241         "Inequality Ligatures",
242         "Exponents",
243         NULL
244       }
245     }, {                                    /* 16 */
246       "Ornament Sets",
247       1,
248       {
249         "No Ornaments",
250         "Dingbats",
251         "Pi Characters",
252         "Fleurons",
253         "Decorative Borders",
254         "International Symbols",
255         "Math Symbols",
256         NULL
257       }
258     }, {                                    /* 17 */
259       "Character Alternatives",
260       1,
261       {
262         "No Alternates",
263         /* TODO */
264         NULL
265       }
266     }, {                                    /* 18 */
267       "Design Complexity",
268       1,
269       {
270         "Design Level 1",
271         "Design Level 2",
272         "Design Level 3",
273         "Design Level 4",
274         "Design Level 5",
275         /* TODO */
276         NULL
277       }
278     }, {                                    /* 19 */
279       "Style Options",
280       1,
281       {
282         "No Style Options",
283         "Display Text",
284         "Engraved Text",
285         "Illuminated Caps",
286         "Tilling Caps",
287         "Tall Caps",
288         NULL
289       }
290     }, {                                    /* 20 */
291       "Character Shape",
292       1,
293       {
294         "Traditional Characters",
295         "Simplified Characters",
296         "JIS 1978 Characters",
297         "JIS 1983 Characters",
298         "JIS 1990 Characters",
299         "Traditional Characters, Alternative Set 1",
300         "Traditional Characters, Alternative Set 2",
301         "Traditional Characters, Alternative Set 3",
302         "Traditional Characters, Alternative Set 4",
303         "Traditional Characters, Alternative Set 5",
304         "Expert Characters",
305         NULL                           /* count => 12 */
306       }
307     }, {                                    /* 21 */
308       "Number Case",
309       1,
310       {
311         "Lower Case Numbers",
312         "Upper Case Numbers",
313         NULL
314       }
315     }, {                                    /* 22 */
316       "Text Spacing",
317       1,
318       {
319         "Proportional",
320         "Monospaced",
321         "Half-width",
322         "Normal",
323         NULL
324       }
325     }, /* Here after Newer */  { /* 23 */
326       "Transliteration",
327       1,
328       {
329         "No Transliteration",
330         "Hanja To Hangul",
331         "Hiragana to Katakana",
332         "Katakana to Hiragana",
333         "Kana to Romanization",
334         "Romanization to Hiragana",
335         "Romanization to Katakana",
336         "Hanja to Hangul, Alternative Set 1",
337         "Hanja to Hangul, Alternative Set 2",
338         "Hanja to Hangul, Alternative Set 3",
339         NULL
340       }
341     }, {                                    /* 24 */
342       "Annotation",
343       1,
344       {
345         "No Annotation",
346         "Box Annotation",
347         "Rounded Box Annotation",
348         "Circle Annotation",
349         "Inverted Circle Annotation",
350         "Parenthesis Annotation",
351         "Period Annotation",
352         "Roman Numeral Annotation",
353         "Diamond Annotation",
354         NULL
355       }
356     }, {                                    /* 25 */
357       "Kana Spacing",
358       1,
359       {
360         "Full Width",
361         "Proportional",
362         NULL
363       }
364     }, {                                    /* 26 */
365       "Ideographic Spacing",
366       1,
367       {
368         "Full Width",
369         "Proportional",
370         NULL
371       }
372     }, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT,         /* 27-30 */
373     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 31-35 */
374     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 36-40 */
375     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 40-45 */
376     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 46-50 */
377     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 51-55 */
378     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 56-60 */
379     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 61-65 */
380     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 66-70 */
381     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 71-75 */
382     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 76-80 */
383     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 81-85 */
384     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 86-90 */
385     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 91-95 */
386     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT,                       /* 96-98 */
387     EMPTYFEAT, /* 99 */ {                   /* 100 => 22 */
388       "Text Spacing",
389       1,
390       {
391         "Proportional",
392         "Monospaced",
393         "Half-width",
394         "Normal",
395         NULL
396       }
397     }, {                                    /* 101 => 25 */
398       "Kana Spacing",
399       1,
400       {
401         "Full Width",
402         "Proportional",
403         NULL
404       }
405     }, {                                    /* 102 => 26 */
406       "Ideographic Spacing",
407       1,
408       {
409         "Full Width",
410         "Proportional",
411         NULL
412       }
413     }, {                                    /* 103 */
414       "CJK Roman Spacing",
415       1,
416       {
417         "Half-width",
418         "Proportional",
419         "Default Roman",
420         "Full-width Roman",
421         NULL
422       }
423     }, {                                    /* 104 => 1 */
424       "All Typographic Features",
425       0,
426       {
427         "All Type Features",
428         NULL
429       }
430     }
431   };
432
433
434   /*************************************************************************/
435   /*************************************************************************/
436   /*****                                                               *****/
437   /*****                         Generator                             *****/
438   /*****                                                               *****/
439   /*************************************************************************/
440   /*************************************************************************/
441
442   int
443   main( void )
444   {
445     int  i;
446
447
448     printf( "  {\n" );
449     printf( "   /* Generated from %s */\n", __FILE__ );
450
451     for ( i = 0;
452           i < sizeof ( featreg_table ) / sizeof ( GX_Feature_RegistryRec );
453           i++ )
454     {
455       const char*  feat_name;
456       int          nSettings;
457
458
459       feat_name = featreg_table[i].feat_name;
460       for ( nSettings = 0;
461             featreg_table[i].setting_name[nSettings];
462             nSettings++)
463         ;                                   /* Do nothing */
464
465       printf( "    {%1d, %1d, %1d, %2d},   /* %s */\n",
466               feat_name ? 1 : 0,
467               ( feat_name                                                  &&
468                 ( ft_strncmp( feat_name,
469                               APPLE_RESERVED, APPLE_RESERVED_LENGTH ) == 0 )
470               ) ? 1 : 0,
471               featreg_table[i].exclusive ? 1 : 0,
472               nSettings,
473               feat_name ? feat_name : "__EMPTY__" );
474     }
475
476     printf( "  };\n" );
477
478     return 0;
479   }
480
481
482 /* END */