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.
[dependencies]
ttf2eot = "0.1"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.
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.
Licensed under the MIT license.