1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#[allow(unused_imports)]
use crate::codegen_prelude::*;
#[derive(Clone, Debug, Default)]
pub struct Vhea {
pub ascender: FWord,
pub descender: FWord,
pub line_gap: FWord,
pub advance_height_max: UfWord,
pub min_top_side_bearing: FWord,
pub min_bottom_side_bearing: FWord,
pub y_max_extent: FWord,
pub caret_slope_rise: i16,
pub caret_slope_run: i16,
pub caret_offset: i16,
pub number_of_long_ver_metrics: u16,
}
impl Vhea {
#[allow(clippy::too_many_arguments)]
pub fn new(
ascender: FWord,
descender: FWord,
line_gap: FWord,
advance_height_max: UfWord,
min_top_side_bearing: FWord,
min_bottom_side_bearing: FWord,
y_max_extent: FWord,
caret_slope_rise: i16,
caret_slope_run: i16,
caret_offset: i16,
number_of_long_ver_metrics: u16,
) -> Self {
Self {
ascender,
descender,
line_gap,
advance_height_max,
min_top_side_bearing,
min_bottom_side_bearing,
y_max_extent,
caret_slope_rise,
caret_slope_run,
caret_offset,
number_of_long_ver_metrics,
}
}
}
impl FontWrite for Vhea {
#[allow(clippy::unnecessary_cast)]
fn write_into(&self, writer: &mut TableWriter) {
(Version16Dot16::VERSION_1_1 as Version16Dot16).write_into(writer);
self.ascender.write_into(writer);
self.descender.write_into(writer);
self.line_gap.write_into(writer);
self.advance_height_max.write_into(writer);
self.min_top_side_bearing.write_into(writer);
self.min_bottom_side_bearing.write_into(writer);
self.y_max_extent.write_into(writer);
self.caret_slope_rise.write_into(writer);
self.caret_slope_run.write_into(writer);
self.caret_offset.write_into(writer);
(0 as i16).write_into(writer);
(0 as i16).write_into(writer);
(0 as i16).write_into(writer);
(0 as i16).write_into(writer);
(0 as i16).write_into(writer);
self.number_of_long_ver_metrics.write_into(writer);
}
}
impl Validate for Vhea {
fn validate_impl(&self, _ctx: &mut ValidationCtx) {}
}
impl TopLevelTable for Vhea {
const TAG: Tag = Tag::new(b"vhea");
}
impl<'a> FromObjRef<read_fonts::tables::vhea::Vhea<'a>> for Vhea {
fn from_obj_ref(obj: &read_fonts::tables::vhea::Vhea<'a>, _: FontData) -> Self {
Vhea {
ascender: obj.ascender(),
descender: obj.descender(),
line_gap: obj.line_gap(),
advance_height_max: obj.advance_height_max(),
min_top_side_bearing: obj.min_top_side_bearing(),
min_bottom_side_bearing: obj.min_bottom_side_bearing(),
y_max_extent: obj.y_max_extent(),
caret_slope_rise: obj.caret_slope_rise(),
caret_slope_run: obj.caret_slope_run(),
caret_offset: obj.caret_offset(),
number_of_long_ver_metrics: obj.number_of_long_ver_metrics(),
}
}
}
impl<'a> FromTableRef<read_fonts::tables::vhea::Vhea<'a>> for Vhea {}
impl<'a> FontRead<'a> for Vhea {
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
<read_fonts::tables::vhea::Vhea as FontRead>::read(data).map(|x| x.to_owned_table())
}
}