diff options
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/org/apache/fop/afp/AFPBorderPainter.java | 8 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/intermediate/BorderPainter.java | 3 |
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); |