Fix OTS warning about `maxp.maxSizeOfInstructions`.
[ttfautohint.git] / lib / tablue.hin
blob769aa34dee5ad9b9a1d8301bfe804e5529ee1f7d
1 /* tablue.h */
3 /*
4  * Copyright (C) 2013-2022 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   do \
27   { \
28     ch = (unsigned char)*p++; \
29     if (ch >= 0x80) \
30     { \
31       FT_UInt len_; \
34       if (ch < 0xE0) \
35       { \
36         len_ = 1; \
37         ch &= 0x1F; \
38       } \
39       else if (ch < 0xF0) \
40       { \
41         len_ = 2; \
42         ch &= 0x0F; \
43       } \
44       else \
45       { \
46         len_ = 3;\
47         ch &= 0x07; \
48       } \
50       for (; len_ > 0; len_--) \
51         ch = (ch << 6) | (*p++ & 0x3F); \
52     } \
53   } while (0)
56 /****************************************************************
57  *
58  *                        BLUE STRINGS
59  *
60  ****************************************************************/
62 /* At the bottommost level, we define strings for finding blue zones. */
65 #define TA_BLUE_STRING_MAX_LEN @TA_BLUE_STRING_MAX_LEN@
67 /* The TA_Blue_String enumeration values are offsets into the */
68 /* `ta_blue_strings' array. */
70 typedef enum TA_Blue_String_
72 @TA_BLUE_STRING_ENUM@
74   TA_BLUE_STRING_MAX   /* do not remove */
75 } TA_Blue_String;
78 extern const char ta_blue_strings[];
81 /****************************************************************
82  *
83  *                      BLUE STRINGSETS
84  *
85  ****************************************************************/
87 /* The next level is to group blue strings into style-specific sets. */
90 /* Properties are specific to a writing system.  We assume that a given */
91 /* blue string can't be used in more than a single writing system, which */
92 /* is a safe bet. */
93 #define TA_BLUE_PROPERTY_LATIN_TOP (1U << 0) /* must have value 1 */
94 #define TA_BLUE_PROPERTY_LATIN_SUB_TOP (1U << 1)
95 #define TA_BLUE_PROPERTY_LATIN_NEUTRAL (1U << 2)
96 #define TA_BLUE_PROPERTY_LATIN_X_HEIGHT (1U << 3)
97 #define TA_BLUE_PROPERTY_LATIN_LONG (1U << 4)
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 */