Crate sfnt [−] [src]
A zero-allocation SFNT parser.
Example
use std::fs::{File}; use std::io::{Read}; use sfnt::{parse_sfnt}; fn main() { // Read the font file into memory. let mut file = File::open("tests/resources/OpenSans-Italic.ttf").unwrap(); let mut bytes = vec![]; file.read_to_end(&mut bytes).unwrap(); // Parse the font file and find one of the tables in the font file. let sfnt = parse_sfnt(&bytes).unwrap(); let (record, bytes) = sfnt.find("head").unwrap(); println!("{:?}", record); // Record { tag: "head", checksum: 4165466467, offset: 316, length: 54 } println!("{:?}", bytes.len()); // 54 }
Structs
Fixed16_16 |
A |
Fixed2_14 |
A |
Header |
An SFNT file header. |
Record |
An SFNT file table record. |
Sfnt |
An SFNT file. |
SfntIter |
An iterator over the tables in an SFNT file. |
Timestamp |
A number of seconds that have elapsed since |
Functions
checksum |
Returns the SFNT checksum for the supplied bytes. |
parse_sfnt |
Parses the supplied SFNT file. |