#ttf #truetype #otf #opentype

owned_ttf_parser

ttf-parser plus support for owned data

9 releases (breaking)

0.12.0 Feb 14, 2021
0.11.0 Feb 4, 2021
0.10.0 Jan 16, 2021
0.9.0 Dec 5, 2020
0.5.1 Apr 21, 2020

#10 in Data formats

Download history 14277/week @ 2020-11-15 17973/week @ 2020-11-22 19685/week @ 2020-11-29 15316/week @ 2020-12-06 15392/week @ 2020-12-13 13029/week @ 2020-12-20 13158/week @ 2020-12-27 15540/week @ 2021-01-03 15699/week @ 2021-01-10 15822/week @ 2021-01-17 16641/week @ 2021-01-24 17914/week @ 2021-01-31 16277/week @ 2021-02-07 16052/week @ 2021-02-14 17168/week @ 2021-02-21 16314/week @ 2021-02-28

67,886 downloads per month
Used in 131 crates (3 directly)

Apache-2.0

22KB
82 lines

owned_ttf_parser crates.io Documentation

ttf-parser plus support for owned data.

Provides OwnedFace, AsFaceRef and re-exports ttf_parser::*.

Example

use owned_ttf_parser::{AsFaceRef, OwnedFace, Face};

let owned_face = OwnedFace::from_vec(owned_face_data, 0).unwrap();
let face_ref: &Face<'_> = owned_face.as_face_ref();

assert_eq!(face_ref.ascender(), 2254);

no_std

no_std environments are supported using alloc.

owned_ttf_parser = { default-features = false }

Minimum supported rust compiler

All crates maintained with latest stable rust.


lib.rs:

Extends ttf_parser with owned version of Face: OwnedFace.

Re-exports ttf_parser::*.

Example

use owned_ttf_parser::{AsFaceRef, OwnedFace, Face};

# let owned_font_data = include_bytes!("../fonts/font.ttf").to_vec();
let owned_face = OwnedFace::from_vec(owned_font_data, 0).unwrap();
let face_ref: &Face<'_> = owned_face.as_face_ref();

assert_eq!(face_ref.ascender(), 2254);

Dependencies

~455KB
~11K SLoC