From 83349530c26741cf8ef0e8cd511bc1fa519fa6d1 Mon Sep 17 00:00:00 2001 From: Chris Bowditch Date: Tue, 29 Dec 2009 11:00:41 +0000 Subject: [PATCH] Bugfix: 48453 AFP Renderer: Page Segments not positioned correctly when reference-orientation != 0 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@894350 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/afp/DataStream.java | 18 +++++++++++------- .../org/apache/fop/render/afp/AFPPainter.java | 5 ++++- .../org/apache/fop/render/afp/AFPRenderer.java | 6 ++++-- status.xml | 3 +++ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/java/org/apache/fop/afp/DataStream.java b/src/java/org/apache/fop/afp/DataStream.java index b8da317ef..c39e0f77e 100644 --- a/src/java/org/apache/fop/afp/DataStream.java +++ b/src/java/org/apache/fop/afp/DataStream.java @@ -512,23 +512,27 @@ public class DataStream { * the x coordinate for the overlay * @param y * the y coordinate for the overlay + * @param width + * the width of the image + * @param height + * the height of the image */ - public void createIncludePageSegment(String name, int x, int y) { + public void createIncludePageSegment(String name, int x, int y, int width, int height) { int xOrigin; int yOrigin; int orientation = paintingState.getRotation(); switch (orientation) { case 90: - xOrigin = currentPage.getWidth() - y; - yOrigin = x; + xOrigin = x - height; + yOrigin = y; break; case 180: - xOrigin = currentPage.getWidth() - x; - yOrigin = currentPage.getHeight() - y; + xOrigin = x - width; + yOrigin = y - height; break; case 270: - xOrigin = y; - yOrigin = currentPage.getHeight() - x; + xOrigin = x; + yOrigin = y - height; break; default: xOrigin = x; diff --git a/src/java/org/apache/fop/render/afp/AFPPainter.java b/src/java/org/apache/fop/render/afp/AFPPainter.java index 7fcd0b3d1..22a5e0a58 100644 --- a/src/java/org/apache/fop/render/afp/AFPPainter.java +++ b/src/java/org/apache/fop/render/afp/AFPPainter.java @@ -187,7 +187,10 @@ public class AFPPainter extends AbstractIFPainter { if (name != null) { float[] srcPts = {rect.x, rect.y}; int[] coords = unitConv.mpts2units(srcPts); - getDataStream().createIncludePageSegment(name, coords[X], coords[Y]); + int width = Math.round(unitConv.mpt2units(rect.width)); + int height = Math.round(unitConv.mpt2units(rect.height)); + + getDataStream().createIncludePageSegment(name, coords[X], coords[Y], width, height); } else { drawImageUsingURI(uri, rect); } diff --git a/src/java/org/apache/fop/render/afp/AFPRenderer.java b/src/java/org/apache/fop/render/afp/AFPRenderer.java index 250ff9624..2118ac2bc 100644 --- a/src/java/org/apache/fop/render/afp/AFPRenderer.java +++ b/src/java/org/apache/fop/render/afp/AFPRenderer.java @@ -468,9 +468,11 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust String name = (String)pageSegmentMap.get(uri); if (name != null) { - float[] srcPts = {x, y}; + float[] srcPts = {x, y, posInt.width, posInt.height}; int[] coords = unitConv.mpts2units(srcPts); - dataStream.createIncludePageSegment(name, coords[X], coords[Y]); + int width = Math.round(unitConv.mpt2units(posInt.width)); + int height = Math.round(unitConv.mpt2units(posInt.height)); + dataStream.createIncludePageSegment(name, coords[X], coords[Y], width, height); } else { ImageManager manager = userAgent.getFactory().getImageManager(); ImageInfo info = null; diff --git a/status.xml b/status.xml index 45145f6bf..35b0618fb 100644 --- a/status.xml +++ b/status.xml @@ -58,6 +58,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Bugfix: AFP Renderer: Page Segments not positioned correctly when reference-orientation != 0 + Added support for TrueType fonts with symbol character maps (like "Wingdings" and "Symbol"). Character for these fonts are usually found in the 0xF020 to 0xF0FF range -- 2.39.5