gxvfgen.c

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  gxfgen.c                                                               */
00004 /*                                                                         */
00005 /*    Generate feature registry data for gxv `feat' validator.             */
00006 /*    This program is derived from gxfeatreg.c in gxlayout.                */
00007 /*                                                                         */
00008 /*  Copyright 2004, 2005, 2006 by Masatake YAMATO and Redhat K.K.          */
00009 /*                                                                         */
00010 /*  This file may only be used,                                            */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 /***************************************************************************/
00019 /*                                                                         */
00020 /*  gxfeatreg.c                                                            */
00021 /*                                                                         */
00022 /*    Database of font features pre-defined by Apple Computer, Inc.        */
00023 /*    http://developer.apple.com/fonts/Registry/                           */
00024 /*    (body).                                                              */
00025 /*                                                                         */
00026 /*  Copyright 2003 by                                                      */
00027 /*  Masatake YAMATO and Redhat K.K.                                        */
00028 /*                                                                         */
00029 /*  This file may only be used,                                            */
00030 /*  modified, and distributed under the terms of the FreeType project      */
00031 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00032 /*  this file you indicate that you have read the license and              */
00033 /*  understand and accept it fully.                                        */
00034 /*                                                                         */
00035 /***************************************************************************/
00036 
00037 /***************************************************************************/
00038 /*                                                                         */
00039 /* Development of gxfeatreg.c is supported by                              */
00040 /* Information-technology Promotion Agency, Japan.                         */
00041 /*                                                                         */
00042 /***************************************************************************/
00043 
00044 
00045 /***************************************************************************/
00046 /*                                                                         */
00047 /* This file is compiled as a stand-alone executable.                      */
00048 /* This file is never compiled into `libfreetype2'.                        */
00049 /* The output of this file is used in `gxvfeat.c'.                         */
00050 /* ----------------------------------------------------------------------- */
00051 /* Compile: gcc `pkg-config --cflags freetype2` gxvfgen.c -o gxvfgen       */
00052 /* Run: ./gxvfgen > tmp.c                                                  */
00053 /*                                                                         */
00054 /***************************************************************************/
00055 
00056   /*******************************************************************/
00057   /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
00058   /*******************************************************************/
00059 
00060   /*
00061    * If you add a new setting to a feature, check the number of settings
00062    * in the feature.  If the number is greater than the value defined as
00063    * FEATREG_MAX_SETTING, update the value.
00064    */
00065 #define FEATREG_MAX_SETTING  12
00066 
00067   /*******************************************************************/
00068   /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
00069   /*******************************************************************/
00070 
00071 
00072 #include <stdio.h>
00073 #include <string.h>
00074 
00075 
00076   /*************************************************************************/
00077   /*************************************************************************/
00078   /*****                                                               *****/
00079   /*****                      Data and Types                           *****/
00080   /*****                                                               *****/
00081   /*************************************************************************/
00082   /*************************************************************************/
00083 
00084 #define APPLE_RESERVED         "Apple Reserved"
00085 #define APPLE_RESERVED_LENGTH  14
00086 
00087   typedef struct  GX_Feature_RegistryRec_
00088   {
00089     const char*  feat_name;
00090     char         exclusive;
00091     char*        setting_name[FEATREG_MAX_SETTING];
00092 
00093   } GX_Feature_RegistryRec;
00094 
00095 
00096 #define EMPTYFEAT {0, 0, {NULL}}
00097 
00098 
00099   static GX_Feature_RegistryRec featreg_table[] = {
00100     {                                       /* 0 */
00101       "All Typographic Features",
00102       0,
00103       {
00104         "All Type Features",
00105         NULL
00106       }
00107     }, {                                    /* 1 */
00108       "Ligatures",
00109       0,
00110       {
00111         "Required Ligatures",
00112         "Common Ligatures",
00113         "Rare Ligatures",
00114         "Logos",
00115         "Rebus Pictures",
00116         "Diphthong Ligatures",
00117         "Squared Ligatures",
00118         "Squared Ligatures, Abbreviated",
00119         NULL
00120       }
00121     }, {                                    /* 2 */
00122       "Cursive Connection",
00123       1,
00124       {
00125         "Unconnected",
00126         "Partially Connected",
00127         "Cursive",
00128         NULL
00129       }
00130     }, {                                    /* 3 */
00131       "Letter Case",
00132       1,
00133       {
00134         "Upper & Lower Case",
00135         "All Caps",
00136         "All Lower Case",
00137         "Small Caps",
00138         "Initial Caps",
00139         "Initial Caps & Small Caps",
00140         NULL
00141       }
00142     }, {                                    /* 4 */
00143       "Vertical Substitution",
00144       0,
00145       {
00146         /* "Substitute Vertical Forms", */
00147         "Turns on the feature",
00148         NULL
00149       }
00150     }, {                                    /* 5 */
00151       "Linguistic Rearrangement",
00152       0,
00153       {
00154         /* "Linguistic Rearrangement", */
00155         "Turns on the feature",
00156         NULL
00157       }
00158     }, {                                    /* 6 */
00159       "Number Spacing",
00160       1,
00161       {
00162         "Monospaced Numbers",
00163         "Proportional Numbers",
00164         NULL
00165       }
00166     }, {                                    /* 7 */
00167       APPLE_RESERVED " 1",
00168       0,
00169       {NULL}
00170     }, {                                    /* 8 */
00171       "Smart Swashes",
00172       0,
00173       {
00174         "Word Initial Swashes",
00175         "Word Final Swashes",
00176         "Line Initial Swashes",
00177         "Line Final Swashes",
00178         "Non-Final Swashes",
00179         NULL
00180       }
00181     }, {                                    /* 9 */
00182       "Diacritics",
00183       1,
00184       {
00185         "Show Diacritics",
00186         "Hide Diacritics",
00187         "Decompose Diacritics",
00188         NULL
00189       }
00190     }, {                                    /* 10 */
00191       "Vertical Position",
00192       1,
00193       {
00194         /* "Normal Position", */
00195         "No Vertical Position",
00196         "Superiors",
00197         "Inferiors",
00198         "Ordinals",
00199         NULL
00200       }
00201     }, {                                    /* 11 */
00202       "Fractions",
00203       1,
00204       {
00205         "No Fractions",
00206         "Vertical Fractions",
00207         "Diagonal Fractions",
00208         NULL
00209       }
00210     }, {                                    /* 12 */
00211       APPLE_RESERVED " 2",
00212       0,
00213       {NULL}
00214     }, {                                    /* 13 */
00215       "Overlapping Characters",
00216       0,
00217       {
00218         /* "Prevent Overlap", */
00219         "Turns on the feature",
00220         NULL
00221       }
00222     }, {                                    /* 14 */
00223       "Typographic Extras",
00224       0,
00225       {
00226         "Hyphens to Em Dash",
00227         "Hyphens to En Dash",
00228         "Unslashed Zero",
00229         "Form Interrobang",
00230         "Smart Quotes",
00231         "Periods to Ellipsis",
00232         NULL
00233       }
00234     }, {                                    /* 15 */
00235       "Mathematical Extras",
00236       0,
00237       {
00238         "Hyphens to Minus",
00239         "Asterisk to Multiply",
00240         "Slash to Divide",
00241         "Inequality Ligatures",
00242         "Exponents",
00243         NULL
00244       }
00245     }, {                                    /* 16 */
00246       "Ornament Sets",
00247       1,
00248       {
00249         "No Ornaments",
00250         "Dingbats",
00251         "Pi Characters",
00252         "Fleurons",
00253         "Decorative Borders",
00254         "International Symbols",
00255         "Math Symbols",
00256         NULL
00257       }
00258     }, {                                    /* 17 */
00259       "Character Alternatives",
00260       1,
00261       {
00262         "No Alternates",
00263         /* TODO */
00264         NULL
00265       }
00266     }, {                                    /* 18 */
00267       "Design Complexity",
00268       1,
00269       {
00270         "Design Level 1",
00271         "Design Level 2",
00272         "Design Level 3",
00273         "Design Level 4",
00274         "Design Level 5",
00275         /* TODO */
00276         NULL
00277       }
00278     }, {                                    /* 19 */
00279       "Style Options",
00280       1,
00281       {
00282         "No Style Options",
00283         "Display Text",
00284         "Engraved Text",
00285         "Illuminated Caps",
00286         "Tilling Caps",
00287         "Tall Caps",
00288         NULL
00289       }
00290     }, {                                    /* 20 */
00291       "Character Shape",
00292       1,
00293       {
00294         "Traditional Characters",
00295         "Simplified Characters",
00296         "JIS 1978 Characters",
00297         "JIS 1983 Characters",
00298         "JIS 1990 Characters",
00299         "Traditional Characters, Alternative Set 1",
00300         "Traditional Characters, Alternative Set 2",
00301         "Traditional Characters, Alternative Set 3",
00302         "Traditional Characters, Alternative Set 4",
00303         "Traditional Characters, Alternative Set 5",
00304         "Expert Characters",
00305         NULL                           /* count => 12 */
00306       }
00307     }, {                                    /* 21 */
00308       "Number Case",
00309       1,
00310       {
00311         "Lower Case Numbers",
00312         "Upper Case Numbers",
00313         NULL
00314       }
00315     }, {                                    /* 22 */
00316       "Text Spacing",
00317       1,
00318       {
00319         "Proportional",
00320         "Monospaced",
00321         "Half-width",
00322         "Normal",
00323         NULL
00324       }
00325     }, /* Here after Newer */  { /* 23 */
00326       "Transliteration",
00327       1,
00328       {
00329         "No Transliteration",
00330         "Hanja To Hangul",
00331         "Hiragana to Katakana",
00332         "Katakana to Hiragana",
00333         "Kana to Romanization",
00334         "Romanization to Hiragana",
00335         "Romanization to Katakana",
00336         "Hanja to Hangul, Alternative Set 1",
00337         "Hanja to Hangul, Alternative Set 2",
00338         "Hanja to Hangul, Alternative Set 3",
00339         NULL
00340       }
00341     }, {                                    /* 24 */
00342       "Annotation",
00343       1,
00344       {
00345         "No Annotation",
00346         "Box Annotation",
00347         "Rounded Box Annotation",
00348         "Circle Annotation",
00349         "Inverted Circle Annotation",
00350         "Parenthesis Annotation",
00351         "Period Annotation",
00352         "Roman Numeral Annotation",
00353         "Diamond Annotation",
00354         NULL
00355       }
00356     }, {                                    /* 25 */
00357       "Kana Spacing",
00358       1,
00359       {
00360         "Full Width",
00361         "Proportional",
00362         NULL
00363       }
00364     }, {                                    /* 26 */
00365       "Ideographic Spacing",
00366       1,
00367       {
00368         "Full Width",
00369         "Proportional",
00370         NULL
00371       }
00372     }, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT,         /* 27-30 */
00373     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 31-35 */
00374     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 36-40 */
00375     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 40-45 */
00376     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 46-50 */
00377     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 51-55 */
00378     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 56-60 */
00379     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 61-65 */
00380     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 66-70 */
00381     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 71-75 */
00382     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 76-80 */
00383     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 81-85 */
00384     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 86-90 */
00385     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, EMPTYFEAT, /* 91-95 */
00386     EMPTYFEAT, EMPTYFEAT, EMPTYFEAT,                       /* 96-98 */
00387     EMPTYFEAT, /* 99 */ {                   /* 100 => 22 */
00388       "Text Spacing",
00389       1,
00390       {
00391         "Proportional",
00392         "Monospaced",
00393         "Half-width",
00394         "Normal",
00395         NULL
00396       }
00397     }, {                                    /* 101 => 25 */
00398       "Kana Spacing",
00399       1,
00400       {
00401         "Full Width",
00402         "Proportional",
00403         NULL
00404       }
00405     }, {                                    /* 102 => 26 */
00406       "Ideographic Spacing",
00407       1,
00408       {
00409         "Full Width",
00410         "Proportional",
00411         NULL
00412       }
00413     }, {                                    /* 103 */
00414       "CJK Roman Spacing",
00415       1,
00416       {
00417         "Half-width",
00418         "Proportional",
00419         "Default Roman",
00420         "Full-width Roman",
00421         NULL
00422       }
00423     }, {                                    /* 104 => 1 */
00424       "All Typographic Features",
00425       0,
00426       {
00427         "All Type Features",
00428         NULL
00429       }
00430     }
00431   };
00432 
00433 
00434   /*************************************************************************/
00435   /*************************************************************************/
00436   /*****                                                               *****/
00437   /*****                         Generator                             *****/
00438   /*****                                                               *****/
00439   /*************************************************************************/
00440   /*************************************************************************/
00441 
00442   int
00443   main( void )
00444   {
00445     int  i;
00446 
00447 
00448     printf( "  {\n" );
00449     printf( "   /* Generated from %s */\n", __FILE__ );
00450 
00451     for ( i = 0;
00452           i < sizeof ( featreg_table ) / sizeof ( GX_Feature_RegistryRec );
00453           i++ )
00454     {
00455       const char*  feat_name;
00456       int          nSettings;
00457 
00458 
00459       feat_name = featreg_table[i].feat_name;
00460       for ( nSettings = 0;
00461             featreg_table[i].setting_name[nSettings];
00462             nSettings++)
00463         ;                                   /* Do nothing */
00464 
00465       printf( "    {%1d, %1d, %1d, %2d},   /* %s */\n",
00466               feat_name ? 1 : 0,
00467               ( feat_name                                                  &&
00468                 ( ft_strncmp( feat_name,
00469                               APPLE_RESERVED, APPLE_RESERVED_LENGTH ) == 0 )
00470               ) ? 1 : 0,
00471               featreg_table[i].exclusive ? 1 : 0,
00472               nSettings,
00473               feat_name ? feat_name : "__EMPTY__" );
00474     }
00475 
00476     printf( "  };\n" );
00477 
00478     return 0;
00479   }
00480 
00481 
00482 /* END */

Generated on Tue Jul 5 14:13:47 2011 for ROOT_528-00b_version by  doxygen 1.5.1