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

Stroke miter limit is not clamped when writing PDFs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.5
    • 2.2
    • renderer/pdf

    Description

      org.apache.fop.svg.PDFGraphics2D line 1240 (as of SVN revision 148001 [1]) is:
      float ml = bs.getMiterLimit();
      but should be (or equivalent):
      float ml = Math.max(1.0f, bs.getMiterLimit());

      Acrobat Reader (on all platforms) refuses to load graphics data after encountering miter limit < 1.0 and reports an error.

      I can't find a reference to the valid range in the PDF spec but Inkscape also had a problem with values less than 1.0 [2] and SVG spec mandates values >= 1.0 as well [3] so clamping the value to 1.0 or more seems like the right thing to do.

      [1] http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java?revision=1480018&view=markup
      [2] http://webcache.googleusercontent.com/search?q=cache:RHSt5Wk7-uQJ:inkscape-forum.andreas-s.net/topic/71990+&cd=7&hl=en&ct=clnk&gl=uk&client=firefox-beta
      [3] http://www.w3.org/TR/SVG11/painting.html#StrokeMiterlimitProperty

      Attachments

        1. FOP_Test.pdf
          0.7 kB
          Max Gilead
        2. PDF-Rendering.png
          104 kB
          Kevin Pearcey
        3. expected result.png
          45 kB
          Max Gilead
        4. Acrobat Reader.png
          39 kB
          Max Gilead

        Activity

          People

            Unassigned Unassigned
            maxgilead Max Gilead
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: