diff --git a/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.css b/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.css
new file mode 100644
index 00000000000..2de4be89f63
--- /dev/null
+++ b/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.css
@@ -0,0 +1,16 @@
+th { font-size: 60%; text-align: Center;
+ width: 0.39%; font-family: monospace;
+ border: 1px solid black; margin: 0; padding: 1px }
+td { font-size: 60%; text-align: Center;
+ border-right: 1px solid #9999FF; border-top: 1px solid #9999FF; margin: 0; padding: 1px }
+table { border-spacing: 0; border-collapse: collapse;
+ border: 1px solid black; margin: 0; padding: 0 }
+.d { border-top: 2px double blue }
+.u { background-color: #DDDDDD }
+.du { background-color: #DDDDDD; border-top: 2px double blue }
+.n { background-color: black }
+.dn { background-color: black; border-top: 2px double blue }
+.i { background-color: yellow }
+.di { background-color: yellow; border-top: 2px double blue }
+p { font-size: 50%; text-align: Right }
+.left { font-size: 75%; text-align: Left }
\ No newline at end of file
diff --git a/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.java b/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.java
index 85eefb2d091..6e26a05a2ac 100644
--- a/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.java
+++ b/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.java
@@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.java,v $
- * $Date: 2003/11/26 23:36:39 $
- * $Revision: 1.1 $
+ * $Date: 2003/11/27 02:31:48 $
+ * $Revision: 1.2 $
*
*****************************************************************************************
*/
@@ -23,27 +23,18 @@ public class UnicodeChart {
int rowWidth = 256;
PrintWriter pw = BagFormatter.openUTF8Writer("", "UnicodeChart.html", BagFormatter.CONSOLE);
pw.println("
");
- pw.println("Unicode 4.0 Chart");
- pw.println("");
- pw.println("Unicode 4.0 Chart
");
+ pw.println("");
+ pw.println("");
+ pw.println("Unicode 4.0 Chart");
+ pw.println("");
+ pw.println("Unicode 4.0 Chart
");
- pw.println(" | ");
+ /*pw.println("
---|
| ");
for (int j = 0; j < rowWidth; ++j) {
pw.print("" + hex(j,2) + " | ");
}
pw.println("
");
+ */
// TODO: fix Utility to take ints
int surrogateType = UCharacter.getType('\ud800');
@@ -53,52 +44,48 @@ public class UnicodeChart {
boolean gotOne = true;
int columns = 0;
- for (int i = 0; i < 0x10FFFF; i += rowWidth) {
- boolean gotLast = gotOne;
- gotOne = false;
- int limit = i + rowWidth;
- for (int j = i; j < limit; ++j) {
- int type = UCharacter.getType(j);
- if (type == Character.UNASSIGNED
- && !UCharacter.hasBinaryProperty(j, UProperty.NONCHARACTER_CODE_POINT)) continue;
- if (type == surrogateType || type == privateUseType) continue;
- gotOne = true;
- }
- if (!gotOne) {
- if (false) {
- System.out.println("Skipping: " + hex(i>>8,2) + "__");
- for (int j = i; j < limit; ++j) {
- System.out.print(UCharacter.getType(j) + ",");
- }
- System.out.println();
- }
- continue;
- };
- System.out.println(hex(i>>8,2) + "__");
+ int limit = 0x10FFFF;
+ char lastType = 'x';
+ int lastCount = 0;
+ pw.println("
");
+ pw.println("Key");
+ pw.println("X | Graphic characters |
");
+ pw.println("\u00A0 | Whitespace |
");
+ pw.println(" | Other Default Ignorable |
");
+ pw.println(" | Undefined, Private Use, or Surrogates |
");
+ pw.println(" | Noncharacter |
");
+ pw.println("
");
+ pw.println("Copyright \u00A9 2003, Mark Davis. All Rights Reserved.");
pw.close();
System.out.println("columns: " + columns);
}
diff --git a/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.js b/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.js
new file mode 100644
index 00000000000..faa74c61ee4
--- /dev/null
+++ b/icu4j/src/com/ibm/icu/dev/demo/chart/UnicodeChart.js
@@ -0,0 +1,88 @@
+var columnBits = 8; // 8
+
+var columnCount = Math.pow(2,columnBits);
+var columnMask = columnCount-1;
+var columnShift = Math.floor(columnBits/4);
+var columnGap = repeat('_', columnShift);
+var columnPad = 4-columnShift;
+
+var gotLast = true;
+var current = 0;
+var haveFirst = false;
+
+function top(count) {
+ document.writeln("
| ");
+ for (var i = 0; i < columnCount; ++i) {
+ document.writeln("", hex(i,2), " | ");
+ }
+}
+
+function writeCell(cellclass, value) {
+ if (!gotLast) cellclass = 'd' + cellclass;
+ if (value) {
+ value = current <= 0xFFFF
+ ? String.fromCharCode(current)
+ : String.fromCharCode(0xD800 + (current >> 10), 0xDC00 + (current & 0x3FF));
+ } else {
+ value = '\u00A0'
+ }
+ if (cellclass!="") cellclass = " class='" + cellclass + "'";
+ document.writeln("", value, " | ");
+ ++current;
+}
+
+function writeCells(count,cellclass,value) {
+ for (var i = 0; i < count; ++i) {
+ if ((current & columnMask) == 0) {
+ if (cellclass!='u' || count - i < columnCount) {
+ gotLast = true
+ } else {
+ gotLast = false;
+ var rem = (count - i) & ~columnMask;
+ current += rem;
+ i += rem;
+ if (i == count) break;
+ }
+ newRow();
+ }
+ writeCell(cellclass,value);
+ }
+}
+
+function newRow() {
+ if (haveFirst) document.write("");
+ else haveFirst = true;
+ var hclass = (gotLast) ? "" : " class='d'";
+ document.writeln("", hex(current>>(columnShift*4),columnPad), columnGap, " | ");
+}
+
+// Utilities
+
+function hex(value, pad) {
+ var result = value.toString(16).toUpperCase();
+ while (result.length < pad) result = '0' + result;
+ return result;
+}
+
+function repeat(str, count) {
+ var result = "";
+ for (var i = 0; i < count; ++i) result += str;
+ return result;
+}
+
+// used in the body. single letters to save bytes.
+function u(count) { // undefined, private use, or surrogates
+ writeCells(count,'u',false);
+}
+function n(count) { // noncharacter
+ writeCells(count,'n',false);
+}
+function i(count) { // ignorable
+ writeCells(count,'i',false);
+}
+function w(count) { // whitespace
+ writeCells(count,'',false);
+}
+function v(count) { // normal visible graphic
+ writeCells(count,'',true);
+}
---|