Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ttf2eot

Convert TrueType and OpenType (SFNT) fonts into the legacy Internet Explorer EOT format.

The crate reads the OS/2, head, and name tables, builds an 82-byte EOT header, appends the four name strings as UTF-16LE, then appends the input font verbatim.

Installation

[dependencies]
ttf2eot = "0.1"

Usage

let ttf = std::fs::read("font.ttf").unwrap();
let eot = ttf2eot::ttf2eot(&ttf).expect("valid SFNT font");
std::fs::write("font.eot", eot).unwrap();

ttf2eot returns an error when the OS/2, head, or name table is missing, or when the input is too short to read a structure it needs.

Notes

EOT output is little-endian and SFNT input is big-endian. The function swaps each name code unit from big-endian to little-endian and copies the font payload byte for byte. Internet Explorer requires the full name to begin with the family name. This crate does not enforce that constraint.

License

Licensed under the MIT license.

About

convert TTF fonts to legacy-IE EOT format

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages