-
Notifications
You must be signed in to change notification settings - Fork 688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Return of the Embedded Font Issue #1346
Comments
Do you experience this issue if you disable font subsetting? |
I tried with |
Could you please provide a minimal reproduction script and fonts you have issues with? |
Also could you please list versions of the gems you use? gem list --all --exact prawn ttfunk pdf-core Or if you use bundler: bundle list | grep -E 'prawn|ttfunk|pdf-core' |
I tried a minimal example that just sets the font, but that did not reproduce the issue so it's definitely something deeper. Our PDF generation code is pretty complex, so it'll take me a while to create a minimal example, not sure when I'll find the time 😕. Before downgrading (with issue):
After downgrading (no issue):
|
Thanks to the magic of Ruby, I've managed to log every call made to the |
Here we go, a minimal reproduction: #!/usr/bin/env ruby
require "prawn"
pdf = Prawn::Document.new
pdf.font_families.update(
"roboto" => {
normal: "Roboto/Roboto-Regular.ttf",
italic: "Roboto/Roboto-Italic.ttf",
bold: "Roboto/Roboto-Bold.ttf",
bold_italic: "Roboto/Roboto-BoldItalic.ttf",
}
)
pdf.font("roboto")
pdf.text_box("€")
File.open("test.pdf", "w") do |file|
pdf.render(file)
end
system "flatpak run com.adobe.Reader test.pdf" I used Roboto here as an easy to acquire example, but it worked with another font I used. Seems to be an issue with the € symbol. Even more curiously, this minimal example is also a problem with 2.4.0, though our full code is fine. So not sure what's going on there. |
OK, it's a bug in The minimal example works with these versions: gem "prawn", "2.4.0" But breaks with these: gem "prawn", "2.4.0" i.e. the issue appears to be in
|
Thanks. |
Thanks for the deep dive @TastyPi, you helped us! |
Filed prawnpdf/ttfunk#102, I wasn't sure if @pointlessone was going to do it as they appear to be the main ttfunk developer. |
It's not immediately obvious where the issue is. PDF has rather complex relationships with fonts. Fonts are partially represented/duplicated in native PDF structures, some essential parts (according to fonts specs) of fonts are ignored in PDF, renderers don't exactly follow specs (both PDF and fonts). So the issue might not be in TTFunk even if it's related to fonts. Let's keep it as is, I'll figure it out when I'll have time to work on this. |
Encountered the same error recently Faced issue on the versions:
Resolution:
I can confirm that downgrading to previous versions of prawn and ttfunk resolved the issue. not sure though if the issue is from ttfunk or prawn upgrade |
I had the same error and I have "solved" it disabling the subsetting when registering the font family. |
I can confirm that this Gem combination fixed the issue in my Rails 7 application:
The special characters that were previously missing in Acrobat Reader are now visible again. |
Although the problem is with ttfunk, the issue is still present in Prawn so I would consider this issue open. @coorasse mentioned:
However I don't think anything has changed in the Prawn codebase (see https://github.com/prawnpdf/prawn/blame/master/prawn.gemspec#L52). So this is still a problem on the current Prawn release and master branch. |
this worked for us |
Prawn 2.5.0 appears to have reintroduced this old "Cannot extract the embedded font" issue prawnpdf/ttfunk#73
Using the exact same code to render a PDF using 2.4.0 does not have this issue.
The text was updated successfully, but these errors were encountered: