Synchronize with FreeType, part 2.
[ttfautohint.git] / lib / talatin.h
blob87473b3d90fca2ec4793c270c8eaf4a8d0bfbf33
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;
31 /* the latin-specific script classes */
33 extern const TA_ScriptClassRec ta_cyrl_script_class;
34 extern const TA_ScriptClassRec ta_grek_script_class;
35 extern const TA_ScriptClassRec ta_hebr_script_class;
36 extern const TA_ScriptClassRec ta_latn_script_class;
37 #if 0
38 extern const TA_ScriptClassRec ta_armn_script_class;
39 #endif
42 /* constants are given with units_per_em == 2048 in mind */
43 #define TA_LATIN_CONSTANT(metrics, c) \
44 (((c) * (FT_Long)((TA_LatinMetrics)(metrics))->units_per_em) / 2048)
47 /* Latin (global) metrics management */
49 #define TA_LATIN_IS_TOP_BLUE(b) \
50 ((b)->properties & TA_BLUE_PROPERTY_LATIN_TOP)
51 #define TA_LATIN_IS_X_HEIGHT_BLUE(b) \
52 ((b)->properties & TA_BLUE_PROPERTY_LATIN_X_HEIGHT)
53 #define TA_LATIN_IS_LONG_BLUE(b) \
54 ((b)->properties &TA_BLUE_PROPERTY_LATIN_LONG)
56 #define TA_LATIN_MAX_WIDTHS 16
59 #define TA_LATIN_BLUE_ACTIVE (1 << 0) /* set if zone height is <= 3/4px */
60 #define TA_LATIN_BLUE_TOP (1 << 1) /* result of TA_LATIN_IS_TOP_BLUE */
61 #define TA_LATIN_BLUE_ADJUSTMENT (1 << 2) /* used for scale adjustment */
62 /* optimization */
65 typedef struct TA_LatinBlueRec_
67 TA_WidthRec ref;
68 TA_WidthRec shoot;
69 FT_UInt flags;
70 } TA_LatinBlueRec, *TA_LatinBlue;
73 typedef struct TA_LatinAxisRec_
75 FT_Fixed scale;
76 FT_Pos delta;
78 FT_UInt width_count; /* number of used widths */
79 TA_WidthRec widths[TA_LATIN_MAX_WIDTHS]; /* widths array */
80 FT_Pos edge_distance_threshold; /* used for creating edges */
81 FT_Pos standard_width; /* the default stem thickness */
82 FT_Bool extra_light; /* is standard width very light? */
84 /* ignored for horizontal metrics */
85 FT_UInt blue_count;
86 /* we add two blue zones for usWinAscent and usWinDescent */
87 TA_LatinBlueRec blues[TA_BLUE_STRINGSET_MAX + 2];
89 FT_Fixed org_scale;
90 FT_Pos org_delta;
91 } TA_LatinAxisRec, *TA_LatinAxis;
94 typedef struct TA_LatinMetricsRec_
96 TA_StyleMetricsRec root;
97 FT_UInt units_per_em;
98 TA_LatinAxisRec axis[TA_DIMENSION_MAX];
99 } TA_LatinMetricsRec, *TA_LatinMetrics;
102 FT_Error
103 ta_latin_metrics_init(TA_LatinMetrics metrics,
104 FT_Face face);
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);
114 void
115 ta_latin_metrics_check_digits(TA_LatinMetrics metrics,
116 FT_Face face);
119 #define TA_LATIN_HINTS_HORZ_SNAP (1 << 0) /* enable stem width snapping */
120 #define TA_LATIN_HINTS_VERT_SNAP (1 << 1) /* enable stem height snapping */
121 #define TA_LATIN_HINTS_STEM_ADJUST (1 << 2) /* enable stem width/height */
122 /* adjustment */
123 #define TA_LATIN_HINTS_MONO (1 << 3) /* indicate monochrome rendering */
126 #define TA_LATIN_HINTS_DO_HORZ_SNAP(h) \
127 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_HORZ_SNAP)
128 #define TA_LATIN_HINTS_DO_VERT_SNAP(h) \
129 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_VERT_SNAP)
130 #define TA_LATIN_HINTS_DO_STEM_ADJUST(h) \
131 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_STEM_ADJUST)
132 #define TA_LATIN_HINTS_DO_MONO(h) \
133 TA_HINTS_TEST_OTHER(h, TA_LATIN_HINTS_MONO)
136 /* the next functions shouldn't normally be exported; */
137 /* however, other scripts might like to use these functions as-is */
139 FT_Error
140 ta_latin_hints_compute_segments(TA_GlyphHints hints,
141 TA_Dimension dim);
142 void
143 ta_latin_hints_link_segments(TA_GlyphHints hints,
144 TA_Dimension dim);
145 FT_Error
146 ta_latin_hints_compute_edges(TA_GlyphHints hints,
147 TA_Dimension dim);
148 FT_Error
149 ta_latin_hints_detect_features(TA_GlyphHints hints,
150 TA_Dimension dim);
152 #endif /* __TALATIN_H__ */
154 /* end of talatin.h */