sfnt

Crates.iosfnt
lib.rssfnt
version0.12.0
sourcesrc
created_at2018-04-25 09:10:23.386414
updated_at2019-01-02 09:04:36.883837
descriptionA zero-allocation SFNT parser.
homepage
repositoryhttps://github.com/glyph-rs/sfnt
max_upload_size
id62216
size33,418
Kyle Mayes (KyleMayes)

documentation

https://docs.rs/sfnt

README

sfnt

crates.io docs.rs travis-ci.com

A zero-allocation SFNT parser.

Released under the Apache License 2.0.

Supported on Rust 1.31.0 and later.

Example

use std::fs::{File};
use std::io::{Read};

use sfnt::{Record, Sfnt, Tag};

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 = Sfnt::parse(&bytes).unwrap();
    let (record, bytes) = sfnt.find(b"head").unwrap();

    assert_eq!(record, Record {
        tag: Tag(b"head"),
        checksum: 4165466467,
        offset: 316,
        length: 54,
    });

    assert_eq!(bytes.len(), 54);
}
Commit count: 0

cargo fmt