You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by dv...@apache.org on 2006/12/30 15:37:29 UTC
svn commit: r491229 - in /xmlgraphics/batik/trunk/sources/org/apache/batik:
dom/svg/SVGGraphicsElement.java ext/swing/DoubleDocument.java
gvt/text/ArabicTextHandler.java parser/NumberParser.java
Author: dvholten
Date: Sat Dec 30 06:37:28 2006
New Revision: 491229
URL: http://svn.apache.org/viewvc?view=rev&rev=491229
Log:
1.) fix typo in ArabicTextHandler.java
2.) give some extra precision to NumberParser.java
3.) drop some garbage objects in DoubleDocument.java
Modified:
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGGraphicsElement.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/DoubleDocument.java
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/ArabicTextHandler.java
xmlgraphics/batik/trunk/sources/org/apache/batik/parser/NumberParser.java
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGGraphicsElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGGraphicsElement.java?view=diff&rev=491229&r1=491228&r2=491229
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGGraphicsElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGGraphicsElement.java Sat Dec 30 06:37:28 2006
@@ -63,6 +63,7 @@
// t.put(null, SVG_SYSTEM_LANGUAGE_ATTRIBUTE,
// new TraitInformation(false, SVGTypes.TYPE_LANG_LIST));
xmlTraitInformation = t;
+
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/DoubleDocument.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/DoubleDocument.java?view=diff&rev=491229&r1=491228&r2=491229
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/DoubleDocument.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/swing/DoubleDocument.java Sat Dec 30 06:37:28 2006
@@ -82,7 +82,7 @@
public void setValue(double d){
try{
remove(0, getLength());
- insertString(0, (new Double(d)).toString(), null);
+ insertString(0, String.valueOf( d ), null);
}catch(BadLocationException e){
// Will not happen because we are sure
// we use the proper range
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/ArabicTextHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/ArabicTextHandler.java?view=diff&rev=491229&r1=491228&r2=491229
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/ArabicTextHandler.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/ArabicTextHandler.java Sat Dec 30 06:37:28 2006
@@ -393,7 +393,7 @@
* @param form Indicates the required arabic form.
* (isolated = 1, final = 2, initial = 3, medial = 4)
*
- * @return The unicode value of the substutute char, or -1 if no susbtitue
+ * @return The unicode value of the substutute char, or -1 if no substitute
* exists.
*/
public static int getSubstituteChar(char ch1, char ch2, int form) {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/parser/NumberParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/parser/NumberParser.java?view=diff&rev=491229&r1=491228&r2=491229
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/parser/NumberParser.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/parser/NumberParser.java Sat Dec 30 06:37:28 2006
@@ -45,6 +45,7 @@
switch (current) {
case '-':
mantPos = false;
+ // fallthrough
case '+':
current = reader.read();
}
@@ -216,7 +217,7 @@
*/
public static float buildFloat(int mant, int exp) {
if (exp < -125 || mant == 0) {
- return 0f;
+ return 0.0f;
}
if (exp >= 128) {
@@ -233,16 +234,17 @@
mant++; // round up trailing bits if they will be dropped.
}
- return (exp > 0) ? mant * pow10[exp] : mant / pow10[-exp];
+ return (float) ((exp > 0) ? mant * pow10[exp] : mant / pow10[-exp]);
}
/**
- * Array of powers of ten.
+ * Array of powers of ten. Using double instead of float gives a tiny bit more precision.
*/
- private static final float[] pow10 = new float [128];
+ private static final double[] pow10 = new double[128];
+
static {
for (int i = 0; i < pow10.length; i++) {
- pow10[i] = (float)Math.pow(10, i);
+ pow10[i] = Math.pow(10, i);
}
}
}