Giter Club home page Giter Club logo

Comments (9)

galkahana avatar galkahana commented on July 20, 2024

Agreed.
can you think of why the code tries to write the font?
[how is it aware of it at all?]

Gal.

from pdf-writer.

softhorizons avatar softhorizons commented on July 20, 2024

The font writing is occurring during EndPDF().

Our app is a PostScript->PDF converter. The converter does PDFWriter::GetFontForFile() when the PS program does a 'findfont,' but has no control over what the PS job will do with the font later -- if anything. Could be that the PS job only wants the font to read some information from it, or get text metrics, or get glyph outlines as paths instead of rendering them as text, or the PS could be defining a bunch of fonts just in case it needs them later. In any event, the PS program is in the driver's seat and the converter must deal with that.

We considered only doing GetFontForFile() on demand when the first text write occurs with that font, but that wouldn't work in the read-only scenarios enumerated above.

JD

from pdf-writer.

galkahana avatar galkahana commented on July 20, 2024

Got it. Ill have the code corrected so that only if the fint is actually used in writing (meaning - got glyphs) than representation is written.
Gimme a few days.
Thanks

from pdf-writer.

galkahana avatar galkahana commented on July 20, 2024

OK.
Essentially font definitions should not be written unless specific commands related to fonts are used (EncodeStringForShowing, EncodeStringsForShowing) so you should be safe with measures 'n such.

However, seems like there's a bug in hummus where if the text writing commands are used with empty strings there will be a failure as you describe.

I committed a correction to this. it's the latest commit.

Let me know if this fixes your issue. Otherwise we'll dig further.

Gal.

from pdf-writer.

softhorizons avatar softhorizons commented on July 20, 2024

No more exceptions thrown, but the fix gives us a PDF as below, which makes Acrobat Reader so unhappy that it won’t render the page. Ghostscript correctly renders the page with a warning that it had to repair errors. I'll bet the bad FN1 ref is the culprit.
<<
/Type /Page
/Parent 4 0 R
/MediaBox [ 0 0 432 144 ]
/Resources
<<
/ProcSet [ /PDF /Text ]
/Font
<<
/FN1 3435973836 0 R
>>
>>
/Contents 1 0 R

from pdf-writer.

galkahana avatar galkahana commented on July 20, 2024

yeah. looks like it.
I'm gonna need to know more about the usage. obviously something is being used in a way that i didn't expect and so far hasn't come up.

Do you think that you can construct a sample code that runs hummus that creates the problem?
Or send me that PDF that fails, that can help too. maybe i can figure this out through the content usage.

from pdf-writer.

galkahana avatar galkahana commented on July 20, 2024

Actually, i think that i simply need to remove the addition of font reference in case fonts are not being written.
think i got it, try the latest commit.

from pdf-writer.

softhorizons avatar softhorizons commented on July 20, 2024

Yup, you nailed it! THANK YOU.

from pdf-writer.

galkahana avatar galkahana commented on July 20, 2024

wonderful :)

from pdf-writer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.