You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ss...@apache.org on 2020/05/27 11:48:14 UTC
svn commit: r1878158 - in /xmlgraphics/fop/trunk/fop-core/src:
main/java/org/apache/fop/render/ps/ test/java/org/apache/fop/svg/
test/resources/org/apache/fop/svg/
Author: ssteiner
Date: Wed May 27 11:48:14 2020
New Revision: 1878158
URL: http://svn.apache.org/viewvc?rev=1878158&view=rev
Log:
FOP-2941: SVG container with stroke=black has an unexpected border
Added:
xmlgraphics/fop/trunk/fop-core/src/test/resources/org/apache/fop/svg/watermark.svg (with props)
Modified:
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/NativeTextPainterTest.java
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/PSTextPainterTestCase.java
Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java?rev=1878158&r1=1878157&r2=1878158&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java Wed May 27 11:48:14 2020
@@ -420,6 +420,9 @@ public class PSTextPainter extends Nativ
private void paintStrokedGlyphs(PSGraphics2D g2d, TextUtil textUtil,
Paint strokePaint, Stroke stroke) throws IOException {
+ if (currentGlyphs.toString().trim().isEmpty()) {
+ return;
+ }
applyColor(strokePaint);
PSGraphics2D.applyStroke(stroke, gen);
Modified: xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/NativeTextPainterTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/NativeTextPainterTest.java?rev=1878158&r1=1878157&r2=1878158&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/NativeTextPainterTest.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/NativeTextPainterTest.java Wed May 27 11:48:14 2020
@@ -40,13 +40,14 @@ import org.apache.fop.svg.font.FOPFontFa
abstract class NativeTextPainterTest {
- protected final void runTest(String testcase, OperatorValidator validator) throws Exception {
+ protected final Graphics2D runTest(String testcase, OperatorValidator validator) throws Exception {
FontInfo fontInfo = createFontInfo();
BridgeContext bridgeContext = createBridgeContext(fontInfo);
GraphicsNode svg = loadSVG(bridgeContext, testcase);
Graphics2D g2d = createGraphics2D(fontInfo, validator);
svg.paint(g2d);
validator.end();
+ return g2d;
}
private FontInfo createFontInfo() {
Modified: xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/PSTextPainterTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/PSTextPainterTestCase.java?rev=1878158&r1=1878157&r2=1878158&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/PSTextPainterTestCase.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/svg/PSTextPainterTestCase.java Wed May 27 11:48:14 2020
@@ -20,12 +20,13 @@
package org.apache.fop.svg;
import java.awt.Graphics2D;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
+import org.junit.Assert;
import org.junit.Test;
-import org.apache.commons.io.output.NullOutputStream;
-
import org.apache.batik.bridge.TextPainter;
import org.apache.xmlgraphics.java2d.GraphicContext;
@@ -40,13 +41,12 @@ public class PSTextPainterTestCase exten
private static class OperatorCheckingPSGraphics2D extends PSGraphics2D {
OperatorCheckingPSGraphics2D(FontInfo fontInfo, final OperatorValidator validator) {
- super(false, new PSGenerator(new NullOutputStream()) {
-
+ super(false, new PSGenerator(new ByteArrayOutputStream()) {
@Override
public void writeln(String cmd) throws IOException {
+ super.writeln(cmd);
validator.check(cmd);
}
-
});
}
}
@@ -74,4 +74,11 @@ public class PSTextPainterTestCase exten
.addOperatorMatch("xshow", "(C)\n[0] xshow"));
}
+ @Test
+ public void testWatermark() throws Exception {
+ PSGraphics2D g2d = (PSGraphics2D) runTest("watermark.svg",
+ new OperatorValidator().addOperatorMatch("GS", "GS"));
+ OutputStream os = g2d.getPSGenerator().getOutputStream();
+ Assert.assertFalse(os.toString().contains("( ) false charpath"));
+ }
}
Added: xmlgraphics/fop/trunk/fop-core/src/test/resources/org/apache/fop/svg/watermark.svg
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/resources/org/apache/fop/svg/watermark.svg?rev=1878158&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/test/resources/org/apache/fop/svg/watermark.svg (added)
+++ xmlgraphics/fop/trunk/fop-core/src/test/resources/org/apache/fop/svg/watermark.svg Wed May 27 11:48:14 2020
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG Version: 3.0.0 Build 43) -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="1170" height="1100" viewBox="0 0 1200.607 1722.573" enable-background="new 0 0 900.407 1522.273" xml:space="preserve">
+ <g id="Layer_1" stroke="#000000">
+ <text transform="matrix(0.5826 -0.8128 0.8128 0.5826 81.2793 600.3428)">
+ <tspan x="0" y="0" fill="#E6E6E6" stroke="none" font-family="'Arial'" font-size="200">Copy</tspan>
+ </text>
+ </g>
+</svg>
Propchange: xmlgraphics/fop/trunk/fop-core/src/test/resources/org/apache/fop/svg/watermark.svg
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org