Synchronize with FreeType.
[ttfautohint.git] / lib / talatin.h
blobb8d0ebf517497ea6637d2cf2fca172e8bb51389a
1 /* talatin.h */
3 /*
4 * Copyright (C) 2011-2014 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_X_HEIGHT_BLUE(b) \
42 ((b)->properties & TA_BLUE_PROPERTY_LATIN_X_HEIGHT)
43 #define TA_LATIN_IS_LONG_BLUE(b) \
44 ((b)->properties &TA_BLUE_PROPERTY_LATIN_LONG)
46 #define TA_LATIN_MAX_WIDTHS 16
49 #define TA_LATIN_BLUE_ACTIVE (1 << 0) /* set if zone height is <= 3/4px */
50 #define TA_LATIN_BLUE_TOP (1 << 1) /* result of TA_LATIN_IS_TOP_BLUE */
51 #define TA_LATIN_BLUE_ADJUSTMENT (1 << 2) /* used for scale adjustment */
52 /* optimization */
55 typedef struct TA_LatinBlueRec_
57 TA_WidthRec ref;
58 TA_WidthRec shoot;
59 FT_UInt flags;
60 } TA_LatinBlueRec, *TA_LatinBlue;
63 typedef struct TA_LatinAxisRec_
65 FT_Fixed scale;
66 FT_Pos delta;
68 FT_UInt width_count; /* number of used widths */
69 TA_WidthRec widths[TA_LATIN_MAX_WIDTHS]; /* widths array */
70 FT_Pos edge_distance_threshold; /* used for creating edges */
71 FT_Pos standard_width; /* the default stem thickness */
72 FT_Bool extra_light; /* is standard width very light? */
74 /* ignored for horizontal metrics */
75 FT_UInt blue_count;
76 /* we add two blue zones for usWinAscent and usWinDescent */
77 TA_LatinBlueRec blues[TA_BLUE_STRINGSET_MAX + 2];
79 FT_Fixed org_scale;
80 FT_Pos org_delta;
81 } TA_LatinAxisRec, *TA_LatinAxis;
84 typedef struct TA_LatinMetricsRec_
86 TA_StyleMetricsRec root;
87 FT_UInt units_per_em;
88 TA_LatinAxisRec axis[TA_DIMENSION_MAX];
89 } TA_LatinMetricsRec, *TA_LatinMetrics;
92 FT_Error
93 ta_latin_metrics_init(TA_LatinMetrics metrics,
94 FT_Face face);
96 void
97 ta_latin_metrics_scale(TA_LatinMetrics metrics,
98 TA_Scaler scaler);
100 void
101 ta_latin_metrics_init_widths(TA_LatinMetrics metrics,
102 FT_Face face);
104 void
105 ta_latin_metrics_check_digits(TA_LatinMetrics metrics,
106 FT_Face face);
109 #define TA_LATIN_HINTS_HORZ_SNAP (1 << 0) /* enable stem width snapping */
110 #define TA_LATIN_HINTS_VERT_SNAP (1 << 1) /* enable stem height snapping */
111 #define TA_LATIN_HINTS_STEM_ADJUST (1 << 2) /* enable stem width/height */
112 /* adjustment */
113 #define TA_LATIN_HINTS_MONO (1 << 3) /* indicate monochrome rendering */
116 #define TA_LATIN_HINTS_DO_HORZ_SNAP(h) \
117 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_HORZ_SNAP)
118 #define TA_LATIN_HINTS_DO_VERT_SNAP(h) \
119 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_VERT_SNAP)
120 #define TA_LATIN_HINTS_DO_STEM_ADJUST(h) \
121 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_STEM_ADJUST)
122 #define TA_LATIN_HINTS_DO_MONO(h) \
123 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_MONO)
126 /* the next functions shouldn't normally be exported; */
127 /* however, other writing systems might like to use these functions as-is */
129 FT_Error
130 ta_latin_hints_compute_segments(TA_GlyphHints hints,
131 TA_Dimension dim);
132 void
133 ta_latin_hints_link_segments(TA_GlyphHints hints,
134 FT_UInt width_count,
135 TA_WidthRec* widths,
136 TA_Dimension dim);
137 FT_Error
138 ta_latin_hints_compute_edges(TA_GlyphHints hints,
139 TA_Dimension dim);
140 FT_Error
141 ta_latin_hints_detect_features(TA_GlyphHints hints,
142 FT_UInt width_count,
143 TA_WidthRec* widths,
144 TA_Dimension dim);
146 #endif /* __TALATIN_H__ */
148 /* end of talatin.h */