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
/****************************************************************************
*
* gxfgen.c
*
* Generate feature registry data for gxv `feat' validator.
* This program is derived from gxfeatreg.c in gxlayout.
*
* Copyright (C) 2004-2023 by
* Masatake YAMATO and Redhat K.K.
*
* This file 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.
*
*/
/****************************************************************************
*
* gxfeatreg.c
*
* Database of font features pre-defined by Apple Computer, Inc.
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html
* (body).
*
* Copyright 2003 by
* Masatake YAMATO and Redhat K.K.
*
* This file 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.
*
*/
/****************************************************************************
*
* Development of gxfeatreg.c is supported by
* Information-technology Promotion Agency, Japan.
*
*/
/****************************************************************************
*
* This file is compiled as a stand-alone executable.
* This file is never compiled into `libfreetype2'.
* The output of this file is used in `gxvfeat.c'.
* -----------------------------------------------------------------------
* Compile: gcc `pkg-config --cflags freetype2` gxvfgen.c -o gxvfgen
* Run: ./gxvfgen > tmp.c
*
*/
/********************************************************************
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*/
/*
* If you add a new setting to a feature, check the number of settings
* in the feature. If the number is greater than the value defined as
* FEATREG_MAX_SETTING, update the value.
*/
#define FEATREG_MAX_SETTING 12
/********************************************************************
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*/
#include <stdio.h>
#include <string.h>
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** Data and Types *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
#define APPLE_RESERVED "Apple Reserved"
#define APPLE_RESERVED_LENGTH 14
typedef struct GX_Feature_RegistryRec_
{
const char* feat_name;
char exclusive;
char* setting_name[FEATREG_MAX_SETTING];
} GX_Feature_RegistryRec;
#define EMPTYFEAT {0, 0, {NULL}}
static GX_Feature_RegistryRec featreg_table[] = {
{ /* 0 */
"All Typographic Features",
0,
{
"All Type Features",
NULL
}
}, { /* 1 */
"Ligatures",
0,
{
"Required Ligatures",
"Common Ligatures",
"Rare Ligatures",
"Logos",
"Rebus Pictures",
"Diphthong Ligatures",
"Squared Ligatures",
"Squared Ligatures, Abbreviated",
NULL
}
}, { /* 2 */
"Cursive Connection",
1,
{
"Unconnected",
"Partially Connected",
"Cursive",
NULL
}
}, { /* 3 */
"Letter Case",
1,
{
"Upper & Lower Case",
"All Caps",
"All Lower Case",
"Small Caps",
"Initial Caps",
"Initial Caps & Small Caps",
NULL
}
}, { /* 4 */
"Vertical Substitution",
0,
{
/* "Substitute Vertical Forms", */
"Turns on the feature",
NULL
}
}, { /* 5 */
"Linguistic Rearrangement",
0,
{
/* "Linguistic Rearrangement", */
"Turns on the feature",
NULL
}
}, { /* 6 */
"Number Spacing",
1,
{
"Monospaced Numbers",
"Proportional Numbers",
NULL
}
}, { /* 7 */
APPLE_RESERVED " 1",
0,
{NULL}
}, { /* 8 */
"Smart Swashes",
0,
{
"Word Initial Swashes",
"Word Final Swashes",
"Line Initial Swashes",
"Line Final Swashes",
"Non-Final Swashes",
NULL
}
}, { /* 9 */
"Diacritics",
1,
{
"Show Diacritics",
"Hide Diacritics",
"Decompose Diacritics",
NULL
}
}, { /* 10 */
"Vertical Position",
1,
{
/* "Normal Position", */
"No Vertical Position",
"Superiors",
"Inferiors",
"Ordinals",
NULL
}
}, { /* 11 */
"Fractions",
1,
{
"No Fractions",
"Vertical Fractions",
"Diagonal Fractions",
NULL
}
}, { /* 12 */
APPLE_RESERVED " 2",
0,
{NULL}
}, { /* 13 */
"Overlapping Characters",
0,
{
/* "Prevent Overlap", */
"Turns on the feature",
NULL
}
}, { /* 14 */
"Typographic Extras",
0,
{
"Hyphens to Em Dash",
"Hyphens to En Dash",
"Unslashed Zero",
"Form Interrobang",
"Smart Quotes",
"Periods to Ellipsis",
NULL
}
}, { /* 15 */
"Mathematical Extras",
0,
{
"Hyphens to Minus",
"Asterisk to Multiply",
"Slash to Divide",
"Inequality Ligatures",
"Exponents",
NULL
}
}, { /* 16 */
"Ornament Sets",
1,
{
"No Ornaments",
"Dingbats",
"Pi Characters",
"Fleurons",
"Decorative Borders",
"International Symbols",
"Math Symbols",
NULL
}
}, { /* 17 */
"Character Alternatives",
1,
{
"No Alternates",
/* TODO */
NULL
}
}, { /* 18 */
"Design Complexity",
1,
{
"Design Level 1",
"Design Level 2",
"Design Level 3",
"Design Level 4",
"Design Level 5",
/* TODO */
NULL
}
}, { /* 19 */
"Style Options",
1,
{
"No Style Options",
"Display Text",
"Engraved Text",
"Illuminated Caps",
"Tilling Caps",
"Tall Caps",
NULL
}
}, { /* 20 */
"Character Shape",
1,
{
"Traditional Characters",
"Simplified Characters",
"JIS 1978 Characters",
"JIS 1983 Characters",
"JIS 1990 Characters",
"Traditional Characters, Alternative Set 1",
"Traditional Characters, Alternative Set 2",
"Traditional Characters, Alternative Set 3",
"Traditional Characters, Alternative Set 4",
"Traditional Characters, Alternative Set 5",
"Expert Characters",
NULL /* count => 12 */
}
}, { /* 21 */
"Number Case",
1,
{
"Lower Case Numbers",
"Upper Case Numbers",
NULL
}
}, { /* 22 */
"Text Spacing",
1,
{
"Proportional",
"Monospaced",
"Half-width",
"Normal",
NULL
}
}, /* Here after Newer */ { /* 23 */
"Transliteration",
1,
{
"No Transliteration",
"Hanja To Hangul",
"Hiragana to Katakana",
"Katakana to Hiragana",
"Kana to Romanization",
"Romanization to Hiragana",
"Romanization to Katakana",
"Hanja to Hangul, Alternative Set 1",
"Hanja to Hangul, Alternative Set 2",
"Hanja to Hangul, Alternative Set 3",
NULL
}
}, { /* 24 */
"Annotation",
1,
{
"No Annotation",
"Box Annotation",
"Rounded Box Annotation",
"Circle Annotation",
"Inverted Circle Annotation",
"Parenthesis Annotation",
"Period Annotation",
"Roman Numeral Annotation",
"Diamond Annotation",
NULL
}
}, { /* 25 */
"Kana Spacing",
1,
{
"Full Width",
"Proportional",
NULL
}
}, { /* 26 */
"Ideographic Spacing",
1,
{
"Full Width",
"Proportional",
NULL
}
}, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 27-30 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 31-35 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 36-40 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 40-45 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 46-50 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 51-55 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 56-60 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 61-65 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 66-70 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 71-75 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 76-80 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 81-85 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 86-90 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 91-95 */
EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 96-98 */
EMPTYFEAT, /* 99 */ { /* 100 => 22 */
"Text Spacing",
1,
{
"Proportional",
"Monospaced",
"Half-width",
"Normal",
NULL
}
}, { /* 101 => 25 */
"Kana Spacing",
1,
{
"Full Width",
"Proportional",
NULL
}
}, { /* 102 => 26 */
"Ideographic Spacing",
1,
{
"Full Width",
"Proportional",
NULL
}
}, { /* 103 */
"CJK Roman Spacing",
1,
{
"Half-width",
"Proportional",
"Default Roman",
"Full-width Roman",
NULL
}
}, { /* 104 => 1 */
"All Typographic Features",
0,
{
"All Type Features",
NULL
}
}
};
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** Generator *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
int
main( void )
{
int i;
printf( " {\n" );
printf( " /* Generated from %s */\n", __FILE__ );
for ( i = 0;
i < sizeof ( featreg_table ) / sizeof ( GX_Feature_RegistryRec );
i++ )
{
const char* feat_name;
int nSettings;
feat_name = featreg_table[i].feat_name;
for ( nSettings = 0;
featreg_table[i].setting_name[nSettings];
nSettings++)
; /* Do nothing */
printf( " {%1d, %1d, %1d, %2d}, /* %s */\n",
feat_name ? 1 : 0,
( feat_name &&
( ft_strncmp( feat_name,
APPLE_RESERVED, APPLE_RESERVED_LENGTH ) == 0 )
) ? 1 : 0,
featreg_table[i].exclusive ? 1 : 0,
nSettings,
feat_name ? feat_name : "__EMPTY__" );
}
printf( " };\n" );
return 0;
}
/* END */