Created attachment 134819 [details]
Input file with embedded fonts
Steps to reproduce:
1. Save the attached file (EmbeddedFont.pdf)
2. Run: pdftocairo -pdf EmbeddedFont.pdf out.pdf
- Output has same appearance as input (a serif font).
- Output falls back to a system font (sans serif) because fonts are no longer embedded.
- The other output formats (PNG, JPEG, SVG) appear to produce the correct/desired appearance. Only the PDF output is affected.
Created attachment 134820 [details]
Before and After Comparison
Screenshot comparing the input and output files using Evince
The font family name in the embedded font contained > 3000 chars of garbage. As a result the font name was truncated and missing the closing delimiter.
Prevent long strings from being truncated in PDF file:
Sanity check the font name length and ignore it if too long:
Interesting finding! Thank you for the explanation and fast fix.
I'm assuming if I now build libcairo from master and then re-run pdftocairo, I should see a different result?
Yes, it works for me now. The missing delimiter caused viewers to fail to parse the font and as a result substitute it with something else.