From: Kelly Campbell Date: Mon, 5 Feb 2001 19:50:51 +0000 (+0000) Subject: Removed NumberFormat usage in PDFRenderer to fix a locale-specific bug X-Git-Tag: fop-0_17_0~41 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cb1f0d6ce76079c3b5bf6784f3db71558f13051c;p=xmlgraphics-fop.git Removed NumberFormat usage in PDFRenderer to fix a locale-specific bug for locales which use comma as the decimal separator. Fixed a minor issue with PDFStream where blank or null filter types were reported with an error message. These are now just ignored. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194020 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/pdf/PDFStream.java b/src/org/apache/fop/pdf/PDFStream.java index 195b2e857..ccf22db75 100644 --- a/src/org/apache/fop/pdf/PDFStream.java +++ b/src/org/apache/fop/pdf/PDFStream.java @@ -117,6 +117,9 @@ public class PDFStream extends PDFObject { public void addFilter(String filterType) { + if (filterType == null) { + return; + } if (filterType.equals("flate")) { addFilter(new FlateFilter()); } @@ -126,6 +129,9 @@ public class PDFStream extends PDFObject { else if (filterType.equals("ascii-hex")) { addFilter(new ASCIIHexFilter()); } + else if (filterType.equals("")) { + return; + } else { MessageHandler.errorln("Unsupported filter type in stream-filter-list: "+filterType); } diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index dfe2d5b52..28c9561c3 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -173,20 +173,8 @@ public class PDFRenderer implements Renderer { /** The width of the previous word. Used to calculate space between */ int prevWordWidth = 0; - /** a number formatter to trim off extra precision we don't need*/ - static java.text.NumberFormat numFormat; - - boolean useKerning; - - // initialize the static number formatter - static { - numFormat = java.text.NumberFormat.getNumberInstance(); - numFormat.setMaximumFractionDigits(2); - numFormat.setGroupingUsed(false); - } - /** * create the PDF renderer @@ -709,8 +697,8 @@ public class PDFRenderer implements Renderer { if (!textOpen || bl != prevWordY) { closeText(); - pdf.append("1 0 0 1 " +numFormat.format(rx / 1000f) + " " + - numFormat.format(bl / 1000f) + " Tm [("); + pdf.append("1 0 0 1 " +(rx / 1000f) + " " + + (bl / 1000f) + " Tm [("); prevWordY = bl; textOpen = true; } @@ -718,7 +706,7 @@ public class PDFRenderer implements Renderer { // express the space between words in thousandths of an em int space = prevWordX - rx + prevWordWidth; float emDiff = (float)space / (float)currentFontSize * 1000f; - pdf.append(numFormat.format(emDiff) + " ("); + pdf.append(emDiff + " ("); } prevWordWidth = area.getContentWidth(); prevWordX = rx;