You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Jan Tošovský (JIRA)" <ji...@apache.org> on 2015/07/18 20:40:04 UTC

[jira] [Created] (FOP-2502) Rendering dashed lines with zero length components

Jan Tošovský created FOP-2502:
---------------------------------

             Summary: Rendering dashed lines with zero length components
                 Key: FOP-2502
                 URL: https://issues.apache.org/jira/browse/FOP-2502
             Project: FOP
          Issue Type: Improvement
          Components: renderer/pdf
    Affects Versions: trunk
            Reporter: Jan Tošovský
            Priority: Minor


The current PDF renderer may produce following dashed line segments:
{code}[0 0] 0 d{code}

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:
{code}
        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;
        }
{code}
The code above produces the following code instead, which is Ok.
{code}[] 0 d{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)