#font #typeface #typography #woff #woff2

webtype

The package provides a parser for fonts in Web Open Font Format

10 releases (breaking)

0.7.0 Aug 19, 2023
0.6.0 Aug 15, 2023
0.5.0 Aug 14, 2023
0.4.0 Jul 21, 2023
0.0.1 Mar 12, 2023

#28 in Data formats

Download history 243/week @ 2023-06-05 173/week @ 2023-06-12 169/week @ 2023-06-19 247/week @ 2023-06-26 214/week @ 2023-07-03 126/week @ 2023-07-10 254/week @ 2023-07-17 204/week @ 2023-07-24 121/week @ 2023-07-31 168/week @ 2023-08-07 348/week @ 2023-08-14 57/week @ 2023-08-21 136/week @ 2023-08-28 123/week @ 2023-09-04 85/week @ 2023-09-11 109/week @ 2023-09-18

454 downloads per month
Used in 2 crates (via font)

Apache-2.0/MIT

100KB
310 lines

WebType Package Documentation Build

The package provides a parser for fonts in Web Open Font Format. It might be helpful to have a look at a higher-level parser called font, which internally relies on this package.

Example

use webtype::opentype::truetype::FontHeader;
use webtype::File;

macro_rules! ok(($result:expr) => ($result.unwrap()));

let path = "NotoNaskhArabic-Regular.woff2";
let mut tape = ok!(std::fs::File::open(path));
let File { mut fonts, mut tape } = ok!(File::read(&mut tape));

let font_header = ok!(ok!(fonts[0].take::<_, FontHeader>(&mut tape)));
assert_eq!(font_header.units_per_em, 2048);

Contribution

Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.md.

Dependencies

~2.5MB
~40K SLoC