From ce37837aaea712ad41ba4caba73e9e8c181e3e97 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Sun, 21 Sep 2003 20:56:24 +0000 Subject: [PATCH] 1.) Moved AWT Viewer classes from org.fop.viewer to org.fop.render.awt.viewer 2.) Updated AWT and PDF renderers to draw region borders more accurately. 3.) Rounding errors for determining region sizes in AWT Renderer fixed. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196934 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 8 +- .../apache/fop/render/awt/AWTRenderer.java | 70 ++++++++---------- .../fop/{ => render/awt}/viewer/Command.java | 4 +- .../awt}/viewer/GoToPageDialog.java | 4 +- .../awt}/viewer/PreviewDialog.java | 4 +- .../awt}/viewer/PreviewDialogAboutBox.java | 4 +- .../{ => render/awt}/viewer/Translator.java | 6 +- .../{ => render/awt}/viewer/images/Print.gif | Bin .../awt}/viewer/images/firstpg.gif | Bin .../{ => render/awt}/viewer/images/fop.gif | Bin .../{ => render/awt}/viewer/images/lastpg.gif | Bin .../{ => render/awt}/viewer/images/nextpg.gif | Bin .../{ => render/awt}/viewer/images/prevpg.gif | Bin .../{ => render/awt}/viewer/images/reload.gif | Bin .../awt}/viewer/resources/Viewer.properties | 2 +- .../viewer/resources/Viewer_cs.properties | 0 .../viewer/resources/Viewer_de.properties | 0 .../viewer/resources/Viewer_fi.properties | 0 .../viewer/resources/Viewer_fr.properties | 0 .../viewer/resources/Viewer_it.properties | 0 .../viewer/resources/Viewer_ja.properties | 0 .../viewer/resources/Viewer_pl.properties | 0 .../viewer/resources/Viewer_ru.properties | 0 .../viewer/resources/Viewer_tr.properties | 0 .../apache/fop/render/pdf/PDFRenderer.java | 43 +++++------ 25 files changed, 66 insertions(+), 79 deletions(-) rename src/java/org/apache/fop/{ => render/awt}/viewer/Command.java (98%) rename src/java/org/apache/fop/{ => render/awt}/viewer/GoToPageDialog.java (98%) rename src/java/org/apache/fop/{ => render/awt}/viewer/PreviewDialog.java (99%) rename src/java/org/apache/fop/{ => render/awt}/viewer/PreviewDialogAboutBox.java (98%) rename src/java/org/apache/fop/{ => render/awt}/viewer/Translator.java (95%) rename src/java/org/apache/fop/{ => render/awt}/viewer/images/Print.gif (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/images/firstpg.gif (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/images/fop.gif (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/images/lastpg.gif (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/images/nextpg.gif (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/images/prevpg.gif (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/images/reload.gif (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer.properties (96%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer_cs.properties (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer_de.properties (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer_fi.properties (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer_fr.properties (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer_it.properties (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer_ja.properties (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer_pl.properties (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer_ru.properties (100%) rename src/java/org/apache/fop/{ => render/awt}/viewer/resources/Viewer_tr.properties (100%) diff --git a/build.xml b/build.xml index fa32e5f35..a2ff79622 100644 --- a/build.xml +++ b/build.xml @@ -174,8 +174,8 @@ list of possible build targets. - - + + @@ -187,8 +187,8 @@ list of possible build targets. - - + + diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java index 7c3ecd116..68b52695f 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java @@ -91,8 +91,8 @@ import org.apache.fop.image.FopImage; import org.apache.fop.image.ImageFactory; import org.apache.fop.render.AbstractRenderer; import org.apache.fop.traits.BorderProps; -import org.apache.fop.viewer.PreviewDialog; -import org.apache.fop.viewer.Translator; +import org.apache.fop.render.awt.viewer.PreviewDialog; +import org.apache.fop.render.awt.viewer.Translator; /** * This is FOP's AWT renderer. @@ -266,8 +266,8 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable Page page = (Page) pageList.get(pageNum); Rectangle2D bounds = pageViewport.getViewArea(); - int pageWidth = (int)((float) bounds.getWidth() / 1000f + .5); - int pageHeight = (int)((float) bounds.getHeight() / 1000f + .5); + int pageWidth = (int) Math.round(bounds.getWidth() / 1000f ); + int pageHeight = (int) Math.round(bounds.getHeight() / 1000f ); /* System.out.println("(Page) X, Y, Width, Height: " + bounds.getX() + " " + bounds.getY() @@ -315,18 +315,25 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable currentFontSize = 0; Rectangle2D viewArea = region.getViewArea(); - int startX = (int)(((float) viewArea.getX() / 1000f + .5) + int startX = (int) Math.round((viewArea.getX() / 1000f) * (scaleFactor / 100f)); - int startY = (int)(((float) viewArea.getY() / 1000f + .5) - * (scaleFactor / 100f)); - int width = (int)(((float) viewArea.getWidth() / 1000f + .5) - * (scaleFactor / 100f)); - int height = (int)(((float) viewArea.getHeight() / 1000f + .5) + int startY = (int) Math.round((viewArea.getY() / 1000f) * (scaleFactor / 100f)); + // for rounding to work correctly, need to take into account + // fractional portion of X and Y. + int width = (int) Math.round(((viewArea.getX() + viewArea.getWidth()) / 1000f) + * (scaleFactor / 100f)) - startX; + int height = (int) Math.round(((viewArea.getY() + viewArea.getHeight()) / 1000f) + * (scaleFactor / 100f)) - startY; if (region.getRegion() != null) { System.out.print("\nRegion type = " + region.getRegion().getRegionClass()); } +/* System.out.println("\nView X, Width, Y, Height: " + viewArea.getX() + + " " + viewArea.getWidth() + + " " + viewArea.getY() + + " " + viewArea.getHeight() + ); */ System.out.println(" X, Width, Y, Height: " + startX + " " + width + " " + startY @@ -382,46 +389,33 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable BorderProps bps = (BorderProps) block.getTrait(Trait.BORDER_BEFORE); if (bps != null) { - int borderWidth = (int) ((bps.width / 1000f) * (scaleFactor / 100f)); - System.out.println("Before (color/width) " + bps.color.getAWTColor().toString() + " " + bps.width); + int borderWidth = (int) Math.round((bps.width / 1000f) * (scaleFactor / 100f)); graphics.setColor(bps.color.getAWTColor()); - // drawLine(x1, y1, x2, y2); - System.out.println("Draw from (" + startx + "," + (starty + borderWidth/2) + - ") to (" + (startx+width) + "," + (starty + borderWidth/ 2) + ")"); - graphics.drawLine(startx, starty + borderWidth / 2, startx + width, - starty + borderWidth / 2); +// System.out.println("Border at (" + startx + "," + (starty + height - borderWidth) + +// ") width, height: (" + (width) + "," + (borderWidth) + ")"); + graphics.fillRect(startx, starty, width, borderWidth); } - bps = (BorderProps) block.getTrait(Trait.BORDER_START); + bps = (BorderProps) block.getTrait(Trait.BORDER_AFTER); if (bps != null) { - int borderWidth = (int) ((bps.width / 1000f) * (scaleFactor / 100f)); - System.out.println("Start (color/width) " + bps.color.getAWTColor().toString() + " " + bps.width); + int borderWidth = (int) Math.round((bps.width / 1000f) * (scaleFactor / 100f)); + int sy = starty + height; graphics.setColor(bps.color.getAWTColor()); - System.out.println("Draw from (" + (startx + borderWidth / 2) + "," + starty + - ") to (" + (startx + borderWidth / 2) + "," + (starty + height) + ")"); - graphics.drawLine(startx + borderWidth / 2, starty, startx + borderWidth / 2, - starty + height); + graphics.fillRect(startx, starty + height - borderWidth, + width, borderWidth); } - bps = (BorderProps) block.getTrait(Trait.BORDER_AFTER); + bps = (BorderProps) block.getTrait(Trait.BORDER_START); if (bps != null) { - int borderWidth = (int) ((bps.width / 1000f) * (scaleFactor / 100f)); - System.out.println("After (color/width) " + bps.color.getAWTColor().toString() + " " + bps.width); - int sy = starty + height; + int borderWidth = (int) Math.round((bps.width / 1000f) * (scaleFactor / 100f)); graphics.setColor(bps.color.getAWTColor()); - System.out.println("Draw from (" + startx + "," + (sy - borderWidth / 2) + - ") to (" + (startx+width) + "," + (sy - borderWidth / 2) + ")"); - graphics.drawLine(startx, sy - borderWidth / 2, startx + width, - sy - borderWidth / 2); + graphics.fillRect(startx, starty, borderWidth, height); } bps = (BorderProps) block.getTrait(Trait.BORDER_END); if (bps != null) { - int borderWidth = (int) ((bps.width / 1000f) * (scaleFactor / 100f)); - System.out.println("End (color/width) " + bps.color.getAWTColor().toString() + " " + bps.width); + int borderWidth = (int) Math.round((bps.width / 1000f) * (scaleFactor / 100f)); int sx = startx + width; graphics.setColor(bps.color.getAWTColor()); - System.out.println("Draw from (" + (sx - borderWidth / 2) + "," + starty + - ") to (" + (sx - borderWidth / 2) + "," + (starty + height) + ")"); - graphics.drawLine(sx - borderWidth / 2, starty, sx - borderWidth / 2, - starty + height); + graphics.fillRect(startx + width - borderWidth, starty, + borderWidth, height); } } } diff --git a/src/java/org/apache/fop/viewer/Command.java b/src/java/org/apache/fop/render/awt/viewer/Command.java similarity index 98% rename from src/java/org/apache/fop/viewer/Command.java rename to src/java/org/apache/fop/render/awt/viewer/Command.java index 616a7cfbc..efebd77c4 100644 --- a/src/java/org/apache/fop/viewer/Command.java +++ b/src/java/org/apache/fop/render/awt/viewer/Command.java @@ -1,5 +1,5 @@ /* - * $Id: Command.java,v 1.9 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber . For more information on the Apache * Software Foundation, please see . */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; //Java import java.awt.event.ActionEvent; diff --git a/src/java/org/apache/fop/viewer/GoToPageDialog.java b/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java similarity index 98% rename from src/java/org/apache/fop/viewer/GoToPageDialog.java rename to src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java index 2156393d4..69280d289 100644 --- a/src/java/org/apache/fop/viewer/GoToPageDialog.java +++ b/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java @@ -1,5 +1,5 @@ /* - * $Id: GoToPageDialog.java,v 1.6 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber . For more information on the Apache * Software Foundation, please see . */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; import java.awt.Dimension; import java.awt.Frame; diff --git a/src/java/org/apache/fop/viewer/PreviewDialog.java b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java similarity index 99% rename from src/java/org/apache/fop/viewer/PreviewDialog.java rename to src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java index 80387d7d4..b0986237b 100644 --- a/src/java/org/apache/fop/viewer/PreviewDialog.java +++ b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java @@ -1,5 +1,5 @@ /* - * $Id: PreviewDialog.java,v 1.14 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber . For more information on the Apache * Software Foundation, please see . */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; //Java import javax.swing.BorderFactory; diff --git a/src/java/org/apache/fop/viewer/PreviewDialogAboutBox.java b/src/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java similarity index 98% rename from src/java/org/apache/fop/viewer/PreviewDialogAboutBox.java rename to src/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java index c8423e188..4eb75ca1a 100644 --- a/src/java/org/apache/fop/viewer/PreviewDialogAboutBox.java +++ b/src/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java @@ -1,5 +1,5 @@ /* - * $Id: PreviewDialogAboutBox.java,v 1.5 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber . For more information on the Apache * Software Foundation, please see . */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; //Java import java.awt.AWTEvent; diff --git a/src/java/org/apache/fop/viewer/Translator.java b/src/java/org/apache/fop/render/awt/viewer/Translator.java similarity index 95% rename from src/java/org/apache/fop/viewer/Translator.java rename to src/java/org/apache/fop/render/awt/viewer/Translator.java index 2381dc1eb..251074c42 100644 --- a/src/java/org/apache/fop/viewer/Translator.java +++ b/src/java/org/apache/fop/render/awt/viewer/Translator.java @@ -1,5 +1,5 @@ /* - * $Id: Translator.java,v 1.6 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber . For more information on the Apache * Software Foundation, please see . */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; //Java import java.util.ResourceBundle; @@ -62,7 +62,7 @@ import java.util.Locale; public class Translator { private ResourceBundle bundle; - private static String bundleBaseName = "org/apache/fop/viewer/resources/Viewer"; + private static String bundleBaseName = "org/apache/fop/render/awt/viewer/resources/Viewer"; /** * Default constructor, default Locale is used. diff --git a/src/java/org/apache/fop/viewer/images/Print.gif b/src/java/org/apache/fop/render/awt/viewer/images/Print.gif similarity index 100% rename from src/java/org/apache/fop/viewer/images/Print.gif rename to src/java/org/apache/fop/render/awt/viewer/images/Print.gif diff --git a/src/java/org/apache/fop/viewer/images/firstpg.gif b/src/java/org/apache/fop/render/awt/viewer/images/firstpg.gif similarity index 100% rename from src/java/org/apache/fop/viewer/images/firstpg.gif rename to src/java/org/apache/fop/render/awt/viewer/images/firstpg.gif diff --git a/src/java/org/apache/fop/viewer/images/fop.gif b/src/java/org/apache/fop/render/awt/viewer/images/fop.gif similarity index 100% rename from src/java/org/apache/fop/viewer/images/fop.gif rename to src/java/org/apache/fop/render/awt/viewer/images/fop.gif diff --git a/src/java/org/apache/fop/viewer/images/lastpg.gif b/src/java/org/apache/fop/render/awt/viewer/images/lastpg.gif similarity index 100% rename from src/java/org/apache/fop/viewer/images/lastpg.gif rename to src/java/org/apache/fop/render/awt/viewer/images/lastpg.gif diff --git a/src/java/org/apache/fop/viewer/images/nextpg.gif b/src/java/org/apache/fop/render/awt/viewer/images/nextpg.gif similarity index 100% rename from src/java/org/apache/fop/viewer/images/nextpg.gif rename to src/java/org/apache/fop/render/awt/viewer/images/nextpg.gif diff --git a/src/java/org/apache/fop/viewer/images/prevpg.gif b/src/java/org/apache/fop/render/awt/viewer/images/prevpg.gif similarity index 100% rename from src/java/org/apache/fop/viewer/images/prevpg.gif rename to src/java/org/apache/fop/render/awt/viewer/images/prevpg.gif diff --git a/src/java/org/apache/fop/viewer/images/reload.gif b/src/java/org/apache/fop/render/awt/viewer/images/reload.gif similarity index 100% rename from src/java/org/apache/fop/viewer/images/reload.gif rename to src/java/org/apache/fop/render/awt/viewer/images/reload.gif diff --git a/src/java/org/apache/fop/viewer/resources/Viewer.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties similarity index 96% rename from src/java/org/apache/fop/viewer/resources/Viewer.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties index 34be39465..422dc5c58 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties @@ -28,7 +28,7 @@ Title.Preview=Preview Status.Show=Show Status.Page=Page Status.of=of -Status.Build.FO.tree=Build FO tree... +Status.Build.FO.tree=Generating document... Exception.Occured=An exception has occured Exception.Error=Fatal error diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_cs.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_cs.properties similarity index 100% rename from src/java/org/apache/fop/viewer/resources/Viewer_cs.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer_cs.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_de.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_de.properties similarity index 100% rename from src/java/org/apache/fop/viewer/resources/Viewer_de.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer_de.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_fi.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fi.properties similarity index 100% rename from src/java/org/apache/fop/viewer/resources/Viewer_fi.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fi.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_fr.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fr.properties similarity index 100% rename from src/java/org/apache/fop/viewer/resources/Viewer_fr.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fr.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_it.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_it.properties similarity index 100% rename from src/java/org/apache/fop/viewer/resources/Viewer_it.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer_it.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_ja.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ja.properties similarity index 100% rename from src/java/org/apache/fop/viewer/resources/Viewer_ja.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ja.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_pl.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_pl.properties similarity index 100% rename from src/java/org/apache/fop/viewer/resources/Viewer_pl.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer_pl.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_ru.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ru.properties similarity index 100% rename from src/java/org/apache/fop/viewer/resources/Viewer_ru.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ru.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_tr.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_tr.properties similarity index 100% rename from src/java/org/apache/fop/viewer/resources/Viewer_tr.properties rename to src/java/org/apache/fop/render/awt/viewer/resources/Viewer_tr.properties diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index bb3654028..ccbe28ba0 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -590,15 +590,13 @@ public class PDFRenderer extends PrintRenderer { } float bwidth = bps.width / 1000f; - updateColor(bps.color, false, null); - currentStream.add(bwidth + " w\n"); - - drawLine(startx, starty + bwidth / 2, endx, starty + bwidth / 2); + updateColor(bps.color, true, null); + currentStream.add(startx + " " + starty + " " + + width + " " + bwidth + " re\n"); + currentStream.add("f\n"); } - bps = (BorderProps)block.getTrait(Trait.BORDER_START); + bps = (BorderProps)block.getTrait(Trait.BORDER_AFTER); if (bps != null) { - float endy = starty + height; - if (!started) { started = true; closeText(); @@ -607,16 +605,13 @@ public class PDFRenderer extends PrintRenderer { } float bwidth = bps.width / 1000f; - updateColor(bps.color, false, null); - currentStream.add(bwidth + " w\n"); - - drawLine(startx + bwidth / 2, starty, startx + bwidth / 2, endy); + updateColor(bps.color, true, null); + currentStream.add(startx + " " + (starty + height - bwidth) + " " + + width + " " + bwidth + " re\n"); + currentStream.add("f\n"); } - bps = (BorderProps)block.getTrait(Trait.BORDER_AFTER); + bps = (BorderProps)block.getTrait(Trait.BORDER_START); if (bps != null) { - float sy = starty + height; - float endx = startx + width; - if (!started) { started = true; closeText(); @@ -625,16 +620,13 @@ public class PDFRenderer extends PrintRenderer { } float bwidth = bps.width / 1000f; - updateColor(bps.color, false, null); - currentStream.add(bwidth + " w\n"); - - drawLine(startx, sy - bwidth / 2, endx, sy - bwidth / 2); + updateColor(bps.color, true, null); + currentStream.add(startx + " " + starty + " " + + bwidth + " " + height + " re\n"); + currentStream.add("f\n"); } bps = (BorderProps)block.getTrait(Trait.BORDER_END); if (bps != null) { - float sx = startx + width; - float endy = starty + height; - if (!started) { started = true; closeText(); @@ -643,9 +635,10 @@ public class PDFRenderer extends PrintRenderer { } float bwidth = bps.width / 1000f; - updateColor(bps.color, false, null); - currentStream.add(bwidth + " w\n"); - drawLine(sx - bwidth / 2, starty, sx - bwidth / 2, endy); + updateColor(bps.color, true, null); + currentStream.add((startx + width - bwidth) + " " + starty + " " + + bwidth + " " + height + " re\n"); + currentStream.add("f\n"); } if (started) { //restoreGraphicsState(); -- 2.39.5