tizen 2.3.1 release
[framework/graphics/freetype.git] / src / autofit / afblue.hin
1 /***************************************************************************/
2 /*                                                                         */
3 /*  afblue.h                                                               */
4 /*                                                                         */
5 /*    Auto-fitter data for blue strings (specification).                   */
6 /*                                                                         */
7 /*  Copyright 2013, 2014 by                                                */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
10 /*  This file is part of the FreeType project, and may only be used,       */
11 /*  modified, and distributed under the terms of the FreeType project      */
12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
13 /*  this file you indicate that you have read the license and              */
14 /*  understand and accept it fully.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17
18
19 #ifndef __AFBLUE_H__
20 #define __AFBLUE_H__
21
22
23 FT_BEGIN_HEADER
24
25
26   /* an auxiliary macro to decode a UTF-8 character -- since we only use */
27   /* hard-coded, self-converted data, no error checking is performed     */
28 #define GET_UTF8_CHAR( ch, p )                    \
29           ch = (unsigned char)*p++;               \
30           if ( ch >= 0x80 )                       \
31           {                                       \
32             FT_UInt  len;                         \
33                                                   \
34                                                   \
35             if ( ch < 0xE0 )                      \
36             {                                     \
37               len = 1;                            \
38               ch &= 0x1F;                         \
39             }                                     \
40             else if ( ch < 0xF0 )                 \
41             {                                     \
42               len = 2;                            \
43               ch &= 0x0F;                         \
44             }                                     \
45             else                                  \
46             {                                     \
47               len = 3;                            \
48               ch &= 0x07;                         \
49             }                                     \
50                                                   \
51             for ( ; len > 0; len-- )              \
52               ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
53           }
54
55
56   /*************************************************************************/
57   /*************************************************************************/
58   /*****                                                               *****/
59   /*****                    B L U E   S T R I N G S                    *****/
60   /*****                                                               *****/
61   /*************************************************************************/
62   /*************************************************************************/
63
64   /* At the bottommost level, we define strings for finding blue zones. */
65
66
67 #define AF_BLUE_STRING_MAX_LEN  @AF_BLUE_STRING_MAX_LEN@
68
69   /* The AF_Blue_String enumeration values are offsets into the */
70   /* `af_blue_strings' array.                                   */
71
72   typedef enum  AF_Blue_String_
73   {
74 @AF_BLUE_STRING_ENUM@
75
76     AF_BLUE_STRING_MAX   /* do not remove */
77
78   } AF_Blue_String;
79
80
81   FT_LOCAL_ARRAY( char )
82   af_blue_strings[];
83
84
85   /*************************************************************************/
86   /*************************************************************************/
87   /*****                                                               *****/
88   /*****                 B L U E   S T R I N G S E T S                 *****/
89   /*****                                                               *****/
90   /*************************************************************************/
91   /*************************************************************************/
92
93   /* The next level is to group blue strings into style-specific sets. */
94
95
96   /* Properties are specific to a writing system.  We assume that a given  */
97   /* blue string can't be used in more than a single writing system, which */
98   /* is a safe bet.                                                        */
99 #define AF_BLUE_PROPERTY_LATIN_TOP       ( 1 << 0 )   /* must have value 1 */
100 #define AF_BLUE_PROPERTY_LATIN_NEUTRAL   ( 1 << 1 )
101 #define AF_BLUE_PROPERTY_LATIN_X_HEIGHT  ( 1 << 2 )
102 #define AF_BLUE_PROPERTY_LATIN_LONG      ( 1 << 3 )
103
104 #define AF_BLUE_PROPERTY_CJK_TOP    ( 1 << 0 )        /* must have value 1 */
105 #define AF_BLUE_PROPERTY_CJK_HORIZ  ( 1 << 1 )        /* must have value 2 */
106 #define AF_BLUE_PROPERTY_CJK_RIGHT  AF_BLUE_PROPERTY_CJK_TOP
107
108
109 #define AF_BLUE_STRINGSET_MAX_LEN  @AF_BLUE_STRINGSET_MAX_LEN@
110
111   /* The AF_Blue_Stringset enumeration values are offsets into the */
112   /* `af_blue_stringsets' array.                                   */
113
114   typedef enum  AF_Blue_Stringset_
115   {
116 @AF_BLUE_STRINGSET_ENUM@
117
118     AF_BLUE_STRINGSET_MAX   /* do not remove */
119
120   } AF_Blue_Stringset;
121
122
123   typedef struct  AF_Blue_StringRec_
124   {
125     AF_Blue_String  string;
126     FT_UShort       properties;
127
128   } AF_Blue_StringRec;
129
130
131   FT_LOCAL_ARRAY( AF_Blue_StringRec )
132   af_blue_stringsets[];
133
134 /* */
135
136 FT_END_HEADER
137
138
139 #endif /* __AFBLUE_H__ */
140
141
142 /* END */