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

[PATCH] Rendering dashed lines with zero length components

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.5
    • None
    • renderer/pdf
    • None

    Description

      The current PDF renderer may produce following dashed line segments:

      [0 0] 0 d

      This combination puzzles Adobe Reader which stops rendering the remaining content.

      I suggest avoiding this combination by a simple check in setDashLine() method in PDFGraphicsPainter.java:

              public PDFContentGeneratorHelper setDashLine(float first, float... rest) {
                  StringBuilder sb = new StringBuilder(format(first));
                  for (float unit : rest) {
                      sb.append(" ").append(format(unit));
                  }
                  if (sb.toString().equals("0 0")) {
                      sb = new StringBuilder();
                  }
                  sb.insert(0, "[");
                  sb.append("] 0 d ");
                  
                  generator.add(sb.toString());
                  return this;
              }
      

      The code above produces the following code instead, which is Ok.

      [] 0 d

      Attachments

        1. FOP-2502.patch
          0.9 kB
          Jan Tošovský

        Activity

          People

            Unassigned Unassigned
            jan.tosovsky.cz Jan Tošovský
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: