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-2015 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_ARABIC_TOP = 0,
78     AF_BLUE_STRING_ARABIC_JOIN = 13,
79     AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 24,
80     AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 41,
81     AF_BLUE_STRING_CYRILLIC_SMALL = 58,
82     AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 75,
83     AF_BLUE_STRING_DEVANAGARI_BASE = 82,
84     AF_BLUE_STRING_DEVANAGARI_TOP = 107,
85     AF_BLUE_STRING_DEVANAGARI_HEAD = 132,
86     AF_BLUE_STRING_DEVANAGARI_BOTTOM = 157,
87     AF_BLUE_STRING_GREEK_CAPITAL_TOP = 164,
88     AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 179,
89     AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 192,
90     AF_BLUE_STRING_GREEK_SMALL = 205,
91     AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 222,
92     AF_BLUE_STRING_HEBREW_TOP = 239,
93     AF_BLUE_STRING_HEBREW_BOTTOM = 256,
94     AF_BLUE_STRING_HEBREW_DESCENDER = 269,
95     AF_BLUE_STRING_LATIN_CAPITAL_TOP = 280,
96     AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 289,
97     AF_BLUE_STRING_LATIN_SMALL_F_TOP = 298,
98     AF_BLUE_STRING_LATIN_SMALL = 306,
99     AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 314,
100     AF_BLUE_STRING_TELUGU_TOP = 320,
101     AF_BLUE_STRING_TELUGU_BOTTOM = 342,
102     AF_BLUE_STRING_THAI_TOP = 364,
103     AF_BLUE_STRING_THAI_BOTTOM = 383,
104     AF_BLUE_STRING_THAI_ASCENDER = 405,
105     AF_BLUE_STRING_THAI_LARGE_ASCENDER = 415,
106     AF_BLUE_STRING_THAI_DESCENDER = 425,
107     AF_BLUE_STRING_THAI_LARGE_DESCENDER = 438,
108     AF_BLUE_STRING_THAI_DIGIT_TOP = 445,
109     af_blue_1_1 = 454,
110 #ifdef AF_CONFIG_OPTION_CJK
111     AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1,
112     AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 153,
113     af_blue_1_1_1 = af_blue_1_1 + 304,
114 #ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
115     AF_BLUE_STRING_CJK_LEFT = af_blue_1_1_1 + 1,
116     AF_BLUE_STRING_CJK_RIGHT = af_blue_1_1_1 + 153,
117     af_blue_1_1_2 = af_blue_1_1_1 + 304,
118 #else
119     af_blue_1_1_2 = af_blue_1_1_1 + 0,
120 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
121     af_blue_1_2 = af_blue_1_1_2 + 0,
122 #else
123     af_blue_1_2 = af_blue_1_1 + 0,
124 #endif /* AF_CONFIG_OPTION_CJK                */
125 
126 
127     AF_BLUE_STRING_MAX   /* do not remove */
128 
129   } AF_Blue_String;
130 
131 
132   FT_LOCAL_ARRAY( char )
133   af_blue_strings[];
134 
135 
136   /*************************************************************************/
137   /*************************************************************************/
138   /*****                                                               *****/
139   /*****                 B L U E   S T R I N G S E T S                 *****/
140   /*****                                                               *****/
141   /*************************************************************************/
142   /*************************************************************************/
143 
144   /* The next level is to group blue strings into style-specific sets. */
145 
146 
147   /* Properties are specific to a writing system.  We assume that a given  */
148   /* blue string can't be used in more than a single writing system, which */
149   /* is a safe bet.                                                        */
150 #define AF_BLUE_PROPERTY_LATIN_TOP       ( 1U << 0 )  /* must have value 1 */
151 #define AF_BLUE_PROPERTY_LATIN_NEUTRAL   ( 1U << 1 )
152 #define AF_BLUE_PROPERTY_LATIN_X_HEIGHT  ( 1U << 2 )
153 #define AF_BLUE_PROPERTY_LATIN_LONG      ( 1U << 3 )
154 
155 #define AF_BLUE_PROPERTY_CJK_TOP    ( 1U << 0 )       /* must have value 1 */
156 #define AF_BLUE_PROPERTY_CJK_HORIZ  ( 1U << 1 )       /* must have value 2 */
157 #define AF_BLUE_PROPERTY_CJK_RIGHT  AF_BLUE_PROPERTY_CJK_TOP
158 
159 
160 #define AF_BLUE_STRINGSET_MAX_LEN  8
161 
162   /* The AF_Blue_Stringset enumeration values are offsets into the */
163   /* `af_blue_stringsets' array.                                   */
164 
165   typedef enum  AF_Blue_Stringset_
166   {
167     AF_BLUE_STRINGSET_ARAB = 0,
168     AF_BLUE_STRINGSET_CYRL = 3,
169     AF_BLUE_STRINGSET_DEVA = 9,
170     AF_BLUE_STRINGSET_GREK = 15,
171     AF_BLUE_STRINGSET_HEBR = 22,
172     AF_BLUE_STRINGSET_LATN = 26,
173     AF_BLUE_STRINGSET_TELU = 33,
174     AF_BLUE_STRINGSET_THAI = 36,
175     af_blue_2_1 = 44,
176 #ifdef AF_CONFIG_OPTION_CJK
177     AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
178     af_blue_2_1_1 = af_blue_2_1 + 2,
179 #ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
180     af_blue_2_1_2 = af_blue_2_1_1 + 2,
181 #else
182     af_blue_2_1_2 = af_blue_2_1_1 + 0,
183 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
184     af_blue_2_2 = af_blue_2_1_2 + 1,
185 #else
186     af_blue_2_2 = af_blue_2_1 + 0,
187 #endif /* AF_CONFIG_OPTION_CJK                */
188 
189 
190     AF_BLUE_STRINGSET_MAX   /* do not remove */
191 
192   } AF_Blue_Stringset;
193 
194 
195   typedef struct  AF_Blue_StringRec_
196   {
197     AF_Blue_String  string;
198     FT_UShort       properties;
199 
200   } AF_Blue_StringRec;
201 
202 
203   FT_LOCAL_ARRAY( AF_Blue_StringRec )
204   af_blue_stringsets[];
205 
206 /* */
207 
208 FT_END_HEADER
209 
210 
211 #endif /* __AFBLUE_H__ */
212 
213 
214 /* END */
215