I created a PDF with 2000 pages and 40MB ttf file, which took me over ten minutes. After trying to return Option<&DirectFontRef> instead, it changed to a few seconds. And i saw the comment: "(Warning): clones the direct font reference", maybe some optimizations can be done here
In the 0.8 version, this was changed to ONLY ever use FontId (which are a random 32-bit character string identifying the font), so this will be solved then.
I created a PDF with 2000 pages and 40MB ttf file, which took me over ten minutes. After trying to return Option<&DirectFontRef> instead, it changed to a few seconds. And i saw the comment: "(Warning): clones the direct font reference", maybe some optimizations can be done here
https://github.com/fschutt/printpdf/blob/cec012ad726344c31f715ab8c939ad0c11c7fcaf/src/font.rs#L630C59-L630C59