#font #typography #woff #typeface #woff2

webtype

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

18 releases (breaking)

0.13.1 Feb 16, 2024
0.12.0 Feb 2, 2024
0.7.0 Aug 19, 2023
0.4.0 Jul 21, 2023
0.2.1 Mar 27, 2023

#35 in Data formats

Download history 45/week @ 2023-12-22 75/week @ 2023-12-29 125/week @ 2024-01-05 98/week @ 2024-01-12 31/week @ 2024-01-19 49/week @ 2024-01-26 146/week @ 2024-02-02 8/week @ 2024-02-09 216/week @ 2024-02-16 77/week @ 2024-02-23 53/week @ 2024-03-01 48/week @ 2024-03-08 110/week @ 2024-03-15 37/week @ 2024-03-22 50/week @ 2024-03-29 100/week @ 2024-04-05

308 downloads per month
Used in 3 crates (via font)

Apache-2.0/MIT

100KB
313 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 abstraction called font, which internally relies on this package.

Example

use webtype::opentype::truetype::tables::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
~41K SLoC