aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Bowditch <cbowditch@apache.org>2013-03-05 10:57:28 +0000
committerChris Bowditch <cbowditch@apache.org>2013-03-05 10:57:28 +0000
commit04e4c552f3581754352e43cd901b46aebe0af984 (patch)
tree4999f5ce904083bc7cdd3c550cd0d43fb8375da2 /src
parent345150938ab9ef36b9ad7ac6d6dea00494995f43 (diff)
downloadxmlgraphics-fop-04e4c552f3581754352e43cd901b46aebe0af984.tar.gz
xmlgraphics-fop-04e4c552f3581754352e43cd901b46aebe0af984.zip
FOP-2215; Thin dashed border look like dots
Submitted by Simon Steiner (ssteiner.at.thunderhead.com) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1452734 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/afp/AFPBorderPainter.java8
-rw-r--r--src/java/org/apache/fop/render/intermediate/BorderPainter.java3
2 files changed, 7 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/afp/AFPBorderPainter.java b/src/java/org/apache/fop/afp/AFPBorderPainter.java
index 06f1ecd11..0e293bf45 100644
--- a/src/java/org/apache/fop/afp/AFPBorderPainter.java
+++ b/src/java/org/apache/fop/afp/AFPBorderPainter.java
@@ -128,23 +128,23 @@ public class AFPBorderPainter extends AbstractAFPPainter {
break;
case Constants.EN_DASHED:
if (borderPaintInfo.isHorizontal()) {
- int dashWidth = (int) (BorderPainter.dashWidthCalculator(x2 - x1, thickness));
+ int dashWidth = (int) unitConv.pt2units(BorderPainter.dashWidthCalculator(w, h));
lineDataInfo.setX2 ( lineDataInfo.getX1() + dashWidth );
lineDataInfo.setY2 ( lineDataInfo.getY1() );
int ex2 = Math.round(x2);
int spaceWidth = (int) (BorderPainter.DASHED_BORDER_SPACE_RATIO * dashWidth);
- while (lineDataInfo.getX2() < ex2) {
+ while (lineDataInfo.getX2() <= ex2) {
dataStream.createLine(lineDataInfo);
lineDataInfo.setX1 ( lineDataInfo.getX2() + spaceWidth );
lineDataInfo.setX2 ( lineDataInfo.getX1() + dashWidth );
}
} else {
- int dashWidth = (int) BorderPainter.dashWidthCalculator(y2 - y1, thickness);
+ int dashWidth = (int) unitConv.pt2units(BorderPainter.dashWidthCalculator(h, w));
lineDataInfo.setX2 ( lineDataInfo.getX1() );
lineDataInfo.setY2 ( lineDataInfo.getY1() + dashWidth );
int ey2 = Math.round(y2);
int spaceWidth = (int) (BorderPainter.DASHED_BORDER_SPACE_RATIO * dashWidth);
- while (lineDataInfo.getY2() < ey2) {
+ while (lineDataInfo.getY2() <= ey2) {
dataStream.createLine(lineDataInfo);
lineDataInfo.setY1 ( lineDataInfo.getY2() + spaceWidth );
lineDataInfo.setY2 ( lineDataInfo.getY1() + dashWidth );
diff --git a/src/java/org/apache/fop/render/intermediate/BorderPainter.java b/src/java/org/apache/fop/render/intermediate/BorderPainter.java
index 3653dd1f3..0e6268884 100644
--- a/src/java/org/apache/fop/render/intermediate/BorderPainter.java
+++ b/src/java/org/apache/fop/render/intermediate/BorderPainter.java
@@ -289,6 +289,9 @@ public class BorderPainter {
*/
public static float dashWidthCalculator(float borderLength, float borderWidth) {
float dashWidth = DASHED_BORDER_LENGTH_FACTOR * borderWidth;
+ if (borderWidth < 3) {
+ dashWidth = (DASHED_BORDER_LENGTH_FACTOR * 3) * borderWidth;
+ }
int period = (int) ((borderLength - dashWidth) / dashWidth / (1.0f + DASHED_BORDER_SPACE_RATIO));
period = period < 0 ? 0 : period;
return borderLength / (period * (1.0f + DASHED_BORDER_SPACE_RATIO) + 1.0f);