Imported Upstream version 2.5.5
[platform/upstream/freetype2.git] / src / autofit / afblue.h
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_STRING_TELUGU_TOP = 296,
99     AF_BLUE_STRING_TELUGU_BOTTOM = 318,
100     af_blue_1_1 = 339,
101 #ifdef AF_CONFIG_OPTION_CJK
102     AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1,
103     AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 153,
104     af_blue_1_1_1 = af_blue_1_1 + 304,
105 #ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
106     AF_BLUE_STRING_CJK_LEFT = af_blue_1_1_1 + 1,
107     AF_BLUE_STRING_CJK_RIGHT = af_blue_1_1_1 + 153,
108     af_blue_1_1_2 = af_blue_1_1_1 + 304,
109 #else
110     af_blue_1_1_2 = af_blue_1_1_1 + 0,
111 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
112     af_blue_1_2 = af_blue_1_1_2 + 0,
113 #else
114     af_blue_1_2 = af_blue_1_1 + 0,
115 #endif /* AF_CONFIG_OPTION_CJK                */
116
117
118     AF_BLUE_STRING_MAX   /* do not remove */
119
120   } AF_Blue_String;
121
122
123   FT_LOCAL_ARRAY( char )
124   af_blue_strings[];
125
126
127   /*************************************************************************/
128   /*************************************************************************/
129   /*****                                                               *****/
130   /*****                 B L U E   S T R I N G S E T S                 *****/
131   /*****                                                               *****/
132   /*************************************************************************/
133   /*************************************************************************/
134
135   /* The next level is to group blue strings into style-specific sets. */
136
137
138   /* Properties are specific to a writing system.  We assume that a given  */
139   /* blue string can't be used in more than a single writing system, which */
140   /* is a safe bet.                                                        */
141 #define AF_BLUE_PROPERTY_LATIN_TOP       ( 1 << 0 )   /* must have value 1 */
142 #define AF_BLUE_PROPERTY_LATIN_NEUTRAL   ( 1 << 1 )
143 #define AF_BLUE_PROPERTY_LATIN_X_HEIGHT  ( 1 << 2 )
144 #define AF_BLUE_PROPERTY_LATIN_LONG      ( 1 << 3 )
145
146 #define AF_BLUE_PROPERTY_CJK_TOP    ( 1 << 0 )        /* must have value 1 */
147 #define AF_BLUE_PROPERTY_CJK_HORIZ  ( 1 << 1 )        /* must have value 2 */
148 #define AF_BLUE_PROPERTY_CJK_RIGHT  AF_BLUE_PROPERTY_CJK_TOP
149
150
151 #define AF_BLUE_STRINGSET_MAX_LEN  7
152
153   /* The AF_Blue_Stringset enumeration values are offsets into the */
154   /* `af_blue_stringsets' array.                                   */
155
156   typedef enum  AF_Blue_Stringset_
157   {
158     AF_BLUE_STRINGSET_CYRL = 0,
159     AF_BLUE_STRINGSET_DEVA = 6,
160     AF_BLUE_STRINGSET_GREK = 12,
161     AF_BLUE_STRINGSET_HEBR = 19,
162     AF_BLUE_STRINGSET_LATN = 23,
163     AF_BLUE_STRINGSET_TELU = 30,
164     af_blue_2_1 = 33,
165 #ifdef AF_CONFIG_OPTION_CJK
166     AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
167     af_blue_2_1_1 = af_blue_2_1 + 2,
168 #ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
169     af_blue_2_1_2 = af_blue_2_1_1 + 2,
170 #else
171     af_blue_2_1_2 = af_blue_2_1_1 + 0,
172 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
173     af_blue_2_2 = af_blue_2_1_2 + 1,
174 #else
175     af_blue_2_2 = af_blue_2_1 + 0,
176 #endif /* AF_CONFIG_OPTION_CJK                */
177
178
179     AF_BLUE_STRINGSET_MAX   /* do not remove */
180
181   } AF_Blue_Stringset;
182
183
184   typedef struct  AF_Blue_StringRec_
185   {
186     AF_Blue_String  string;
187     FT_UShort       properties;
188
189   } AF_Blue_StringRec;
190
191
192   FT_LOCAL_ARRAY( AF_Blue_StringRec )
193   af_blue_stringsets[];
194
195 /* */
196
197 FT_END_HEADER
198
199
200 #endif /* __AFBLUE_H__ */
201
202
203 /* END */