Skip to content
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

Embedding TTF fonts doesn't seem to work in Adobe Reader #94

Closed
Xac opened this issue Mar 4, 2010 · 8 comments
Closed

Embedding TTF fonts doesn't seem to work in Adobe Reader #94

Xac opened this issue Mar 4, 2010 · 8 comments

Comments

@Xac
Copy link

Xac commented Mar 4, 2010

When embedding the standard Arial.tff font, it's not correctly rendering in Adobe Reader 8/9. I have tried the same document in Preview in OS X and it works fine.

I get this error when the document is opened in Adobe Reader:
Cannot extract the embedded font 'AAAAAC+ArialMT'. Some characters may not display or print correctly.

The code I'm using to embed the font is standard:
font("/path/to/Arial.ttf") do
text "TEST"
end

@practicingruby
Copy link
Member

There may have been a regression, can you build from the stable branch and see if it fixes the problem?

-greg

@Xac
Copy link
Author

Xac commented Mar 4, 2010

You are correct. This feature works as expected in 0.8.4. Thanks.

@Xac
Copy link
Author

Xac commented Mar 4, 2010

Actually, it works in Adobe Reader when generated on my local machine after updating, but when I move it to our production server (Windows) and generate it, even on Prawn 0.8.4 I get the same thing.

@practicingruby
Copy link
Member

Check to make sure your versions match on your production machine. Then try the latest stable branch code here on github, then try a different font. If you still end up with a failure, provide us with a font we can download and test with.

@Xac
Copy link
Author

Xac commented Mar 4, 2010

I can be sure that the versions do match. The gems are vendored in a Rails project and there is no local installed copy. I'll give the stable a shot tomorrow along with a different font.

@juanpedrojose
Copy link

juanpedrojose commented Feb 14, 2018

I got the exact same issue.

Preconditions:

OS: OSX 10.3.2
ruby: 2.5.0
prawn: 2.2.2

Code:

    def pdf_document
      doc = Prawn::Document.new(page_size: 'A4')
      font_prefix = Rails.root.join('lib/pdf_exporter/fonts')

      doc.font_families.update("Avenir Next W1G" => {
        :normal => "#{font_prefix}/AvenirNextW1G-Regular.ttf",
        :italic => "#{font_prefix}/AvenirNextW1G-Italic.ttf",
        :bold => "#{font_prefix}/AvenirNextW1G-Bold.ttf",
      })
      doc.font "Avenir Next W1G"
      doc
    end

While generating file in Mac (dev or production environments), the file is opened both in mac's Preview app and Adobe Reader without any issues.
While generated on production server (dockerized ubuntu/alpine linux) the file is opening with no issues in mac's Preview app but with default fonts and corrupted when opened using Adobe Reader:

Cannot extract the embedded font 'fd3e38+AvenirNextW1G-Bold'. Some characters may not display or print correctly.

I have tried using github gem instead of Rubygems, have tried to rename and move files across the project directory, converting to other formats - nothing helps.

@pointlessone
Copy link
Member

Random thing to check: is the font file available on production server?

Could you please attach a sample pdf so someone could examine it?

@pointlessone
Copy link
Member

It's hard to tell what the original issue was. Since it was reported quite a few similar issue has been fixed both in Prawn and TTFunk. I'm closing this issue assuming the original issue might've been fixed. If you're having an issue please open an new issue with more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants