Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-1349

[PATCH] ZWSP works as backspace when font is embedded


    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: trunk
    • Fix Version/s: None
    • Component/s: renderer/pdf
    • Labels:
    • Environment:
      Operating System: All
      Platform: All
    • External issue ID:


      When fonts are embedded in the PDF, zero-width spaces have a backspace effect:
      the text following the ZWSP is left-shifted by about one character's width, so
      it partly overprints the preceding text. At the end of a text area containing
      ZWSPs there's extra whitespace, up to the point where the text would have ended
      had it been rendered correctly.

      Observed with Times, Verdana and MSMincho, but not with Courier, and only if the
      font is embedded in the PDF file. It makes no difference whether the metrics
      file has an entry for ZWSP (8203d) or not.

      Attached are a FO and a PDF file demonstrating the effect. I also attach a patch
      that intercepts non-stretchable ZWSPs before they are written to the PDF stream.
      This doesn't address the cause of the problem so it's probably not the best
      solution, but at least it cures the disease. And there's no point in writing
      zero-dimension areas to the PDF anyway.


        1. zwsp-layout.patch
          5 kB
          Paul Vinkenoog
        2. zwsp.patch
          1 kB
          Paul Vinkenoog
        3. test-zwsp.pdf
          29 kB
          Paul Vinkenoog
        4. test-zwsp.fo
          1 kB
          Paul Vinkenoog
        5. PDFRenderer.java
          63 kB
          Paul Vinkenoog



            • Assignee:
              fop-dev@xmlgraphics.apache.org fop-dev
              paul@vinkenoog.nl Paul Vinkenoog
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: