1/*
2 * Copyright © 2018 Ebrahim Byagowi
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
25#if !defined(HB_OT_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)
26#error "Include <hb-ot.h> instead."
27#endif
28
29#ifndef HB_OT_METRICS_H
30#define HB_OT_METRICS_H
31
32#include "hb.h"
33#include "hb-ot-name.h"
34
35HB_BEGIN_DECLS
36
37
38/**
39 * hb_ot_metrics_tag_t:
40 * @HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER: horizontal ascender.
41 * @HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER: horizontal descender.
42 * @HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP: horizontal line gap.
43 * @HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT: horizontal clipping ascent.
44 * @HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT: horizontal clipping descent.
45 * @HB_OT_METRICS_TAG_VERTICAL_ASCENDER: vertical ascender.
46 * @HB_OT_METRICS_TAG_VERTICAL_DESCENDER: vertical descender.
47 * @HB_OT_METRICS_TAG_VERTICAL_LINE_GAP: vertical line gap.
48 * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE: horizontal caret rise.
49 * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN: horizontal caret run.
50 * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET: horizontal caret offset.
51 * @HB_OT_METRICS_TAG_VERTICAL_CARET_RISE: vertical caret rise.
52 * @HB_OT_METRICS_TAG_VERTICAL_CARET_RUN: vertical caret run.
53 * @HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET: vertical caret offset.
54 * @HB_OT_METRICS_TAG_X_HEIGHT: x height.
55 * @HB_OT_METRICS_TAG_CAP_HEIGHT: cap height.
56 * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE: subscript em x size.
57 * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE: subscript em y size.
58 * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET: subscript em x offset.
59 * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET: subscript em y offset.
60 * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE: superscript em x size.
61 * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE: superscript em y size.
62 * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET: superscript em x offset.
63 * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET: superscript em y offset.
64 * @HB_OT_METRICS_TAG_STRIKEOUT_SIZE: strikeout size.
65 * @HB_OT_METRICS_TAG_STRIKEOUT_OFFSET: strikeout offset.
66 * @HB_OT_METRICS_TAG_UNDERLINE_SIZE: underline size.
67 * @HB_OT_METRICS_TAG_UNDERLINE_OFFSET: underline offset.
68 *
69 * Metric tags corresponding to [MVAR Value
70 * Tags](https://docs.microsoft.com/en-us/typography/opentype/spec/mvar#value-tags)
71 *
72 * Since: 2.6.0
73 **/
74typedef enum {
75 HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER = HB_TAG ('h','a','s','c'),
76 HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER = HB_TAG ('h','d','s','c'),
77 HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP = HB_TAG ('h','l','g','p'),
78 HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT = HB_TAG ('h','c','l','a'),
79 HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT = HB_TAG ('h','c','l','d'),
80 HB_OT_METRICS_TAG_VERTICAL_ASCENDER = HB_TAG ('v','a','s','c'),
81 HB_OT_METRICS_TAG_VERTICAL_DESCENDER = HB_TAG ('v','d','s','c'),
82 HB_OT_METRICS_TAG_VERTICAL_LINE_GAP = HB_TAG ('v','l','g','p'),
83 HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE = HB_TAG ('h','c','r','s'),
84 HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN = HB_TAG ('h','c','r','n'),
85 HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET = HB_TAG ('h','c','o','f'),
86 HB_OT_METRICS_TAG_VERTICAL_CARET_RISE = HB_TAG ('v','c','r','s'),
87 HB_OT_METRICS_TAG_VERTICAL_CARET_RUN = HB_TAG ('v','c','r','n'),
88 HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET = HB_TAG ('v','c','o','f'),
89 HB_OT_METRICS_TAG_X_HEIGHT = HB_TAG ('x','h','g','t'),
90 HB_OT_METRICS_TAG_CAP_HEIGHT = HB_TAG ('c','p','h','t'),
91 HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE = HB_TAG ('s','b','x','s'),
92 HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE = HB_TAG ('s','b','y','s'),
93 HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET = HB_TAG ('s','b','x','o'),
94 HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET = HB_TAG ('s','b','y','o'),
95 HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE = HB_TAG ('s','p','x','s'),
96 HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE = HB_TAG ('s','p','y','s'),
97 HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET = HB_TAG ('s','p','x','o'),
98 HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET = HB_TAG ('s','p','y','o'),
99 HB_OT_METRICS_TAG_STRIKEOUT_SIZE = HB_TAG ('s','t','r','s'),
100 HB_OT_METRICS_TAG_STRIKEOUT_OFFSET = HB_TAG ('s','t','r','o'),
101 HB_OT_METRICS_TAG_UNDERLINE_SIZE = HB_TAG ('u','n','d','s'),
102 HB_OT_METRICS_TAG_UNDERLINE_OFFSET = HB_TAG ('u','n','d','o'),
103
104 /*< private >*/
105 _HB_OT_METRICS_TAG_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/
106} hb_ot_metrics_tag_t;
107
108HB_EXTERN hb_bool_t
109hb_ot_metrics_get_position (hb_font_t *font,
110 hb_ot_metrics_tag_t metrics_tag,
111 hb_position_t *position /* OUT. May be NULL. */);
112
113HB_EXTERN void
114hb_ot_metrics_get_position_with_fallback (hb_font_t *font,
115 hb_ot_metrics_tag_t metrics_tag,
116 hb_position_t *position /* OUT */);
117
118HB_EXTERN float
119hb_ot_metrics_get_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag);
120
121HB_EXTERN hb_position_t
122hb_ot_metrics_get_x_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag);
123
124HB_EXTERN hb_position_t
125hb_ot_metrics_get_y_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag);
126
127HB_END_DECLS
128
129#endif /* HB_OT_METRICS_H */
130