webtype

Crates.iowebtype
lib.rswebtype
version0.16.0
sourcesrc
created_at2023-03-12 15:27:31.905984
updated_at2024-08-30 13:14:21.184579
descriptionThe package provides a parser for fonts in Web Open Font Format.
homepagehttps://github.com/bodoni/webtype
repositoryhttps://github.com/bodoni/webtype
max_upload_size
id808086
size112,920
Owners (github:buoyantio:owners)

documentation

https://docs.rs/webtype

README

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.

Commit count: 50

cargo fmt