• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* This file has been generated by the Perl script `afblue.pl', */
2 /* using data from file `afblue.dat'.                           */
3 
4 /***************************************************************************/
5 /*                                                                         */
6 /*  afblue.h                                                               */
7 /*                                                                         */
8 /*    Auto-fitter data for blue strings (specification).                   */
9 /*                                                                         */
10 /*  Copyright 2013, 2014 by                                                */
11 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
12 /*                                                                         */
13 /*  This file is part of the FreeType project, and may only be used,       */
14 /*  modified, and distributed under the terms of the FreeType project      */
15 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
16 /*  this file you indicate that you have read the license and              */
17 /*  understand and accept it fully.                                        */
18 /*                                                                         */
19 /***************************************************************************/
20 
21 
22 #ifndef __AFBLUE_H__
23 #define __AFBLUE_H__
24 
25 
26 FT_BEGIN_HEADER
27 
28 
29   /* an auxiliary macro to decode a UTF-8 character -- since we only use */
30   /* hard-coded, self-converted data, no error checking is performed     */
31 #define GET_UTF8_CHAR( ch, p )                    \
32           ch = (unsigned char)*p++;               \
33           if ( ch >= 0x80 )                       \
34           {                                       \
35             FT_UInt  len;                         \
36                                                   \
37                                                   \
38             if ( ch < 0xE0 )                      \
39             {                                     \
40               len = 1;                            \
41               ch &= 0x1F;                         \
42             }                                     \
43             else if ( ch < 0xF0 )                 \
44             {                                     \
45               len = 2;                            \
46               ch &= 0x0F;                         \
47             }                                     \
48             else                                  \
49             {                                     \
50               len = 3;                            \
51               ch &= 0x07;                         \
52             }                                     \
53                                                   \
54             for ( ; len > 0; len-- )              \
55               ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
56           }
57 
58 
59   /*************************************************************************/
60   /*************************************************************************/
61   /*****                                                               *****/
62   /*****                    B L U E   S T R I N G S                    *****/
63   /*****                                                               *****/
64   /*************************************************************************/
65   /*************************************************************************/
66 
67   /* At the bottommost level, we define strings for finding blue zones. */
68 
69 
70 #define AF_BLUE_STRING_MAX_LEN  51
71 
72   /* The AF_Blue_String enumeration values are offsets into the */
73   /* `af_blue_strings' array.                                   */
74 
75   typedef enum  AF_Blue_String_
76   {
77     AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 0,
78     AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 17,
79     AF_BLUE_STRING_CYRILLIC_SMALL = 34,
80     AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 51,
81     AF_BLUE_STRING_DEVANAGARI_BASE = 58,
82     AF_BLUE_STRING_DEVANAGARI_TOP = 83,
83     AF_BLUE_STRING_DEVANAGARI_HEAD = 108,
84     AF_BLUE_STRING_DEVANAGARI_BOTTOM = 133,
85     AF_BLUE_STRING_GREEK_CAPITAL_TOP = 140,
86     AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 155,
87     AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 168,
88     AF_BLUE_STRING_GREEK_SMALL = 181,
89     AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 198,
90     AF_BLUE_STRING_HEBREW_TOP = 215,
91     AF_BLUE_STRING_HEBREW_BOTTOM = 232,
92     AF_BLUE_STRING_HEBREW_DESCENDER = 245,
93     AF_BLUE_STRING_LATIN_CAPITAL_TOP = 256,
94     AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 265,
95     AF_BLUE_STRING_LATIN_SMALL_F_TOP = 274,
96     AF_BLUE_STRING_LATIN_SMALL = 282,
97     AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 290,
98     af_blue_1_1 = 295,
99 #ifdef AF_CONFIG_OPTION_CJK
100     AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1,
101     AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 153,
102     af_blue_1_1_1 = af_blue_1_1 + 304,
103 #ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
104     AF_BLUE_STRING_CJK_LEFT = af_blue_1_1_1 + 1,
105     AF_BLUE_STRING_CJK_RIGHT = af_blue_1_1_1 + 153,
106     af_blue_1_1_2 = af_blue_1_1_1 + 304,
107 #else
108     af_blue_1_1_2 = af_blue_1_1_1 + 0,
109 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
110     af_blue_1_2 = af_blue_1_1_2 + 0,
111 #else
112     af_blue_1_2 = af_blue_1_1 + 0,
113 #endif /* AF_CONFIG_OPTION_CJK                */
114 
115 
116     AF_BLUE_STRING_MAX   /* do not remove */
117 
118   } AF_Blue_String;
119 
120 
121   FT_LOCAL_ARRAY( char )
122   af_blue_strings[];
123 
124 
125   /*************************************************************************/
126   /*************************************************************************/
127   /*****                                                               *****/
128   /*****                 B L U E   S T R I N G S E T S                 *****/
129   /*****                                                               *****/
130   /*************************************************************************/
131   /*************************************************************************/
132 
133   /* The next level is to group blue strings into style-specific sets. */
134 
135 
136   /* Properties are specific to a writing system.  We assume that a given  */
137   /* blue string can't be used in more than a single writing system, which */
138   /* is a safe bet.                                                        */
139 #define AF_BLUE_PROPERTY_LATIN_TOP       ( 1 << 0 )   /* must have value 1 */
140 #define AF_BLUE_PROPERTY_LATIN_NEUTRAL   ( 1 << 1 )
141 #define AF_BLUE_PROPERTY_LATIN_X_HEIGHT  ( 1 << 2 )
142 #define AF_BLUE_PROPERTY_LATIN_LONG      ( 1 << 3 )
143 
144 #define AF_BLUE_PROPERTY_CJK_TOP    ( 1 << 0 )        /* must have value 1 */
145 #define AF_BLUE_PROPERTY_CJK_HORIZ  ( 1 << 1 )        /* must have value 2 */
146 #define AF_BLUE_PROPERTY_CJK_RIGHT  AF_BLUE_PROPERTY_CJK_TOP
147 
148 
149 #define AF_BLUE_STRINGSET_MAX_LEN  7
150 
151   /* The AF_Blue_Stringset enumeration values are offsets into the */
152   /* `af_blue_stringsets' array.                                   */
153 
154   typedef enum  AF_Blue_Stringset_
155   {
156     AF_BLUE_STRINGSET_CYRL = 0,
157     AF_BLUE_STRINGSET_DEVA = 6,
158     AF_BLUE_STRINGSET_GREK = 12,
159     AF_BLUE_STRINGSET_HEBR = 19,
160     AF_BLUE_STRINGSET_LATN = 23,
161     af_blue_2_1 = 30,
162 #ifdef AF_CONFIG_OPTION_CJK
163     AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
164     af_blue_2_1_1 = af_blue_2_1 + 2,
165 #ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
166     af_blue_2_1_2 = af_blue_2_1_1 + 2,
167 #else
168     af_blue_2_1_2 = af_blue_2_1_1 + 0,
169 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
170     af_blue_2_2 = af_blue_2_1_2 + 1,
171 #else
172     af_blue_2_2 = af_blue_2_1 + 0,
173 #endif /* AF_CONFIG_OPTION_CJK                */
174 
175 
176     AF_BLUE_STRINGSET_MAX   /* do not remove */
177 
178   } AF_Blue_Stringset;
179 
180 
181   typedef struct  AF_Blue_StringRec_
182   {
183     AF_Blue_String  string;
184     FT_UShort       properties;
185 
186   } AF_Blue_StringRec;
187 
188 
189   FT_LOCAL_ARRAY( AF_Blue_StringRec )
190   af_blue_stringsets[];
191 
192 /* */
193 
194 FT_END_HEADER
195 
196 
197 #endif /* __AFBLUE_H__ */
198 
199 
200 /* END */
201