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
use core::num::NonZeroU16;
use crate::parser::Stream;
#[derive(Clone, Copy, Debug)]
pub struct Table {
pub number_of_glyphs: NonZeroU16,
}
impl Table {
pub fn parse(data: &[u8]) -> Option<Self> {
let mut s = Stream::new(data);
let version = s.read::<u32>()?;
if !(version == 0x00005000 || version == 0x00010000) {
return None;
}
let n = s.read::<u16>()?;
let number_of_glyphs = NonZeroU16::new(n)?;
Some(Table { number_of_glyphs })
}
}