Fix OTS warning about `maxp.maxSizeOfInstructions`.
[ttfautohint.git] / lib / taglobal.h
blob5fa18014f93f2326e4f9fff95d8c5b58a5bdd96c
1 /* taglobal.h */
3 /*
4 * Copyright (C) 2011-2022 by Werner Lemberg.
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.
11 * The file `COPYING' mentioned in the previous paragraph is distributed
12 * with the ttfautohint library.
16 /* originally file `afglobal.h' (2011-Mar-28) from FreeType */
18 /* heavily modified 2011 by Werner Lemberg <wl@gnu.org> */
20 #ifndef TAGLOBAL_H_
21 #define TAGLOBAL_H_
23 #include "ta.h"
24 #include "tatypes.h"
25 #include "tashaper.h"
28 extern TA_WritingSystemClass const ta_writing_system_classes[];
31 #undef SCRIPT
32 #define SCRIPT(s, S, d, h, H, ss) \
33 extern const TA_ScriptClassRec ta_ ## s ## _script_class;
35 #include "ttfautohint-scripts.h"
37 extern TA_ScriptClass const ta_script_classes[];
40 #undef STYLE
41 #define STYLE(s, S, d, ws, sc, ss, c) \
42 extern const TA_StyleClassRec ta_ ## s ## _style_class;
44 #include "tastyles.h"
46 extern TA_StyleClass const ta_style_classes[];
49 #ifdef TA_DEBUG
50 extern const char* ta_style_names[];
51 #endif
54 /* Default values and flags for both autofitter globals */
55 /* (originally found in AF_ModuleRec, we use FONT instead) */
56 /* and face globals (in TA_FaceGlobalsRec). */
58 /* index of fallback style in `ta_style_classes' */
59 #define TA_STYLE_FALLBACK TA_STYLE_NONE_DFLT
60 /* default script for OpenType */
61 #define TA_SCRIPT_DEFAULT TA_SCRIPT_LATN
63 /* a bit mask for TA_DIGIT and TA_NONBASE */
64 #define TA_STYLE_MASK 0x3FFF
65 /* an uncovered glyph */
66 #define TA_STYLE_UNASSIGNED TA_STYLE_MASK
68 /* if this flag is set, we have an ASCII digit */
69 #define TA_DIGIT 0x8000U
70 /* if this flag is set, we have a non-base character */
71 #define TA_NONBASE 0x4000U
73 /* `increase-x-height' property */
74 #define TA_PROP_INCREASE_X_HEIGHT_MIN 6
75 #define TA_PROP_INCREASE_X_HEIGHT_MAX 0
78 /* note that glyph_styles[] maps each glyph to an index into the */
79 /* `ta_style_classes' array. */
80 typedef struct TA_FaceGlobalsRec_
82 FT_Face face;
83 FT_Long glyph_count; /* same as face->num_glyphs */
84 FT_UShort* glyph_styles;
86 hb_font_t* hb_font;
87 hb_buffer_t* hb_buf; /* for feature comparison */
89 /* per-face auto-hinter properties */
90 FT_UInt increase_x_height;
92 TA_StyleMetrics metrics[TA_STYLE_MAX];
93 FT_UInt sample_glyphs[TA_STYLE_MAX]; /* per-style sample glyph indices */
95 FONT* font; /* to access global properties */
96 } TA_FaceGlobalsRec;
99 /* this models the global hints data for a given face, */
100 /* decomposed into style-specific items */
102 FT_Error
103 ta_face_globals_new(FT_Face face,
104 TA_FaceGlobals *aglobals,
105 FONT* font);
107 FT_Error
108 ta_face_globals_get_metrics(TA_FaceGlobals globals,
109 FT_UInt gindex,
110 FT_UInt options,
111 TA_StyleMetrics *ametrics);
113 void
114 ta_face_globals_free(TA_FaceGlobals globals);
116 FT_Bool
117 ta_face_globals_is_digit(TA_FaceGlobals globals,
118 FT_UInt gindex);
120 #endif /* TAGLOBAL_H_ */
122 /* end of taglobal.h */