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 | #ifndef HB_OT_H_IN |
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 | |
35 | HB_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 | * From https://docs.microsoft.com/en-us/typography/opentype/spec/mvar#value-tags |
70 | * |
71 | * Since: 2.6.0 |
72 | **/ |
73 | typedef enum { |
74 | HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER = HB_TAG ('h','a','s','c'), |
75 | HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER = HB_TAG ('h','d','s','c'), |
76 | HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP = HB_TAG ('h','l','g','p'), |
77 | HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT = HB_TAG ('h','c','l','a'), |
78 | HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT = HB_TAG ('h','c','l','d'), |
79 | HB_OT_METRICS_TAG_VERTICAL_ASCENDER = HB_TAG ('v','a','s','c'), |
80 | HB_OT_METRICS_TAG_VERTICAL_DESCENDER = HB_TAG ('v','d','s','c'), |
81 | HB_OT_METRICS_TAG_VERTICAL_LINE_GAP = HB_TAG ('v','l','g','p'), |
82 | HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE = HB_TAG ('h','c','r','s'), |
83 | HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN = HB_TAG ('h','c','r','n'), |
84 | HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET = HB_TAG ('h','c','o','f'), |
85 | HB_OT_METRICS_TAG_VERTICAL_CARET_RISE = HB_TAG ('v','c','r','s'), |
86 | HB_OT_METRICS_TAG_VERTICAL_CARET_RUN = HB_TAG ('v','c','r','n'), |
87 | HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET = HB_TAG ('v','c','o','f'), |
88 | HB_OT_METRICS_TAG_X_HEIGHT = HB_TAG ('x','h','g','t'), |
89 | HB_OT_METRICS_TAG_CAP_HEIGHT = HB_TAG ('c','p','h','t'), |
90 | HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE = HB_TAG ('s','b','x','s'), |
91 | HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE = HB_TAG ('s','b','y','s'), |
92 | HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET = HB_TAG ('s','b','x','o'), |
93 | HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET = HB_TAG ('s','b','y','o'), |
94 | HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE = HB_TAG ('s','p','x','s'), |
95 | HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE = HB_TAG ('s','p','y','s'), |
96 | HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET = HB_TAG ('s','p','x','o'), |
97 | HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET = HB_TAG ('s','p','y','o'), |
98 | HB_OT_METRICS_TAG_STRIKEOUT_SIZE = HB_TAG ('s','t','r','s'), |
99 | HB_OT_METRICS_TAG_STRIKEOUT_OFFSET = HB_TAG ('s','t','r','o'), |
100 | HB_OT_METRICS_TAG_UNDERLINE_SIZE = HB_TAG ('u','n','d','s'), |
101 | HB_OT_METRICS_TAG_UNDERLINE_OFFSET = HB_TAG ('u','n','d','o'), |
102 | |
103 | _HB_OT_METRICS_TAG_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/ |
104 | } hb_ot_metrics_tag_t; |
105 | |
106 | HB_EXTERN hb_bool_t |
107 | hb_ot_metrics_get_position (hb_font_t *font, |
108 | hb_ot_metrics_tag_t metrics_tag, |
109 | hb_position_t *position /* OUT. May be NULL. */); |
110 | |
111 | HB_EXTERN float |
112 | hb_ot_metrics_get_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag); |
113 | |
114 | HB_EXTERN hb_position_t |
115 | hb_ot_metrics_get_x_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag); |
116 | |
117 | HB_EXTERN hb_position_t |
118 | hb_ot_metrics_get_y_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag); |
119 | |
120 | HB_END_DECLS |
121 | |
122 | #endif /* HB_OT_METRICS_H */ |
123 | |