1*2d1272b8SAndroid Build Coastguard Worker /*
2*2d1272b8SAndroid Build Coastguard Worker * Copyright © 2016 Igalia S.L.
3*2d1272b8SAndroid Build Coastguard Worker *
4*2d1272b8SAndroid Build Coastguard Worker * This is part of HarfBuzz, a text shaping library.
5*2d1272b8SAndroid Build Coastguard Worker *
6*2d1272b8SAndroid Build Coastguard Worker * Permission is hereby granted, without written agreement and without
7*2d1272b8SAndroid Build Coastguard Worker * license or royalty fees, to use, copy, modify, and distribute this
8*2d1272b8SAndroid Build Coastguard Worker * software and its documentation for any purpose, provided that the
9*2d1272b8SAndroid Build Coastguard Worker * above copyright notice and the following two paragraphs appear in
10*2d1272b8SAndroid Build Coastguard Worker * all copies of this software.
11*2d1272b8SAndroid Build Coastguard Worker *
12*2d1272b8SAndroid Build Coastguard Worker * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13*2d1272b8SAndroid Build Coastguard Worker * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14*2d1272b8SAndroid Build Coastguard Worker * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15*2d1272b8SAndroid Build Coastguard Worker * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16*2d1272b8SAndroid Build Coastguard Worker * DAMAGE.
17*2d1272b8SAndroid Build Coastguard Worker *
18*2d1272b8SAndroid Build Coastguard Worker * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19*2d1272b8SAndroid Build Coastguard Worker * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20*2d1272b8SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21*2d1272b8SAndroid Build Coastguard Worker * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22*2d1272b8SAndroid Build Coastguard Worker * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23*2d1272b8SAndroid Build Coastguard Worker *
24*2d1272b8SAndroid Build Coastguard Worker * Igalia Author(s): Frédéric Wang
25*2d1272b8SAndroid Build Coastguard Worker */
26*2d1272b8SAndroid Build Coastguard Worker
27*2d1272b8SAndroid Build Coastguard Worker #include "hb.hh"
28*2d1272b8SAndroid Build Coastguard Worker
29*2d1272b8SAndroid Build Coastguard Worker #ifndef HB_NO_MATH
30*2d1272b8SAndroid Build Coastguard Worker
31*2d1272b8SAndroid Build Coastguard Worker #include "hb-ot-math-table.hh"
32*2d1272b8SAndroid Build Coastguard Worker
33*2d1272b8SAndroid Build Coastguard Worker
34*2d1272b8SAndroid Build Coastguard Worker /**
35*2d1272b8SAndroid Build Coastguard Worker * SECTION:hb-ot-math
36*2d1272b8SAndroid Build Coastguard Worker * @title: hb-ot-math
37*2d1272b8SAndroid Build Coastguard Worker * @short_description: OpenType Math information
38*2d1272b8SAndroid Build Coastguard Worker * @include: hb-ot.h
39*2d1272b8SAndroid Build Coastguard Worker *
40*2d1272b8SAndroid Build Coastguard Worker * Functions for fetching mathematics layout data from OpenType fonts.
41*2d1272b8SAndroid Build Coastguard Worker *
42*2d1272b8SAndroid Build Coastguard Worker * HarfBuzz itself does not implement a math layout solution. The
43*2d1272b8SAndroid Build Coastguard Worker * functions and types provided can be used by client programs to access
44*2d1272b8SAndroid Build Coastguard Worker * the font data necessary for typesetting OpenType Math layout.
45*2d1272b8SAndroid Build Coastguard Worker *
46*2d1272b8SAndroid Build Coastguard Worker **/
47*2d1272b8SAndroid Build Coastguard Worker
48*2d1272b8SAndroid Build Coastguard Worker
49*2d1272b8SAndroid Build Coastguard Worker /*
50*2d1272b8SAndroid Build Coastguard Worker * OT::MATH
51*2d1272b8SAndroid Build Coastguard Worker */
52*2d1272b8SAndroid Build Coastguard Worker
53*2d1272b8SAndroid Build Coastguard Worker /**
54*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_has_data:
55*2d1272b8SAndroid Build Coastguard Worker * @face: #hb_face_t to test
56*2d1272b8SAndroid Build Coastguard Worker *
57*2d1272b8SAndroid Build Coastguard Worker * Tests whether a face has a `MATH` table.
58*2d1272b8SAndroid Build Coastguard Worker *
59*2d1272b8SAndroid Build Coastguard Worker * Return value: `true` if the table is found, `false` otherwise
60*2d1272b8SAndroid Build Coastguard Worker *
61*2d1272b8SAndroid Build Coastguard Worker * Since: 1.3.3
62*2d1272b8SAndroid Build Coastguard Worker **/
63*2d1272b8SAndroid Build Coastguard Worker hb_bool_t
hb_ot_math_has_data(hb_face_t * face)64*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_has_data (hb_face_t *face)
65*2d1272b8SAndroid Build Coastguard Worker {
66*2d1272b8SAndroid Build Coastguard Worker return face->table.MATH->has_data ();
67*2d1272b8SAndroid Build Coastguard Worker }
68*2d1272b8SAndroid Build Coastguard Worker
69*2d1272b8SAndroid Build Coastguard Worker /**
70*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_get_constant:
71*2d1272b8SAndroid Build Coastguard Worker * @font: #hb_font_t to work upon
72*2d1272b8SAndroid Build Coastguard Worker * @constant: #hb_ot_math_constant_t the constant to retrieve
73*2d1272b8SAndroid Build Coastguard Worker *
74*2d1272b8SAndroid Build Coastguard Worker * Fetches the specified math constant. For most constants, the value returned
75*2d1272b8SAndroid Build Coastguard Worker * is an #hb_position_t.
76*2d1272b8SAndroid Build Coastguard Worker *
77*2d1272b8SAndroid Build Coastguard Worker * However, if the requested constant is #HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN,
78*2d1272b8SAndroid Build Coastguard Worker * #HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN or
79*2d1272b8SAndroid Build Coastguard Worker * #HB_OT_MATH_CONSTANT_RADICAL_DEGREE_BOTTOM_RAISE_PERCENT, then the return value is
80*2d1272b8SAndroid Build Coastguard Worker * an integer between 0 and 100 representing that percentage.
81*2d1272b8SAndroid Build Coastguard Worker *
82*2d1272b8SAndroid Build Coastguard Worker * Return value: the requested constant or zero
83*2d1272b8SAndroid Build Coastguard Worker *
84*2d1272b8SAndroid Build Coastguard Worker * Since: 1.3.3
85*2d1272b8SAndroid Build Coastguard Worker **/
86*2d1272b8SAndroid Build Coastguard Worker hb_position_t
hb_ot_math_get_constant(hb_font_t * font,hb_ot_math_constant_t constant)87*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_get_constant (hb_font_t *font,
88*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_constant_t constant)
89*2d1272b8SAndroid Build Coastguard Worker {
90*2d1272b8SAndroid Build Coastguard Worker return font->face->table.MATH->get_constant(constant, font);
91*2d1272b8SAndroid Build Coastguard Worker }
92*2d1272b8SAndroid Build Coastguard Worker
93*2d1272b8SAndroid Build Coastguard Worker /**
94*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_get_glyph_italics_correction:
95*2d1272b8SAndroid Build Coastguard Worker * @font: #hb_font_t to work upon
96*2d1272b8SAndroid Build Coastguard Worker * @glyph: The glyph index from which to retrieve the value
97*2d1272b8SAndroid Build Coastguard Worker *
98*2d1272b8SAndroid Build Coastguard Worker * Fetches an italics-correction value (if one exists) for the specified
99*2d1272b8SAndroid Build Coastguard Worker * glyph index.
100*2d1272b8SAndroid Build Coastguard Worker *
101*2d1272b8SAndroid Build Coastguard Worker * Return value: the italics correction of the glyph or zero
102*2d1272b8SAndroid Build Coastguard Worker *
103*2d1272b8SAndroid Build Coastguard Worker * Since: 1.3.3
104*2d1272b8SAndroid Build Coastguard Worker **/
105*2d1272b8SAndroid Build Coastguard Worker hb_position_t
hb_ot_math_get_glyph_italics_correction(hb_font_t * font,hb_codepoint_t glyph)106*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_get_glyph_italics_correction (hb_font_t *font,
107*2d1272b8SAndroid Build Coastguard Worker hb_codepoint_t glyph)
108*2d1272b8SAndroid Build Coastguard Worker {
109*2d1272b8SAndroid Build Coastguard Worker return font->face->table.MATH->get_glyph_info().get_italics_correction (glyph, font);
110*2d1272b8SAndroid Build Coastguard Worker }
111*2d1272b8SAndroid Build Coastguard Worker
112*2d1272b8SAndroid Build Coastguard Worker /**
113*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_get_glyph_top_accent_attachment:
114*2d1272b8SAndroid Build Coastguard Worker * @font: #hb_font_t to work upon
115*2d1272b8SAndroid Build Coastguard Worker * @glyph: The glyph index from which to retrieve the value
116*2d1272b8SAndroid Build Coastguard Worker *
117*2d1272b8SAndroid Build Coastguard Worker * Fetches a top-accent-attachment value (if one exists) for the specified
118*2d1272b8SAndroid Build Coastguard Worker * glyph index.
119*2d1272b8SAndroid Build Coastguard Worker *
120*2d1272b8SAndroid Build Coastguard Worker * For any glyph that does not have a top-accent-attachment value - that is,
121*2d1272b8SAndroid Build Coastguard Worker * a glyph not covered by the `MathTopAccentAttachment` table (or, when
122*2d1272b8SAndroid Build Coastguard Worker * @font has no `MathTopAccentAttachment` table or no `MATH` table, any
123*2d1272b8SAndroid Build Coastguard Worker * glyph) - the function synthesizes a value, returning the position at
124*2d1272b8SAndroid Build Coastguard Worker * one-half the glyph's advance width.
125*2d1272b8SAndroid Build Coastguard Worker *
126*2d1272b8SAndroid Build Coastguard Worker * Return value: the top accent attachment of the glyph or 0.5 * the advance
127*2d1272b8SAndroid Build Coastguard Worker * width of @glyph
128*2d1272b8SAndroid Build Coastguard Worker *
129*2d1272b8SAndroid Build Coastguard Worker * Since: 1.3.3
130*2d1272b8SAndroid Build Coastguard Worker **/
131*2d1272b8SAndroid Build Coastguard Worker hb_position_t
hb_ot_math_get_glyph_top_accent_attachment(hb_font_t * font,hb_codepoint_t glyph)132*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_get_glyph_top_accent_attachment (hb_font_t *font,
133*2d1272b8SAndroid Build Coastguard Worker hb_codepoint_t glyph)
134*2d1272b8SAndroid Build Coastguard Worker {
135*2d1272b8SAndroid Build Coastguard Worker return font->face->table.MATH->get_glyph_info().get_top_accent_attachment (glyph, font);
136*2d1272b8SAndroid Build Coastguard Worker }
137*2d1272b8SAndroid Build Coastguard Worker
138*2d1272b8SAndroid Build Coastguard Worker /**
139*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_is_glyph_extended_shape:
140*2d1272b8SAndroid Build Coastguard Worker * @face: #hb_face_t to work upon
141*2d1272b8SAndroid Build Coastguard Worker * @glyph: The glyph index to test
142*2d1272b8SAndroid Build Coastguard Worker *
143*2d1272b8SAndroid Build Coastguard Worker * Tests whether the given glyph index is an extended shape in the face.
144*2d1272b8SAndroid Build Coastguard Worker *
145*2d1272b8SAndroid Build Coastguard Worker * Return value: `true` if the glyph is an extended shape, `false` otherwise
146*2d1272b8SAndroid Build Coastguard Worker *
147*2d1272b8SAndroid Build Coastguard Worker * Since: 1.3.3
148*2d1272b8SAndroid Build Coastguard Worker **/
149*2d1272b8SAndroid Build Coastguard Worker hb_bool_t
hb_ot_math_is_glyph_extended_shape(hb_face_t * face,hb_codepoint_t glyph)150*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_is_glyph_extended_shape (hb_face_t *face,
151*2d1272b8SAndroid Build Coastguard Worker hb_codepoint_t glyph)
152*2d1272b8SAndroid Build Coastguard Worker {
153*2d1272b8SAndroid Build Coastguard Worker return face->table.MATH->get_glyph_info().is_extended_shape (glyph);
154*2d1272b8SAndroid Build Coastguard Worker }
155*2d1272b8SAndroid Build Coastguard Worker
156*2d1272b8SAndroid Build Coastguard Worker /**
157*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_get_glyph_kerning:
158*2d1272b8SAndroid Build Coastguard Worker * @font: #hb_font_t to work upon
159*2d1272b8SAndroid Build Coastguard Worker * @glyph: The glyph index from which to retrieve the value
160*2d1272b8SAndroid Build Coastguard Worker * @kern: The #hb_ot_math_kern_t from which to retrieve the value
161*2d1272b8SAndroid Build Coastguard Worker * @correction_height: the correction height to use to determine the kerning.
162*2d1272b8SAndroid Build Coastguard Worker *
163*2d1272b8SAndroid Build Coastguard Worker * Fetches the math kerning (cut-ins) value for the specified font, glyph index, and
164*2d1272b8SAndroid Build Coastguard Worker * @kern.
165*2d1272b8SAndroid Build Coastguard Worker *
166*2d1272b8SAndroid Build Coastguard Worker * If the MathKern table is found, the function examines it to find a height
167*2d1272b8SAndroid Build Coastguard Worker * value that is greater or equal to @correction_height. If such a height
168*2d1272b8SAndroid Build Coastguard Worker * value is found, corresponding kerning value from the table is returned. If
169*2d1272b8SAndroid Build Coastguard Worker * no such height value is found, the last kerning value is returned.
170*2d1272b8SAndroid Build Coastguard Worker *
171*2d1272b8SAndroid Build Coastguard Worker * Return value: requested kerning value or zero
172*2d1272b8SAndroid Build Coastguard Worker *
173*2d1272b8SAndroid Build Coastguard Worker * Since: 1.3.3
174*2d1272b8SAndroid Build Coastguard Worker **/
175*2d1272b8SAndroid Build Coastguard Worker hb_position_t
hb_ot_math_get_glyph_kerning(hb_font_t * font,hb_codepoint_t glyph,hb_ot_math_kern_t kern,hb_position_t correction_height)176*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_get_glyph_kerning (hb_font_t *font,
177*2d1272b8SAndroid Build Coastguard Worker hb_codepoint_t glyph,
178*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_kern_t kern,
179*2d1272b8SAndroid Build Coastguard Worker hb_position_t correction_height)
180*2d1272b8SAndroid Build Coastguard Worker {
181*2d1272b8SAndroid Build Coastguard Worker return font->face->table.MATH->get_glyph_info().get_kerning (glyph,
182*2d1272b8SAndroid Build Coastguard Worker kern,
183*2d1272b8SAndroid Build Coastguard Worker correction_height,
184*2d1272b8SAndroid Build Coastguard Worker font);
185*2d1272b8SAndroid Build Coastguard Worker }
186*2d1272b8SAndroid Build Coastguard Worker
187*2d1272b8SAndroid Build Coastguard Worker /**
188*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_get_glyph_kernings:
189*2d1272b8SAndroid Build Coastguard Worker * @font: #hb_font_t to work upon
190*2d1272b8SAndroid Build Coastguard Worker * @glyph: The glyph index from which to retrieve the kernings
191*2d1272b8SAndroid Build Coastguard Worker * @kern: The #hb_ot_math_kern_t from which to retrieve the kernings
192*2d1272b8SAndroid Build Coastguard Worker * @start_offset: offset of the first kern entry to retrieve
193*2d1272b8SAndroid Build Coastguard Worker * @entries_count: (inout) (optional): Input = the maximum number of kern entries to return;
194*2d1272b8SAndroid Build Coastguard Worker * Output = the actual number of kern entries returned
195*2d1272b8SAndroid Build Coastguard Worker * @kern_entries: (out caller-allocates) (array length=entries_count): array of kern entries returned
196*2d1272b8SAndroid Build Coastguard Worker *
197*2d1272b8SAndroid Build Coastguard Worker * Fetches the raw MathKern (cut-in) data for the specified font, glyph index,
198*2d1272b8SAndroid Build Coastguard Worker * and @kern. The corresponding list of kern values and correction heights is
199*2d1272b8SAndroid Build Coastguard Worker * returned as a list of #hb_ot_math_kern_entry_t structs.
200*2d1272b8SAndroid Build Coastguard Worker *
201*2d1272b8SAndroid Build Coastguard Worker * See also #hb_ot_math_get_glyph_kerning, which handles selecting the
202*2d1272b8SAndroid Build Coastguard Worker * appropriate kern value for a given correction height.
203*2d1272b8SAndroid Build Coastguard Worker *
204*2d1272b8SAndroid Build Coastguard Worker * <note>For a glyph with @n defined kern values (where @n > 0), there are only
205*2d1272b8SAndroid Build Coastguard Worker * @n−1 defined correction heights, as each correction height defines a boundary
206*2d1272b8SAndroid Build Coastguard Worker * past which the next kern value should be selected. Therefore, only the
207*2d1272b8SAndroid Build Coastguard Worker * #hb_ot_math_kern_entry_t.kern_value of the uppermost #hb_ot_math_kern_entry_t
208*2d1272b8SAndroid Build Coastguard Worker * actually comes from the font; its corresponding
209*2d1272b8SAndroid Build Coastguard Worker * #hb_ot_math_kern_entry_t.max_correction_height is always set to
210*2d1272b8SAndroid Build Coastguard Worker * <code>INT32_MAX</code>.</note>
211*2d1272b8SAndroid Build Coastguard Worker *
212*2d1272b8SAndroid Build Coastguard Worker * Return value: the total number of kern values available or zero
213*2d1272b8SAndroid Build Coastguard Worker *
214*2d1272b8SAndroid Build Coastguard Worker * Since: 3.4.0
215*2d1272b8SAndroid Build Coastguard Worker **/
216*2d1272b8SAndroid Build Coastguard Worker unsigned int
hb_ot_math_get_glyph_kernings(hb_font_t * font,hb_codepoint_t glyph,hb_ot_math_kern_t kern,unsigned int start_offset,unsigned int * entries_count,hb_ot_math_kern_entry_t * kern_entries)217*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_get_glyph_kernings (hb_font_t *font,
218*2d1272b8SAndroid Build Coastguard Worker hb_codepoint_t glyph,
219*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_kern_t kern,
220*2d1272b8SAndroid Build Coastguard Worker unsigned int start_offset,
221*2d1272b8SAndroid Build Coastguard Worker unsigned int *entries_count, /* IN/OUT */
222*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_kern_entry_t *kern_entries /* OUT */)
223*2d1272b8SAndroid Build Coastguard Worker {
224*2d1272b8SAndroid Build Coastguard Worker return font->face->table.MATH->get_glyph_info().get_kernings (glyph,
225*2d1272b8SAndroid Build Coastguard Worker kern,
226*2d1272b8SAndroid Build Coastguard Worker start_offset,
227*2d1272b8SAndroid Build Coastguard Worker entries_count,
228*2d1272b8SAndroid Build Coastguard Worker kern_entries,
229*2d1272b8SAndroid Build Coastguard Worker font);
230*2d1272b8SAndroid Build Coastguard Worker }
231*2d1272b8SAndroid Build Coastguard Worker
232*2d1272b8SAndroid Build Coastguard Worker /**
233*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_get_glyph_variants:
234*2d1272b8SAndroid Build Coastguard Worker * @font: #hb_font_t to work upon
235*2d1272b8SAndroid Build Coastguard Worker * @glyph: The index of the glyph to stretch
236*2d1272b8SAndroid Build Coastguard Worker * @direction: The direction of the stretching (horizontal or vertical)
237*2d1272b8SAndroid Build Coastguard Worker * @start_offset: offset of the first variant to retrieve
238*2d1272b8SAndroid Build Coastguard Worker * @variants_count: (inout): Input = the maximum number of variants to return;
239*2d1272b8SAndroid Build Coastguard Worker * Output = the actual number of variants returned
240*2d1272b8SAndroid Build Coastguard Worker * @variants: (out) (array length=variants_count): array of variants returned
241*2d1272b8SAndroid Build Coastguard Worker *
242*2d1272b8SAndroid Build Coastguard Worker * Fetches the MathGlyphConstruction for the specified font, glyph index, and
243*2d1272b8SAndroid Build Coastguard Worker * direction. The corresponding list of size variants is returned as a list of
244*2d1272b8SAndroid Build Coastguard Worker * #hb_ot_math_glyph_variant_t structs.
245*2d1272b8SAndroid Build Coastguard Worker *
246*2d1272b8SAndroid Build Coastguard Worker * <note>The @direction parameter is only used to select between horizontal
247*2d1272b8SAndroid Build Coastguard Worker * or vertical directions for the construction. Even though all #hb_direction_t
248*2d1272b8SAndroid Build Coastguard Worker * values are accepted, only the result of #HB_DIRECTION_IS_HORIZONTAL is
249*2d1272b8SAndroid Build Coastguard Worker * considered.</note>
250*2d1272b8SAndroid Build Coastguard Worker *
251*2d1272b8SAndroid Build Coastguard Worker * Return value: the total number of size variants available or zero
252*2d1272b8SAndroid Build Coastguard Worker *
253*2d1272b8SAndroid Build Coastguard Worker * Since: 1.3.3
254*2d1272b8SAndroid Build Coastguard Worker **/
255*2d1272b8SAndroid Build Coastguard Worker unsigned int
hb_ot_math_get_glyph_variants(hb_font_t * font,hb_codepoint_t glyph,hb_direction_t direction,unsigned int start_offset,unsigned int * variants_count,hb_ot_math_glyph_variant_t * variants)256*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_get_glyph_variants (hb_font_t *font,
257*2d1272b8SAndroid Build Coastguard Worker hb_codepoint_t glyph,
258*2d1272b8SAndroid Build Coastguard Worker hb_direction_t direction,
259*2d1272b8SAndroid Build Coastguard Worker unsigned int start_offset,
260*2d1272b8SAndroid Build Coastguard Worker unsigned int *variants_count, /* IN/OUT */
261*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_glyph_variant_t *variants /* OUT */)
262*2d1272b8SAndroid Build Coastguard Worker {
263*2d1272b8SAndroid Build Coastguard Worker return font->face->table.MATH->get_variants().get_glyph_variants (glyph, direction, font,
264*2d1272b8SAndroid Build Coastguard Worker start_offset,
265*2d1272b8SAndroid Build Coastguard Worker variants_count,
266*2d1272b8SAndroid Build Coastguard Worker variants);
267*2d1272b8SAndroid Build Coastguard Worker }
268*2d1272b8SAndroid Build Coastguard Worker
269*2d1272b8SAndroid Build Coastguard Worker /**
270*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_get_min_connector_overlap:
271*2d1272b8SAndroid Build Coastguard Worker * @font: #hb_font_t to work upon
272*2d1272b8SAndroid Build Coastguard Worker * @direction: direction of the stretching (horizontal or vertical)
273*2d1272b8SAndroid Build Coastguard Worker *
274*2d1272b8SAndroid Build Coastguard Worker * Fetches the MathVariants table for the specified font and returns the
275*2d1272b8SAndroid Build Coastguard Worker * minimum overlap of connecting glyphs that are required to draw a glyph
276*2d1272b8SAndroid Build Coastguard Worker * assembly in the specified direction.
277*2d1272b8SAndroid Build Coastguard Worker *
278*2d1272b8SAndroid Build Coastguard Worker * <note>The @direction parameter is only used to select between horizontal
279*2d1272b8SAndroid Build Coastguard Worker * or vertical directions for the construction. Even though all #hb_direction_t
280*2d1272b8SAndroid Build Coastguard Worker * values are accepted, only the result of #HB_DIRECTION_IS_HORIZONTAL is
281*2d1272b8SAndroid Build Coastguard Worker * considered.</note>
282*2d1272b8SAndroid Build Coastguard Worker *
283*2d1272b8SAndroid Build Coastguard Worker * Return value: requested minimum connector overlap or zero
284*2d1272b8SAndroid Build Coastguard Worker *
285*2d1272b8SAndroid Build Coastguard Worker * Since: 1.3.3
286*2d1272b8SAndroid Build Coastguard Worker **/
287*2d1272b8SAndroid Build Coastguard Worker hb_position_t
hb_ot_math_get_min_connector_overlap(hb_font_t * font,hb_direction_t direction)288*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_get_min_connector_overlap (hb_font_t *font,
289*2d1272b8SAndroid Build Coastguard Worker hb_direction_t direction)
290*2d1272b8SAndroid Build Coastguard Worker {
291*2d1272b8SAndroid Build Coastguard Worker return font->face->table.MATH->get_variants().get_min_connector_overlap (direction, font);
292*2d1272b8SAndroid Build Coastguard Worker }
293*2d1272b8SAndroid Build Coastguard Worker
294*2d1272b8SAndroid Build Coastguard Worker /**
295*2d1272b8SAndroid Build Coastguard Worker * hb_ot_math_get_glyph_assembly:
296*2d1272b8SAndroid Build Coastguard Worker * @font: #hb_font_t to work upon
297*2d1272b8SAndroid Build Coastguard Worker * @glyph: The index of the glyph to stretch
298*2d1272b8SAndroid Build Coastguard Worker * @direction: direction of the stretching (horizontal or vertical)
299*2d1272b8SAndroid Build Coastguard Worker * @start_offset: offset of the first glyph part to retrieve
300*2d1272b8SAndroid Build Coastguard Worker * @parts_count: (inout): Input = maximum number of glyph parts to return;
301*2d1272b8SAndroid Build Coastguard Worker * Output = actual number of parts returned
302*2d1272b8SAndroid Build Coastguard Worker * @parts: (out) (array length=parts_count): the glyph parts returned
303*2d1272b8SAndroid Build Coastguard Worker * @italics_correction: (out): italics correction of the glyph assembly
304*2d1272b8SAndroid Build Coastguard Worker *
305*2d1272b8SAndroid Build Coastguard Worker * Fetches the GlyphAssembly for the specified font, glyph index, and direction.
306*2d1272b8SAndroid Build Coastguard Worker * Returned are a list of #hb_ot_math_glyph_part_t glyph parts that can be
307*2d1272b8SAndroid Build Coastguard Worker * used to draw the glyph and an italics-correction value (if one is defined
308*2d1272b8SAndroid Build Coastguard Worker * in the font).
309*2d1272b8SAndroid Build Coastguard Worker *
310*2d1272b8SAndroid Build Coastguard Worker * <note>The @direction parameter is only used to select between horizontal
311*2d1272b8SAndroid Build Coastguard Worker * or vertical directions for the construction. Even though all #hb_direction_t
312*2d1272b8SAndroid Build Coastguard Worker * values are accepted, only the result of #HB_DIRECTION_IS_HORIZONTAL is
313*2d1272b8SAndroid Build Coastguard Worker * considered.</note>
314*2d1272b8SAndroid Build Coastguard Worker *
315*2d1272b8SAndroid Build Coastguard Worker * Return value: the total number of parts in the glyph assembly
316*2d1272b8SAndroid Build Coastguard Worker *
317*2d1272b8SAndroid Build Coastguard Worker * Since: 1.3.3
318*2d1272b8SAndroid Build Coastguard Worker **/
319*2d1272b8SAndroid Build Coastguard Worker unsigned int
hb_ot_math_get_glyph_assembly(hb_font_t * font,hb_codepoint_t glyph,hb_direction_t direction,unsigned int start_offset,unsigned int * parts_count,hb_ot_math_glyph_part_t * parts,hb_position_t * italics_correction)320*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_get_glyph_assembly (hb_font_t *font,
321*2d1272b8SAndroid Build Coastguard Worker hb_codepoint_t glyph,
322*2d1272b8SAndroid Build Coastguard Worker hb_direction_t direction,
323*2d1272b8SAndroid Build Coastguard Worker unsigned int start_offset,
324*2d1272b8SAndroid Build Coastguard Worker unsigned int *parts_count, /* IN/OUT */
325*2d1272b8SAndroid Build Coastguard Worker hb_ot_math_glyph_part_t *parts, /* OUT */
326*2d1272b8SAndroid Build Coastguard Worker hb_position_t *italics_correction /* OUT */)
327*2d1272b8SAndroid Build Coastguard Worker {
328*2d1272b8SAndroid Build Coastguard Worker return font->face->table.MATH->get_variants().get_glyph_parts (glyph,
329*2d1272b8SAndroid Build Coastguard Worker direction,
330*2d1272b8SAndroid Build Coastguard Worker font,
331*2d1272b8SAndroid Build Coastguard Worker start_offset,
332*2d1272b8SAndroid Build Coastguard Worker parts_count,
333*2d1272b8SAndroid Build Coastguard Worker parts,
334*2d1272b8SAndroid Build Coastguard Worker italics_correction);
335*2d1272b8SAndroid Build Coastguard Worker }
336*2d1272b8SAndroid Build Coastguard Worker
337*2d1272b8SAndroid Build Coastguard Worker
338*2d1272b8SAndroid Build Coastguard Worker #endif
339