Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
30
third-party/vendor/ttf-parser-0.15.2/src/tables/maxp.rs
vendored
Normal file
30
third-party/vendor/ttf-parser-0.15.2/src/tables/maxp.rs
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//! A [Maximum Profile Table](
|
||||
//! https://docs.microsoft.com/en-us/typography/opentype/spec/maxp) implementation.
|
||||
|
||||
use core::num::NonZeroU16;
|
||||
|
||||
use crate::parser::Stream;
|
||||
|
||||
/// A [Maximum Profile Table](https://docs.microsoft.com/en-us/typography/opentype/spec/maxp).
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Table {
|
||||
/// The total number of glyphs in the face.
|
||||
pub number_of_glyphs: NonZeroU16,
|
||||
}
|
||||
|
||||
impl Table {
|
||||
/// Parses a table from raw data.
|
||||
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
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue