Run `update-copyright'.
[ttfautohint.git] / lib / talatin.h
blob25187710f4120fc3f16a65d07a7b99625dc4d034
1 /* talatin.h */
3 /*
4 * Copyright (C) 2011-2013 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-specific script class */
29 extern const TA_ScriptClassRec ta_latin_script_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 enum
41 TA_LATIN_BLUE_CAPITAL_TOP,
42 TA_LATIN_BLUE_CAPITAL_BOTTOM,
43 TA_LATIN_BLUE_SMALL_F_TOP,
44 TA_LATIN_BLUE_SMALL_TOP,
45 TA_LATIN_BLUE_SMALL_BOTTOM,
46 TA_LATIN_BLUE_SMALL_MINOR,
48 TA_LATIN_BLUE_MAX
52 #define TA_LATIN_IS_TOP_BLUE(b) \
53 ((b) == TA_LATIN_BLUE_CAPITAL_TOP \
54 || (b) == TA_LATIN_BLUE_SMALL_F_TOP \
55 || (b) == TA_LATIN_BLUE_SMALL_TOP)
57 #define TA_LATIN_MAX_WIDTHS 16
58 #define TA_LATIN_MAX_BLUES TA_LATIN_BLUE_MAX
61 #define TA_LATIN_BLUE_ACTIVE (1 << 0) /* set if zone height is <= 3/4px */
62 #define TA_LATIN_BLUE_TOP (1 << 1) /* result of TA_LATIN_IS_TOP_BLUE */
63 #define TA_LATIN_BLUE_ADJUSTMENT (1 << 2) /* used for scale adjustment */
64 /* optimization */
67 typedef struct TA_LatinBlueRec_
69 TA_WidthRec ref;
70 TA_WidthRec shoot;
71 FT_UInt flags;
72 } TA_LatinBlueRec, *TA_LatinBlue;
75 typedef struct TA_LatinAxisRec_
77 FT_Fixed scale;
78 FT_Pos delta;
80 FT_UInt width_count; /* number of used widths */
81 TA_WidthRec widths[TA_LATIN_MAX_WIDTHS]; /* widths array */
82 FT_Pos edge_distance_threshold; /* used for creating edges */
83 FT_Pos standard_width; /* the default stem thickness */
84 FT_Bool extra_light; /* is standard width very light? */
86 /* ignored for horizontal metrics */
87 FT_UInt blue_count;
88 /* we add two blue zones for usWinAscent and usWinDescent */
89 TA_LatinBlueRec blues[TA_LATIN_BLUE_MAX + 2];
91 FT_Fixed org_scale;
92 FT_Pos org_delta;
93 } TA_LatinAxisRec, *TA_LatinAxis;
96 typedef struct TA_LatinMetricsRec_
98 TA_ScriptMetricsRec root;
99 FT_UInt units_per_em;
100 TA_LatinAxisRec axis[TA_DIMENSION_MAX];
101 } TA_LatinMetricsRec, *TA_LatinMetrics;
104 FT_Error
105 ta_latin_metrics_init(TA_LatinMetrics metrics,
106 FT_Face face);
108 void
109 ta_latin_metrics_scale(TA_LatinMetrics metrics,
110 TA_Scaler scaler);
112 void
113 ta_latin_metrics_init_widths(TA_LatinMetrics metrics,
114 FT_Face face);
116 void
117 ta_latin_metrics_check_digits(TA_LatinMetrics metrics,
118 FT_Face face);
121 #define TA_LATIN_HINTS_HORZ_SNAP (1 << 0) /* enable stem width snapping */
122 #define TA_LATIN_HINTS_VERT_SNAP (1 << 1) /* enable stem height snapping */
123 #define TA_LATIN_HINTS_STEM_ADJUST (1 << 2) /* enable stem width/height */
124 /* adjustment */
125 #define TA_LATIN_HINTS_MONO (1 << 3) /* indicate monochrome rendering */
128 #define TA_LATIN_HINTS_DO_HORZ_SNAP(h) \
129 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_HORZ_SNAP)
130 #define TA_LATIN_HINTS_DO_VERT_SNAP(h) \
131 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_VERT_SNAP)
132 #define TA_LATIN_HINTS_DO_STEM_ADJUST(h) \
133 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_STEM_ADJUST)
134 #define TA_LATIN_HINTS_DO_MONO(h) \
135 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_MONO)
138 /* the next functions shouldn't normally be exported; */
139 /* however, other scripts might like to use these functions as-is */
141 FT_Error
142 ta_latin_hints_compute_segments(TA_GlyphHints hints,
143 TA_Dimension dim);
144 void
145 ta_latin_hints_link_segments(TA_GlyphHints hints,
146 TA_Dimension dim);
147 FT_Error
148 ta_latin_hints_compute_edges(TA_GlyphHints hints,
149 TA_Dimension dim);
150 FT_Error
151 ta_latin_hints_detect_features(TA_GlyphHints hints,
152 TA_Dimension dim);
154 #endif /* __TALATIN_H__ */
156 /* end of talatin.h */