foray-commit Mailing List for FOray (Page 279)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: <vic...@us...> - 2006-03-08 21:49:09
|
Revision: 6911 Author: victormote Date: 2006-03-08 13:49:04 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6911&view=rev Log Message: ----------- Use new break opportunity logic to compute last break opportunity. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 21:19:19 UTC (rev 6910) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 21:49:04 UTC (rev 6911) @@ -583,9 +583,17 @@ private class Queue { /** Collection of Strings that need to be written as soon as we know * enough of what comes after them to choose line breaks. This is needed - * for PCDATA and inline tags that must stay on the current line. */ + * for PCDATA and inline tags that must stay on the current line. + * It is tempting to turn this all into one long StringBuffer, but we + * need to handle attributes differently from PCDATA. */ private ArrayList toWriteQueue = new ArrayList(); + /* After running listBreakOpportunities, these two arrays hold a list of + * break opportunities. The "Items" element points to the item in + * toWriteQueue. The "Indexes" element points to a specific character + * in that queue item. */ + private int[] breakOpportunityItems; + private int[] breakOpportunityIndexes; Queue() { } @@ -646,45 +654,60 @@ } private void breakAtLastOpportunity() { - if (this.size() < 1) { - return; - } - int lastBreakItem = -1; - int lastBreakItemIndex = -1; - for (int i = this.toWriteQueue.size() - 1; - i >= 0 && lastBreakItem < 0; i--) { - String string = this.get(i); - for (int j = string.length() - 1; j >= 0 && lastBreakItem < 0; - j--) { - char c = string.charAt(j); - switch (c) { - case ' ': - case '\t': - case '\n': { - lastBreakItem = i; - lastBreakItemIndex = j; - } - } - } - } + this.listBreakOpportunities(); /* If there is no break, there is nothing to do but write the whole * thing.*/ - if (lastBreakItem < 0) { + if (this.breakOpportunityItems.length < 1) { this.writeAll(); return; } /* Otherwise, split into two chunks. */ /* Write the first chunk. */ - writeChunk(0, 0, lastBreakItem, lastBreakItemIndex - 1); + int lastIndex = this.breakOpportunityItems.length - 1; + int lastBreakItem = this.breakOpportunityItems[lastIndex]; + int lastBreakIndex = this.breakOpportunityIndexes[lastIndex]; + writeChunk(0, 0, lastBreakItem, lastBreakIndex); write(newLine()); /* Write the second chunk. */ - writeChunk(lastBreakItem, lastBreakItemIndex + 1, + writeChunk(lastBreakItem, lastBreakIndex + 1, this.toWriteQueue.size() - 1, this.getLastItem().length() - 1); /* Clear the queue contents. */ this.toWriteQueue.clear(); } + private void listBreakOpportunities() { + int count = countBreakOpportunities(); + this.breakOpportunityItems = new int[count]; + this.breakOpportunityIndexes = new int[count]; + count = 0; + for (int i = 0; i < this.toWriteQueue.size(); i++) { + String string = this.get(i); + for (int j = 0; j < string.length(); j++) { + char c = string.charAt(j); + if (c == ' ') { + this.breakOpportunityItems[count] = i; + this.breakOpportunityIndexes[count] = j; + count ++; + } + } + } + } + + private int countBreakOpportunities() { + int count = 0; + for (int i = 0; i < this.toWriteQueue.size(); i++) { + String string = this.get(i); + for (int j = 0; j < string.length(); j++) { + char c = string.charAt(j); + if (c == ' ') { + count ++; + } + } + } + return count; + } + private void writeChunk(int startItem, int startItemIndex, int endItem, int endItemIndex) { for (int i = startItem; i <= endItem; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 21:19:25
|
Revision: 6910 Author: victormote Date: 2006-03-08 13:19:19 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6910&view=rev Log Message: ----------- Improvements to queue processing. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 20:59:04 UTC (rev 6909) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 21:19:19 UTC (rev 6910) @@ -214,11 +214,11 @@ public void startDocument() { write(this.xmlDeclaration); - newLine(); + write(newLine()); } public void endDocument() { - newLine(); + write(newLine()); } public void startElement(String uri, String local, String qName, @@ -257,9 +257,9 @@ } if (this.startTagOnNewLine()) { - newLine(); + write(newLine()); if (this.shouldIndent()) { - indent(); + write(indent()); } } @@ -306,17 +306,18 @@ return true; } - private void newLine() { - write(this.lineTerminator); - this.lastColumnWritten = 0; + private String newLine() { + return this.lineTerminator; } - private void indent() { + private String indent() { int numIndents = currentIndentation() * this.indent; + StringBuffer buffer = new StringBuffer(); while (numIndents > 0) { - write(" "); + buffer.append(" "); numIndents --; } + return buffer.toString(); } public void endElement(String uri, String local, String qName) { @@ -324,15 +325,15 @@ if (this.topElementWritten) { if (this.elementStack.topIsBlockElement()) { - flushQueue(); + this.queue.flush(); } if (endTagOnNewLine()) { - newLine(); - indent(); + write(newLine()); + write(indent()); } addToQueue("</" + local + ">"); if (this.elementStack.topIsBlockElement()) { - flushQueue(); + this.queue.flush(); } } else { /* Element was empty. */ @@ -346,18 +347,6 @@ this.elementStack.pop(); } - private void flushQueue() { - /* If they all fit on the current line, write them all. */ - if (this.queue.charCount() + this.lastColumnWritten - <= this.desiredLineLength) { - this.queue.writeAll(); - return; - } - this.queue.breakAtLastOpportunity(); - /* Otherwise, search backwards through the items in the queue looking - * for the last break opportunity*/ - } - /** * Determines whether the start tag for the current element should * be written on a new line or whether it should be written inside the @@ -465,19 +454,19 @@ } public void startDTD(String name, String publicId, String systemId) { - newLine(); + write(newLine()); write("<!DOCTYPE "); write(name); - newLine(); + write(newLine()); // Indentation. write(" "); write("PUBLIC "); write("\"" + publicId + "\""); - newLine(); + write(newLine()); write(" "); write("\"" + systemId + "\""); write(">"); - newLine(); + write(newLine()); this.inDTD = true; this.rootElement = name; } @@ -601,6 +590,29 @@ Queue() { } + private void flush() { + if (attemptWriteAll()) { + return; + } + breakAtLastOpportunity(); + /* Otherwise, search backwards through the items in the queue looking + * for the last break opportunity*/ + } + + /** + * If everything can be written on the current line, do it. Otherwise, + * do nothing. + * @return True if everything was written, false otherwise. + */ + private boolean attemptWriteAll() { + /* If they all fit on the current line, write them all. */ + if (charCount() + lastColumnWritten <= desiredLineLength) { + writeAll(); + return true; + } + return false; + } + private void writeAll() { while (this.toWriteQueue.size() > 0) { String returnItem = (String) this.toWriteQueue.get(0); @@ -664,7 +676,7 @@ /* Otherwise, split into two chunks. */ /* Write the first chunk. */ writeChunk(0, 0, lastBreakItem, lastBreakItemIndex - 1); - newLine(); + write(newLine()); /* Write the second chunk. */ writeChunk(lastBreakItem, lastBreakItemIndex + 1, this.toWriteQueue.size() - 1, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 20:59:12
|
Revision: 6909 Author: victormote Date: 2006-03-08 12:59:04 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6909&view=rev Log Message: ----------- Since spaces between attributes can cause line breaks, queue up attributes like other content. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 20:26:28 UTC (rev 6908) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 20:59:04 UTC (rev 6909) @@ -263,21 +263,36 @@ } } - /* Now write the element itself. */ + /* Always write the tag opener and the element name itself. */ write("<"); write(local); + + /* Accumulate the attributes. */ + StringBuffer attributesBuffer = new StringBuffer(); for (int i = 0; i < attributes.getLength(); i++) { - write(" "); - write(attributes.getLocalName(i)); - write("=\""); - write(attributes.getValue(i)); - write("\""); + attributesBuffer.append(" "); + attributesBuffer.append(attributes.getLocalName(i)); + attributesBuffer.append("=\""); + attributesBuffer.append(attributes.getValue(i)); + attributesBuffer.append("\""); } + + /* Accumulate the tag closer. */ + StringBuffer tagCloseBuffer = new StringBuffer(); if (isEmpty) { - write("/>"); + tagCloseBuffer.append("/>"); } else { - write(">"); + tagCloseBuffer.append(">"); } + + /* If there are attributes, they must be queued up for output.*/ + if (attributes.getLength() > 0) { + this.queue.add(attributesBuffer.toString() + + tagCloseBuffer.toString()); + } else { + /* Otherwise write the tag closer now. */ + write(tagCloseBuffer.toString()); + } } private boolean shouldIndent() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 20:26:33
|
Revision: 6908 Author: victormote Date: 2006-03-08 12:26:28 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6908&view=rev Log Message: ----------- Put all text into the queue. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 19:29:21 UTC (rev 6907) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 20:26:28 UTC (rev 6908) @@ -388,46 +388,38 @@ } ensureTopElementWritten(false); if (this.breakPCDATA) { - breakPCDATA(); + /* Note: SAX input has linefeeds normalized to \n. */ + normalizeWhitespace(); + this.queue.add(this.charBuffer.toString()); } else { writeRawPCDATA(this.charBuffer.toString()); } - this.charBuffer.delete(0, this.charBuffer.length()); + this.charBuffer.setLength(0); } - private void breakPCDATA() { - /* SAX input has linefeeds normalized to \n. - * The goal here is to write as much as we are forced to write and to - * leave any text that we do not have to write in the buffer. */ - int lastBreak = 0; - int lastBreakOpportunity = -1; - for (int i = 0; i < this.charBuffer.length(); i++) { - int lineLengthSoFar = i - lastBreak + this.lastColumnWritten; - if (lineLengthSoFar > this.desiredLineLength) { - if (lastBreakOpportunity > -1) { - /* String excludes the character that gave the break - * opportunity. We'll write the newline manually. */ - String textToWrite = this.charBuffer.substring(lastBreak, - lastBreakOpportunity); - write(textToWrite); - newLine(); - lastBreak = lastBreakOpportunity + 1; - lastBreakOpportunity = -1; - } + private void normalizeWhitespace() { + /* Convert all line-feeds to spaces. */ + convertString(this.charBuffer, "\n", " "); + /* Convert all tabs to spaces. */ + convertString(this.charBuffer, "\t", " "); + /* Remove extra spaces. */ + convertString(this.charBuffer, " ", " "); + } + + /** + * Replaces all occurrences of a given String with a different Strings. + */ + private static void convertString(StringBuffer buffer, String oldString, + String newString) { + boolean anyChanges = true; + while (anyChanges) { + anyChanges = false; + int index = buffer.indexOf(oldString); + if (index > -1) { + buffer.replace(index, index + oldString.length(), newString); + anyChanges = true; } - char c = this.charBuffer.charAt(i); - switch (c) { - case ' ': - case '\t': - case '\n': { - lastBreakOpportunity = i; - break; - } - } } - String textToWrite = this.charBuffer.substring(lastBreak, - this.charBuffer.length()); - addToQueue(textToWrite); } private void addToQueue(String string) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 19:29:27
|
Revision: 6907 Author: victormote Date: 2006-03-08 11:29:21 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6907&view=rev Log Message: ----------- Simplify logic by treating the root element as a normal element WRT whether it starts on a new line. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 19:19:40 UTC (rev 6906) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 19:29:21 UTC (rev 6907) @@ -108,7 +108,7 @@ /** The line terminator that should be used in the output. */ private String lineTerminator = "\n"; private String outputEncoding = "UTF-8"; - private String preRootText = "\n"; + private String preRootText = null; private String postRootText = "\n"; /** * Set this to true if PCDATA content can have space characters replaced @@ -143,7 +143,7 @@ /* Set the line terminator to the default for this operating system. */ this.lineTerminator = System.getProperty("line.separator"); /* Default the pre- and post- root text to one line separator. */ - this.preRootText = this.lineTerminator; + this.preRootText = null; this.postRootText = this.lineTerminator; } @@ -535,6 +535,9 @@ } private void write(String outputString) { + if (outputString == null) { + return; + } if (outputString.length() < 1) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 19:19:45
|
Revision: 6906 Author: victormote Date: 2006-03-08 11:19:40 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6906&view=rev Log Message: ----------- Don't increment the column counter twice. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 19:13:16 UTC (rev 6905) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 19:19:40 UTC (rev 6906) @@ -301,7 +301,6 @@ while (numIndents > 0) { write(" "); numIndents --; - this.lastColumnWritten ++; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 19:13:20
|
Revision: 6905 Author: victormote Date: 2006-03-08 11:13:16 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6905&view=rev Log Message: ----------- Improvements to indentation. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 18:55:35 UTC (rev 6904) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 19:13:16 UTC (rev 6905) @@ -121,6 +121,15 @@ /** The maximum number of characters desired on each line. */ private int desiredLineLength = 80; + + /** + * Block elements are started on a new line. However, if they are inside + * elements containing mixed content, the default behavior is to start the + * element at column 0. If it should be indented, set this variable to + * true. + */ + private boolean indentBlocksInsideMixedContent = false; + /* End configuration variables. */ /** @@ -232,11 +241,6 @@ if (this.topElementWritten) { return; } -// boolean isEmpty = false; -// DTDElement topElement = this.elementStack.peek(); -// if (topElement != null) { -// isEmpty = topElement.isEmpty(); -// } writeElement(this.lastStartedLocal, this.lastStartedAttributes, isEmpty); this.topElementWritten = true; } @@ -254,7 +258,9 @@ if (this.startTagOnNewLine()) { newLine(); - indent(); + if (this.shouldIndent()) { + indent(); + } } /* Now write the element itself. */ @@ -274,6 +280,17 @@ } } + private boolean shouldIndent() { + if (! this.elementStack.topIsBlockElement()) { + return false; + } + if (this.elementStack.topIsInsideMixedContent()) { + return this.indentBlocksInsideMixedContent; + } + /* It is a block element, not inside mixed content. Indent it. */ + return true; + } + private void newLine() { write(this.lineTerminator); this.lastColumnWritten = 0; @@ -304,6 +321,7 @@ flushQueue(); } } else { + /* Element was empty. */ ensureTopElementWritten(true); } if (local.equals(this.rootElement)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 18:55:40
|
Revision: 6904 Author: victormote Date: 2006-03-08 10:55:35 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6904&view=rev Log Message: ----------- Use new stack methods to simplify pretty-printer logic. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 18:51:20 UTC (rev 6903) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 18:55:35 UTC (rev 6904) @@ -292,9 +292,7 @@ flushCharacters(); if (this.topElementWritten) { - DTDElement parentElement = this.elementStack.peekParent(); - if (parentElement != null - && ! parentElement.hasPCDATA()) { + if (this.elementStack.topIsBlockElement()) { flushQueue(); } if (endTagOnNewLine()) { @@ -302,8 +300,7 @@ indent(); } addToQueue("</" + local + ">"); - if (parentElement != null - && ! parentElement.hasPCDATA()) { + if (this.elementStack.topIsBlockElement()) { flushQueue(); } } else { Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java 2006-03-08 18:51:20 UTC (rev 6903) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java 2006-03-08 18:55:35 UTC (rev 6904) @@ -52,10 +52,6 @@ return peek(0); } - public DTDElement peekParent() { - return peek(1); - } - /** * @param indexFromTop The number of items deep in the stack the desired * element is. To get the top element, set to 0. To get the next element This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 18:51:26
|
Revision: 6903 Author: victormote Date: 2006-03-08 10:51:20 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6903&view=rev Log Message: ----------- Use new stack methods to simplify pretty-printer logic. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 18:41:56 UTC (rev 6902) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-03-08 18:51:20 UTC (rev 6903) @@ -337,31 +337,7 @@ * on a new line. */ private boolean startTagOnNewLine() { - DTDElement currentElement = this.elementStack.peek(); - if (currentElement == null) { - return false; - } - - /* If this is the root element, there is no parent, and we don't care - * what the content model of ancestor elements is. */ - if (this.elementStack.size() == 1) { - if (this.lastColumnWritten > 0) { - return true; - } - } - - /* If the parent element does not contain PCDATA, then start this - * element on a new line. */ - DTDElement parentElement = this.elementStack.peekParent(); - if (parentElement == null) { - /* This shouldn't ever happen. We already tested for the top of the - * stack above. */ - return false; - } - if (! parentElement.hasPCDATA()) { - return true; - } - return false; + return this.elementStack.topIsBlockElement(); } /** @@ -372,35 +348,15 @@ * a new line. */ private boolean endTagOnNewLine() { - DTDElement currentElement = this.elementStack.peek(); - if (currentElement == null) { + if (! this.elementStack.topIsBlockElement()) { return false; } - /* If the current element contains PCDATA, the end tag should be * written in-line instead of on a new line. */ - if (currentElement.hasPCDATA()) { + if (this.elementStack.topHasPCDATA()) { return false; } - - /* If this is the root element, there is no parent, and we don't care - * what the content model of ancestor elements is. */ - if (this.elementStack.size() == 1) { - return true; - } - - /* If the parent element does not contain PCDATA, then end this - * element on a new line and indent that line. */ - DTDElement parentElement = this.elementStack.peekParent(); - if (parentElement == null) { - /* This shouldn't ever happen. We already tested for the top of the - * stack above. */ - return false; - } - if (! parentElement.hasPCDATA()) { - return true; - } - return false; + return true; } public void characters(char[] buffer, int offset, int length) { Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java 2006-03-08 18:41:56 UTC (rev 6902) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java 2006-03-08 18:51:20 UTC (rev 6903) @@ -120,4 +120,15 @@ return false; } + public boolean topHasPCDATA() { + DTDElement topElement = peek(); + if (topElement == null) { + return false; + } + if (topElement.hasPCDATA()) { + return true; + } + return false; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 18:42:03
|
Revision: 6902 Author: victormote Date: 2006-03-08 10:41:56 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6902&view=rev Log Message: ----------- Add methods for determining the stack state. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java 2006-03-08 17:57:36 UTC (rev 6901) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java 2006-03-08 18:41:56 UTC (rev 6902) @@ -67,4 +67,8 @@ return this.isEmpty; } + public boolean hasElementChildren() { + return this.hasElementChildren; + } + } Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java 2006-03-08 17:57:36 UTC (rev 6901) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/ElementStack.java 2006-03-08 18:41:56 UTC (rev 6902) @@ -62,7 +62,7 @@ * down, set to 1, etc. * @return The nth item down the stack, where n is indexFromTop. */ - public DTDElement peek(int indexFromTop) { + private DTDElement peek(int indexFromTop) { if (this.stack.size() <= indexFromTop) { return null; } @@ -78,4 +78,46 @@ return this.stack.isEmpty(); } + /** + * Reports whether the top element on the stack should be treated as a block + * element or as an inline element. + * A block element is any element whose immediate parent in the document + * does not contain PCDATA. + * Note that an element may be a block element but still be part of mixed + * content, if some other ancestor does contain PCDATA. + * @return True iff the top element on the stack is a block element, or if + * the stack is empty. + */ + public boolean topIsBlockElement() { + DTDElement parentElement = peek(1); + if (parentElement == null) { + return true; + } + if (! parentElement.hasPCDATA()) { + return true; + } + return false; + } + + /** + * Reports whether the top element on the stack is inside of any element + * that contains mixed content. + * @return True iff any ancestor element of the top of the stack can + * contain PCDATA. + */ + public boolean topIsInsideMixedContent() { + /* Start the loop at 1, because we don't care whether the top of the + * stack contains PCDATA or not. */ + for (int i = 1; i < this.stack.size(); i++) { + DTDElement element = peek(i); + if (element == null) { + return false; + } + if (element.hasPCDATA) { + return true; + } + } + return false; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 17:57:41
|
Revision: 6901 Author: victormote Date: 2006-03-08 09:57:36 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6901&view=rev Log Message: ----------- Add javadoc. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java 2006-03-08 17:50:07 UTC (rev 6900) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java 2006-03-08 17:57:36 UTC (rev 6901) @@ -34,6 +34,15 @@ private DTDTokenizer() { } + /** + * Returns the content of an Element as an array of String tokens. + * This method makes no assumptions about the source of the content. + * Specifically, although some parsers strip all whitespace out of the + * content, this method considers the possibility that there may be + * whitespace in the content. + * @param content The Element content to be parsed. + * @return An array of String tokens. + */ public static String[] tokenizeElementContent(String content) { ArrayList tokens = new ArrayList(); int startIndex = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-08 17:50:16
|
Revision: 6900 Author: victormote Date: 2006-03-08 09:50:07 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6900&view=rev Log Message: ----------- Add tokenizer for slightly more sophisticated insight into element content. Modified Paths: -------------- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java Added Paths: ----------- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java 2006-03-07 22:32:59 UTC (rev 6899) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDElement.java 2006-03-08 17:50:07 UTC (rev 6900) @@ -34,6 +34,7 @@ boolean hasPCDATA = false; boolean isEmpty = false; + boolean hasElementChildren = false; public DTDElement(String elementName, String contentModel) { this.elementName = elementName; @@ -41,13 +42,17 @@ } private void parseContentModel(String contentModel) { - /* All we really care about right now is whether it contains text. */ + /* All we really care about right now is a whether it is empty, PCDATA, + * mixed, or element children only. */ if (contentModel.indexOf("#PCDATA") > -1) { this.hasPCDATA = true; } - if (contentModel.indexOf("EMPTY") > -1) { - this.isEmpty = true; - } + String[] contentTokens = DTDTokenizer.tokenizeElementContent( + contentModel); + this.isEmpty = DTDTokenizer.isElementContentEmpty(contentTokens); + this.hasPCDATA = DTDTokenizer.hasPCDATA(contentTokens); + this.hasElementChildren = DTDTokenizer.hasElementChildren( + contentTokens); } public String getName() { Added: trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java (rev 0) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/dtd/DTDTokenizer.java 2006-03-08 17:50:07 UTC (rev 6900) @@ -0,0 +1,148 @@ +/* + * Copyright 2006 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.pretty.dtd; + +import java.util.ArrayList; + +public class DTDTokenizer { + + /** + * Private constructor. Should not be instantiated. + */ + private DTDTokenizer() { + } + + public static String[] tokenizeElementContent(String content) { + ArrayList tokens = new ArrayList(); + int startIndex = 0; + int currentIndex = 0; + while (true) { + if (currentIndex >= content.length()) { + if (currentIndex - 1 > startIndex) { + tokens.add(content.substring(startIndex, currentIndex)); + } + break; + } + char character = content.charAt(currentIndex); + if (isWhitespace(character) || isElementDelimiter(character)) { + if (currentIndex - 1 > startIndex) { + tokens.add(content.substring(startIndex, currentIndex)); + } + if (! isWhitespace(character)) { + tokens.add(content.substring(currentIndex, + currentIndex + 1)); + } + startIndex = currentIndex + 1; + } + currentIndex ++; + } + return arrayListToStrings(tokens); + } + + public static boolean isWhitespace(int character) { + switch (character) { + case ' ': + case '\t': + case '\n': { + return true; + } + } + return false; + } + + public static boolean isElementDelimiter(int character) { + switch (character) { + case '|': + case '(': + case ')': + case ',': + case '*': + case '+': + case '?': { + return true; + } + } + return false; + } + + public static boolean isElementContentEmpty(String[] tokens) { + for (int i = 0; i < tokens.length; i++) { + String token = tokens[i]; + if (token.equals("EMPTY")) { + return true; + } + } + return false; + } + + public static boolean hasPCDATA(String[] tokens) { + for (int i = 0; i < tokens.length; i++) { + String token = tokens[i]; + if (token.equals("#PCDATA")) { + return true; + } + } + return false; + } + + public static boolean hasElementChildren(String[] tokens) { + for (int i = 0; i < tokens.length; i++) { + String token = tokens[i]; + if (isElementChild(token)) { + return true; + } + } + return false; + } + + private static boolean isElementChild(String token) { + if (token.length() == 1) { + int character = token.charAt(0); + if (isElementDelimiter(character)) { + return false; + } + return true; + } + if (token.equals("#PCDATA") + || token.equals("EMPTY")) { + return false; + } + return true; + } + + /** + * Converts an ArrayList containing Strings to a String[]. + * @param arrayList + * @return A String array with arrayList's contents. + */ + public static String[] arrayListToStrings(ArrayList arrayList) { + String[] strings = new String[arrayList.size()]; + for (int i = 0; i < arrayList.size(); i++) { + strings[i] = (String) arrayList.get(i); + } + return strings; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-07 22:33:29
|
Revision: 6899 Author: victormote Date: 2006-03-07 14:32:59 -0800 (Tue, 07 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6899&view=rev Log Message: ----------- Fix bug in SolitaryLineBreaker causing 32-bit character to be split into 2 16-bit characters. Modified Paths: -------------- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-03-07 20:50:41 UTC (rev 6898) +++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-03-07 22:32:59 UTC (rev 6899) @@ -136,6 +136,7 @@ for (int i = startIndex; i <= endIndex; i++) { /* get the character */ char c = this.currentChars[i]; + int thisCharStarts = i; int codePoint = StringUtilPre5.codePointAt(this.currentChars, i); int charCount = 1; if (StringUtilPre5.isHighSurrogate(c)) { @@ -154,7 +155,7 @@ // If it got this far, it is TEXT. canEatLeadingSpaces = false; int charWidth = charWidth(lineText, codePoint, whitespaceWidth); - processTextChar(language, i, charWidth); + processTextChar(language, thisCharStarts, charWidth); if ((finalWidth + spaceWidth + wordWidth) <= currentLineWidthRemaining()) { @@ -182,7 +183,7 @@ finalWidth += spaceWidth; finalWidth += wordWidth; finalWidth -= charWidth; - createLineContent(start, i - 1, finalWidth, false); + createLineContent(start, i - charCount, finalWidth, false); /* Return the index at the start of this character*/ return i - charCount + 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-07 20:50:51
|
Revision: 6898 Author: victormote Date: 2006-03-07 12:50:41 -0800 (Tue, 07 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6898&view=rev Log Message: ----------- Remove glyphs in foray-latin-extra and related encoding that are found in the CE (Central European) encoding. Modified Paths: -------------- trunk/foray/foray-ps/resource/encoding/foray-latin-extra.txt trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java Modified: trunk/foray/foray-ps/resource/encoding/foray-latin-extra.txt =================================================================== --- trunk/foray/foray-ps/resource/encoding/foray-latin-extra.txt 2006-03-07 19:44:49 UTC (rev 6897) +++ trunk/foray/foray-ps/resource/encoding/foray-latin-extra.txt 2006-03-07 20:50:41 UTC (rev 6898) @@ -7,105 +7,56 @@ # # Character Name Index # -------------- --- -Abreve 041 -Amacron 042 -Aogonek 043 -Cacute 044 -Ccaron 045 -Dcaron 046 -Dcroat 047 -Delta 050 -Ecaron 051 -Edotaccent 052 -Emacron 053 -Eogonek 054 -Gbreve 055 -Gcommaaccent 056 -Idotaccent 057 -Imacron 060 -Iogonek 061 -Kcommaaccent 062 -Lacute 063 -Lcaron 064 -Lcommaaccent 065 -Lslash 066 -Nacute 067 -Ncaron 070 -Ncommaaccent 071 -Ohungarumlaut 072 -Omacron 073 -Racute 074 -Rcaron 075 -Rcommaaccent 076 -Sacute 077 -Scedilla 100 -Scommaaccent 101 -Tcaron 102 -Tcommaaccent 103 -Uhungarumlaut 104 -Umacron 105 -Uogonek 106 -Uring 107 -Zacute 110 -Zdotaccent 111 -abreve 112 -amacron 113 -aogonek 114 -breve 115 -cacute 116 -caron 117 -ccaron 120 -commaaccent 121 -dcaron 122 -dcroat 123 -dotaccent 124 -dotlessi 125 -ecaron 126 -edotaccent 127 -emacron 130 -eogonek 131 -fi 132 -fl 133 -fraction 134 -gbreve 135 -gcommaaccent 136 -greaterequal 137 -hungarumlaut 140 -imacron 141 -iogonek 142 -kcommaaccent 143 -lacute 144 -lcaron 145 -lcommaaccent 146 -lessequal 147 -lozenge 150 -lslash 151 -minus 152 -nacute 153 -ncaron 154 -ncommaaccent 155 -notequal 156 -ogonek 157 -ohungarumlaut 160 -omacron 161 -partialdiff 162 -racute 163 -radical 164 -rcaron 165 -rcommaaccent 166 -ring 167 -sacute 170 -scedilla 171 -scommaaccent 172 + +# First any special characters space 040 -summation 173 -tcaron 174 -tcommaaccent 175 -uhungarumlaut 176 -umacron 177 -uogonek 200 -uring 201 -zacute 202 -zdotaccent 203 +# Now all other glyphs, in no particular order +Amacron 041 +Delta 042 +Edotaccent 043 +Emacron 044 +Gbreve 045 +Gcommaaccent 046 +Idotaccent 047 +Imacron 050 +Iogonek 051 +Kcommaaccent 052 +Lcommaaccent 053 +Ncommaaccent 054 +Omacron 055 +Rcommaaccent 056 +Scedilla 057 +Umacron 060 +Uogonek 061 +amacron 062 +commaaccent 063 +dotlessi 064 +edotaccent 065 +emacron 066 +fi 067 +fl 070 +fraction 071 +gbreve 072 +gcommaaccent 073 +greaterequal 074 +imacron 075 +iogonek 076 +kcommaaccent 077 +lcommaaccent 100 +lessequal 101 +lozenge 102 +minus 103 +ncommaaccent 104 +notequal 105 +omacron 106 +partialdiff 107 +radical 110 +rcommaaccent 111 +ring 112 +scedilla 113 +summation 114 +umacron 115 +uogonek 116 + # Last line of file. Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java 2006-03-07 19:44:49 UTC (rev 6897) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java 2006-03-07 20:50:41 UTC (rev 6898) @@ -49,416 +49,204 @@ /* public static final String[] sortedGlyphNames = { - "Abreve", // [0] glyph-index: 0x0021 \041 - "Amacron", // [1] glyph-index: 0x0022 \042 - "Aogonek", // [2] glyph-index: 0x0023 \043 - "Cacute", // [3] glyph-index: 0x0024 \044 - "Ccaron", // [4] glyph-index: 0x0025 \045 - "Dcaron", // [5] glyph-index: 0x0026 \046 - "Dcroat", // [6] glyph-index: 0x0027 \047 - "Delta", // [7] glyph-index: 0x0028 \050 - "Ecaron", // [8] glyph-index: 0x0029 \051 - "Edotaccent", // [9] glyph-index: 0x002a \052 - "Emacron", // [10] glyph-index: 0x002b \053 - "Eogonek", // [11] glyph-index: 0x002c \054 - "Gbreve", // [12] glyph-index: 0x002d \055 - "Gcommaaccent", // [13] glyph-index: 0x002e \056 - "Idotaccent", // [14] glyph-index: 0x002f \057 - "Imacron", // [15] glyph-index: 0x0030 \060 - "Iogonek", // [16] glyph-index: 0x0031 \061 - "Kcommaaccent", // [17] glyph-index: 0x0032 \062 - "Lacute", // [18] glyph-index: 0x0033 \063 - "Lcaron", // [19] glyph-index: 0x0034 \064 - "Lcommaaccent", // [20] glyph-index: 0x0035 \065 - "Lslash", // [21] glyph-index: 0x0036 \066 - "Nacute", // [22] glyph-index: 0x0037 \067 - "Ncaron", // [23] glyph-index: 0x0038 \070 - "Ncommaaccent", // [24] glyph-index: 0x0039 \071 - "Ohungarumlaut", // [25] glyph-index: 0x003a \072 - "Omacron", // [26] glyph-index: 0x003b \073 - "Racute", // [27] glyph-index: 0x003c \074 - "Rcaron", // [28] glyph-index: 0x003d \075 - "Rcommaaccent", // [29] glyph-index: 0x003e \076 - "Sacute", // [30] glyph-index: 0x003f \077 - "Scedilla", // [31] glyph-index: 0x0040 \100 - "Scommaaccent", // [32] glyph-index: 0x0041 \101 - "Tcaron", // [33] glyph-index: 0x0042 \102 - "Tcommaaccent", // [34] glyph-index: 0x0043 \103 - "Uhungarumlaut", // [35] glyph-index: 0x0044 \104 - "Umacron", // [36] glyph-index: 0x0045 \105 - "Uogonek", // [37] glyph-index: 0x0046 \106 - "Uring", // [38] glyph-index: 0x0047 \107 - "Zacute", // [39] glyph-index: 0x0048 \110 - "Zdotaccent", // [40] glyph-index: 0x0049 \111 - "abreve", // [41] glyph-index: 0x004a \112 - "amacron", // [42] glyph-index: 0x004b \113 - "aogonek", // [43] glyph-index: 0x004c \114 - "breve", // [44] glyph-index: 0x004d \115 - "cacute", // [45] glyph-index: 0x004e \116 - "caron", // [46] glyph-index: 0x004f \117 - "ccaron", // [47] glyph-index: 0x0050 \120 - "commaaccent", // [48] glyph-index: 0x0051 \121 - "dcaron", // [49] glyph-index: 0x0052 \122 - "dcroat", // [50] glyph-index: 0x0053 \123 - "dotaccent", // [51] glyph-index: 0x0054 \124 - "dotlessi", // [52] glyph-index: 0x0055 \125 - "ecaron", // [53] glyph-index: 0x0056 \126 - "edotaccent", // [54] glyph-index: 0x0057 \127 - "emacron", // [55] glyph-index: 0x0058 \130 - "eogonek", // [56] glyph-index: 0x0059 \131 - "fi", // [57] glyph-index: 0x005a \132 - "fl", // [58] glyph-index: 0x005b \133 - "fraction", // [59] glyph-index: 0x005c \134 - "gbreve", // [60] glyph-index: 0x005d \135 - "gcommaaccent", // [61] glyph-index: 0x005e \136 - "greaterequal", // [62] glyph-index: 0x005f \137 - "hungarumlaut", // [63] glyph-index: 0x0060 \140 - "imacron", // [64] glyph-index: 0x0061 \141 - "iogonek", // [65] glyph-index: 0x0062 \142 - "kcommaaccent", // [66] glyph-index: 0x0063 \143 - "lacute", // [67] glyph-index: 0x0064 \144 - "lcaron", // [68] glyph-index: 0x0065 \145 - "lcommaaccent", // [69] glyph-index: 0x0066 \146 - "lessequal", // [70] glyph-index: 0x0067 \147 - "lozenge", // [71] glyph-index: 0x0068 \150 - "lslash", // [72] glyph-index: 0x0069 \151 - "minus", // [73] glyph-index: 0x006a \152 - "nacute", // [74] glyph-index: 0x006b \153 - "ncaron", // [75] glyph-index: 0x006c \154 - "ncommaaccent", // [76] glyph-index: 0x006d \155 - "notequal", // [77] glyph-index: 0x006e \156 - "ogonek", // [78] glyph-index: 0x006f \157 - "ohungarumlaut", // [79] glyph-index: 0x0070 \160 - "omacron", // [80] glyph-index: 0x0071 \161 - "partialdiff", // [81] glyph-index: 0x0072 \162 - "racute", // [82] glyph-index: 0x0073 \163 - "radical", // [83] glyph-index: 0x0074 \164 - "rcaron", // [84] glyph-index: 0x0075 \165 - "rcommaaccent", // [85] glyph-index: 0x0076 \166 - "ring", // [86] glyph-index: 0x0077 \167 - "sacute", // [87] glyph-index: 0x0078 \170 - "scedilla", // [88] glyph-index: 0x0079 \171 - "scommaaccent", // [89] glyph-index: 0x007a \172 - "space", // [90] glyph-index: 0x0020 \040 - "summation", // [91] glyph-index: 0x007b \173 - "tcaron", // [92] glyph-index: 0x007c \174 - "tcommaaccent", // [93] glyph-index: 0x007d \175 - "uhungarumlaut", // [94] glyph-index: 0x007e \176 - "umacron", // [95] glyph-index: 0x007f \177 - "uogonek", // [96] glyph-index: 0x0080 \200 - "uring", // [97] glyph-index: 0x0081 \201 - "zacute", // [98] glyph-index: 0x0082 \202 - "zdotaccent" // [99] glyph-index: 0x0083 \203 + "Amacron", // [0] glyph-index: 0x0021 \041 + "Delta", // [1] glyph-index: 0x0022 \042 + "Edotaccent", // [2] glyph-index: 0x0023 \043 + "Emacron", // [3] glyph-index: 0x0024 \044 + "Gbreve", // [4] glyph-index: 0x0025 \045 + "Gcommaaccent", // [5] glyph-index: 0x0026 \046 + "Idotaccent", // [6] glyph-index: 0x0027 \047 + "Imacron", // [7] glyph-index: 0x0028 \050 + "Iogonek", // [8] glyph-index: 0x0029 \051 + "Kcommaaccent", // [9] glyph-index: 0x002a \052 + "Lcommaaccent", // [10] glyph-index: 0x002b \053 + "Ncommaaccent", // [11] glyph-index: 0x002c \054 + "Omacron", // [12] glyph-index: 0x002d \055 + "Rcommaaccent", // [13] glyph-index: 0x002e \056 + "Scedilla", // [14] glyph-index: 0x002f \057 + "Umacron", // [15] glyph-index: 0x0030 \060 + "Uogonek", // [16] glyph-index: 0x0031 \061 + "amacron", // [17] glyph-index: 0x0032 \062 + "commaaccent", // [18] glyph-index: 0x0033 \063 + "dotlessi", // [19] glyph-index: 0x0034 \064 + "edotaccent", // [20] glyph-index: 0x0035 \065 + "emacron", // [21] glyph-index: 0x0036 \066 + "fi", // [22] glyph-index: 0x0037 \067 + "fl", // [23] glyph-index: 0x0038 \070 + "fraction", // [24] glyph-index: 0x0039 \071 + "gbreve", // [25] glyph-index: 0x003a \072 + "gcommaaccent", // [26] glyph-index: 0x003b \073 + "greaterequal", // [27] glyph-index: 0x003c \074 + "imacron", // [28] glyph-index: 0x003d \075 + "iogonek", // [29] glyph-index: 0x003e \076 + "kcommaaccent", // [30] glyph-index: 0x003f \077 + "lcommaaccent", // [31] glyph-index: 0x0040 \100 + "lessequal", // [32] glyph-index: 0x0041 \101 + "lozenge", // [33] glyph-index: 0x0042 \102 + "minus", // [34] glyph-index: 0x0043 \103 + "ncommaaccent", // [35] glyph-index: 0x0044 \104 + "notequal", // [36] glyph-index: 0x0045 \105 + "omacron", // [37] glyph-index: 0x0046 \106 + "partialdiff", // [38] glyph-index: 0x0047 \107 + "radical", // [39] glyph-index: 0x0048 \110 + "rcommaaccent", // [40] glyph-index: 0x0049 \111 + "ring", // [41] glyph-index: 0x004a \112 + "scedilla", // [42] glyph-index: 0x004b \113 + "space", // [43] glyph-index: 0x0020 \040 + "summation", // [44] glyph-index: 0x004c \114 + "umacron", // [45] glyph-index: 0x004d \115 + "uogonek" // [46] glyph-index: 0x004e \116 }; public static final short[] glyphIndexes = { - 0x0021, // [0] \041 Abreve - 0x0022, // [1] \042 Amacron - 0x0023, // [2] \043 Aogonek - 0x0024, // [3] \044 Cacute - 0x0025, // [4] \045 Ccaron - 0x0026, // [5] \046 Dcaron - 0x0027, // [6] \047 Dcroat - 0x0028, // [7] \050 Delta - 0x0029, // [8] \051 Ecaron - 0x002a, // [9] \052 Edotaccent - 0x002b, // [10] \053 Emacron - 0x002c, // [11] \054 Eogonek - 0x002d, // [12] \055 Gbreve - 0x002e, // [13] \056 Gcommaaccent - 0x002f, // [14] \057 Idotaccent - 0x0030, // [15] \060 Imacron - 0x0031, // [16] \061 Iogonek - 0x0032, // [17] \062 Kcommaaccent - 0x0033, // [18] \063 Lacute - 0x0034, // [19] \064 Lcaron - 0x0035, // [20] \065 Lcommaaccent - 0x0036, // [21] \066 Lslash - 0x0037, // [22] \067 Nacute - 0x0038, // [23] \070 Ncaron - 0x0039, // [24] \071 Ncommaaccent - 0x003a, // [25] \072 Ohungarumlaut - 0x003b, // [26] \073 Omacron - 0x003c, // [27] \074 Racute - 0x003d, // [28] \075 Rcaron - 0x003e, // [29] \076 Rcommaaccent - 0x003f, // [30] \077 Sacute - 0x0040, // [31] \100 Scedilla - 0x0041, // [32] \101 Scommaaccent - 0x0042, // [33] \102 Tcaron - 0x0043, // [34] \103 Tcommaaccent - 0x0044, // [35] \104 Uhungarumlaut - 0x0045, // [36] \105 Umacron - 0x0046, // [37] \106 Uogonek - 0x0047, // [38] \107 Uring - 0x0048, // [39] \110 Zacute - 0x0049, // [40] \111 Zdotaccent - 0x004a, // [41] \112 abreve - 0x004b, // [42] \113 amacron - 0x004c, // [43] \114 aogonek - 0x004d, // [44] \115 breve - 0x004e, // [45] \116 cacute - 0x004f, // [46] \117 caron - 0x0050, // [47] \120 ccaron - 0x0051, // [48] \121 commaaccent - 0x0052, // [49] \122 dcaron - 0x0053, // [50] \123 dcroat - 0x0054, // [51] \124 dotaccent - 0x0055, // [52] \125 dotlessi - 0x0056, // [53] \126 ecaron - 0x0057, // [54] \127 edotaccent - 0x0058, // [55] \130 emacron - 0x0059, // [56] \131 eogonek - 0x005a, // [57] \132 fi - 0x005b, // [58] \133 fl - 0x005c, // [59] \134 fraction - 0x005d, // [60] \135 gbreve - 0x005e, // [61] \136 gcommaaccent - 0x005f, // [62] \137 greaterequal - 0x0060, // [63] \140 hungarumlaut - 0x0061, // [64] \141 imacron - 0x0062, // [65] \142 iogonek - 0x0063, // [66] \143 kcommaaccent - 0x0064, // [67] \144 lacute - 0x0065, // [68] \145 lcaron - 0x0066, // [69] \146 lcommaaccent - 0x0067, // [70] \147 lessequal - 0x0068, // [71] \150 lozenge - 0x0069, // [72] \151 lslash - 0x006a, // [73] \152 minus - 0x006b, // [74] \153 nacute - 0x006c, // [75] \154 ncaron - 0x006d, // [76] \155 ncommaaccent - 0x006e, // [77] \156 notequal - 0x006f, // [78] \157 ogonek - 0x0070, // [79] \160 ohungarumlaut - 0x0071, // [80] \161 omacron - 0x0072, // [81] \162 partialdiff - 0x0073, // [82] \163 racute - 0x0074, // [83] \164 radical - 0x0075, // [84] \165 rcaron - 0x0076, // [85] \166 rcommaaccent - 0x0077, // [86] \167 ring - 0x0078, // [87] \170 sacute - 0x0079, // [88] \171 scedilla - 0x007a, // [89] \172 scommaaccent - 0x0020, // [90] \040 space - 0x007b, // [91] \173 summation - 0x007c, // [92] \174 tcaron - 0x007d, // [93] \175 tcommaaccent - 0x007e, // [94] \176 uhungarumlaut - 0x007f, // [95] \177 umacron - 0x0080, // [96] \200 uogonek - 0x0081, // [97] \201 uring - 0x0082, // [98] \202 zacute - 0x0083 // [99] \203 zdotaccent + 0x0021, // [0] \041 Amacron + 0x0022, // [1] \042 Delta + 0x0023, // [2] \043 Edotaccent + 0x0024, // [3] \044 Emacron + 0x0025, // [4] \045 Gbreve + 0x0026, // [5] \046 Gcommaaccent + 0x0027, // [6] \047 Idotaccent + 0x0028, // [7] \050 Imacron + 0x0029, // [8] \051 Iogonek + 0x002a, // [9] \052 Kcommaaccent + 0x002b, // [10] \053 Lcommaaccent + 0x002c, // [11] \054 Ncommaaccent + 0x002d, // [12] \055 Omacron + 0x002e, // [13] \056 Rcommaaccent + 0x002f, // [14] \057 Scedilla + 0x0030, // [15] \060 Umacron + 0x0031, // [16] \061 Uogonek + 0x0032, // [17] \062 amacron + 0x0033, // [18] \063 commaaccent + 0x0034, // [19] \064 dotlessi + 0x0035, // [20] \065 edotaccent + 0x0036, // [21] \066 emacron + 0x0037, // [22] \067 fi + 0x0038, // [23] \070 fl + 0x0039, // [24] \071 fraction + 0x003a, // [25] \072 gbreve + 0x003b, // [26] \073 gcommaaccent + 0x003c, // [27] \074 greaterequal + 0x003d, // [28] \075 imacron + 0x003e, // [29] \076 iogonek + 0x003f, // [30] \077 kcommaaccent + 0x0040, // [31] \100 lcommaaccent + 0x0041, // [32] \101 lessequal + 0x0042, // [33] \102 lozenge + 0x0043, // [34] \103 minus + 0x0044, // [35] \104 ncommaaccent + 0x0045, // [36] \105 notequal + 0x0046, // [37] \106 omacron + 0x0047, // [38] \107 partialdiff + 0x0048, // [39] \110 radical + 0x0049, // [40] \111 rcommaaccent + 0x004a, // [41] \112 ring + 0x004b, // [42] \113 scedilla + 0x0020, // [43] \040 space + 0x004c, // [44] \114 summation + 0x004d, // [45] \115 umacron + 0x004e // [46] \116 uogonek }; */ public static final char[] codePoints = { 0x0020, // [0] glyph: 0x0020 \0040 - 0x0100, // [1] glyph: 0x0022 \0042 - 0x0101, // [2] glyph: 0x004b \0113 - 0x0102, // [3] glyph: 0x0021 \0041 - 0x0103, // [4] glyph: 0x004a \0112 - 0x0104, // [5] glyph: 0x0023 \0043 - 0x0105, // [6] glyph: 0x004c \0114 - 0x0106, // [7] glyph: 0x0024 \0044 - 0x0107, // [8] glyph: 0x004e \0116 - 0x010c, // [9] glyph: 0x0025 \0045 - 0x010d, // [10] glyph: 0x0050 \0120 - 0x010e, // [11] glyph: 0x0026 \0046 - 0x010f, // [12] glyph: 0x0052 \0122 - 0x0110, // [13] glyph: 0x0027 \0047 - 0x0111, // [14] glyph: 0x0053 \0123 - 0x0112, // [15] glyph: 0x002b \0053 - 0x0113, // [16] glyph: 0x0058 \0130 - 0x0116, // [17] glyph: 0x002a \0052 - 0x0117, // [18] glyph: 0x0057 \0127 - 0x0118, // [19] glyph: 0x002c \0054 - 0x0119, // [20] glyph: 0x0059 \0131 - 0x011a, // [21] glyph: 0x0029 \0051 - 0x011b, // [22] glyph: 0x0056 \0126 - 0x011e, // [23] glyph: 0x002d \0055 - 0x011f, // [24] glyph: 0x005d \0135 - 0x0122, // [25] glyph: 0x002e \0056 - 0x0123, // [26] glyph: 0x005e \0136 - 0x012a, // [27] glyph: 0x0030 \0060 - 0x012b, // [28] glyph: 0x0061 \0141 - 0x012e, // [29] glyph: 0x0031 \0061 - 0x012f, // [30] glyph: 0x0062 \0142 - 0x0130, // [31] glyph: 0x002f \0057 - 0x0131, // [32] glyph: 0x0055 \0125 - 0x0136, // [33] glyph: 0x0032 \0062 - 0x0137, // [34] glyph: 0x0063 \0143 - 0x0139, // [35] glyph: 0x0033 \0063 - 0x013a, // [36] glyph: 0x0064 \0144 - 0x013b, // [37] glyph: 0x0035 \0065 - 0x013c, // [38] glyph: 0x0066 \0146 - 0x013d, // [39] glyph: 0x0034 \0064 - 0x013e, // [40] glyph: 0x0065 \0145 - 0x0141, // [41] glyph: 0x0036 \0066 - 0x0142, // [42] glyph: 0x0069 \0151 - 0x0143, // [43] glyph: 0x0037 \0067 - 0x0144, // [44] glyph: 0x006b \0153 - 0x0145, // [45] glyph: 0x0039 \0071 - 0x0146, // [46] glyph: 0x006d \0155 - 0x0147, // [47] glyph: 0x0038 \0070 - 0x0148, // [48] glyph: 0x006c \0154 - 0x014c, // [49] glyph: 0x003b \0073 - 0x014d, // [50] glyph: 0x0071 \0161 - 0x0150, // [51] glyph: 0x003a \0072 - 0x0151, // [52] glyph: 0x0070 \0160 - 0x0154, // [53] glyph: 0x003c \0074 - 0x0155, // [54] glyph: 0x0073 \0163 - 0x0156, // [55] glyph: 0x003e \0076 - 0x0157, // [56] glyph: 0x0076 \0166 - 0x0158, // [57] glyph: 0x003d \0075 - 0x0159, // [58] glyph: 0x0075 \0165 - 0x015a, // [59] glyph: 0x003f \0077 - 0x015b, // [60] glyph: 0x0078 \0170 - 0x015e, // [61] glyph: 0x0040 \0100 - 0x015f, // [62] glyph: 0x0079 \0171 - 0x0162, // [63] glyph: 0x0043 \0103 - 0x0163, // [64] glyph: 0x007d \0175 - 0x0164, // [65] glyph: 0x0042 \0102 - 0x0165, // [66] glyph: 0x007c \0174 - 0x016a, // [67] glyph: 0x0045 \0105 - 0x016b, // [68] glyph: 0x007f \0177 - 0x016e, // [69] glyph: 0x0047 \0107 - 0x016f, // [70] glyph: 0x0081 \0201 - 0x0170, // [71] glyph: 0x0044 \0104 - 0x0171, // [72] glyph: 0x007e \0176 - 0x0172, // [73] glyph: 0x0046 \0106 - 0x0173, // [74] glyph: 0x0080 \0200 - 0x0179, // [75] glyph: 0x0048 \0110 - 0x017a, // [76] glyph: 0x0082 \0202 - 0x017b, // [77] glyph: 0x0049 \0111 - 0x017c, // [78] glyph: 0x0083 \0203 - 0x0218, // [79] glyph: 0x0041 \0101 - 0x0219, // [80] glyph: 0x007a \0172 - 0x02c7, // [81] glyph: 0x004f \0117 - 0x02d8, // [82] glyph: 0x004d \0115 - 0x02d9, // [83] glyph: 0x0054 \0124 - 0x02da, // [84] glyph: 0x0077 \0167 - 0x02db, // [85] glyph: 0x006f \0157 - 0x02dd, // [86] glyph: 0x0060 \0140 - 0x2044, // [87] glyph: 0x005c \0134 - 0x2202, // [88] glyph: 0x0072 \0162 - 0x2206, // [89] glyph: 0x0028 \0050 - 0x2211, // [90] glyph: 0x007b \0173 - 0x2212, // [91] glyph: 0x006a \0152 - 0x221a, // [92] glyph: 0x0074 \0164 - 0x2260, // [93] glyph: 0x006e \0156 - 0x2264, // [94] glyph: 0x0067 \0147 - 0x2265, // [95] glyph: 0x005f \0137 - 0x25ca, // [96] glyph: 0x0068 \0150 - 0xf6c3, // [97] glyph: 0x0051 \0121 - 0xfb01, // [98] glyph: 0x005a \0132 - 0xfb02 // [99] glyph: 0x005b \0133 + 0x0100, // [1] glyph: 0x0021 \0041 + 0x0101, // [2] glyph: 0x0032 \0062 + 0x0112, // [3] glyph: 0x0024 \0044 + 0x0113, // [4] glyph: 0x0036 \0066 + 0x0116, // [5] glyph: 0x0023 \0043 + 0x0117, // [6] glyph: 0x0035 \0065 + 0x011e, // [7] glyph: 0x0025 \0045 + 0x011f, // [8] glyph: 0x003a \0072 + 0x0122, // [9] glyph: 0x0026 \0046 + 0x0123, // [10] glyph: 0x003b \0073 + 0x012a, // [11] glyph: 0x0028 \0050 + 0x012b, // [12] glyph: 0x003d \0075 + 0x012e, // [13] glyph: 0x0029 \0051 + 0x012f, // [14] glyph: 0x003e \0076 + 0x0130, // [15] glyph: 0x0027 \0047 + 0x0131, // [16] glyph: 0x0034 \0064 + 0x0136, // [17] glyph: 0x002a \0052 + 0x0137, // [18] glyph: 0x003f \0077 + 0x013b, // [19] glyph: 0x002b \0053 + 0x013c, // [20] glyph: 0x0040 \0100 + 0x0145, // [21] glyph: 0x002c \0054 + 0x0146, // [22] glyph: 0x0044 \0104 + 0x014c, // [23] glyph: 0x002d \0055 + 0x014d, // [24] glyph: 0x0046 \0106 + 0x0156, // [25] glyph: 0x002e \0056 + 0x0157, // [26] glyph: 0x0049 \0111 + 0x015e, // [27] glyph: 0x002f \0057 + 0x015f, // [28] glyph: 0x004b \0113 + 0x016a, // [29] glyph: 0x0030 \0060 + 0x016b, // [30] glyph: 0x004d \0115 + 0x0172, // [31] glyph: 0x0031 \0061 + 0x0173, // [32] glyph: 0x004e \0116 + 0x02da, // [33] glyph: 0x004a \0112 + 0x2044, // [34] glyph: 0x0039 \0071 + 0x2202, // [35] glyph: 0x0047 \0107 + 0x2206, // [36] glyph: 0x0022 \0042 + 0x2211, // [37] glyph: 0x004c \0114 + 0x2212, // [38] glyph: 0x0043 \0103 + 0x221a, // [39] glyph: 0x0048 \0110 + 0x2260, // [40] glyph: 0x0045 \0105 + 0x2264, // [41] glyph: 0x0041 \0101 + 0x2265, // [42] glyph: 0x003c \0074 + 0x25ca, // [43] glyph: 0x0042 \0102 + 0xf6c3, // [44] glyph: 0x0033 \0063 + 0xfb01, // [45] glyph: 0x0037 \0067 + 0xfb02 // [46] glyph: 0x0038 \0070 }; public static final char[] codePointIndexes = { 0x0020, // [0] - 0x0022, // [1] - 0x004b, // [2] - 0x0021, // [3] - 0x004a, // [4] + 0x0021, // [1] + 0x0032, // [2] + 0x0024, // [3] + 0x0036, // [4] 0x0023, // [5] - 0x004c, // [6] - 0x0024, // [7] - 0x004e, // [8] - 0x0025, // [9] - 0x0050, // [10] - 0x0026, // [11] - 0x0052, // [12] - 0x0027, // [13] - 0x0053, // [14] - 0x002b, // [15] - 0x0058, // [16] + 0x0035, // [6] + 0x0025, // [7] + 0x003a, // [8] + 0x0026, // [9] + 0x003b, // [10] + 0x0028, // [11] + 0x003d, // [12] + 0x0029, // [13] + 0x003e, // [14] + 0x0027, // [15] + 0x0034, // [16] 0x002a, // [17] - 0x0057, // [18] - 0x002c, // [19] - 0x0059, // [20] - 0x0029, // [21] - 0x0056, // [22] + 0x003f, // [18] + 0x002b, // [19] + 0x0040, // [20] + 0x002c, // [21] + 0x0044, // [22] 0x002d, // [23] - 0x005d, // [24] + 0x0046, // [24] 0x002e, // [25] - 0x005e, // [26] - 0x0030, // [27] - 0x0061, // [28] - 0x0031, // [29] - 0x0062, // [30] - 0x002f, // [31] - 0x0055, // [32] - 0x0032, // [33] - 0x0063, // [34] - 0x0033, // [35] - 0x0064, // [36] - 0x0035, // [37] - 0x0066, // [38] - 0x0034, // [39] - 0x0065, // [40] - 0x0036, // [41] - 0x0069, // [42] - 0x0037, // [43] - 0x006b, // [44] - 0x0039, // [45] - 0x006d, // [46] - 0x0038, // [47] - 0x006c, // [48] - 0x003b, // [49] - 0x0071, // [50] - 0x003a, // [51] - 0x0070, // [52] - 0x003c, // [53] - 0x0073, // [54] - 0x003e, // [55] - 0x0076, // [56] - 0x003d, // [57] - 0x0075, // [58] - 0x003f, // [59] - 0x0078, // [60] - 0x0040, // [61] - 0x0079, // [62] - 0x0043, // [63] - 0x007d, // [64] - 0x0042, // [65] - 0x007c, // [66] - 0x0045, // [67] - 0x007f, // [68] - 0x0047, // [69] - 0x0081, // [70] - 0x0044, // [71] - 0x007e, // [72] - 0x0046, // [73] - 0x0080, // [74] - 0x0048, // [75] - 0x0082, // [76] - 0x0049, // [77] - 0x0083, // [78] - 0x0041, // [79] - 0x007a, // [80] - 0x004f, // [81] - 0x004d, // [82] - 0x0054, // [83] - 0x0077, // [84] - 0x006f, // [85] - 0x0060, // [86] - 0x005c, // [87] - 0x0072, // [88] - 0x0028, // [89] - 0x007b, // [90] - 0x006a, // [91] - 0x0074, // [92] - 0x006e, // [93] - 0x0067, // [94] - 0x005f, // [95] - 0x0068, // [96] - 0x0051, // [97] - 0x005a, // [98] - 0x005b // [99] + 0x0049, // [26] + 0x002f, // [27] + 0x004b, // [28] + 0x0030, // [29] + 0x004d, // [30] + 0x0031, // [31] + 0x004e, // [32] + 0x004a, // [33] + 0x0039, // [34] + 0x0047, // [35] + 0x0022, // [36] + 0x004c, // [37] + 0x0043, // [38] + 0x0048, // [39] + 0x0045, // [40] + 0x0041, // [41] + 0x003c, // [42] + 0x0042, // [43] + 0x0033, // [44] + 0x0037, // [45] + 0x0038 // [46] }; public EncodingFOrayLatinExtra() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-07 19:44:53
|
Revision: 6897 Author: victormote Date: 2006-03-07 11:44:49 -0800 (Tue, 07 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6897&view=rev Log Message: ----------- Add comment to PDF output with name of encoding. Modified Paths: -------------- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java 2006-03-07 19:39:44 UTC (rev 6896) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java 2006-03-07 19:44:49 UTC (rev 6897) @@ -80,6 +80,7 @@ } StringBuffer p = new StringBuffer(); p.append(pdfID() + EOL); + p.append("% " + this.encoding.getName() + EOL); p.append("<< /Type /Encoding" + EOL); p.append(this.encoding.asPostScript(null)); p.append(">>" + EOL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-07 19:39:51
|
Revision: 6896 Author: victormote Date: 2006-03-07 11:39:44 -0800 (Tue, 07 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6896&view=rev Log Message: ----------- Use the standard CE encoding instead of the special FOray catch-all, where possible. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-03-07 18:09:10 UTC (rev 6895) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-03-07 19:39:44 UTC (rev 6896) @@ -187,11 +187,18 @@ return internalEncoding; } if (internalEncoding instanceof EncodingStandard) { + /* Try WinAnsiEncoding. */ trialEncoding = EncodingVector.getPredefinedEncoding( "WinAnsiEncoding"); if (trialEncoding.canEncode(codePoint)) { return trialEncoding; } + /* Try the Central European encoding. */ + trialEncoding = EncodingVector.getPredefinedEncoding("CEEncoding"); + if (trialEncoding.canEncode(codePoint)) { + return trialEncoding; + } + /* Try the FOray catch-all encoding. */ trialEncoding = EncodingVector.getPredefinedEncoding( "FOrayLatinExtraEncoding"); if (trialEncoding.canEncode(codePoint)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-07 18:09:16
|
Revision: 6895 Author: victormote Date: 2006-03-07 10:09:10 -0800 (Tue, 07 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6895&view=rev Log Message: ----------- Add Peter West as contributor. Modified Paths: -------------- trunk/foray/doc/web/project/team.html Modified: trunk/foray/doc/web/project/team.html =================================================================== --- trunk/foray/doc/web/project/team.html 2006-03-07 01:30:19 UTC (rev 6894) +++ trunk/foray/doc/web/project/team.html 2006-03-07 18:09:10 UTC (rev 6895) @@ -28,6 +28,7 @@ <ul> <li>Vincent Hennebert</li> <li>Jeremias Märki</li> + <li>Peter B. West</li> </ul> <h3>FOP development team</h3> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-07 01:30:25
|
Revision: 6894 Author: victormote Date: 2006-03-06 17:30:19 -0800 (Mon, 06 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6894&view=rev Log Message: ----------- Handle some compiler warnings. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-07 01:22:31 UTC (rev 6893) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-07 01:30:19 UTC (rev 6894) @@ -384,6 +384,9 @@ } TTFTableLOCA getTTFTableLOCA() throws IOException { + if (this.locaTable != null) { + return this.locaTable; + } TTFTableDirEntry dirTableEntry = getTTFDirTabEntry("loca"); if (dirTableEntry == null) { /* OTF/CFF fonts don't have a "loca" table. */ @@ -396,6 +399,9 @@ } TTFTableGLYF getTTFTableGLYF() throws IOException { + if (this.glyfTable != null) { + return this.glyfTable; + } TTFTableDirEntry dirTableEntry = getTTFDirTabEntry("glyf"); if (dirTableEntry == null) { /* OTF/CFF fonts don't have a "glyf" table. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-07 01:22:49
|
Revision: 6893 Author: victormote Date: 2006-03-06 17:22:31 -0800 (Mon, 06 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6893&view=rev Log Message: ----------- Make TTFFont variables private. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFSubSetFile.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableGLYF.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHMTX.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableLOCA.java Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-07 00:58:30 UTC (rev 6892) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-07 01:22:31 UTC (rev 6893) @@ -41,26 +41,26 @@ * The TTFTableDirectory in ttfFile which lists the tables that are in this * TTFFont instance. */ - TTFTableDirectory ttfTableDir = null; + private TTFTableDirectory ttfTableDir = null; /** * For convenience only. TODO: Remove after the table-building logic is * cleaned up. */ - FontFileReader in = null; + private FontFileReader in = null; - TTFTableHEAD headTable = null; - TTFTableMAXP maxpTable = null; - TTFTableHHEA hheaTable = null; - TTFTableHMTX hmtxTable = null; - TTFTablePOST postTable = null; - TTFTableOS2 os2Table = null; - TTFTableLOCA locaTable = null; - TTFTableGLYF glyfTable = null; - TTFTableNAME nameTable = null; - TTFTablePCLT pcltTable = null; - TTFTableCMAP cmapTable = null; - TTFTableKERN kernTable = null; + private TTFTableHEAD headTable = null; + private TTFTableMAXP maxpTable = null; + private TTFTableHHEA hheaTable = null; + private TTFTableHMTX hmtxTable = null; + private TTFTablePOST postTable = null; + private TTFTableOS2 os2Table = null; + private TTFTableLOCA locaTable = null; + private TTFTableGLYF glyfTable = null; + private TTFTableNAME nameTable = null; + private TTFTablePCLT pcltTable = null; + private TTFTableCMAP cmapTable = null; + private TTFTableKERN kernTable = null; /** * Private constructor suitable for creating an instance that represents a Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFSubSetFile.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFSubSetFile.java 2006-03-07 00:58:30 UTC (rev 6892) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFSubSetFile.java 2006-03-07 01:22:31 UTC (rev 6893) @@ -369,7 +369,7 @@ int origGlyphIndex = this.subset.decodeSubsetIndex(i); int glyphLength = computeGlyphLength(origGlyphIndex); int glyphOffset = - (int) ttfFont.hmtxTable.metrics[origGlyphIndex].offset; + (int) ttfFont.getTTFTableHMTX().metrics[origGlyphIndex].offset; int fileOffset = entry.getOffset() + glyphOffset; // Copy glyph System.arraycopy( @@ -391,18 +391,18 @@ return remapComposite(byteArray); } - private int computeGlyphLength(int origGlyphIndex) { + private int computeGlyphLength(int origGlyphIndex) throws IOException { int nextOffset = 0; - if (origGlyphIndex >= (ttfFont.hmtxTable.metrics.length - 1)) { - nextOffset = (int) ttfFont.locaTable.lastLoca; + if (origGlyphIndex >= (ttfFont.getTTFTableHMTX().metrics.length - 1)) { + nextOffset = (int) ttfFont.getTTFTableLOCA().lastLoca; } else { nextOffset = - (int) ttfFont.hmtxTable.metrics[origGlyphIndex + 1].offset; + (int) ttfFont.getTTFTableHMTX().metrics[origGlyphIndex + 1].offset; } int glyphLength = 0; glyphLength = nextOffset - - (int) ttfFont.hmtxTable.metrics[origGlyphIndex].offset; + - (int) ttfFont.getTTFTableHMTX().metrics[origGlyphIndex].offset; return glyphLength; } @@ -423,9 +423,9 @@ for (int i = 0; i < subset.numGlyphsUsed(); i ++) { int originalIndex = this.subset.decodeSubsetIndex(i); writeUShort(byteArray, i * 4, - ttfFont.hmtxTable.metrics[originalIndex].wx); + ttfFont.getTTFTableHMTX().metrics[originalIndex].wx); writeUShort(byteArray, (i * 4) + 2, - ttfFont.hmtxTable.metrics[originalIndex].lsb); + ttfFont.getTTFTableHMTX().metrics[originalIndex].lsb); } return byteArray; } @@ -439,7 +439,7 @@ List ret = new ArrayList(); ret.add(glyphIdx); int offset = glyphOffset - + (int)ttfFont.hmtxTable.metrics[glyphIdx.intValue()].offset + + (int) ttfFont.getTTFTableHMTX().metrics[glyphIdx.intValue()].offset + 10; Integer compositeIdx = null; int flags = 0; @@ -576,7 +576,7 @@ int originalIndex = this.subset.decodeSubsetIndex(i); Integer origIndex = new Integer(originalIndex); long glyphOffset = - ttfFont.hmtxTable.metrics[originalIndex].offset; + ttfFont.getTTFTableHMTX().metrics[originalIndex].offset; /* * Save the current position so that we can go back to it after * this test. Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java 2006-03-07 00:58:30 UTC (rev 6892) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java 2006-03-07 01:22:31 UTC (rev 6893) @@ -85,7 +85,7 @@ return tableDirEntry; } TTFTableDirEntry entry - = ttfFont.ttfTableDir.getTableDirectoryEntry(getTableTag()); + = ttfFont.getTTFDirTabEntry(getTableTag()); if (entry == null) { getLogger().error("Dirtab " + getTableTag() + " not found."); Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableGLYF.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableGLYF.java 2006-03-07 00:58:30 UTC (rev 6892) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableGLYF.java 2006-03-07 01:22:31 UTC (rev 6893) @@ -41,8 +41,8 @@ */ protected void parseTable() throws IOException { TTFTableDirEntry dirTab = ttfFont.getTTFDirTabEntry("glyf"); - TTFMtxEntry[] metricsTable = ttfFont.hmtxTable.metrics; - for (int i = 0; i < (ttfFont.maxpTable.numGlyphs - 1); i++) { + TTFMtxEntry[] metricsTable = ttfFont.getTTFTableHMTX().metrics; + for (int i = 0; i < (ttfFont.getTTFTableMAXP().numGlyphs - 1); i++) { if (metricsTable[i].offset != metricsTable[i + 1].offset) { getReader().seek(dirTab.getOffset() + metricsTable[i].offset); getReader().skipBytes(2); @@ -60,7 +60,7 @@ int n = dirTab.getOffset(); - for (int i = 0; i < ttfFont.maxpTable.numGlyphs; i++) { + for (int i = 0; i < ttfFont.getTTFTableMAXP().numGlyphs; i++) { if ((i + 1) >= metricsTable.length || metricsTable[i].offset != metricsTable[i + 1].offset) { getReader().seek(n + metricsTable[i].offset); Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHMTX.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHMTX.java 2006-03-07 00:58:30 UTC (rev 6892) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHMTX.java 2006-03-07 01:22:31 UTC (rev 6893) @@ -45,10 +45,10 @@ */ protected void parseTable() throws IOException { int metricsSize; - if (ttfFont.maxpTable.numGlyphs > ttfFont.hheaTable.numberOfHMetrics) { - metricsSize = ttfFont.maxpTable.numGlyphs; + if (ttfFont.getTTFTableMAXP().numGlyphs > ttfFont.getTTFTableHHEA().numberOfHMetrics) { + metricsSize = ttfFont.getTTFTableMAXP().numGlyphs; } else { - metricsSize = ttfFont.hheaTable.numberOfHMetrics; + metricsSize = ttfFont.getTTFTableHHEA().numberOfHMetrics; } metrics = new TTFMtxEntry[metricsSize]; @@ -56,17 +56,17 @@ for (int i = 0; i < metricsSize; i++) { metrics[i] = new TTFMtxEntry(); } - for (int i = 0; i < ttfFont.hheaTable.numberOfHMetrics; i++) { + for (int i = 0; i < ttfFont.getTTFTableHHEA().numberOfHMetrics; i++) { metrics[i].wx = getReader().readUnsignedShort(); metrics[i].lsb = getReader().readShort(); getLogger().debug(" width[" + i + "] = " + ttfFont.get_ttf_funit(metrics[i].wx) + ";"); } - if (ttfFont.hheaTable.numberOfHMetrics < metricsSize) { + if (ttfFont.getTTFTableHHEA().numberOfHMetrics < metricsSize) { // Fill in the missing widths - int lastWidth = metrics[ttfFont.hheaTable.numberOfHMetrics - 1].wx; - for (int i = ttfFont.hheaTable.numberOfHMetrics; i < metricsSize; + int lastWidth = metrics[ttfFont.getTTFTableHHEA().numberOfHMetrics - 1].wx; + for (int i = ttfFont.getTTFTableHHEA().numberOfHMetrics; i < metricsSize; i++) { metrics[i].wx = lastWidth; metrics[i].lsb = getReader().readShort(); Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableLOCA.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableLOCA.java 2006-03-07 00:58:30 UTC (rev 6892) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableLOCA.java 2006-03-07 01:22:31 UTC (rev 6893) @@ -41,16 +41,16 @@ * Read the "loca" table */ protected void parseTable() throws IOException { - for (int i = 0; i < ttfFont.maxpTable.numGlyphs; i++) { - if (ttfFont.headTable.indexToLocFormat == 1) { - ttfFont.hmtxTable.metrics[i].offset + for (int i = 0; i < ttfFont.getTTFTableMAXP().numGlyphs; i++) { + if (ttfFont.getTTFTableHEAD().indexToLocFormat == 1) { + ttfFont.getTTFTableHMTX().metrics[i].offset = getReader().readUnsignedInt(); } else { - ttfFont.hmtxTable.metrics[i].offset + ttfFont.getTTFTableHMTX().metrics[i].offset = getReader().readUnsignedShort() << 1; } } - if (ttfFont.headTable.indexToLocFormat == 1) { + if (ttfFont.getTTFTableHEAD().indexToLocFormat == 1) { lastLoca = getReader().readUnsignedInt(); } else { lastLoca = getReader().readUnsignedShort() << 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-07 00:58:36
|
Revision: 6892 Author: victormote Date: 2006-03-06 16:58:30 -0800 (Mon, 06 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6892&view=rev Log Message: ----------- Fix bug in TTF kerning build logic. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-07 00:48:01 UTC (rev 6891) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2006-03-07 00:58:30 UTC (rev 6892) @@ -287,10 +287,10 @@ } public Kerning getKerning() { - if (kernTable == null) { + if (this.kernTable == null) { return new Kerning(0); } - return kernTable.kerningTab; + return this.kernTable.kerningTab; } public boolean isEmbeddable() { Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java 2006-03-07 00:48:01 UTC (rev 6891) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java 2006-03-07 00:58:30 UTC (rev 6892) @@ -79,6 +79,7 @@ getReader().skipBytes(2); // Entry selector getReader().skipBytes(2); // Range shift TTFTableCMAP cmapTable = null; + cmapTable = this.ttfFont.getTTFTableCMAP(); if (cmapTable == null) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-07 00:48:07
|
Revision: 6891 Author: victormote Date: 2006-03-06 16:48:01 -0800 (Mon, 06 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6891&view=rev Log Message: ----------- Enhance Kerning to handle 32-bit code points gracefully. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java 2006-03-06 23:40:57 UTC (rev 6890) +++ trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java 2006-03-07 00:48:01 UTC (rev 6891) @@ -33,20 +33,35 @@ */ public class Kerning { /* - * This class maintins three parallel arrays. - * Taken together, element "n" in the three arrays describes one kerning - * pair. + * This class maintins 2 sets of three parallel arrays. One set is used + * for kerning pairs where both code points are less than or equal to + * 0xFFFF. The other set is used for kerning pairs where at least one of + * the code points requires more than 16 bits. + * + * For each set, when taken together, element "n" in the three arrays + * describes one kerning pair. * The first array contains the first Unicode code point in a kerning pair, * the second contains the second Unicode code point in the kerning pair, * and the third contains the kern value. + * + * Until the instance is locked, all data is accumulated in the 32-bit + * variables. Then as part of the locking process, any 16-bit pairs are + * moved to the 16-bit variables. Thus, once the instance is built, the + * memory consumption is minimized. */ - private char[] firstChars; + private int[] firstChars32; - private char[] secondChars; + private int[] secondChars32; - private short[] kernAmount; + private short[] kernAmount32; + private char[] firstChars16; + + private char[] secondChars16; + + private short[] kernAmount16; + /** Stores the index to the last kerning entry that was added. */ private int lastIndex = -1; @@ -63,9 +78,9 @@ if (expectedPairs < 1) { expectedPairs = 1; } - firstChars = new char[expectedPairs]; - secondChars = new char[expectedPairs]; - kernAmount = new short[expectedPairs]; + this.firstChars32 = new int[expectedPairs]; + this.secondChars32 = new int[expectedPairs]; + this.kernAmount32 = new short[expectedPairs]; } /** @@ -83,22 +98,22 @@ return; } // Increase size of firstChars - char[] newChars = new char[this.firstChars.length + pairsToAdd]; - System.arraycopy(this.firstChars, 0, newChars, 0, - this.firstChars.length); + int[] newChars = new int[this.firstChars32.length + pairsToAdd]; + System.arraycopy(this.firstChars32, 0, newChars, 0, + this.firstChars32.length); - this.firstChars = newChars; + this.firstChars32 = newChars; // Increase size of secondChars - newChars = new char[this.secondChars.length + pairsToAdd]; - System.arraycopy(this.secondChars, 0, newChars, 0, - this.secondChars.length); - this.secondChars = newChars; + newChars = new int[this.secondChars32.length + pairsToAdd]; + System.arraycopy(this.secondChars32, 0, newChars, 0, + this.secondChars32.length); + this.secondChars32 = newChars; // Increase size of firstChars - short[] newShorts = new short[this.kernAmount.length + pairsToAdd]; - System.arraycopy(this.kernAmount, 0, newShorts, 0, - this.kernAmount.length); - this.kernAmount = newShorts; + short[] newShorts = new short[this.kernAmount32.length + pairsToAdd]; + System.arraycopy(this.kernAmount32, 0, newShorts, 0, + this.kernAmount32.length); + this.kernAmount32 = newShorts; } /** @@ -120,12 +135,12 @@ return; } this.lastIndex++; - if (this.lastIndex >= this.firstChars.length) { + if (this.lastIndex >= this.firstChars32.length) { addCapacity(10); } - this.firstChars[this.lastIndex] = (char) char1; - this.secondChars[this.lastIndex] = (char) char2; - this.kernAmount[this.lastIndex] = kernAmount; + this.firstChars32[this.lastIndex] = char1; + this.secondChars32[this.lastIndex] = char2; + this.kernAmount32[this.lastIndex] = kernAmount; } /** @@ -136,6 +151,7 @@ public void lock() { this.isLocked = true; sortKerning(); + splitKerning(); } /** @@ -155,11 +171,22 @@ if (! this.isLocked) { return 0; } - int index = indexOfKerningPair(char1, char2); + int index = 0; + if (char1 > 0xFFFF + || char2 > 0xFFFF) { + /* Look in the 32-bit pairs. */ + index = indexOfKerningPair32(char1, char2); + if (index < 0) { + return 0; + } + return this.kernAmount32[index]; + } + /* Look in the 16-bit pairs. */ + index = indexOfKerningPair16((char) char1, (char) char2); if (index < 0) { return 0; } - return this.kernAmount[index]; + return this.kernAmount16[index]; } public boolean isEmpty() { @@ -173,29 +200,29 @@ boolean anyChanges = true; while (anyChanges) { anyChanges = false; - for (int i = 0; i < firstChars.length - 1; i++) { + for (int i = 0; i < firstChars32.length - 1; i++) { boolean switchNeeded = false; - if (firstChars[i] > firstChars[i + 1]) { + if (firstChars32[i] > firstChars32[i + 1]) { switchNeeded = true; - } else if (firstChars[i] == firstChars[i + 1]) { - if (secondChars[i] > secondChars[i + 1]) { + } else if (firstChars32[i] == firstChars32[i + 1]) { + if (secondChars32[i] > secondChars32[i + 1]) { switchNeeded = true; } } if (switchNeeded) { /* They are out of order. Reverse these two elements in * all three arrays. Start with firstChars. */ - char saveChar = firstChars[i]; - firstChars[i] = firstChars[i + 1]; - firstChars[i + 1] = saveChar; + int saveChar = firstChars32[i]; + firstChars32[i] = firstChars32[i + 1]; + firstChars32[i + 1] = saveChar; /* Now reverse secondChars. */ - saveChar = secondChars[i]; - secondChars[i] = this.secondChars[i + 1]; - this.secondChars[i + 1] = saveChar; + saveChar = secondChars32[i]; + secondChars32[i] = this.secondChars32[i + 1]; + this.secondChars32[i + 1] = saveChar; /* Now reverse the kerning amounts. */ - short saveShort = this.kernAmount[i]; - this.kernAmount[i] = this.kernAmount[i + 1]; - this.kernAmount[i + 1] = saveShort; + short saveShort = this.kernAmount32[i]; + this.kernAmount32[i] = this.kernAmount32[i + 1]; + this.kernAmount32[i + 1] = saveShort; /* Record that a change was made. */ anyChanges = true; } @@ -203,35 +230,81 @@ } } + private void splitKerning() { + /* Count the 32-bit items. */ + int index32bits = 0; + for (int i = 0; i < this.lastIndex; i++) { + if (this.firstChars32[i] > 0xFFFF + || this.secondChars32[i] > 0xFFFF) { + index32bits ++; + } + } + /* Count the 16-bit items. */ + int index16bits = this.lastIndex + 1 - index32bits; + + /* Create empty 16-bit arrays. */ + this.firstChars16 = new char[index16bits]; + this.secondChars16 = new char[index16bits]; + this.kernAmount16 = new short[index16bits]; + + /* Move the comprehensive arrays to local variables. */ + int[] tempFirstChars32 = this.firstChars32; + int[] tempSecondChars32 = this.secondChars32; + short[] tempKernAmount32 = this.kernAmount32; + + /* Create empty 32-bit arrays. */ + this.firstChars32 = new int[index32bits]; + this.secondChars32 = new int[index32bits]; + this.kernAmount32 = new short[index32bits]; + + /* The local arrays are already sorted. All we need to do is copy each + * item into the proper array. */ + index16bits = 0; + index32bits = 0; + for (int i = 0; i < this.lastIndex; i++) { + if (tempFirstChars32[i] > 0xFFFF + || tempSecondChars32[i] > 0xFFFF) { + this.firstChars32[index32bits] = tempFirstChars32[i]; + this.secondChars32[index32bits] = tempSecondChars32[i]; + this.kernAmount32[index32bits] = tempKernAmount32[i]; + index32bits ++; + } else { + this.firstChars16[index16bits] = (char) tempFirstChars32[i]; + this.secondChars16[index16bits] = (char) tempSecondChars32[i]; + this.kernAmount16[index16bits] = tempKernAmount32[i]; + index16bits ++; + } + } + } + /** - * Uses a binary search to search both {@link #firstChars} and - * {@link #secondChars} arrays for a match. + * Uses a binary search to search both {@link #firstChars16} and + * {@link #secondChars16} arrays for a match. * This routine assumes that the three arrays have been sorted in parallel, - * using {@link #firstChars} as the primary key and {@link #secondChars} + * using {@link #firstChars16} as the primary key and {@link #secondChars16} * as the secondary key. - * No checking of the truth of this assumption is made. - * @param char1 The first char in the kerning pair. - * @param char2 The second char in the kerning pair. + * @param codePoint1 The first code point in the kerning pair. + * @param codePoint2 The second code point in the kerning pair. * @return The index (0 through stringArray.length - 1) of the matching * element, or -1 if no match is found. */ - private int indexOfKerningPair(int char1, int char2) { + private int indexOfKerningPair16(char codePoint1, char codePoint2) { int bottom = 0; - int top = this.firstChars.length - 1; + int top = this.firstChars16.length - 1; while (top >= bottom) { int mid = (bottom + top) / 2; - if (char1 == this.firstChars[mid]) { - if (char2 == this.secondChars[mid]) { + if (codePoint1 == this.firstChars16[mid]) { + if (codePoint2 == this.secondChars16[mid]) { // This is the item we are looking for. Return it. return mid; - } else if (char2 < this.secondChars[mid]) { + } else if (codePoint2 < this.secondChars16[mid]) { // Look next time in the bottom half top = mid - 1; } else { // Look next time in the top half bottom = mid + 1; } - } else if (char1 < this.firstChars[mid]) { + } else if (codePoint1 < this.firstChars16[mid]) { // Look next time in the bottom half top = mid - 1; } else { @@ -243,4 +316,43 @@ return -1; } + /** + * Uses a binary search to search both {@link #firstChars32} and + * {@link #secondChars32} arrays for a match. + * This routine assumes that the three arrays have been sorted in parallel, + * using {@link #firstChars32} as the primary key and {@link #secondChars32} + * as the secondary key. + * @param codePoint1 The first code point in the kerning pair. + * @param codePoint2 The second code point in the kerning pair. + * @return The index (0 through stringArray.length - 1) of the matching + * element, or -1 if no match is found. + */ + private int indexOfKerningPair32(int codePoint1, int codePoint2) { + int bottom = 0; + int top = this.firstChars32.length - 1; + while (top >= bottom) { + int mid = (bottom + top) / 2; + if (codePoint1 == this.firstChars32[mid]) { + if (codePoint2 == this.secondChars32[mid]) { + // This is the item we are looking for. Return it. + return mid; + } else if (codePoint2 < this.secondChars32[mid]) { + // Look next time in the bottom half + top = mid - 1; + } else { + // Look next time in the top half + bottom = mid + 1; + } + } else if (codePoint1 < this.firstChars32[mid]) { + // Look next time in the bottom half + top = mid - 1; + } else { + // Look next time in the top half + bottom = mid + 1; + } + } + // If not found, return an invalid index + return -1; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-06 23:41:08
|
Revision: 6890 Author: victormote Date: 2006-03-06 15:40:57 -0800 (Mon, 06 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6890&view=rev Log Message: ----------- Enhance CharSet to handle 32-bit code points gracefully. Modified Paths: -------------- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java Modified: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java 2006-03-04 22:59:26 UTC (rev 6889) +++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java 2006-03-06 23:40:57 UTC (rev 6890) @@ -56,30 +56,114 @@ private String name; - private char[] characterSet; + /** Holds 16-bit Unicode codepoints. */ + private char[] characterSet16; + /** Holds 32-bit Unicode codepoints. These are conceptually appended to the + * end of {@link #characterSet16} as if they were all in one array. */ + private int[] characterSet32; + /** - * Create a new CharSet instance. + * Constructor suitable for character sets that contain only 16-bit + * characters. If there are any 32-bit code points in the character set, + * use {@link #CharSet(String, int[])} instead. + * @param name The name of this character set. + * @param characterSet The array containing the code points in this + * character set. */ public CharSet(String name, char[] characterSet) { this.name = name; - this.characterSet = characterSet; + if (characterSet == null) { + return; + } + /* Make sure the input array is sorted. */ + Arrays.sort(characterSet); + this.characterSet16 = characterSet; } + /** + * General constructor suitable for character sets containing 16-bit + * codePoints, 32-bit code points, or both. + * If all code points in the character set are 16-bit (less than or equal to + * 0xFFFF), then {@link #CharSet(String, char[])} may also be used. + * @param name The name of this character set. + * @param characterSet The array containing the code points in this + * character set. + */ + public CharSet(String name, int[] characterSet) { + this.name = name; + if (characterSet == null) { + return; + } + + /* Make sure the input array is sorted. */ + Arrays.sort(characterSet); + + /* Find the index to the first code point > 0xFFFF. */ + int first32bitIndex = Integer.MAX_VALUE; + for (int i = characterSet.length - 1; i > -1 && first32bitIndex < 0; + i--) { + if (characterSet[i] <= 0xFFFF) { + /* We are down to the 16-bit items, so we are done. */ + break; + } + /* We are still in the 32-bit items, so this one is now the first + * known 32-bit item. */ + first32bitIndex = i; + } + + /* Split the input array into 2 arrays, one for 16-bit items, one for + * 32-bit items. */ + if (first32bitIndex == Integer.MAX_VALUE) { + /* There are no 32-bit values. */ + this.characterSet32 = null; + this.characterSet16 = new char[characterSet.length]; + for (int i = 0; i < characterSet.length; i++) { + this.characterSet16[i] = (char) characterSet[i]; + } + } else { + int num16bits = first32bitIndex; + int num32bits = characterSet.length - num16bits; + this.characterSet16 = new char[num16bits]; + for (int i = 0; i < first32bitIndex; i++) { + this.characterSet16[i] = (char) characterSet[i]; + } + this.characterSet32 = new int[num32bits]; + for (int i = first32bitIndex; i < characterSet.length; i++) { + this.characterSet32[i - first32bitIndex] = characterSet[i]; + } + } + } + public String getName() { return this.name; } /** * Returns the array index for a character in this character set. - * @param c The character whose index should be found. - * @return The index for c, or -1 if c is not in the character set. + * @param codePoint The character whose index should be found. + * @return The index for codePoint, or -1 if codePoint is not in the + * character set. */ - public int getCharSetIndex(int c) { - if (this.characterSet == null) { - return -1; + public int getCharSetIndex(int codePoint) { + int index = -1; + if (this.characterSet16 != null) { + index = Arrays.binarySearch(this.characterSet16, (char) codePoint); } - return Arrays.binarySearch(this.characterSet, (char) c); + if (index > -1) { + return index; + } + if (this.characterSet32 != null) { + index = Arrays.binarySearch(this.characterSet32, codePoint); + if (index > -1 + && this.characterSet16 != null) { + index += this.characterSet16.length; + } + } + if (index < 0) { + index = -1; + } + return index; } /** @@ -107,7 +191,14 @@ } public int size() { - return this.characterSet.length; + int size = 0; + if (this.characterSet16 != null) { + size += this.characterSet16.length; + } + if (this.characterSet32 != null) { + size += this.characterSet32.length; + } + return size; } } Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2006-03-04 22:59:26 UTC (rev 6889) +++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2006-03-06 23:40:57 UTC (rev 6890) @@ -299,7 +299,7 @@ /** If we need to build a CharSet for this font, this array is where the * characters are accumulated, then later sorted, and eventually is used * to create the CharSet instance. */ - private char[] charArray = null; + private int[] codePoints = null; /** The next index to be used as charArray is built. */ private int nextCharArrayIndex = 0; @@ -764,7 +764,7 @@ this.charSet = CharSet.getRegisteredCharSet(this.charSetString); } if (this.charSet == null) { - this.charArray = new char[qtyCharMetricsExpected]; + this.codePoints = new int[qtyCharMetricsExpected]; } this.extentTable = new short[qtyCharMetricsExpected]; // 256 is the maximum size needed. The actual encoding may be less. @@ -790,12 +790,12 @@ boolean anyChanges = true; while (anyChanges) { anyChanges = false; - for (int i = 0; i < this.charArray.length - 1; i++) { - if (this.charArray[i] > this.charArray[i + 1]) { + for (int i = 0; i < this.codePoints.length - 1; i++) { + if (this.codePoints[i] > this.codePoints[i + 1]) { /* They are out of order. Switch them. */ - char saveChar = this.charArray[i]; - this.charArray[i] = this.charArray[i + 1]; - this.charArray[i + 1] = saveChar; + int saveInt = this.codePoints[i]; + this.codePoints[i] = this.codePoints[i + 1]; + this.codePoints[i + 1] = saveInt; /* Also switch the same elements in the width array. */ short saveShort = this.extentTable[i]; this.extentTable[i] = this.extentTable[i + 1]; @@ -804,7 +804,7 @@ } } } - this.charSet = new CharSet(this.postscriptName, this.charArray); + this.charSet = new CharSet(this.postscriptName, this.codePoints); } private void c() { @@ -1072,7 +1072,7 @@ // We are building the charset as we go. charIndex = this.nextCharArrayIndex; this.nextCharArrayIndex++; - this.charArray[charIndex] = theChar; + this.codePoints[charIndex] = theChar; } else { charIndex = charSet.getCharSetIndex(theChar); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-04 22:59:56
|
Revision: 6889 Author: victormote Date: 2006-03-04 14:59:26 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6889&view=rev Log Message: ----------- 1. Conform to aXSL changes, replacing some char interfaces with code points. 2. Other code point use fixes. Modified Paths: -------------- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-03-04 22:17:43 UTC (rev 6888) +++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-03-04 22:59:26 UTC (rev 6889) @@ -180,8 +180,8 @@ return traitGeneratedBy().getPrimaryFont(); } - public FontUse getSecondaryFont(char c) { - return traitGeneratedBy().getSecondaryFont(c); + public FontUse getSecondaryFont(int codePoint) { + return traitGeneratedBy().getSecondaryFont(codePoint); } public int getAscender() { Modified: trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java 2006-03-04 22:17:43 UTC (rev 6888) +++ trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java 2006-03-04 22:59:26 UTC (rev 6889) @@ -91,6 +91,13 @@ } /** + * Mimics Java 5.0: Character.isSupplementaryCodePoint(int). + */ + public static boolean isSupplementaryCodePoint(int codePoint) { + return UCharacter.isSupplementaryCodePoint(codePoint); + } + + /** * Mimics Java 5.0: String(int[], int, int). */ public static String newString(int[] codePoints, int offset, int count) { Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-03-04 22:17:43 UTC (rev 6888) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-03-04 22:59:26 UTC (rev 6889) @@ -108,7 +108,7 @@ return this.fontUses; } - public FOrayFontUse selectFontUse(RegisteredFontDesc rfd, char c) { + public FOrayFontUse selectFontUse(RegisteredFontDesc rfd, int codePoint) { FOrayFontUse fontUse = null; /* Check existing FontUse instances. */ for (int i = 0; i < this.fontUses.size() && fontUse == null; i++) { @@ -117,7 +117,7 @@ continue; } org.axsl.ps.Encoding encoding = trialFontUse.getEncoding(); - if (encoding.encodeCharacter(c) == 0) { + if (encoding.encodeCharacter(codePoint) == 0) { continue; } fontUse = trialFontUse; @@ -129,7 +129,7 @@ if (rfd == null) { return null; } - Encoding encoding = findEncoding(rfd, c); + Encoding encoding = findEncoding(rfd, codePoint); if (encoding == null) { /* We can't encode this character. We need to return null so that * the upstream font selection routines can try another font @@ -158,7 +158,7 @@ return new FOrayFontUse(this, rfd, encoding); } - public Encoding findEncoding(RegisteredFontDesc rfd, char c) { + public Encoding findEncoding(RegisteredFontDesc rfd, int codePoint) { switch (this.consumer.getEncodingLatitude()) { case FOrayFontConsumer.ENCODING_SPECIFIED_ONLY: { return rfd.getEncoding(); @@ -167,13 +167,13 @@ return (Encoding) this.font.getInternalEncoding(); } case FOrayFontConsumer.ENCODING_ANY: { - return getBestEncoding(c); + return getBestEncoding(codePoint); } } return null; } - private Encoding getBestEncoding(char c) { + private Encoding getBestEncoding(int codePoint) { Encoding trialEncoding = null; Encoding internalEncoding = (Encoding) this.font.getInternalEncoding(); if (! (internalEncoding instanceof EncodingVector)) { @@ -189,16 +189,16 @@ if (internalEncoding instanceof EncodingStandard) { trialEncoding = EncodingVector.getPredefinedEncoding( "WinAnsiEncoding"); - if (trialEncoding.canEncode(c)) { + if (trialEncoding.canEncode(codePoint)) { return trialEncoding; } trialEncoding = EncodingVector.getPredefinedEncoding( "FOrayLatinExtraEncoding"); - if (trialEncoding.canEncode(c)) { + if (trialEncoding.canEncode(codePoint)) { return trialEncoding; } } - if (internalEncoding.canEncode(c)) { + if (internalEncoding.canEncode(codePoint)) { return internalEncoding; } return null; Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2006-03-04 22:17:43 UTC (rev 6888) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2006-03-04 22:59:26 UTC (rev 6889) @@ -160,7 +160,7 @@ * {@inheritDoc} */ public org.axsl.font.FontUse selectFontXSL(String [] familyList, int style, - int weight, int variant, int stretch, int size, char c) + int weight, int variant, int stretch, int size, int codePoint) throws FontException { /* The algorithm for font selection is described in the CSS 2 * standard at Section 15.5. @@ -182,7 +182,7 @@ continue; } /* Use the SystemFont or FreeStandingFont? */ - fontSelected = whichUse(fontDescSelected, c); + fontSelected = whichUse(fontDescSelected, codePoint); /* Skip this font-family if we can't use the type of font it * supports or if it can't encode the character. */ if (fontSelected == null) { @@ -208,7 +208,7 @@ } FOrayConsumerFont consumerFont = registerFontUse(fontSelected); /* Selection of the actual FontUse is delegated to consumerFont. */ - FOrayFontUse fontUse = consumerFont.selectFontUse(fontDescSelected, c); + FOrayFontUse fontUse = consumerFont.selectFontUse(fontDescSelected, codePoint); return fontUse; } @@ -251,10 +251,10 @@ * font. * @return The FontUse instance dictated by the parameters of consumer. */ - protected FOrayFont whichUse(RegisteredFontDesc rfd, char c) { + protected FOrayFont whichUse(RegisteredFontDesc rfd, int codePoint) { RegisteredFont rf = rfd.getRegisteredFont(); - FreeStandingFont fsf = eligibleFreeStandingFont(rfd, c); - SystemFont sf = eligibleSystemFont(rf, c); + FreeStandingFont fsf = eligibleFreeStandingFont(rfd, codePoint); + SystemFont sf = eligibleSystemFont(rf, codePoint); /* Consumer uses and prefers FreeStandingFont and it is available. */ if (fsf != null && preferFreeStandingFonts()) { @@ -275,7 +275,7 @@ } private FreeStandingFont eligibleFreeStandingFont(RegisteredFontDesc rfd, - char c) { + int codePoint) { if (! isUsingFreeStandingFonts()) { return null; } @@ -284,7 +284,7 @@ return null; } FOrayConsumerFont consumerFont = this.getConsumerFont(fsf); - Encoding encoding = consumerFont.findEncoding(rfd, c); + Encoding encoding = consumerFont.findEncoding(rfd, codePoint); if (encoding == null) { /* Either no known encoding for this font can encode this character * or we have been restricted from using an encoding that can. @@ -294,8 +294,7 @@ return fsf; } - private SystemFont eligibleSystemFont(RegisteredFont rf, - char c) { + private SystemFont eligibleSystemFont(RegisteredFont rf, int codePoint) { if (! isUsingSystemFonts()) { return null; } @@ -303,7 +302,7 @@ if (sf == null) { return null; } - if (sf.glyphAvailable(c)) { + if (sf.glyphAvailable(codePoint)) { return sf; } return null; @@ -327,10 +326,10 @@ * {@inheritDoc} */ public org.axsl.font.FontUse selectFontCSS(String [] familyList, int style, - int weight, int variant, int stretch, int size, char c) + int weight, int variant, int stretch, int size, int codePoint) throws FontException { return selectFontXSL(familyList, style, weight, variant, stretch, size, - c); + codePoint); } private RegisteredFontDesc selectFont(String familyToTry, int style, Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-03-04 22:17:43 UTC (rev 6888) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-03-04 22:59:26 UTC (rev 6889) @@ -2438,8 +2438,8 @@ /** * {@inheritDoc} */ - public FontUse getSecondaryFont(char c) { - return propertyList.getSecondaryFont(c); + public FontUse getSecondaryFont(int codePoint) { + return propertyList.getSecondaryFont(codePoint); } /** Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2006-03-04 22:17:43 UTC (rev 6888) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2006-03-04 22:59:26 UTC (rev 6889) @@ -236,7 +236,7 @@ return this.resolvedFont; } - public org.axsl.font.FontUse getSecondaryFont(char c) { + public org.axsl.font.FontUse getSecondaryFont(int codePoint) { org.axsl.font.FontUse secondaryFont = null; try { secondaryFont = fobj.getFontConsumer().selectFontXSL( @@ -246,7 +246,7 @@ convertFontVariant(getFontVariant()), convertFontStretch(getFontStretch()), getFontSize(), - c); + codePoint); } catch (FontException e) { fobj.getLogger().error("Error creating Font.\n" + fobj.getContextMessage()); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2006-03-04 22:17:43 UTC (rev 6888) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2006-03-04 22:59:26 UTC (rev 6889) @@ -24,6 +24,8 @@ package org.foray.pdf.object; +import org.foray.common.StringUtilPre5; + import org.axsl.font.Font; import org.axsl.font.FontUse; @@ -49,7 +51,11 @@ buffer.append(startTextDelimiter()); FontUse font = this.font.fsFont; for (int i = 0; i < theString.length(); i++) { - int ch = font.encodeCharacter(theString.charAt(i)); + int codePoint = StringUtilPre5.codePointAt(theString, i); + if (StringUtilPre5.isSupplementaryCodePoint(codePoint)) { + i++; + } + int ch = font.encodeCharacter(codePoint); addCharToBuffer(buffer, ch); if (i + 1 < theString.length()) { addKerning(font.getFont(), theString.charAt(i), Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2006-03-04 22:17:43 UTC (rev 6888) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2006-03-04 22:59:26 UTC (rev 6889) @@ -73,8 +73,8 @@ return false; } - public boolean canEncode(char c) { - return this.encodeCharacter(c) != 0; + public boolean canEncode(int codePoint) { + return this.encodeCharacter(codePoint) != 0; } } Modified: trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2006-03-04 22:17:43 UTC (rev 6888) +++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2006-03-04 22:59:26 UTC (rev 6889) @@ -30,6 +30,7 @@ package org.foray.render.pdf; import org.foray.common.FOrayException; +import org.foray.common.StringUtilPre5; import org.foray.output.OutputConfig; import org.foray.pdf.PDFException; import org.foray.pdf.PDFGraphicsState; @@ -295,8 +296,11 @@ FontUse currentFont = primaryFont; int startIndex = 0; for (int i = 0; i < text.length; i++) { - char c = text[i]; - FontUse newFont = whichFont(area, primaryFont, currentFont, c); + int codePoint = StringUtilPre5.codePointAt(text, i); + if (StringUtilPre5.isSupplementaryCodePoint(codePoint)) { + i++; + } + FontUse newFont = whichFont(area, primaryFont, currentFont, codePoint); if (newFont != currentFont) { /* Font has changed. Write the text so far. */ int size = i - startIndex; @@ -314,7 +318,7 @@ } private FontUse whichFont(GeneralInlineArea area, FontUse primaryFont, - FontUse currentFont, char c) { + FontUse currentFont, int c) { /* Trying to avoid unnecessary font selection work on the one hand, and * unnecessary switching between fonts in the output on the other.*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-04 22:17:55
|
Revision: 6888 Author: victormote Date: 2006-03-04 14:17:43 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6888&view=rev Log Message: ----------- 1. Add some more pre-5 utility methods. 2. Have line-breaking logic keep track of both codePoint and char counters properly. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java Modified: trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2006-03-04 21:08:28 UTC (rev 6887) +++ trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2006-03-04 22:17:43 UTC (rev 6888) @@ -24,9 +24,6 @@ package org.foray.common; -import com.ibm.icu.lang.UCharacter; -import com.ibm.icu.text.UTF16; - /** * Utility class containing methods that are useful for manipulating or managing * strings. @@ -241,12 +238,17 @@ || input.length() < 1) { return new int[0]; } - /* TODO: Add the char to int conversion. */ - int[] returnArray = new int[input.length()]; + int length = StringUtilPre5.codePointCount(input, 0, input.length()); + int[] output = new int[length]; + int outputIndex = 0; for (int i = 0; i < input.length(); i++) { - returnArray[i] = input.charAt(i); + output[outputIndex] = StringUtilPre5.codePointAt(input, i); + outputIndex++; + if (StringUtilPre5.isHighSurrogate(input.charAt(i))) { + i++; + } } - return returnArray; + return output; } /** @@ -259,13 +261,13 @@ || input.length < 1) { return new int[0]; } - int length = UTF16.countCodePoint(input, 0, input.length); + int length = StringUtilPre5.codePointCount(input, 0, input.length); int[] output = new int[length]; int outputIndex = 0; for (int i = 0; i < input.length; i++) { - output[outputIndex] = UCharacter.codePointAt(input, i); + output[outputIndex] = StringUtilPre5.codePointAt(input, i); outputIndex++; - if (UCharacter.isHighSurrogate(input[i])) { + if (StringUtilPre5.isHighSurrogate(input[i])) { i++; } } Modified: trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java 2006-03-04 21:08:28 UTC (rev 6887) +++ trunk/foray/foray-common/src/java/org/foray/common/StringUtilPre5.java 2006-03-04 22:17:43 UTC (rev 6888) @@ -24,6 +24,7 @@ package org.foray.common; +import com.ibm.icu.lang.UCharacter; import com.ibm.icu.text.UTF16; /** @@ -39,19 +40,54 @@ private StringUtilPre5() {} /** + * Mimics Java 5.0: Character.charCount(int). + */ + public static int charCount(int codePoint) { + return UCharacter.charCount(codePoint); + } + + /** + * Mimics Java 5.0: Character.codePointAt(char[], int). + */ + public static int codePointAt(char[] chars, int index) { + return UCharacter.codePointAt(chars, index); + } + + /** + * Mimics Java 5.0: Character.codePointAt(CharSequence, int). + */ + public static int codePointAt(CharSequence chars, int index) { + return UCharacter.codePointAt(chars, index); + } + + /** + * Mimics Java 5.0: Character.codePointCount(char[], int, int). + */ + public static int codePointCount(char[] input, int offset, int count) { + return UTF16.countCodePoint(input, offset, count); + } + + /** + * Mimics Java 5.0: Character.codePointCount(char[], int, int). + */ + public static int codePointCount(CharSequence input, int beginIndex, + int endIndex) { + char[] array = input.toString().toCharArray(); + return codePointCount(array, beginIndex, endIndex); + } + + /** + * Mimics Java 5.0: Character.isHighSurrogate(char). + */ + public static boolean isHighSurrogate(char ch) { + return UCharacter.isHighSurrogate(ch); + } + + /** * Mimics Java 5.0: Character.isLetter(int). - * @param codePoint The Unicode code point to be tested. - * @return True iff the character is a letter. */ public static boolean isLetter(int codePoint) { - if (codePoint < Character.MIN_VALUE) { - return false; - } - if (codePoint <= Character.MAX_VALUE) { - return Character.isLetter((char) codePoint); - } - /* TODO: This needs to be expanded to handle code points > U+FFFF. */ - return false; + return UCharacter.isLetter(codePoint); } /** Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-03-04 21:08:28 UTC (rev 6887) +++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-03-04 22:17:43 UTC (rev 6888) @@ -25,6 +25,7 @@ package org.foray.text.line.solitary; import org.foray.common.StringUtil; +import org.foray.common.StringUtilPre5; import org.foray.text.hyphen.Hyphenation; import org.foray.text.hyphen.HyphenationServer; import org.foray.text.line.EagerLineBreaker; @@ -89,7 +90,8 @@ private int wordStart = 0; private LineText currentLineText = null; - private int[] currentChars = null; + private char[] currentChars = null; + private int[] currentCodePoints = null; private boolean canEatLeadingSpaces = true; @@ -105,7 +107,8 @@ protected int processLineText(LineText lineText, int start, int end) throws TextException { this.currentLineText = lineText; - this.currentChars = StringUtil.toCodePoints(currentLineText.inlineText()); + this.currentChars = currentLineText.inlineText(); + this.currentCodePoints = StringUtil.toCodePoints(currentChars); String language = lineText.inlineLanguage(); finalWidth = 0; @@ -132,19 +135,25 @@ /* iterate over each character */ for (int i = startIndex; i <= endIndex; i++) { /* get the character */ - int c = this.currentChars[i]; - if (forcesLineBreak(c)) { + char c = this.currentChars[i]; + int codePoint = StringUtilPre5.codePointAt(this.currentChars, i); + int charCount = 1; + if (StringUtilPre5.isHighSurrogate(c)) { + i++; + charCount++; + } + if (forcesLineBreak(codePoint)) { createLineContent(start, i, finalWidth, false); return i + 1; } - if (allowsLineBreak(c)) { - processLineBreakPossibility(lineText, c); + if (allowsLineBreak(codePoint)) { + processLineBreakPossibility(lineText, codePoint); continue; } // If it got this far, it is TEXT. canEatLeadingSpaces = false; - int charWidth = charWidth(lineText, c, whitespaceWidth); + int charWidth = charWidth(lineText, codePoint, whitespaceWidth); processTextChar(language, i, charWidth); if ((finalWidth + spaceWidth + wordWidth) @@ -174,7 +183,8 @@ finalWidth += wordWidth; finalWidth -= charWidth; createLineContent(start, i - 1, finalWidth, false); - return i; + /* Return the index at the start of this character*/ + return i - charCount + 1; } // Break the line at the end of the previous word. createLineContent(start, wordStart - 1, finalWidth, false); @@ -335,9 +345,10 @@ */ HyphenationServer server = this.getHyphenationServer(); // Count the number of chars at the beginning that should be ignored. - int nonWordChars = server.nonWordChars(this.currentChars, wordStart); + int nonWordChars = server.nonWordChars(this.currentCodePoints, + wordStart); // Extract the word that should be evaluated by the hyphenation system. - String wordToHyphenate = server.getHyphenationWord(this.currentChars, + String wordToHyphenate = server.getHyphenationWord(this.currentCodePoints, this.wordStart + nonWordChars); // See if there are discretionary hyphenation points. Hyphenation hyph = server.hyphenate(wordToHyphenate, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-03-04 21:17:08
|
Revision: 6886 Author: victormote Date: 2006-03-04 13:07:04 -0800 (Sat, 04 Mar 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=6886&view=rev Log Message: ----------- Fix classpath entry for source. Modified Paths: -------------- trunk/foray/foray-common/.classpath Modified: trunk/foray/foray-common/.classpath =================================================================== --- trunk/foray/foray-common/.classpath 2006-03-04 21:05:41 UTC (rev 6885) +++ trunk/foray/foray-common/.classpath 2006-03-04 21:07:04 UTC (rev 6886) @@ -7,6 +7,6 @@ <classpathentry kind="var" path="FORAY_LIB_ROOT/batik.jar"/> <classpathentry kind="var" path="FORAY_LIB_ROOT/commons-logging.jar"/> <classpathentry kind="var" path="FORAY_LIB_ROOT/avalon-framework-cvs-20020806.jar"/> - <classpathentry kind="var" path="ICU4J_HOME/icu4j_3_4_3.jar"/> + <classpathentry sourcepath="/ICU4J_HOME/source/src" kind="var" path="ICU4J_HOME/icu4j_3_4_3.jar"/> <classpathentry kind="output" path="build/eclipse"/> </classpath> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |