1use crate::types::{Fixed, LongDateTime, Tag, int16, tags, uint16, uint32};
2
3#[repr(C)]
4pub struct HeadTableRepr {
5 pub major_version: uint16,
6 pub minor_version: uint16,
7 pub font_revision: Fixed,
8 pub checksum_adjustment: uint32,
9 pub magic_number: uint32,
10 pub flags: uint16,
11 pub units_per_em: uint16,
12 pub created: LongDateTime,
13 pub modified: LongDateTime,
14 pub x_min: int16,
15 pub y_min: int16,
16 pub x_max: int16,
17 pub y_max: int16,
18 pub mac_style: uint16,
19 pub lowest_rec_ppem: uint16,
20 pub font_direction_hint: int16,
21 pub index_to_loc_format: int16,
22 pub glyph_data_format: int16,
23}
24
25impl super::Table for HeadTableRepr {
26 const TAG: Tag = tags::head;
27 type Handle<'a> = &'a Self;
28}
29
30impl std::fmt::Debug for HeadTableRepr {
31 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
32 f.debug_struct("HeadTable")
33 .field("major_version", &self.major_version.get())
34 .field("minor_version", &self.minor_version.get())
35 .field("font_revision", &self.font_revision)
36 .field_with("checksum_adjustment", |f| write!(f, "{:#010X}", self.checksum_adjustment))
37 .field_with("magic_number", |f| write!(f, "{:#010X}", self.magic_number))
38 .field_with("flags", |f| write!(f, "{:#017b}", self.flags))
39 .field("units_per_em", &self.units_per_em.get())
40 .field_with("created", |f| write!(f, "{}", self.created))
41 .field_with("modified", |f| write!(f, "{}", self.modified))
42 .field("x_min", &self.x_min.get())
43 .field("y_min", &self.y_min.get())
44 .field("x_max", &self.x_max.get())
45 .field("y_max", &self.y_max.get())
46 .field_with("mac_style", |f| write!(f, "{:#09b}", self.mac_style))
47 .field("lowest_rec_ppem", &self.lowest_rec_ppem.get())
48 .field("font_direction_hint", &self.font_direction_hint.get())
49 .field("index_to_loc_format", &self.index_to_loc_format.get())
50 .field("glyph_data_format", &self.glyph_data_format.get())
51 .finish()
52 }
53}