diff options
author | Keiron Liddle <keiron@apache.org> | 2002-08-02 06:44:46 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2002-08-02 06:44:46 +0000 |
commit | 5d1208bcd158014ddc52f76ee11ab1e71499e342 (patch) | |
tree | fb8a8615756b0ff57eeaf5617dc76100b3fc0ff9 /src/org | |
parent | cadb1a7a9b611e322da64c2f0b2726d4f472bcfd (diff) | |
download | xmlgraphics-fop-5d1208bcd158014ddc52f76ee11ab1e71499e342.tar.gz xmlgraphics-fop-5d1208bcd158014ddc52f76ee11ab1e71499e342.zip |
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 <erlto@net-linx.de>
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195048 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/apache/fop/image/analyser/EPSReader.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/org/apache/fop/image/analyser/EPSReader.java b/src/org/apache/fop/image/analyser/EPSReader.java index a0060b58c..0e7948fb2 100644 --- a/src/org/apache/fop/image/analyser/EPSReader.java +++ b/src/org/apache/fop/image/analyser/EPSReader.java @@ -170,20 +170,29 @@ public class EPSReader implements ImageReader { } 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 class EPSReader implements ImageReader { public String getMimeType() { return "image/eps"; } - } |