Menu

#81 Handle word-spacing as per PDF specs

Unstable_(example)
open
1
2015-12-31
2015-12-15
No

Hi,

I finally managed to implement word-spacing in the latest TCPDF code (the patch is against 6.2.11)
Here is the corresponding patch.
When it's used along letter-spading, word-spacing overrides the letter-spacing for the space character.

Thanks,
Mathieu

1 Attachments

Discussion

  • Mathieu Masseboeuf

    Just noticed the patch was against our patched version (register_shutdown_function is commented and handled outside of the constructor in our code, as it is a memory hogg if done that way - there is a ticket opened for that).
    Anyway, the principles are here.

     
  • Mathieu Masseboeuf

    The patch was only working for justified text, and was messing non-justified one in a bad way (which is easy to fix but won't let non-justified text handle word-spacing).

    Took me a while to figure out what was going on - justification is done in writeHTML (and my adjustment here were OK), while the rest is done in getCellCode (which don't know about justification when coming from writeHTML - as it's handled there).
    I can share that if needed, but it's too dirty as of now (it involves a flag telling writeHTML that the spacing has already been handeled beforehand).

     
  • Mathieu Masseboeuf

    Something else I forgot to mention - a little addition to the patch above : GetCharWidth shall also handle char 160 (non-breaking space) for word-spacing, as that one is transformed as char 32 (regular space) after the calls to this function.
    I started looking at the other spaces - but the PDF specs are clear on that : only char 32 shall be modified by the word-spacing directive.

     

Log in to post a comment.

MongoDB Logo MongoDB