pub fn parse(src: &str) -> Result<FontMetrics<'_>, ParseError>Expand description
Parse an AFM file into a borrowed FontMetrics.
The returned struct borrows from src. Use
FontMetrics::into_owned to detach.
§Errors
Returns ParseError if the header is missing, the version is
outside the 4.x range, a required field never appears, or any
record is structurally malformed.
§Examples
use adobe_font_metrics::parse;
let src = "StartFontMetrics 4.1\nFontName Demo\nFontBBox 0 0 1000 1000\nEndFontMetrics\n";
let metrics = parse(src)?;
assert_eq!(metrics.font_name, "Demo");