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 je...@apache.org on 2005/09/06 11:34:58 UTC
svn commit: r278957 -
/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java
Author: jeremias
Date: Tue Sep 6 02:34:55 2005
New Revision: 278957
URL: http://svn.apache.org/viewcvs?rev=278957&view=rev
Log:
Fix for SVG images with an intrinsic size when the FOUserAgent does not default to 72dpi.
Round the intrinsic size, don't truncate it.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java?rev=278957&r1=278956&r2=278957&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/SVGReader.java Tue Sep 6 02:34:55 2005
@@ -166,6 +166,10 @@
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 @@
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 @@
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 @@
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) {
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org