blob: 2af9a0da419ed46e222d3de2bbdd9e480b8b54c2 [file] [log] [blame]
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +00001/***************************************************************************/
2/* */
3/* gxfgen.c */
4/* */
Werner Lemberga4aa1c52005-08-31 22:39:23 +00005/* Generate feature registry data for gxv `feat' validator. */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +00006/* This program is derived from gxfeatreg.c in gxlayout. */
7/* */
Werner Lemberg8fe65392006-04-29 07:31:16 +00008/* Copyright 2004, 2005, 2006 by Masatake YAMATO and Redhat K.K. */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +00009/* */
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/***************************************************************************/
Werner Lemberga4aa1c52005-08-31 22:39:23 +000038/* */
39/* Development of gxfeatreg.c is supported by */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000040/* Information-technology Promotion Agency, Japan. */
Werner Lemberga4aa1c52005-08-31 22:39:23 +000041/* */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000042/***************************************************************************/
43
Werner Lemberga4aa1c52005-08-31 22:39:23 +000044
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000045/***************************************************************************/
46/* */
Werner Lemberga4aa1c52005-08-31 22:39:23 +000047/* This file is compiled as a stand-alone executable. */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000048/* 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
Werner Lemberga4aa1c52005-08-31 22:39:23 +000056 /*******************************************************************/
57 /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
58 /*******************************************************************/
59
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000060 /*
Werner Lemberga4aa1c52005-08-31 22:39:23 +000061 * 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
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000063 * FEATREG_MAX_SETTING, update the value.
64 */
Werner Lemberga4aa1c52005-08-31 22:39:23 +000065#define FEATREG_MAX_SETTING 12
66
67 /*******************************************************************/
68 /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
69 /*******************************************************************/
70
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000071
72#include <stdio.h>
73#include <string.h>
74
Werner Lemberga4aa1c52005-08-31 22:39:23 +000075
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000076 /*************************************************************************/
77 /*************************************************************************/
78 /***** *****/
79 /***** Data and Types *****/
80 /***** *****/
81 /*************************************************************************/
82 /*************************************************************************/
83
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000084#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;
Werner Lemberga4aa1c52005-08-31 22:39:23 +000091 char* setting_name[FEATREG_MAX_SETTING];
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000092
93 } GX_Feature_RegistryRec;
94
Werner Lemberga4aa1c52005-08-31 22:39:23 +000095
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +000096#define EMPTYFEAT {0, 0, {NULL}}
Werner Lemberga4aa1c52005-08-31 22:39:23 +000097
98
99 static GX_Feature_RegistryRec featreg_table[] = {
100 { /* 0 */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +0000101 "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",
Werner Lemberga4aa1c52005-08-31 22:39:23 +0000305 NULL /* count => 12 */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +0000306 }
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 }
Werner Lemberga4aa1c52005-08-31 22:39:23 +0000372 }, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 27-30 */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +0000373 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 */
Werner Lemberga4aa1c52005-08-31 22:39:23 +0000386 EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 96-98 */
387 EMPTYFEAT, /* 99 */ { /* 100 => 22 */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +0000388 "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
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +0000434 /*************************************************************************/
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
Werner Lemberga4aa1c52005-08-31 22:39:23 +0000458
459 feat_name = featreg_table[i].feat_name;
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +0000460 for ( nSettings = 0;
461 featreg_table[i].setting_name[nSettings];
462 nSettings++)
Werner Lemberga4aa1c52005-08-31 22:39:23 +0000463 ; /* Do nothing */
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +0000464
465 printf( " {%1d, %1d, %1d, %2d}, /* %s */\n",
466 feat_name ? 1 : 0,
Werner Lemberg8fe65392006-04-29 07:31:16 +0000467 ( feat_name &&
468 ( ft_strncmp( feat_name,
469 APPLE_RESERVED, APPLE_RESERVED_LENGTH ) == 0 )
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +0000470 ) ? 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
Werner Lemberga4aa1c52005-08-31 22:39:23 +0000481
Suzuki, Toshiya (鈴木俊哉)a4386212005-08-24 04:31:31 +0000482/* END */