Crate fonttools[−][src]
Expand description
A library for parsing, manipulating and writing OpenType fonts
This is a prerelease version; it is not feature complete. Notably, variable fonts are supported, but GPOS/GSUB (OpenType Layout) is not.
Example usage
use fonttools::font::{self, Font, Table}; use fonttools::name::{name, NameRecord, NameRecordID}; // Load a font (tables are lazy-loaded) let fontfile = File::open("Test.otf").unwrap(); use std::fs::File; let mut myfont = font::load(fontfile).expect("Could not load font"); // Access an existing table if let Table::Name(name_table) = myfont.get_table(b"name") .expect("Error reading name table") .expect("There was no name table") { // Manipulate the table (table-specific) name_table.records.push(NameRecord::windows_unicode( NameRecordID::LicenseURL, "http://opensource.org/licenses/OFL-1.1" )); } let mut outfile = File::create("Test-with-OFL.otf").expect("Could not create file"); myfont.save(&mut outfile);
For information about creating and manipulating structures for each specific OpenType table, see the modules below. See the font module as the entry point to creating, parsing and saving an OpenType font.
Modules
avar | The |
cmap | The |
font | The main font object. Start here. |
fvar | The |
gasp | The |
glyf | The |
gvar | The |
head | The |
hhea | The |
hmtx | The |
layout | OpenType Layout common tables |
maxp | The |
name | The |
os2 | The |
otvar | OpenType Variations common tables |
post | The |
utils | Useful utilities |