1/*
2 * Copyright © 2017 Google, Inc.
3 *
4 * This is part of HarfBuzz, a text shaping library.
5 *
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16 * DAMAGE.
17 *
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 *
24 * Red Hat Author(s): Behdad Esfahbod
25 */
26
27#ifndef HB_OT_H_IN
28#error "Include <hb-ot.h> instead."
29#endif
30
31#ifndef HB_OT_VAR_H
32#define HB_OT_VAR_H
33
34#include "hb.h"
35
36HB_BEGIN_DECLS
37
38/**
39 * hb_tag_t:
40 * @HB_OT_TAG_VAR_AXIS_ITALIC: Registered tag for the roman/italic axis
41 */
42#define HB_OT_TAG_VAR_AXIS_ITALIC HB_TAG('i','t','a','l')
43
44/**
45 * hb_tag_t:
46 * @HB_OT_TAG_VAR_AXIS_OPTICAL_SIZE: Registered tag for the optical-size axis
47 *
48 * <note>Note: The optical-size axis supersedes the OpenType `size` feature.</note>
49 */
50#define HB_OT_TAG_VAR_AXIS_OPTICAL_SIZE HB_TAG('o','p','s','z')
51
52/**
53 * hb_tag_t:
54 * @HB_OT_TAG_VAR_AXIS_SLANT: Registered tag for the slant axis
55 */
56#define HB_OT_TAG_VAR_AXIS_SLANT HB_TAG('s','l','n','t')
57
58/**
59 * hb_tag_t:
60 * @HB_OT_TAG_VAR_AXIS_WIDTH: Registered tag for the width axis
61 */
62#define HB_OT_TAG_VAR_AXIS_WIDTH HB_TAG('w','d','t','h')
63
64/**
65 * hb_tag_t:
66 * @HB_OT_TAG_VAR_AXIS_WEIGHT: Registered tag for the weight axis
67 */
68#define HB_OT_TAG_VAR_AXIS_WEIGHT HB_TAG('w','g','h','t')
69
70
71/*
72 * fvar / avar
73 */
74
75HB_EXTERN hb_bool_t
76hb_ot_var_has_data (hb_face_t *face);
77
78
79/*
80 * Variation axes.
81 */
82
83
84HB_EXTERN unsigned int
85hb_ot_var_get_axis_count (hb_face_t *face);
86
87/**
88 * hb_ot_var_axis_flags_t:
89 * @HB_OT_VAR_AXIS_FLAG_HIDDEN: The axis should not be exposed directly in user interfaces.
90 *
91 * Since: 2.2.0
92 */
93typedef enum { /*< flags >*/
94 HB_OT_VAR_AXIS_FLAG_HIDDEN = 0x00000001u,
95
96 _HB_OT_VAR_AXIS_FLAG_MAX_VALUE= HB_TAG_MAX_SIGNED /*< skip >*/
97} hb_ot_var_axis_flags_t;
98
99/**
100 * hb_ot_var_axis_info_t:
101 * @axis_index: Index of the axis in the variation-axis array
102 * @tag: The #hb_tag_t tag identifying the design variation of the axis
103 * @name_id: The `name` table Name ID that provides display names for the axis
104 * @flags: The #hb_ot_var_axis_flags_t flags for the axis
105 * @min_value: The mininum value on the variation axis that the font covers
106 * @default_value: The position on the variation axis corresponding to the font's defaults
107 * @max_value: The maximum value on the variation axis that the font covers
108 *
109 * Data type for holding variation-axis values.
110 *
111 * The minimum, default, and maximum values are in un-normalized, user scales.
112 *
113 * <note>Note: at present, the only flag defined for @flags is
114 * #HB_OT_VAR_AXIS_FLAG_HIDDEN.</note>
115 *
116 * Since: 2.2.0
117 */
118typedef struct hb_ot_var_axis_info_t {
119 unsigned int axis_index;
120 hb_tag_t tag;
121 hb_ot_name_id_t name_id;
122 hb_ot_var_axis_flags_t flags;
123 float min_value;
124 float default_value;
125 float max_value;
126 /*< private >*/
127 unsigned int reserved;
128} hb_ot_var_axis_info_t;
129
130HB_EXTERN unsigned int
131hb_ot_var_get_axis_infos (hb_face_t *face,
132 unsigned int start_offset,
133 unsigned int *axes_count /* IN/OUT */,
134 hb_ot_var_axis_info_t *axes_array /* OUT */);
135
136HB_EXTERN hb_bool_t
137hb_ot_var_find_axis_info (hb_face_t *face,
138 hb_tag_t axis_tag,
139 hb_ot_var_axis_info_t *axis_info);
140
141
142/*
143 * Named instances.
144 */
145
146HB_EXTERN unsigned int
147hb_ot_var_get_named_instance_count (hb_face_t *face);
148
149HB_EXTERN hb_ot_name_id_t
150hb_ot_var_named_instance_get_subfamily_name_id (hb_face_t *face,
151 unsigned int instance_index);
152
153HB_EXTERN hb_ot_name_id_t
154hb_ot_var_named_instance_get_postscript_name_id (hb_face_t *face,
155 unsigned int instance_index);
156
157HB_EXTERN unsigned int
158hb_ot_var_named_instance_get_design_coords (hb_face_t *face,
159 unsigned int instance_index,
160 unsigned int *coords_length, /* IN/OUT */
161 float *coords /* OUT */);
162
163
164/*
165 * Conversions.
166 */
167
168HB_EXTERN void
169hb_ot_var_normalize_variations (hb_face_t *face,
170 const hb_variation_t *variations, /* IN */
171 unsigned int variations_length,
172 int *coords, /* OUT */
173 unsigned int coords_length);
174
175HB_EXTERN void
176hb_ot_var_normalize_coords (hb_face_t *face,
177 unsigned int coords_length,
178 const float *design_coords, /* IN */
179 int *normalized_coords /* OUT */);
180
181
182HB_END_DECLS
183
184#endif /* HB_OT_VAR_H */
185

source code of include/harfbuzz/hb-ot-var.h