| Crates.io | font |
| lib.rs | font |
| version | 0.42.0 |
| created_at | 2015-08-13 12:42:20.290401+00 |
| updated_at | 2025-05-14 13:34:10.580072+00 |
| description | The package provides a builder and parser of fonts. |
| homepage | https://github.com/bodoni/font |
| repository | https://github.com/bodoni/font |
| max_upload_size | |
| id | 2829 |
| size | 223,331 |
The package provides a builder and parser for fonts.
use font::glyph::Segment;
use font::File;
macro_rules! ok(($result:expr) => ($result.unwrap()));
let path = "SourceSerifPro-Regular.otf";
let File { mut fonts } = ok!(File::open(path));
let glyph = ok!(ok!(fonts[0].glyph('a')));
for contour in glyph.iter() {
for segment in contour.iter() {
match segment {
&Segment::Linear(..) => { /* … */ },
&Segment::Quadratic(..) => { /* … */ },
&Segment::Cubic(..) => { /* … */ },
}
}
}
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.