aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-09-06 09:34:55 +0000
committerJeremias Maerki <jeremias@apache.org>2005-09-06 09:34:55 +0000
commitb7ecb21cf6e5bb73f75046a9b73d83d33b6c23f0 (patch)
tree7fce3d189e3606eba01d9686b78f12a9b58dc48b /src
parentd730c08c5418b1644ebe0c22fc4cc854fbe7e73f (diff)
downloadxmlgraphics-fop-b7ecb21cf6e5bb73f75046a9b73d83d33b6c23f0.tar.gz
xmlgraphics-fop-b7ecb21cf6e5bb73f75046a9b73d83d33b6c23f0.zip
Fix for SVG images with an intrinsic size when the FOUserAgent does not default to 72dpi.
Round the intrinsic size, don't truncate it. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@278957 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/image/analyser/SVGReader.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/java/org/apache/fop/image/analyser/SVGReader.java b/src/java/org/apache/fop/image/analyser/SVGReader.java
index d7f433f3c..e627dbcdc 100644
--- a/src/java/org/apache/fop/image/analyser/SVGReader.java
+++ b/src/java/org/apache/fop/image/analyser/SVGReader.java
@@ -166,6 +166,10 @@ public class SVGReader implements ImageReader {
FopImage.ImageInfo info = new FopImage.ImageInfo();
+ //Set the resolution to that of the FOUserAgent
+ info.dpiHorizontal = 25.4f / pixelUnitToMM;
+ info.dpiVertical = info.dpiHorizontal;
+
info.originalURI = uri;
info.mimeType = getMimeType();
info.str = SVGDOMImplementation.SVG_NAMESPACE_URI;
@@ -182,8 +186,7 @@ public class SVGReader implements ImageReader {
SVGUserAgent userAg = new SVGUserAgent(pixelUnitToMM,
new AffineTransform());
BridgeContext ctx = new BridgeContext(userAg);
- UnitProcessor.Context uctx =
- UnitProcessor.createContext(ctx, e);
+ UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e);
// 'width' attribute - default is 100%
s = e.getAttributeNS(null,
@@ -191,8 +194,8 @@ public class SVGReader implements ImageReader {
if (s.length() == 0) {
s = SVGOMDocument.SVG_SVG_WIDTH_DEFAULT_VALUE;
}
- info.width = (int) UnitProcessor.svgHorizontalLengthToUserSpace(
- s, SVGOMDocument.SVG_WIDTH_ATTRIBUTE, uctx);
+ info.width = Math.round(UnitProcessor.svgHorizontalLengthToUserSpace(
+ s, SVGOMDocument.SVG_WIDTH_ATTRIBUTE, uctx));
// 'height' attribute - default is 100%
s = e.getAttributeNS(null,
@@ -200,8 +203,8 @@ public class SVGReader implements ImageReader {
if (s.length() == 0) {
s = SVGOMDocument.SVG_SVG_HEIGHT_DEFAULT_VALUE;
}
- info.height = (int) UnitProcessor.svgVerticalLengthToUserSpace(
- s, SVGOMDocument.SVG_HEIGHT_ATTRIBUTE, uctx);
+ info.height = Math.round(UnitProcessor.svgVerticalLengthToUserSpace(
+ s, SVGOMDocument.SVG_HEIGHT_ATTRIBUTE, uctx));
return info;
} catch (NoClassDefFoundError ncdfe) {