Synchronize with FreeType.
[ttfautohint.git] / lib / tablue.hin
blob779964df766379be2c554da4c3a5922a85b793c6
1 /* tablue.h */
3 /*
4  * Copyright (C) 2013-2014 by Werner Lemberg.
5  *
6  * This file is part of the ttfautohint library, and may only be used,
7  * modified, and distributed under the terms given in `COPYING'.  By
8  * continuing to use, modify, or distribute this file you indicate that you
9  * have read `COPYING' and understand and accept it fully.
10  *
11  * The file `COPYING' mentioned in the previous paragraph is distributed
12  * with the ttfautohint library.
13  */
16 /* originally file `afblue.h' (2013-Sep-11) from FreeType */
19 #ifndef __TABLUE_H__
20 #define __TABLUE_H__
23   /* an auxiliary macro to decode a UTF-8 character -- since we only use */
24   /* hard-coded, self-converted data, no error checking is performed */
25 #define GET_UTF8_CHAR(ch, p) \
26   ch = (unsigned char)*p++; \
27   if (ch >= 0x80) \
28   { \
29     FT_UInt len; \
32     if (ch < 0xE0) \
33     { \
34       len = 1; \
35       ch &= 0x1F; \
36     } \
37     else if (ch < 0xF0) \
38     { \
39       len = 2; \
40       ch &= 0x0F; \
41     } \
42     else \
43     { \
44       len = 3;\
45       ch &= 0x07; \
46     } \
48     for (; len > 0; len--) \
49       ch = (ch << 6) | (*p++ & 0x3F); \
50   }
53 /****************************************************************
54  *
55  *                        BLUE STRINGS
56  *
57  ****************************************************************/
59 /* At the bottommost level, we define strings for finding blue zones. */
62 #define TA_BLUE_STRING_MAX_LEN @TA_BLUE_STRING_MAX_LEN@
64 /* The TA_Blue_String enumeration values are offsets into the */
65 /* `ta_blue_strings' array. */
67 typedef enum TA_Blue_String_
69 @TA_BLUE_STRING_ENUM@
71   TA_BLUE_STRING_MAX   /* do not remove */
72 } TA_Blue_String;
75 extern const char ta_blue_strings[];
78 /****************************************************************
79  *
80  *                      BLUE STRINGSETS
81  *
82  ****************************************************************/
84 /* The next level is to group blue strings into style-specific sets. */
87 /* Properties are specific to a writing system.  We assume that a given */
88 /* blue string can't be used in more than a single writing system, which */
89 /* is a safe bet. */
90 #define TA_BLUE_PROPERTY_LATIN_TOP (1 << 0)
91 #define TA_BLUE_PROPERTY_LATIN_X_HEIGHT (1 << 1)
92 #define TA_BLUE_PROPERTY_LATIN_LONG (1 << 2)
94 #define TA_BLUE_PROPERTY_CJK_HORIZ (1 << 0)
95 #define TA_BLUE_PROPERTY_CJK_TOP (1 << 1)
96 #define TA_BLUE_PROPERTY_CJK_FILL (1 << 2)
97 #define TA_BLUE_PROPERTY_CJK_RIGHT TA_BLUE_PROPERTY_CJK_TOP
100 #define TA_BLUE_STRINGSET_MAX_LEN @TA_BLUE_STRINGSET_MAX_LEN@
102 /* The TA_Blue_Stringset enumeration values are offsets into the */
103 /* `ta_blue_stringsets' array. */
105 typedef enum TA_Blue_Stringset_
107 @TA_BLUE_STRINGSET_ENUM@
109   TA_BLUE_STRINGSET_MAX   /* do not remove */
110 } TA_Blue_Stringset;
113 typedef struct TA_Blue_StringRec_
115   TA_Blue_String string;
116   FT_UShort properties;
117 } TA_Blue_StringRec;
120 extern const TA_Blue_StringRec ta_blue_stringsets[];
122 #endif /* __TABLUE_H__ */
124 /* end of tablue.h */