Fix OTS warning about `maxp.maxSizeOfInstructions`.
[ttfautohint.git] / lib / talatin.h
blob2ce6e58ab3cb7be4bcb01629d002e83407951a70
1 /* talatin.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 `aflatin.h' (2011-Mar-28) from FreeType */
18 /* heavily modified 2011 by Werner Lemberg <wl@gnu.org> */
20 #ifndef TALATIN_H_
21 #define TALATIN_H_
23 #include "tatypes.h"
24 #include "tahints.h"
27 /* the `latin' writing system */
29 extern const TA_WritingSystemClassRec ta_latin_writing_system_class;
32 /* constants are given with units_per_em == 2048 in mind */
33 #define TA_LATIN_CONSTANT(metrics, c) \
34 (((c) * (FT_Long)((TA_LatinMetrics)(metrics))->units_per_em) / 2048)
37 /* Latin (global) metrics management */
39 #define TA_LATIN_IS_TOP_BLUE(b) \
40 ((b)->properties & TA_BLUE_PROPERTY_LATIN_TOP)
41 #define TA_LATIN_IS_SUB_TOP_BLUE(b) \
42 ((b)->properties & TA_BLUE_PROPERTY_LATIN_SUB_TOP)
43 #define TA_LATIN_IS_NEUTRAL_BLUE(b) \
44 ((b)->properties & TA_BLUE_PROPERTY_LATIN_NEUTRAL)
45 #define TA_LATIN_IS_X_HEIGHT_BLUE(b) \
46 ((b)->properties & TA_BLUE_PROPERTY_LATIN_X_HEIGHT)
47 #define TA_LATIN_IS_LONG_BLUE(b) \
48 ((b)->properties &TA_BLUE_PROPERTY_LATIN_LONG)
50 #define TA_LATIN_MAX_WIDTHS 16
53 #define TA_LATIN_BLUE_ACTIVE (1U << 0) /* set if zone height is <= 3/4px */
54 #define TA_LATIN_BLUE_TOP (1U << 1) /* set if we have a top blue zone */
55 #define TA_LATIN_BLUE_SUB_TOP (1U << 2) /* set if we have a */
56 /* subscript top blue zone */
57 #define TA_LATIN_BLUE_NEUTRAL (1U << 3) /* set if we have neutral blue zone */
58 #define TA_LATIN_BLUE_ADJUSTMENT (1U << 4) /* used for scale adjustment */
59 /* optimization */
62 typedef struct TA_LatinBlueRec_
64 TA_WidthRec ref;
65 TA_WidthRec shoot;
66 FT_Pos ascender;
67 FT_Pos descender;
68 FT_UInt flags;
69 } TA_LatinBlueRec, *TA_LatinBlue;
72 typedef struct TA_LatinAxisRec_
74 FT_Fixed scale;
75 FT_Pos delta;
77 FT_UInt width_count; /* number of used widths */
78 TA_WidthRec widths[TA_LATIN_MAX_WIDTHS]; /* widths array */
79 FT_Pos edge_distance_threshold; /* used for creating edges */
80 FT_Pos standard_width; /* the default stem thickness */
81 FT_Bool extra_light; /* is standard width very light? */
83 /* ignored for horizontal metrics */
84 FT_UInt blue_count; /* does not contain artificial blue zones */
85 /* we add two artificial blue zones for usWinAscent and usWinDescent */
86 TA_LatinBlueRec blues[TA_BLUE_STRINGSET_MAX + 2];
88 FT_Fixed org_scale;
89 FT_Pos org_delta;
90 } TA_LatinAxisRec, *TA_LatinAxis;
93 typedef struct TA_LatinMetricsRec_
95 TA_StyleMetricsRec root;
96 FT_UInt units_per_em;
97 TA_LatinAxisRec axis[TA_DIMENSION_MAX];
98 } TA_LatinMetricsRec, *TA_LatinMetrics;
101 FT_Error
102 ta_latin_metrics_init(TA_LatinMetrics metrics,
103 FT_Face face,
104 FT_Face reference);
106 void
107 ta_latin_metrics_scale(TA_LatinMetrics metrics,
108 TA_Scaler scaler);
110 void
111 ta_latin_metrics_init_widths(TA_LatinMetrics metrics,
112 FT_Face face,
113 FT_Bool use_cmap);
115 void
116 ta_latin_metrics_check_digits(TA_LatinMetrics metrics,
117 FT_Face face);
120 #define TA_LATIN_HINTS_HORZ_SNAP (1U << 0) /* enable stem width snapping */
121 #define TA_LATIN_HINTS_VERT_SNAP (1U << 1) /* enable stem height snapping */
122 #define TA_LATIN_HINTS_STEM_ADJUST (1U << 2) /* enable stem width/height */
123 /* adjustment */
124 #define TA_LATIN_HINTS_MONO (1U << 3) /* indicate monochrome rendering */
127 #define TA_LATIN_HINTS_DO_HORZ_SNAP(h) \
128 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_HORZ_SNAP)
129 #define TA_LATIN_HINTS_DO_VERT_SNAP(h) \
130 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_VERT_SNAP)
131 #define TA_LATIN_HINTS_DO_STEM_ADJUST(h) \
132 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_STEM_ADJUST)
133 #define TA_LATIN_HINTS_DO_MONO(h) \
134 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_MONO)
137 /* the next functions shouldn't normally be exported; */
138 /* however, other writing systems might like to use these functions as-is */
140 FT_Error
141 ta_latin_hints_compute_segments(TA_GlyphHints hints,
142 TA_Dimension dim);
143 void
144 ta_latin_hints_link_segments(TA_GlyphHints hints,
145 FT_UInt width_count,
146 TA_WidthRec* widths,
147 TA_Dimension dim);
148 FT_Error
149 ta_latin_hints_compute_edges(TA_GlyphHints hints,
150 TA_Dimension dim);
151 FT_Error
152 ta_latin_hints_detect_features(TA_GlyphHints hints,
153 FT_UInt width_count,
154 TA_WidthRec* widths,
155 TA_Dimension dim);
157 #endif /* TALATIN_H_ */
159 /* end of talatin.h */