1 
2 //          Copyright Ahmet Sait Koçak 2020.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          https://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.hb.bind.ot.metrics;
8 
9 import bindbc.hb.config;
10 
11 static if (hbSupport >= HBSupport.v2_6_3)
12 {
13 	import bindbc.hb.bind.common;
14 	import bindbc.hb.bind.font;
15 
16 	extern(C) @nogc nothrow:
17 
18 	/**
19 	 * hb_ot_metrics_tag_t:
20 	 * @HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER: horizontal ascender.
21 	 * @HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER: horizontal descender.
22 	 * @HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP: horizontal line gap.
23 	 * @HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT: horizontal clipping ascent.
24 	 * @HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT: horizontal clipping descent.
25 	 * @HB_OT_METRICS_TAG_VERTICAL_ASCENDER: vertical ascender.
26 	 * @HB_OT_METRICS_TAG_VERTICAL_DESCENDER: vertical descender.
27 	 * @HB_OT_METRICS_TAG_VERTICAL_LINE_GAP: vertical line gap.
28 	 * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE: horizontal caret rise.
29 	 * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN: horizontal caret run.
30 	 * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET: horizontal caret offset.
31 	 * @HB_OT_METRICS_TAG_VERTICAL_CARET_RISE: vertical caret rise.
32 	 * @HB_OT_METRICS_TAG_VERTICAL_CARET_RUN: vertical caret run.
33 	 * @HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET: vertical caret offset.
34 	 * @HB_OT_METRICS_TAG_X_HEIGHT: x height.
35 	 * @HB_OT_METRICS_TAG_CAP_HEIGHT: cap height.
36 	 * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE: subscript em x size.
37 	 * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE: subscript em y size.
38 	 * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET: subscript em x offset.
39 	 * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET: subscript em y offset.
40 	 * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE: superscript em x size.
41 	 * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE: superscript em y size.
42 	 * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET: superscript em x offset.
43 	 * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET: superscript em y offset.
44 	 * @HB_OT_METRICS_TAG_STRIKEOUT_SIZE: strikeout size.
45 	 * @HB_OT_METRICS_TAG_STRIKEOUT_OFFSET: strikeout offset.
46 	 * @HB_OT_METRICS_TAG_UNDERLINE_SIZE: underline size.
47 	 * @HB_OT_METRICS_TAG_UNDERLINE_OFFSET: underline offset.
48 	 *
49 	 * From https://docs.microsoft.com/en-us/typography/opentype/spec/mvar#value-tags
50 	 *
51 	 * Since: 2.6.0
52 	 **/
53 	enum : hb_tag_t
54 	{
55 		HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER = HB_TAG('h', 'a', 's', 'c'),
56 		HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER = HB_TAG('h', 'd', 's', 'c'),
57 		HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP = HB_TAG('h', 'l', 'g', 'p'),
58 		HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT = HB_TAG('h', 'c', 'l', 'a'),
59 		HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT = HB_TAG('h', 'c', 'l', 'd'),
60 		HB_OT_METRICS_TAG_VERTICAL_ASCENDER = HB_TAG('v', 'a', 's', 'c'),
61 		HB_OT_METRICS_TAG_VERTICAL_DESCENDER = HB_TAG('v', 'd', 's', 'c'),
62 		HB_OT_METRICS_TAG_VERTICAL_LINE_GAP = HB_TAG('v', 'l', 'g', 'p'),
63 		HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE = HB_TAG('h', 'c', 'r', 's'),
64 		HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN = HB_TAG('h', 'c', 'r', 'n'),
65 		HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET = HB_TAG('h', 'c', 'o', 'f'),
66 		HB_OT_METRICS_TAG_VERTICAL_CARET_RISE = HB_TAG('v', 'c', 'r', 's'),
67 		HB_OT_METRICS_TAG_VERTICAL_CARET_RUN = HB_TAG('v', 'c', 'r', 'n'),
68 		HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET = HB_TAG('v', 'c', 'o', 'f'),
69 		HB_OT_METRICS_TAG_X_HEIGHT = HB_TAG('x', 'h', 'g', 't'),
70 		HB_OT_METRICS_TAG_CAP_HEIGHT = HB_TAG('c', 'p', 'h', 't'),
71 		HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE = HB_TAG('s', 'b', 'x', 's'),
72 		HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE = HB_TAG('s', 'b', 'y', 's'),
73 		HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET = HB_TAG('s', 'b', 'x', 'o'),
74 		HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET = HB_TAG('s', 'b', 'y', 'o'),
75 		HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE = HB_TAG('s', 'p', 'x', 's'),
76 		HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE = HB_TAG('s', 'p', 'y', 's'),
77 		HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET = HB_TAG('s', 'p', 'x', 'o'),
78 		HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET = HB_TAG('s', 'p', 'y', 'o'),
79 		HB_OT_METRICS_TAG_STRIKEOUT_SIZE = HB_TAG('s', 't', 'r', 's'),
80 		HB_OT_METRICS_TAG_STRIKEOUT_OFFSET = HB_TAG('s', 't', 'r', 'o'),
81 		HB_OT_METRICS_TAG_UNDERLINE_SIZE = HB_TAG('u', 'n', 'd', 's'),
82 		HB_OT_METRICS_TAG_UNDERLINE_OFFSET = HB_TAG('u', 'n', 'd', 'o'),
83 
84 		_HB_OT_METRICS_TAG_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/
85 	}
86 	alias hb_ot_metrics_tag_t = hb_tag_t;
87 
88 	/* OUT.  May be NULL. */
89 	version(BindHB_Static)
90 		hb_bool_t hb_ot_metrics_get_position (
91 			hb_font_t* font,
92 			hb_ot_metrics_tag_t metrics_tag,
93 			hb_position_t* position);
94 	else
95 	{
96 		private alias fp_hb_ot_metrics_get_position = hb_bool_t function (
97 			hb_font_t* font,
98 			hb_ot_metrics_tag_t metrics_tag,
99 			hb_position_t* position);
100 		__gshared fp_hb_ot_metrics_get_position hb_ot_metrics_get_position;
101 	}
102 
103 	version(BindHB_Static)
104 		float hb_ot_metrics_get_variation (
105 			hb_font_t* font,
106 			hb_ot_metrics_tag_t metrics_tag);
107 	else
108 	{
109 		private alias fp_hb_ot_metrics_get_variation = float function (
110 			hb_font_t* font,
111 			hb_ot_metrics_tag_t metrics_tag);
112 		__gshared fp_hb_ot_metrics_get_variation hb_ot_metrics_get_variation;
113 	}
114 
115 	version(BindHB_Static)
116 		hb_position_t hb_ot_metrics_get_x_variation (
117 			hb_font_t* font,
118 			hb_ot_metrics_tag_t metrics_tag);
119 	else
120 	{
121 		private alias fp_hb_ot_metrics_get_x_variation = hb_position_t function (
122 			hb_font_t* font,
123 			hb_ot_metrics_tag_t metrics_tag);
124 		__gshared fp_hb_ot_metrics_get_x_variation hb_ot_metrics_get_x_variation;
125 	}
126 
127 	version(BindHB_Static)
128 		hb_position_t hb_ot_metrics_get_y_variation (
129 			hb_font_t* font,
130 			hb_ot_metrics_tag_t metrics_tag);
131 	else
132 	{
133 		private alias fp_hb_ot_metrics_get_y_variation = hb_position_t function (
134 			hb_font_t* font,
135 			hb_ot_metrics_tag_t metrics_tag);
136 		__gshared fp_hb_ot_metrics_get_y_variation hb_ot_metrics_get_y_variation;
137 	}
138 }