You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by jg...@apache.org on 2026/05/28 20:23:53 UTC

(xmlgraphics-fop) branch main updated: FOP-3306 Fix issue preventing dotted leader from being rendered on PDFs

This is an automated email from the ASF dual-hosted git repository.

joao12021996 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-fop.git


The following commit(s) were added to refs/heads/main by this push:
     new 6361eaf65 FOP-3306 Fix issue preventing dotted leader from being rendered on PDFs
6361eaf65 is described below

commit 6361eaf6559a29da124bdd28e2023ff29e531afe
Author: Joao Goncalves <an...@gmail.com>
AuthorDate: Thu May 28 12:10:58 2026 -0500

    FOP-3306 Fix issue preventing dotted leader from being rendered on PDFs
---
 .../java/org/apache/fop/render/pdf/PDFGraphicsPainter.java     | 10 +---------
 .../org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java  |  9 +++++++++
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java
index 17d9108f0..20ee0bc80 100644
--- a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java
+++ b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java
@@ -203,22 +203,14 @@ public class PDFGraphicsPainter implements GraphicsPainter, BezierCurvePainter {
         saveGraphicsState();
         int half = width / 2;
         int starty = start.y - half;
-        Rectangle boundingRect = new Rectangle(start.x, start.y - half, end.x - start.x, width);
         switch (style.getEnumValue()) {
         case Constants.EN_SOLID:
         case Constants.EN_DASHED:
         case Constants.EN_DOUBLE:
+        case Constants.EN_DOTTED:
             drawBorderLine(start.x, start.y - half, end.x, end.y + half,
                     true, true, style.getEnumValue(), color);
             break;
-        case Constants.EN_DOTTED:
-            generator.clipRect(boundingRect)
-            //This displaces the dots to the right by half a dot's width
-            //TODO There's room for improvement here
-                    .transformCoordinatesLine(1, 0, 0 , 1, half, 0);
-            drawBorderLine(start.x, start.y - half, end.x, end.y + half, true, true, style.getEnumValue(),
-                    color);
-            break;
         case Constants.EN_GROOVE:
         case Constants.EN_RIDGE:
             generator.setFillColor(ColorUtil.lightenColor(color, 0.6f))
diff --git a/fop-core/src/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java b/fop-core/src/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java
index 9587baefe..f57daa0c4 100644
--- a/fop-core/src/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java
@@ -19,6 +19,8 @@
 
 package org.apache.fop.render.pdf;
 
+import java.awt.Color;
+import java.awt.Point;
 import java.io.IOException;
 
 import org.junit.Before;
@@ -31,6 +33,7 @@ import static org.mockito.Mockito.verify;
 
 import org.apache.fop.fo.Constants;
 import org.apache.fop.pdf.PDFNumber;
+import org.apache.fop.traits.RuleStyle;
 
 public class PDFGraphicsPainterTestCase {
 
@@ -135,6 +138,12 @@ public class PDFGraphicsPainterTestCase {
         verify(generator, never()).add(any(String.class));
     }
 
+    @Test
+    public void testDottedLeader() {
+        sut.drawLine(new Point(0, 0), new Point(10, 0), 10, new Color(0), RuleStyle.DOTTED);
+        verify(generator, never()).clipRect(any());
+    }
+
     private void testTransformCoordinatesF(float... args) {
         verify(generator).add(opf("cm", args));
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org