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

Using ContentStream#write makes GhostScript complain #20

Open
JasonBarnabe opened this issue Jun 9, 2017 · 3 comments
Open

Using ContentStream#write makes GhostScript complain #20

JasonBarnabe opened this issue Jun 9, 2017 · 3 comments

Comments

@JasonBarnabe
Copy link

In an otherwise valid document, If I do

      contents.write('my text', {
          x: 30,
          y: 30,
          size: 8,
          leading: 8 * 1.2
      })

when I process the resulting file with GhostScript, it says

   **** Warning: Tf refers to an unknown resource name: F1 Assuming it's a font name.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> GPL Ghostscript 9.16 <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.
@JasonBarnabe
Copy link
Author

Solution seems to be to first

page.add_font(Origami::Font::Type1::Standard::Helvetica.new.pre_build, :Helvetica)

and then

      contents.write('my text', {
          x: 30,
          y: 30,
          size: 8,
          leading: 8 * 1.2,
          font: :Helvetica,
      })

@gdelugre
Copy link
Owner

I'm still unsure what should be the correct behavior if no font is passed as an argument.

I could simply reuse the current font used in the graphics stack of the page.

@JasonBarnabe
Copy link
Author

Any of these seem sensible to me:

  • Make font a required argument
  • Use a (working!) default font
  • Use a font used elsewhere in the PDF (is there always at least one font?)

No matter what you choose, please document it and update the examples.

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

No branches or pull requests

2 participants