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 ke...@apache.org on 2002/08/02 08:44:46 UTC
cvs commit: xml-fop/src/org/apache/fop/image/analyser EPSReader.java
keiron 2002/08/01 23:44:46
Modified: src/org/apache/fop/image/analyser EPSReader.java
Log:
workaround for eps files that have invalid float bounding box values
float values are rounded off
according to the spec the %%HiResBoundingBox should be used
instead for floating poitn values
Submitted by: Torsten Erler <er...@net-linx.de>
Revision Changes Path
1.6 +14 -6 xml-fop/src/org/apache/fop/image/analyser/EPSReader.java
Index: EPSReader.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/image/analyser/EPSReader.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- EPSReader.java 19 May 2002 16:39:08 -0000 1.5
+++ EPSReader.java 2 Aug 2002 06:44:46 -0000 1.6
@@ -170,20 +170,29 @@
}
private int readLongString(EPSImage.EPSData data, long[] mbbox, int i, int idx) {
- while (idx < data.epsFile.length && (data.epsFile[idx] == 32))
- idx++;
+ while (idx < data.epsFile.length && (data.epsFile[idx] == 32)) {
+ idx++;
+ }
int nidx = idx;
+ // check also for ANSI46(".") to identify floating point values
while (nidx < data.epsFile.length &&
((data.epsFile[nidx] >= 48 && data.epsFile[nidx] <= 57) ||
- (data.epsFile[nidx] == 45)))
+ (data.epsFile[nidx] == 45) || (data.epsFile[nidx] == 46) )) {
nidx++;
+ }
byte[] num = new byte[nidx - idx];
System.arraycopy(data.epsFile, idx, num, 0, nidx - idx);
String ns = new String(num);
- mbbox[i] = Long.parseLong(ns);
+
+ //if( ns.indexOf(".") != -1 ) {
+ // do something like logging a warning
+ //}
+
+ // then parse the double and round off to the next math. Integer
+ mbbox[i] = (long) Math.ceil( Double.parseDouble( ns ) );
return (1 + nidx - idx);
}
@@ -191,6 +200,5 @@
public String getMimeType() {
return "image/eps";
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org