aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Pepping <spepping@apache.org>2009-08-20 18:27:47 +0000
committerSimon Pepping <spepping@apache.org>2009-08-20 18:27:47 +0000
commitc36d7815bb0af31e59c02fa8f5759aa7f5e16f48 (patch)
treeb19e06fa2f190919b3ef31ae748fd01a6099d296
parent40b065f45838f40ebdd7225e67f89e9c62ca3947 (diff)
downloadxmlgraphics-fop-c36d7815bb0af31e59c02fa8f5759aa7f5e16f48.tar.gz
xmlgraphics-fop-c36d7815bb0af31e59c02fa8f5759aa7f5e16f48.zip
I tried to remove all methods which are not Java 1.4 compliant.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@806291 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/hyphenation/UnicodeClasses.java42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/java/org/apache/fop/hyphenation/UnicodeClasses.java b/src/java/org/apache/fop/hyphenation/UnicodeClasses.java
index bbaa391a8..a0688f166 100644
--- a/src/java/org/apache/fop/hyphenation/UnicodeClasses.java
+++ b/src/java/org/apache/fop/hyphenation/UnicodeClasses.java
@@ -32,7 +32,14 @@ import java.util.Map;
/**
* Create the default classes file classes.xml,
* for use in building hyphenation patterns
- * from pattern files which do not contain their own classes
+ * from pattern files which do not contain their own classes.
+ * The class contains three methods to do that.
+ * The method fromJava gets its infirmation from Java's compiled-in Unicode Character Database,
+ * the method fromUCD gets its information from the UCD files,
+ * the method fromTeX gets its information from the file unicode-letters-XeTeX.tex,
+ * which is the basis of XeTeX's unicode support.
+ * In the build file only the method from UCD is used; the other two methods are there for demonstration.
+ * The methods fromJava and fromTeX are commented out because they are not Java 1.4 compliant.
*/
public class UnicodeClasses {
@@ -45,7 +52,7 @@ public class UnicodeClasses {
* @param outfilePath output file
* @throws IOException
*/
- public static void fromJava(boolean hexcode, String outfilePath) throws IOException {
+/* public static void fromJava(boolean hexcode, String outfilePath) throws IOException {
File f = new File(outfilePath);
if (f.exists()) {
f.delete();
@@ -105,7 +112,7 @@ public class UnicodeClasses {
ow.flush();
ow.close();
}
-
+*/
static public int UNICODE = 0, GENERAL_CATEGORY = 2, SIMPLE_UPPERCASE_MAPPING = 12,
SIMPLE_LOWERCASE_MAPPING = 13, SIMPLE_TITLECASE_MAPPING = 14, NUM_FIELDS = 15;
@@ -190,12 +197,16 @@ public class UnicodeClasses {
if (hexcode) {
s.append("0x" + fields[UNICODE].replaceFirst("^0+", "").toLowerCase() + " ");
}
- s.append(Character.toChars(code));
+ // s.append(Character.toChars(code));
+ /* This cast only works correctly when we do not exceed Character.MAX_VALUE */
+ s.append((char) code);
if (uppercode != -1 && uppercode != code) {
- s.append(Character.toChars(uppercode));
+ // s.append(Character.toChars(uppercode));
+ s.append((char) uppercode);
}
if (titlecode != -1 && titlecode != code && titlecode != uppercode) {
- s.append(Character.toChars(titlecode));
+ // s.append(Character.toChars(titlecode));
+ s.append((char) titlecode);
}
ow.write(s.toString() + "\n");
}
@@ -213,7 +224,7 @@ public class UnicodeClasses {
* @param outfilePath output file
* @throws IOException
*/
- public static void fromTeX(boolean hexcode, String lettersPath, String outfilePath) throws IOException {
+/* public static void fromTeX(boolean hexcode, String lettersPath, String outfilePath) throws IOException {
File in = new File(lettersPath);
File f = new File(outfilePath);
@@ -252,9 +263,9 @@ public class UnicodeClasses {
if (hexcode) {
s.append("0x" + codes[1].replaceFirst("^0+", "").toLowerCase() + " ");
}
- s.append(Character.toChars(Integer.parseInt(codes[1], 16)));
+ s.append((char) Integer.parseInt(codes[1], 16));
if (codes[0].equals("\\L")) {
- s.append(Character.toChars(Integer.parseInt(codes[2], 16)));
+ s.append((char) Integer.parseInt(codes[2], 16));
}
ow.write(s.toString() + "\n");
}
@@ -264,7 +275,7 @@ public class UnicodeClasses {
ow.close();
inbr.close();
}
-
+*/
public static void main(String[] args) throws IOException {
String type = "ucd", prefix = "--", infile = null, outfile = CLASSES_XML;
@@ -302,13 +313,16 @@ public class UnicodeClasses {
System.exit(1);
}
}
- if (type.equals("java")) {
+/* if (type.equals("java")) {
fromJava(hexcode, outfile);
- } else if (type.equals("ucd")) {
+ } else
+ */
+ if (type.equals("ucd")) {
fromUCD(hexcode, infile, outfile);
- } else if (type.equals("tex")) {
+/* } else if (type.equals("tex")) {
fromTeX(hexcode, infile, outfile);
- } else {
+*/
+ } else {
System.err.println("Unknown type: " + type + ", nothing done");
System.exit(1);
}