write_fonts/generated/
generated_vmtx.rs1#[allow(unused_imports)]
6use crate::codegen_prelude::*;
7
8#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
11pub struct Vmtx {
12 pub v_metrics: Vec<LongMetric>,
15 pub top_side_bearings: Vec<i16>,
17}
18
19impl Vmtx {
20 pub fn new(v_metrics: Vec<LongMetric>, top_side_bearings: Vec<i16>) -> Self {
22 Self {
23 v_metrics,
24 top_side_bearings,
25 }
26 }
27}
28
29impl FontWrite for Vmtx {
30 fn write_into(&self, writer: &mut TableWriter) {
31 self.v_metrics.write_into(writer);
32 self.top_side_bearings.write_into(writer);
33 }
34 fn table_type(&self) -> TableType {
35 TableType::TopLevel(Vmtx::TAG)
36 }
37}
38
39impl Validate for Vmtx {
40 fn validate_impl(&self, ctx: &mut ValidationCtx) {
41 ctx.in_table("Vmtx", |ctx| {
42 ctx.in_field("v_metrics", |ctx| {
43 if self.v_metrics.len() > (u16::MAX as usize) {
44 ctx.report("array exceeds max length");
45 }
46 self.v_metrics.validate_impl(ctx);
47 });
48 })
49 }
50}
51
52impl TopLevelTable for Vmtx {
53 const TAG: Tag = Tag::new(b"vmtx");
54}
55
56impl<'a> FromObjRef<read_fonts::tables::vmtx::Vmtx<'a>> for Vmtx {
57 fn from_obj_ref(obj: &read_fonts::tables::vmtx::Vmtx<'a>, _: FontData) -> Self {
58 let offset_data = obj.offset_data();
59 Vmtx {
60 v_metrics: obj.v_metrics().to_owned_obj(offset_data),
61 top_side_bearings: obj.top_side_bearings().to_owned_obj(offset_data),
62 }
63 }
64}
65
66#[allow(clippy::needless_lifetimes)]
67impl<'a> FromTableRef<read_fonts::tables::vmtx::Vmtx<'a>> for Vmtx {}