foray-commit Mailing List for FOray (Page 270)
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
|
Dec
|
|
From: <vic...@us...> - 2006-05-04 21:37:08
|
Revision: 7135 Author: victormote Date: 2006-05-04 14:36:47 -0700 (Thu, 04 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7135&view=rev Log Message: ----------- Conform to new axsl changes regarding FONodeProxy. Modified Paths: -------------- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java trunk/foray/foray-areatree/src/java/org/foray/area/FObjProxy.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2006-05-04 15:04:28 UTC (rev 7134) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2006-05-04 21:36:47 UTC (rev 7135) @@ -267,7 +267,7 @@ } public FObj traitGeneratedBy() { - return (FObj) this.generatedBy.getRealFObj(); + return (FObj) this.generatedBy.getFONode(); } public String traitInternalDestination() { Modified: trunk/foray/foray-areatree/src/java/org/foray/area/FObjProxy.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/FObjProxy.java 2006-05-04 15:04:28 UTC (rev 7134) +++ trunk/foray/foray-areatree/src/java/org/foray/area/FObjProxy.java 2006-05-04 21:36:47 UTC (rev 7135) @@ -46,7 +46,7 @@ * in the Gang of Four literature. This specific implementation shares some * characteristics of the Protection Proxy and of the Smart Reference.</p> */ -public class FObjProxy { +public class FObjProxy implements org.axsl.fotree.FONodeProxy { /** The real FObj which this proxy represents. */ protected FONode realFObj; @@ -63,7 +63,7 @@ this.realFObj = realFObj; } - public FONode getRealFObj() { + public FONode getFONode() { return this.realFObj; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2006-05-04 15:04:28 UTC (rev 7134) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2006-05-04 21:36:47 UTC (rev 7135) @@ -26,6 +26,8 @@ import org.foray.common.OrderedTreeNode; +import org.axsl.fotree.FONodeProxy; + /** * Base class for nodes in the formatting object tree. */ @@ -109,6 +111,8 @@ public static final byte NODE_SVG_ELEMENT = 75; public static final byte NODE_BOOKMARK_TREE = 76; + private FONodeProxy proxy; + protected FONode(FObj parent) { super(parent); } @@ -122,9 +126,36 @@ } /** - * Return a value indicating what subclass of FONode this is (to avoid the - * cost of instanceof and to allow more efficient switch statements). + * {@inheritDoc} */ public abstract byte getNodeType() ; + /** + * {@inheritDoc} + */ + public void setProxy(FONodeProxy proxy) { + this.proxy = proxy; + } + + /** + * {@inheritDoc} + */ + public FONodeProxy getProxy() { + return this.proxy; + } + + /** + * {@inheritDoc} + */ + public void reset() { + this.proxy = null; + if (this.getChildren() == null) { + return; + } + for (int i = 0; i < this.getChildren().size(); i++) { + FONode node = (FONode) this.getChildren().get(i); + node.reset(); + } + } + } Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java 2006-05-04 15:04:28 UTC (rev 7134) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java 2006-05-04 21:36:47 UTC (rev 7135) @@ -87,7 +87,7 @@ } List getChildren() { - return ((FObj) this.getRealFObj()).getChildren(); + return ((FObj) this.getFONode()).getChildren(); } /** @@ -101,7 +101,7 @@ Area findStartingLayoutArea() { // Find the previous sibling FO // The cast to FObj below s/b OK because FONodes won't be running this. - FObj realFObj = (FObj) this.getRealFObj(); + FObj realFObj = (FObj) this.getFONode(); FObj previousSibling = realFObj.getPreviousSiblingFObj(); if (previousSibling == null) { return null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-04 15:04:33
|
Revision: 7134 Author: victormote Date: 2006-05-04 08:04:28 -0700 (Thu, 04 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7134&view=rev Log Message: ----------- 1. Add filtering status concept to keep track of what filtering is still needed. 2. For now, store the filtered text in the object instead of the raw text. This results in significant performance benefits. We can add a feature later that allows more raw states to be stored instead. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-04 14:16:20 UTC (rev 7133) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-04 15:04:28 UTC (rev 7134) @@ -46,11 +46,35 @@ public static final char DISCARD_CHAR = 0xFFFF; + /* Following is a list of constants that can be used to describe the + * filtering status of this object's text. + * The order of filtering is as follows: + * Start: raw text returned by the parser + * Apply white-space-treatment + * Apply linefeed-treatment + * Result: pre-text-transform text (an intermediate step for processing + * convenience). + * Apply text-transform + * Result: refined fo tree text + * Apply white-space-collapse + * Result: area tree text + */ + private static final byte FILTER_RAW = 0; + private static final byte FILTER_PRE_TRANSFORM = 30; + private static final byte FILTER_REFINED_FO_TREE = 60; + private static final byte FILTER_AREA_TREE = 90; + private char[] ca; + private byte filterStatus = FILTER_RAW; public FOText(FObj parent, char[] chars) { super(parent); this.ca = chars; + /* Convert the text as far as possible, store it, and set the status. + * We cannot filter text-transform yet, because we may need subsequent + * FOText instances. */ + this.ca = this.getPreTextTransformText(); + this.filterStatus = FILTER_PRE_TRANSFORM; } public List getChildren() { @@ -97,6 +121,11 @@ * @return The text that should appear in the refined FO tree. */ public char[] getRefinedText() { + if (this.filterStatus >= FILTER_REFINED_FO_TREE) { + /* The stored text has already been filtered. Just return it. */ + return this.ca; + } + char[] charArray = getPreTextTransformText(); // Now handle text-transform. short textTransform = getFObjParent().traitTextTransform(); @@ -105,6 +134,11 @@ charArray[i] = applyTextTransform(charArray, i, textTransform); } } + + /* Update the instance's text with the refined value, and update the + * status. */ + this.ca = charArray; + this.filterStatus = FILTER_REFINED_FO_TREE; return charArray; } @@ -125,6 +159,11 @@ * text-transform is not applied. */ private char[] getPreTextTransformText() { + if (this.filterStatus >= FILTER_PRE_TRANSFORM) { + /* The stored text has already been filtered. Just return it. */ + return this.ca; + } + /* Must handle white-space-treatment first. */ char[] workArray = applyWhiteSpaceTreatment(this.ca, getFObjParent().traitWhiteSpaceTreatment()); @@ -132,6 +171,11 @@ // Now handle linefeed-treatment. workArray = applyLinefeedTreatment(workArray, getFObjParent().traitLinefeedTreatment()); + + /* Update this instance's text with the filtered value and update the + * status. */ + this.ca = workArray; + this.filterStatus = FILTER_PRE_TRANSFORM; return workArray; } @@ -424,11 +468,21 @@ * @return The text that should appear in the area tree. */ public char[] getAreaTreeText() { + if (this.filterStatus >= FILTER_AREA_TREE) { + /* The stored text has already been filtered. Just return it. */ + return this.ca; + } + // Start with the refined FO Tree text char[] returnArray = getRefinedText(); // Apply white-space-collapse. boolean whiteSpaceCollapse = getFObjParent().traitWhiteSpaceCollapse(); returnArray = applyWhiteSpaceCollapse(returnArray, whiteSpaceCollapse); + + /* Set the instance text to the more refined value and update the + * status. */ + this.ca = returnArray; + this.filterStatus = FILTER_AREA_TREE; return returnArray; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-04 14:16:30
|
Revision: 7133 Author: victormote Date: 2006-05-04 07:16:20 -0700 (Thu, 04 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7133&view=rev Log Message: ----------- 1. Remove StringBuffer constructor for FOText. 2. Change order of FOText constructor parameters for consistency with other FOTree constructors. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-04 13:16:53 UTC (rev 7132) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-04 14:16:20 UTC (rev 7133) @@ -48,14 +48,8 @@ private char[] ca; - public FOText(StringBuffer b, FObj parent) { + public FOText(FObj parent, char[] chars) { super(parent); - this.ca = new char[b.length()]; - b.getChars(0,b.length(),ca,0); - } - - public FOText(char[] chars, FObj parent) { - super(parent); this.ca = chars; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java 2006-05-04 13:16:53 UTC (rev 7132) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java 2006-05-04 14:16:20 UTC (rev 7133) @@ -49,7 +49,8 @@ protected void finalizeText() throws FOTreeException { if (textBuffer != null && textBuffer.length() > 0) { - FOText ft = new FOText(textBuffer, this); + char[] charArray = textBuffer.toString().toCharArray(); + FOText ft = new FOText(this, charArray); super.addChild(ft); textBuffer.setLength(0); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2006-05-04 13:16:53 UTC (rev 7132) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2006-05-04 14:16:20 UTC (rev 7133) @@ -67,7 +67,7 @@ * moment, because it is expected that use of fo:character will normally * be very limited. */ char[] chars = new char[] {c}; - FOText text = new FOText(chars, this); + FOText text = new FOText(this, chars); super.addChild(text); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-04 13:17:01
|
Revision: 7132 Author: victormote Date: 2006-05-04 06:16:53 -0700 (Thu, 04 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7132&view=rev Log Message: ----------- Make text-crunching methods more independent and modular. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 23:45:11 UTC (rev 7131) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-04 13:16:53 UTC (rev 7132) @@ -44,6 +44,8 @@ private static final int IS_WORD_CHAR_TRUE = 1; private static final int IS_WORD_CHAR_MAYBE = 2; + public static final char DISCARD_CHAR = 0xFFFF; + private char[] ca; public FOText(StringBuffer b, FObj parent) { @@ -140,25 +142,6 @@ } /** - * Removes an element from the array, moving each succeeding element up - * in the array by one (element n+1 is moved to element n), and padding - * the end of the array with a specified value. Note that the actual size - * of the array is not changed: clients that need to track the used size - * of the array need to keep a counter. - * @param charArray The char[] object that should be collapsed. - * @param index The 0-based index of the element that should be removed. - * @param padChar The value that should be placed at the end of the array - * to replace the one that has been removed. - */ - private static void collapseCharArray(char[] charArray, int index, - char padChar) { - for (int i = index; i < charArray.length - 1; i++) { - charArray[i] = charArray[i + 1]; - } - charArray[charArray.length - 1] = padChar; - } - - /** * Applies text-transform to one character of the array. * @param charArray The array which is being transformed. * @param index The 0-based index into charArray, which points to the @@ -448,43 +431,10 @@ */ public char[] getAreaTreeText() { // Start with the refined FO Tree text - char[] workArray = getRefinedText(); - - // If there are no changes needed, just return the input array. + char[] returnArray = getRefinedText(); + // Apply white-space-collapse. boolean whiteSpaceCollapse = getFObjParent().traitWhiteSpaceCollapse(); - if (! anyWhiteSpaceCollapseChanges(workArray, whiteSpaceCollapse)) { - return workArray; - } - - /* - * There is no need to make a copy of the array here since the - * value returned by getRefinedText() is transient. The size of the - * array returned in this method will never be larger than that - * returned by getRefinedText(). - */ - - int discardedElements = 0; - - for (int i = 0; i < workArray.length - discardedElements; i++) { - char c = workArray[i]; - if (XMLCharacter.isXMLWhitespace(c) && c != 0x000a) { - char conversionChar = applyWhiteSpaceCollapse(workArray, i); - if (conversionChar == 0x0000) { - collapseCharArray(workArray, i, (char) 0x0000); - discardedElements ++; - // Pull counter back down to avoid skipping one - i --; - } else { - workArray[i] = conversionChar; - } - } - } - // Try to avoid the array copy if possible. - if (discardedElements == 0) { - return workArray; - } - char[] returnArray = new char[workArray.length - discardedElements]; - System.arraycopy(workArray, 0, returnArray, 0, returnArray.length); + returnArray = applyWhiteSpaceCollapse(returnArray, whiteSpaceCollapse); return returnArray; } @@ -569,13 +519,12 @@ * to be converted. * @return The character to which the charArray[index] should be converted * for white-space-treatment purposes. - * Returns 0xFFFF if charArray[index] should be discarded. - * Note that 0xFFFF is not a valid Unicode codepoint, and should therefore - * never be in the input. + * Returns {@link #DISCARD_CHAR} if charArray[index] should be discarded. + * Note that {@link #DISCARD_CHAR} is not a valid Unicode codepoint, and + * should therefore never be in the input. */ public static char applyWhiteSpaceTreatment(char[] charArray, int index, short whiteSpaceTreatment) { - final char discardChar = 0xFFFF; char c = charArray[index]; if (! XMLCharacter.isXMLWhitespace(c)) { /* If it is not whitespace, it cannot be changed. */ @@ -587,7 +536,7 @@ } switch (whiteSpaceTreatment) { case Constants.FOVAL_IGNORE: { - return discardChar; + return DISCARD_CHAR; } case Constants.FOVAL_PRESERVE: { return 0x0020; @@ -600,7 +549,7 @@ if (charArray[index + 1] != 0x000a) { return c; } - return discardChar; + return DISCARD_CHAR; } case Constants.FOVAL_IGNORE_IF_AFTER_LINEFEED: { // If first element, no change needed. @@ -610,7 +559,7 @@ if (charArray[index - 1] != 0x000a) { return c; } - return discardChar; + return DISCARD_CHAR; } /* * default handles "initial" value @@ -620,21 +569,21 @@ // If first element, only check next. if (index == 0) { if (charArray[index + 1] == 0x000a) { - return discardChar; + return DISCARD_CHAR; } return c; } // If last element, only check previous if (index >= charArray.length - 1) { if (charArray[index - 1] == 0x000a) { - return discardChar; + return DISCARD_CHAR; } return c; } // Otherwise, check both if (charArray[index - 1] == 0x000a || charArray[index + 1] == 0x000a) { - return discardChar; + return DISCARD_CHAR; } return c; } @@ -680,7 +629,7 @@ char c = charArray[i]; char conversionChar = applyWhiteSpaceTreatment(charArray, i, whiteSpaceTreatment); - if (conversionChar == 0xFFFF) { + if (conversionChar == DISCARD_CHAR) { discardElements ++; } else if (conversionChar != c) { changeElements ++; @@ -699,7 +648,7 @@ for (int i = 0; i < charArray.length; i++) { char conversionChar = applyWhiteSpaceTreatment(charArray, i, whiteSpaceTreatment); - if (conversionChar == 0xFFFF) { + if (conversionChar == DISCARD_CHAR) { discardElements ++; } else { returnArray[i - discardElements] = conversionChar; @@ -712,7 +661,7 @@ assert c == 0x000a: "Invalid linefeed-treatment input."; switch (linefeedTreatment) { case Constants.FOVAL_IGNORE: { - return 0x0000; + return DISCARD_CHAR; } case Constants.FOVAL_TREAT_AS_SPACE: { return 0x0020; @@ -785,7 +734,7 @@ if (c == 0x000a) { char conversionChar = applyLinefeedTreatment(c, linefeedTreatment); - if (conversionChar == 0x0000) { + if (conversionChar == DISCARD_CHAR) { discardElements ++; } else { returnArray[i - discardElements] = conversionChar; @@ -798,37 +747,6 @@ } /** - * <p>Determines whether white-space-collapse will produce any changes - * to testArray.</p> - * <p>Per http://lists.w3.org/Archives/Public/xsl-editors/2002OctDec/0004, - * elements in previous or subsequent FOs should <em>not</em> be - * considered.</p> - * - * @param testArray The char array whose contents should be tested. - * @return True if the application of the white-space-collapse property - * would result in any changes to testArray. See XSL-FO Standard 1.0, - * Section 7.15.12. - */ - public static boolean anyWhiteSpaceCollapseChanges(char[] testArray, - boolean whiteSpaceCollapse) { - if (! whiteSpaceCollapse) { - return false; - } - for (int i = 0; i < testArray.length; i++) { - char c = testArray[i]; - if (XMLCharacter.isXMLWhitespace(c) && c != 0x000a) { - if (i != 0 && XMLCharacter.isXMLWhitespace(testArray[i - 1])) { - return true; - } - if (i < testArray.length - 1 && testArray[i + 1] == 0x000a) { - return true; - } - } - } - return false; - } - - /** * <p>Applies white-space-collapse to one character of charArray.</p> * <p>Per http://lists.w3.org/Archives/Public/xsl-editors/2002OctDec/0004, * elements in previous or subsequent FOs should <em>not</em> be @@ -836,31 +754,73 @@ * @param charArray The char[] that is being converted. * @param index The 0-based index into charArray that points to the * char that is being tested. - * @return 0x0000 if the previous character is whitespace or if the - * next character is a line-feed. If neither of these is true, returns - * the original character. + * @return {@link #DISCARD_CHAR} if the previous character is whitespace or + * if the next character is a line-feed. + * If neither of these is true, returns the original character. */ public static char applyWhiteSpaceCollapse(char[] charArray, int index) { char c = charArray[index]; - assert XMLCharacter.isXMLWhitespace(c) && c != 0x000a: - "Invalid white-space-collapse input."; + if (! XMLCharacter.isXMLWhitespace(c)) { + /* If it is not whitespace, nothing should change. */ + return c; + } + if (c == 0x000A) { + /* If it is a linefeed, nothing should change. */ + return c; + } if (index != 0 && XMLCharacter.isXMLWhitespace( charArray[index - 1])) { - return 0x0000; + return DISCARD_CHAR; } if (index < charArray.length - 1 && charArray[index + 1] == 0x000a) { - return 0x0000; + return DISCARD_CHAR; } return c; } - public static char[] truncateArray(char[] charArray, int truncateQuantity) { - if (truncateQuantity < 1) { + /** + * Applies white-space-collapse to an array of characters. + * See XSL-FO Standard 1.0, Section 7.15.12. + * <p>Per http://lists.w3.org/Archives/Public/xsl-editors/2002OctDec/0004, + * elements in previous or subsequent FOs should <em>not</em> be + * considered.</p> + * @param charArray The char array whose contents should be converted. + * @param whiteSpaceCollapse The value of the white-space-collapse property. + * @return If no changes result from the application of + * white-space-collapse, <code>charArray</code> is returned. + * Otherwise, a new char array with the result is returned. + */ + public static char[] applyWhiteSpaceCollapse(char[] charArray, + boolean whiteSpaceCollapse) { + if (! whiteSpaceCollapse) { return charArray; } - char[] returnArray = new char[charArray.length - truncateQuantity]; - System.arraycopy(charArray, 0, returnArray, 0, returnArray.length); + + int discardElements = 0; + for (int i = 0; i < charArray.length; i++) { + char convertChar = applyWhiteSpaceCollapse(charArray, i); + if (convertChar == DISCARD_CHAR) { + discardElements ++; + } + } + + if (discardElements == 0) { + return charArray; + } + + /* We now know that changes of some sort must be made. Create a new + * array in which to put the results. */ + char[] returnArray = new char[charArray.length - discardElements]; + discardElements = 0; + for (int i = 0; i < charArray.length; i++) { + char conversionChar = applyWhiteSpaceCollapse(charArray, i); + if (conversionChar == DISCARD_CHAR) { + discardElements ++; + } else { + returnArray[i - discardElements] = conversionChar; + } + } return returnArray; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 23:45:20
|
Revision: 7131 Author: victormote Date: 2006-05-03 16:45:11 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7131&view=rev Log Message: ----------- Remove unused methods. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 23:36:40 UTC (rev 7130) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 23:45:11 UTC (rev 7131) @@ -88,29 +88,7 @@ return FONode.NODE_TEXT; } - public boolean isContentPCDATA() { - return true; - } - - public String getName() { - return "#PCDATA"; - } - /** - * @param text The raw text returned by the XML parser. - */ - protected void setRawText(char[] text) { - this.ca = text; - } - - /** - * @return The raw text returned by the XML parser. - */ - public char[] getRawText() { - return ca; - } - - /** * <p>Filters the raw text as needed to present the text that should appear * in the "refined FO tree". * Specifically, this effectively filters for the following properties:</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 23:36:46
|
Revision: 7130 Author: victormote Date: 2006-05-03 16:36:40 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7130&view=rev Log Message: ----------- Make text-crunching methods more independent. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 23:28:04 UTC (rev 7129) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 23:36:40 UTC (rev 7130) @@ -586,17 +586,18 @@ } /** - * @param charArray char array containing character to be tested. + * @param charArray char array containing character to be converted. * @param index Index into charArray pointing to a char element that is - * any valid XML whitespace character except 0x000a. - * @return The character that should appear in the refined FO Tree where - * c appears in the raw FO Tree, or 0x0000 if the original should be - * discarded. Note that regardless of whether 0x0000 is a valid XML - * character, since it should not be input to this method, returning it - * from this method should not cause problems. + * to be converted. + * @return The character to which the charArray[index] should be converted + * for white-space-treatment purposes. + * Returns 0xFFFF if charArray[index] should be discarded. + * Note that 0xFFFF is not a valid Unicode codepoint, and should therefore + * never be in the input. */ public static char applyWhiteSpaceTreatment(char[] charArray, int index, short whiteSpaceTreatment) { + final char discardChar = 0xFFFF; char c = charArray[index]; if (! XMLCharacter.isXMLWhitespace(c)) { /* If it is not whitespace, it cannot be changed. */ @@ -608,7 +609,7 @@ } switch (whiteSpaceTreatment) { case Constants.FOVAL_IGNORE: { - return 0x0000; + return discardChar; } case Constants.FOVAL_PRESERVE: { return 0x0020; @@ -621,7 +622,7 @@ if (charArray[index + 1] != 0x000a) { return c; } - return 0x0000; + return discardChar; } case Constants.FOVAL_IGNORE_IF_AFTER_LINEFEED: { // If first element, no change needed. @@ -631,7 +632,7 @@ if (charArray[index - 1] != 0x000a) { return c; } - return 0x0000; + return discardChar; } /* * default handles "initial" value @@ -641,21 +642,21 @@ // If first element, only check next. if (index == 0) { if (charArray[index + 1] == 0x000a) { - return 0x0000; + return discardChar; } return c; } // If last element, only check previous if (index >= charArray.length - 1) { if (charArray[index - 1] == 0x000a) { - return 0x0000; + return discardChar; } return c; } // Otherwise, check both if (charArray[index - 1] == 0x000a || charArray[index + 1] == 0x000a) { - return 0x0000; + return discardChar; } return c; } @@ -701,7 +702,7 @@ char c = charArray[i]; char conversionChar = applyWhiteSpaceTreatment(charArray, i, whiteSpaceTreatment); - if (conversionChar == 0x0000) { + if (conversionChar == 0xFFFF) { discardElements ++; } else if (conversionChar != c) { changeElements ++; @@ -720,7 +721,7 @@ for (int i = 0; i < charArray.length; i++) { char conversionChar = applyWhiteSpaceTreatment(charArray, i, whiteSpaceTreatment); - if (conversionChar == 0x0000) { + if (conversionChar == 0xFFFF) { discardElements ++; } else { returnArray[i - discardElements] = conversionChar; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 23:28:19
|
Revision: 7129 Author: victormote Date: 2006-05-03 16:28:04 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7129&view=rev Log Message: ----------- Make text-crunching methods more independent. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 23:26:58 UTC (rev 7128) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 23:28:04 UTC (rev 7129) @@ -585,79 +585,6 @@ return getPreviousContiguousTextInBlock(); } - public static boolean anyWhiteSpaceTreatmentChanges(char[] testArray, - short whiteSpaceTreatment) { - /* - * There is no property value that precludes any changes. The contents - * must be examined. - */ - for (int i = 0; i < testArray.length; i++) { - char c = testArray[i]; - if (! XMLCharacter.isXMLWhitespace(c) || c == 0x000a) { - continue; - } - // c is XML whitespace and not a linefeed - switch (whiteSpaceTreatment) { - case Constants.FOVAL_IGNORE: { - return true; - } - case Constants.FOVAL_PRESERVE: { - return true; - } - case Constants.FOVAL_IGNORE_IF_BEFORE_LINEFEED: { - // If last element, no change needed. - if (i == testArray.length - 1) { - continue; - } - if (testArray[i + 1] != 0x000a) { - continue; - } - return true; - } - case Constants.FOVAL_IGNORE_IF_AFTER_LINEFEED: { - // If first element, no change needed. - if (i == 0) { - continue; - } - if (testArray[i - 1] != 0x000a) { - continue; - } - return true; - } - /* - * default handles "initial" value - * IGNORE_IF_SURROUNDING_LINEFEED - */ - default: { - // If first element, only check next. - if (i == 0) { - if (testArray.length > 1 && testArray[i + 1] == 0x000a) { - return true; - } - continue; - } - // If last element, only check previous - if (i >= testArray.length - 1) { - if (testArray.length > 1 && testArray[i - 1] == 0x000a) { - return true; - } - continue; - } - // Otherwise, check both - if (i - 1 >= 0 && testArray[i - 1] == 0x000a) { - return true; - } - if (i + 1 <= testArray.length - 1 - && testArray[i + 1] == 0x000a) { - return true; - } - continue; - } - } - } - return false; - } - /** * @param charArray char array containing character to be tested. * @param index Index into charArray pointing to a char element that is This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 23:27:11
|
Revision: 7128 Author: victormote Date: 2006-05-03 16:26:58 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7128&view=rev Log Message: ----------- Make text-crunching methods more independent. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 22:30:15 UTC (rev 7127) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 23:26:58 UTC (rev 7128) @@ -151,57 +151,14 @@ * text-transform is not applied. */ private char[] getPreTextTransformText() { - // If there are no changes needed, just return the input array. - boolean wsChanges = anyWhiteSpaceTreatmentChanges(this.ca, + /* Must handle white-space-treatment first. */ + char[] workArray = applyWhiteSpaceTreatment(this.ca, getFObjParent().traitWhiteSpaceTreatment()); - if (! wsChanges) { - return ca; - } - /* - * Make a copy of the array. Output array will be no larger than the - * input array. - */ - char[] workArray = new char[ca.length]; - System.arraycopy(ca, 0, workArray, 0, ca.length); - - int discardedElements = 0; - - /* - * The result of both the white-space-treatment and - * linefeed-treatment tests is that each character will either be - * copied intact, replaced by exactly one other character, or - * discarded. - */ - - // white-space-treatment must be handled first - if (wsChanges) { - for (int i = 0; i < workArray.length - discardedElements; i++) { - char c = workArray[i]; - if (XMLCharacter.isXMLWhitespace(c) && c != 0x000a) { - char conversionChar = applyWhiteSpaceTreatment(workArray, - i); - if (conversionChar == 0x0000) { - collapseCharArray(workArray, i, (char) 0x0000); - discardedElements ++; - // Pull counter back down to avoid skipping one - i --; - } else { - workArray[i] = conversionChar; - } - } - } - } // Now handle linefeed-treatment. workArray = applyLinefeedTreatment(workArray, getFObjParent().traitLinefeedTreatment()); - - // Try to avoid the array copy if possible. - if (discardedElements == 0) { - return workArray; - } - char[] returnArray = truncateArray(workArray, discardedElements); - return returnArray; + return workArray; } /** @@ -224,76 +181,6 @@ } /** - * @param charArray char array containing character to be tested. - * @param index Index into charArray pointing to a char element that is - * any valid XML whitespace character except 0x000a. - * @return The character that should appear in the refined FO Tree where - * c appears in the raw FO Tree, or 0x0000 if the original should be - * discarded. Note that regardless of whether 0x0000 is a valid XML - * character, since it should not be input to this method, returning it - * from this method should not cause problems. - */ - private char applyWhiteSpaceTreatment(char[] charArray, int index) { - char c = charArray[index]; - assert (XMLCharacter.isXMLWhitespace(c) && c != 0x000a): "Invalid " - + "white-space-treatment input"; - switch (getFObjParent().traitWhiteSpaceTreatment()) { - case Constants.FOVAL_IGNORE: { - return 0x0000; - } - case Constants.FOVAL_PRESERVE: { - return 0x0020; - } - case Constants.FOVAL_IGNORE_IF_BEFORE_LINEFEED: { - // If last element, no change needed. - if (index == charArray.length - 1) { - return c; - } - if (charArray[index + 1] != 0x000a) { - return c; - } - return 0x0000; - } - case Constants.FOVAL_IGNORE_IF_AFTER_LINEFEED: { - // If first element, no change needed. - if (index == 0) { - return c; - } - if (charArray[index - 1] != 0x000a) { - return c; - } - return 0x0000; - } - /* - * default handles "initial" value - * IGNORE_IF_SURROUNDING_LINEFEED - */ - default: { - // If first element, only check next. - if (index == 0) { - if (charArray[index + 1] == 0x000a) { - return 0x0000; - } - return c; - } - // If last element, only check previous - if (index >= charArray.length - 1) { - if (charArray[index - 1] == 0x000a) { - return 0x0000; - } - return c; - } - // Otherwise, check both - if (charArray[index - 1] == 0x000a - || charArray[index + 1] == 0x000a) { - return 0x0000; - } - return c; - } - } - } - - /** * Applies text-transform to one character of the array. * @param charArray The array which is being transformed. * @param index The 0-based index into charArray, which points to the @@ -698,13 +585,6 @@ return getPreviousContiguousTextInBlock(); } - /** - * <p>Determines whether white-space-treatment will produce any changes - * to testArray.</p> - * @return True if the application of the white-space-treatment property - * would result in any changes to the testArray. - * See XSL-FO Standard 1.0, Section 7.15.8. - */ public static boolean anyWhiteSpaceTreatmentChanges(char[] testArray, short whiteSpaceTreatment) { /* @@ -778,6 +658,150 @@ return false; } + /** + * @param charArray char array containing character to be tested. + * @param index Index into charArray pointing to a char element that is + * any valid XML whitespace character except 0x000a. + * @return The character that should appear in the refined FO Tree where + * c appears in the raw FO Tree, or 0x0000 if the original should be + * discarded. Note that regardless of whether 0x0000 is a valid XML + * character, since it should not be input to this method, returning it + * from this method should not cause problems. + */ + public static char applyWhiteSpaceTreatment(char[] charArray, int index, + short whiteSpaceTreatment) { + char c = charArray[index]; + if (! XMLCharacter.isXMLWhitespace(c)) { + /* If it is not whitespace, it cannot be changed. */ + return c; + } + if (c == 0x000a) { + /* If it is 0x000A (linefeed), it cannot be changed. */ + return c; + } + switch (whiteSpaceTreatment) { + case Constants.FOVAL_IGNORE: { + return 0x0000; + } + case Constants.FOVAL_PRESERVE: { + return 0x0020; + } + case Constants.FOVAL_IGNORE_IF_BEFORE_LINEFEED: { + // If last element, no change needed. + if (index == charArray.length - 1) { + return c; + } + if (charArray[index + 1] != 0x000a) { + return c; + } + return 0x0000; + } + case Constants.FOVAL_IGNORE_IF_AFTER_LINEFEED: { + // If first element, no change needed. + if (index == 0) { + return c; + } + if (charArray[index - 1] != 0x000a) { + return c; + } + return 0x0000; + } + /* + * default handles "initial" value + * IGNORE_IF_SURROUNDING_LINEFEED + */ + default: { + // If first element, only check next. + if (index == 0) { + if (charArray[index + 1] == 0x000a) { + return 0x0000; + } + return c; + } + // If last element, only check previous + if (index >= charArray.length - 1) { + if (charArray[index - 1] == 0x000a) { + return 0x0000; + } + return c; + } + // Otherwise, check both + if (charArray[index - 1] == 0x000a + || charArray[index + 1] == 0x000a) { + return 0x0000; + } + return c; + } + } + } + + /** + * Applies white-space-treatment to an array of characters. + * See XSL-FO Standard 1.0, Section 7.15.8. + * @param charArray The char array whose contents should be converted. + * @param whiteSpaceTreatment The value of the white-space-treatment + * property, one of {@link Constants#FOVAL_IGNORE}, + * {@link Constants#FOVAL_PRESERVE}, + * {@link Constants#FOVAL_IGNORE_IF_BEFORE_LINEFEED}, + * {@link Constants#FOVAL_IGNORE_IF_AFTER_LINEFEED}, + * or {@link Constants#FOVAL_IGNORE_IF_SURROUNDING_LINEFEED}. + * @return If no changes result from the application of + * white-space-treatment, <code>charArray</code> is returned. + * Otherwise, a new char array with the result is returned. + */ + public static char[] applyWhiteSpaceTreatment(char[] charArray, + short whiteSpaceTreatment) { + switch (whiteSpaceTreatment) { + case Constants.FOVAL_IGNORE: + case Constants.FOVAL_PRESERVE: + case Constants.FOVAL_IGNORE_IF_BEFORE_LINEFEED: + case Constants.FOVAL_IGNORE_IF_AFTER_LINEFEED: + case Constants.FOVAL_IGNORE_IF_SURROUNDING_LINEFEED: { + // These are all valid and need further processing. + break; + } + default: { + /* Invalid value. Silently convert to the default value as specified + * in the standard . */ + whiteSpaceTreatment = + Constants.FOVAL_IGNORE_IF_SURROUNDING_LINEFEED; + } + } + + int discardElements = 0; + int changeElements = 0; + for (int i = 0; i < charArray.length; i++) { + char c = charArray[i]; + char conversionChar = applyWhiteSpaceTreatment(charArray, i, + whiteSpaceTreatment); + if (conversionChar == 0x0000) { + discardElements ++; + } else if (conversionChar != c) { + changeElements ++; + } + } + + if (discardElements == 0 && changeElements == 0) { + return charArray; + } + + /* We now know that changes of some sort must be made. Create a new + * array in which to put the results. */ + char[] returnArray = new char[charArray.length - discardElements]; + discardElements = 0; + + for (int i = 0; i < charArray.length; i++) { + char conversionChar = applyWhiteSpaceTreatment(charArray, + i, whiteSpaceTreatment); + if (conversionChar == 0x0000) { + discardElements ++; + } else { + returnArray[i - discardElements] = conversionChar; + } + } + return returnArray; + } + public static char applyLinefeedTreatment(char c, short linefeedTreatment) { assert c == 0x000a: "Invalid linefeed-treatment input."; switch (linefeedTreatment) { @@ -823,8 +847,9 @@ break; } default: { - // Invalid value. Silently return the input. - return charArray; + /* Invalid value. Silently convert to the default, as specified by + * the standard. */ + linefeedTreatment = Constants.FOVAL_TREAT_AS_SPACE; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 22:30:22
|
Revision: 7127 Author: victormote Date: 2006-05-03 15:30:15 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7127&view=rev Log Message: ----------- Make text-crunching methods more independent. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 21:48:23 UTC (rev 7126) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 22:30:15 UTC (rev 7127) @@ -778,33 +778,6 @@ return false; } - /** - * <p>Determines whether linefeed-treatment will produce any changes - * to testArray.</p> - * @param testArray The char array whose contents should be tested. - * @param linefeedTreatment The value of the linefee-treatment property, - * one of {@link Constants#FOVAL_IGNORE}, - * {@link Constants#FOVAL_PRESERVE}, - * {@link Constants#FOVAL_TREAT_AS_SPACE}, - * or {@link Constants#FOVAL_TREAT_AS_ZERO_WIDTH_SPACE}. - * @return True if the application of the linefeed-treatment property - * would result in any changes to the rawText. See XSL-FO Standard 1.0, - * Section 7.15.7. - */ - public static boolean anyLinefeedTreatmentChanges(char[] testArray, - short linefeedTreatment) { - if (linefeedTreatment == Constants.FOVAL_PRESERVE) { - return false; - } - for (int i = 0; i < testArray.length; i++) { - char c = testArray[i]; - if (c == 0x000a) { - return true; - } - } - return false; - } - public static char applyLinefeedTreatment(char c, short linefeedTreatment) { assert c == 0x000a: "Invalid linefeed-treatment input."; switch (linefeedTreatment) { @@ -824,31 +797,73 @@ } } + /** + * Applies linefeed-treatment to an array of characters. + * See XSL-FO Standard 1.0, Section 7.15.7. + * @param charArray The char array whose contents should be converted. + * @param linefeedTreatment The value of the linefeed-treatment property, + * one of {@link Constants#FOVAL_IGNORE}, + * {@link Constants#FOVAL_PRESERVE}, + * {@link Constants#FOVAL_TREAT_AS_SPACE}, + * or {@link Constants#FOVAL_TREAT_AS_ZERO_WIDTH_SPACE}. + * @return If no changes result from the application of linefeed-treatment, + * <code>charArray</code> is returned. Otherwise, a new char array with the + * result is returned. + */ public static char[] applyLinefeedTreatment(char[] charArray, short linefeedTreatment) { - boolean anyChanges = anyLinefeedTreatmentChanges(charArray, - linefeedTreatment); - if (! anyChanges) { + switch (linefeedTreatment) { + case Constants.FOVAL_PRESERVE: { return charArray; } + case Constants.FOVAL_IGNORE: + case Constants.FOVAL_TREAT_AS_SPACE: + case Constants.FOVAL_TREAT_AS_ZERO_WIDTH_SPACE: { + // These need further processing. + break; + } + default: { + // Invalid value. Silently return the input. + return charArray; + } + } - int discardedElements = 0; + int discardElements = 0; + int changeElements = 0; for (int i = 0; i < charArray.length; i++) { char c = charArray[i]; if (c == 0x000a) { + if (linefeedTreatment == Constants.FOVAL_IGNORE) { + discardElements ++; + } else { + changeElements ++; + } + } + } + + if (discardElements == 0 && changeElements == 0) { + return charArray; + } + + /* We now know that changes of some sort must be made. Create a new + * array in which to put the results. */ + char[] returnArray = new char[charArray.length - discardElements]; + discardElements = 0; + for (int i = 0; i < charArray.length; i++) { + char c = charArray[i]; + if (c == 0x000a) { char conversionChar = applyLinefeedTreatment(c, linefeedTreatment); if (conversionChar == 0x0000) { - collapseCharArray(charArray, i, (char) 0x0000); - discardedElements ++; - // Pull counter back down to avoid skipping one - i --; + discardElements ++; } else { - charArray[i] = conversionChar; + returnArray[i - discardElements] = conversionChar; } + } else { + returnArray[i - discardElements] = c; } } - return truncateArray(charArray, discardedElements); + return returnArray; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 21:48:29
|
Revision: 7126 Author: victormote Date: 2006-05-03 14:48:23 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7126&view=rev Log Message: ----------- Make text-crunching methods more independent. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 21:28:42 UTC (rev 7125) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 21:48:23 UTC (rev 7126) @@ -154,9 +154,7 @@ // If there are no changes needed, just return the input array. boolean wsChanges = anyWhiteSpaceTreatmentChanges(this.ca, getFObjParent().traitWhiteSpaceTreatment()); - boolean lfChanges = anyLinefeedTreatmentChanges(this.ca, - getFObjParent().traitLinefeedTreatment()); - if (! wsChanges && ! lfChanges) { + if (! wsChanges) { return ca; } @@ -195,28 +193,14 @@ } } // Now handle linefeed-treatment. - if (lfChanges) { - for (int i = 0; i < workArray.length - discardedElements; i++) { - char c = workArray[i]; - if (c == 0x000a) { - char conversionChar = applyLinefeedTreatment(c); - if (conversionChar == 0x0000) { - collapseCharArray(workArray, i, (char) 0x0000); - discardedElements ++; - // Pull counter back down to avoid skipping one - i --; - } else { - workArray[i] = conversionChar; - } - } - } - } + workArray = applyLinefeedTreatment(workArray, + getFObjParent().traitLinefeedTreatment()); + // Try to avoid the array copy if possible. if (discardedElements == 0) { return workArray; } - char[] returnArray = new char[workArray.length - discardedElements]; - System.arraycopy(workArray, 0, returnArray, 0, returnArray.length); + char[] returnArray = truncateArray(workArray, discardedElements); return returnArray; } @@ -309,25 +293,6 @@ } } - private char applyLinefeedTreatment(char c) { - assert c == 0x000a: "Invalid linefeed-treatment input."; - switch (getFObjParent().traitLinefeedTreatment()) { - case Constants.FOVAL_IGNORE: { - return 0x0000; - } - case Constants.FOVAL_TREAT_AS_SPACE: { - return 0x0020; - } - case Constants.FOVAL_TREAT_AS_ZERO_WIDTH_SPACE: { - return 0x200b; - } - // default handles the "initial" value of "preserve" - default: { - return c; - } - } - } - /** * Applies text-transform to one character of the array. * @param charArray The array which is being transformed. @@ -840,6 +805,52 @@ return false; } + public static char applyLinefeedTreatment(char c, short linefeedTreatment) { + assert c == 0x000a: "Invalid linefeed-treatment input."; + switch (linefeedTreatment) { + case Constants.FOVAL_IGNORE: { + return 0x0000; + } + case Constants.FOVAL_TREAT_AS_SPACE: { + return 0x0020; + } + case Constants.FOVAL_TREAT_AS_ZERO_WIDTH_SPACE: { + return 0x200b; + } + // default handles the "initial" value of "preserve" + default: { + return c; + } + } + } + + public static char[] applyLinefeedTreatment(char[] charArray, + short linefeedTreatment) { + boolean anyChanges = anyLinefeedTreatmentChanges(charArray, + linefeedTreatment); + if (! anyChanges) { + return charArray; + } + + int discardedElements = 0; + for (int i = 0; i < charArray.length; i++) { + char c = charArray[i]; + if (c == 0x000a) { + char conversionChar = applyLinefeedTreatment(c, + linefeedTreatment); + if (conversionChar == 0x0000) { + collapseCharArray(charArray, i, (char) 0x0000); + discardedElements ++; + // Pull counter back down to avoid skipping one + i --; + } else { + charArray[i] = conversionChar; + } + } + } + return truncateArray(charArray, discardedElements); + } + /** * <p>Determines whether white-space-collapse will produce any changes * to testArray.</p> @@ -898,4 +909,13 @@ return c; } + public static char[] truncateArray(char[] charArray, int truncateQuantity) { + if (truncateQuantity < 1) { + return charArray; + } + char[] returnArray = new char[charArray.length - truncateQuantity]; + System.arraycopy(charArray, 0, returnArray, 0, returnArray.length); + return returnArray; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 21:28:50
|
Revision: 7125 Author: victormote Date: 2006-05-03 14:28:42 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7125&view=rev Log Message: ----------- Make text-crunching methods more independent. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 21:19:01 UTC (rev 7124) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 21:28:42 UTC (rev 7125) @@ -658,33 +658,6 @@ return returnArray; } - /** - * <p>Applies white-space-collapse to one character of charArray.</p> - * <p>Per http://lists.w3.org/Archives/Public/xsl-editors/2002OctDec/0004, - * elements in previous or subsequent FOs should <em>not</em> be - * considered.</p> - * @param charArray The char[] that is being converted. - * @param index The 0-based index into charArray that points to the - * char that is being tested. - * @return 0x0000 if the previous character is whitespace or if the - * next character is a line-feed. If neither of these is true, returns - * the original character. - */ - private char applyWhiteSpaceCollapse(char[] charArray, int index) { - char c = charArray[index]; - assert XMLCharacter.isXMLWhitespace(c) && c != 0x000a: - "Invalid white-space-collapse input."; - if (index != 0 && XMLCharacter.isXMLWhitespace( - charArray[index - 1])) { - return 0x0000; - } - if (index < charArray.length - 1 - && charArray[index + 1] == 0x000a) { - return 0x0000; - } - return c; - } - public char[] inlineText() { return getAreaTreeText(); } @@ -898,4 +871,31 @@ return false; } + /** + * <p>Applies white-space-collapse to one character of charArray.</p> + * <p>Per http://lists.w3.org/Archives/Public/xsl-editors/2002OctDec/0004, + * elements in previous or subsequent FOs should <em>not</em> be + * considered.</p> + * @param charArray The char[] that is being converted. + * @param index The 0-based index into charArray that points to the + * char that is being tested. + * @return 0x0000 if the previous character is whitespace or if the + * next character is a line-feed. If neither of these is true, returns + * the original character. + */ + public static char applyWhiteSpaceCollapse(char[] charArray, int index) { + char c = charArray[index]; + assert XMLCharacter.isXMLWhitespace(c) && c != 0x000a: + "Invalid white-space-collapse input."; + if (index != 0 && XMLCharacter.isXMLWhitespace( + charArray[index - 1])) { + return 0x0000; + } + if (index < charArray.length - 1 + && charArray[index + 1] == 0x000a) { + return 0x0000; + } + return c; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 21:19:13
|
Revision: 7124 Author: victormote Date: 2006-05-03 14:19:01 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7124&view=rev Log Message: ----------- Make text-crunching methods more independent. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 19:43:11 UTC (rev 7123) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-05-03 21:19:01 UTC (rev 7124) @@ -152,8 +152,10 @@ */ private char[] getPreTextTransformText() { // If there are no changes needed, just return the input array. - boolean wsChanges = anyWhiteSpaceTreatmentChanges(); - boolean lfChanges = anyLinefeedTreatmentChanges(); + boolean wsChanges = anyWhiteSpaceTreatmentChanges(this.ca, + getFObjParent().traitWhiteSpaceTreatment()); + boolean lfChanges = anyLinefeedTreatmentChanges(this.ca, + getFObjParent().traitLinefeedTreatment()); if (! wsChanges && ! lfChanges) { return ca; } @@ -617,8 +619,10 @@ public char[] getAreaTreeText() { // Start with the refined FO Tree text char[] workArray = getRefinedText(); + // If there are no changes needed, just return the input array. - if (! anyWhiteSpaceCollapseChanges(workArray)) { + boolean whiteSpaceCollapse = getFObjParent().traitWhiteSpaceCollapse(); + if (! anyWhiteSpaceCollapseChanges(workArray, whiteSpaceCollapse)) { return workArray; } @@ -757,22 +761,25 @@ } /** - * @return True if the application of the linefeed-treatment property - * would result in any changes to the rawText. See XSL-FO Standard 1.0, - * Section 7.15.8. + * <p>Determines whether white-space-treatment will produce any changes + * to testArray.</p> + * @return True if the application of the white-space-treatment property + * would result in any changes to the testArray. + * See XSL-FO Standard 1.0, Section 7.15.8. */ - private boolean anyWhiteSpaceTreatmentChanges() { + public static boolean anyWhiteSpaceTreatmentChanges(char[] testArray, + short whiteSpaceTreatment) { /* * There is no property value that precludes any changes. The contents * must be examined. */ - for (int i = 0; i < ca.length; i++) { - char c = ca[i]; + for (int i = 0; i < testArray.length; i++) { + char c = testArray[i]; if (! XMLCharacter.isXMLWhitespace(c) || c == 0x000a) { continue; } // c is XML whitespace and not a linefeed - switch (getFObjParent().traitWhiteSpaceTreatment()) { + switch (whiteSpaceTreatment) { case Constants.FOVAL_IGNORE: { return true; } @@ -781,10 +788,10 @@ } case Constants.FOVAL_IGNORE_IF_BEFORE_LINEFEED: { // If last element, no change needed. - if (i == ca.length - 1) { + if (i == testArray.length - 1) { continue; } - if (ca[i + 1] != 0x000a) { + if (testArray[i + 1] != 0x000a) { continue; } return true; @@ -794,7 +801,7 @@ if (i == 0) { continue; } - if (ca[i - 1] != 0x000a) { + if (testArray[i - 1] != 0x000a) { continue; } return true; @@ -806,23 +813,24 @@ default: { // If first element, only check next. if (i == 0) { - if (ca.length > 1 && ca[i + 1] == 0x000a) { + if (testArray.length > 1 && testArray[i + 1] == 0x000a) { return true; } continue; } // If last element, only check previous - if (i >= ca.length - 1) { - if (ca.length > 1 && ca[i - 1] == 0x000a) { + if (i >= testArray.length - 1) { + if (testArray.length > 1 && testArray[i - 1] == 0x000a) { return true; } continue; } // Otherwise, check both - if (i - 1 >= 0 && ca[i - 1] == 0x000a) { + if (i - 1 >= 0 && testArray[i - 1] == 0x000a) { return true; } - if (i + 1 <= ca.length - 1 && ca[i + 1] == 0x000a) { + if (i + 1 <= testArray.length - 1 + && testArray[i + 1] == 0x000a) { return true; } continue; @@ -833,17 +841,25 @@ } /** + * <p>Determines whether linefeed-treatment will produce any changes + * to testArray.</p> + * @param testArray The char array whose contents should be tested. + * @param linefeedTreatment The value of the linefee-treatment property, + * one of {@link Constants#FOVAL_IGNORE}, + * {@link Constants#FOVAL_PRESERVE}, + * {@link Constants#FOVAL_TREAT_AS_SPACE}, + * or {@link Constants#FOVAL_TREAT_AS_ZERO_WIDTH_SPACE}. * @return True if the application of the linefeed-treatment property * would result in any changes to the rawText. See XSL-FO Standard 1.0, * Section 7.15.7. */ - private boolean anyLinefeedTreatmentChanges() { - if (getFObjParent().traitLinefeedTreatment() - == Constants.FOVAL_PRESERVE) { + public static boolean anyLinefeedTreatmentChanges(char[] testArray, + short linefeedTreatment) { + if (linefeedTreatment == Constants.FOVAL_PRESERVE) { return false; } - for (int i = 0; i < ca.length; i++) { - char c = ca[i]; + for (int i = 0; i < testArray.length; i++) { + char c = testArray[i]; if (c == 0x000a) { return true; } @@ -863,8 +879,9 @@ * would result in any changes to testArray. See XSL-FO Standard 1.0, * Section 7.15.12. */ - private boolean anyWhiteSpaceCollapseChanges(char[] testArray) { - if (! getFObjParent().traitWhiteSpaceCollapse()) { + public static boolean anyWhiteSpaceCollapseChanges(char[] testArray, + boolean whiteSpaceCollapse) { + if (! whiteSpaceCollapse) { return false; } for (int i = 0; i < testArray.length; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 19:43:34
|
Revision: 7123 Author: victormote Date: 2006-05-03 12:43:11 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7123&view=rev Log Message: ----------- Conform to new aXSL requirements regarding movement of some FOTreeControl methods to FOTreeBuilder setters, including the removal of the FOTreeControl interface. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java trunk/foray/foray-areatree/src/java/org/foray/area/LayoutControl.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java trunk/foray/foray-output/src/java/org/foray/output/OutputControl.java Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -39,7 +39,6 @@ import org.axsl.font.FontConsumer; import org.axsl.font.FontServer; -import org.axsl.fotree.FOTreeControl; import org.axsl.graphic.GraphicServer; import org.axsl.pdf.PDFDocument; import org.axsl.text.TextServer; @@ -53,7 +52,6 @@ import org.xml.sax.XMLReader; import java.io.IOException; -import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -66,7 +64,7 @@ * This class manages the process of parsing an input FO document and creating * an FOTree. */ -public class FOrayDocument implements FOTreeControl { +public class FOrayDocument { /** The "parent" FOraySession. */ private FOraySession session; @@ -113,10 +111,6 @@ /** The SAX parser. */ private XMLReader parser; - /** The ordered list of URLs that should be tried when resolving the - * location of Graphics for this document. */ - private URL[] graphicSearchPath; - /** * Private constructor used only by the other constructors. * @param session The parent FOraySession. @@ -124,7 +118,7 @@ private FOrayDocument(FOraySession session) { this.session = session; session.registerDocument(this); - treeBuilder = this.session.getFOTreeServer().makeTreeBuilder(this); + treeBuilder = this.session.getFOTreeServer().makeTreeBuilder(); } /** @@ -309,14 +303,6 @@ return this.session.getFontServer(); } - /** - * @return True if graphics should be cached in memory, false if the memory - * should be released. - */ - public boolean getCachingGraphics() { - return getConfiguration().optionCacheGraphics(); - } - public String getParserClassName() { return XMLParser.getParserClassName(); } @@ -330,31 +316,6 @@ return getConfiguration().optionBaseDirectory(); } - /** - * {@inheritDoc} - */ - public URL[] getGraphicSearchPath() { - if (this.graphicSearchPath == null) { - this.graphicSearchPath = buildGraphicSearchPath(); - } - return this.graphicSearchPath; - } - - /** - * - */ - private URL[] buildGraphicSearchPath() { - URL[] urls = new URL[3]; - urls[0] = getConfiguration().getBaseDocument(); - urls[1] = getConfiguration().optionBaseDirectory(); - try { - urls[2] = new URL(System.getProperty("user.dir")); - } catch (MalformedURLException e) { - // Ignore this -- just leave the null value in the array - } - return urls; - } - public FontConsumer getFontConsumer() { return this.currentTarget.getFontConsumer(); } Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -42,6 +42,7 @@ import org.xml.sax.EntityResolver; +import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; @@ -236,9 +237,26 @@ return; } this.foTreeServer = new FOrayFOTreeServer(this.getLogger(), - this.getGraphicServer(), this.getTextServer()); + this.getGraphicServer(), this.getTextServer(), + this.buildGraphicSearchPath(), + getConfiguration().optionCacheGraphics()); } + /** + * + */ + private URL[] buildGraphicSearchPath() { + URL[] urls = new URL[3]; + urls[0] = getConfiguration().getBaseDocument(); + urls[1] = getConfiguration().optionBaseDirectory(); + try { + urls[2] = new URL(System.getProperty("user.dir")); + } catch (MalformedURLException e) { + // Ignore this -- just leave the null value in the array + } + return urls; + } + public GraphicServer getGraphicServer() { return this.graphicServer; } Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -463,14 +463,6 @@ return document.getBaseURL(); } - /** - * @return True if graphics should be cached in memory, false if the memory - * should be released. - */ - public boolean getCachingGraphics() { - return document.getCachingGraphics(); - } - public FontConsumer getFontConsumer() { return this.fontConsumer; } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LayoutControl.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/LayoutControl.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-areatree/src/java/org/foray/area/LayoutControl.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -37,11 +37,6 @@ public interface LayoutControl { /** - * @return True if graphics should be cached, false otherwise. - */ - public boolean getCachingGraphics() ; - - /** * @return The URL that is the root of the path for finding external files. */ public URL getBaseURL() ; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -32,7 +32,6 @@ import org.foray.fotree.xml.NamespaceXML; import org.axsl.font.FontConsumer; -import org.axsl.fotree.FOTreeControl; import org.axsl.fotree.FOTreeEvent; import org.axsl.fotree.FOTreeException; import org.axsl.fotree.FOTreeListener; @@ -46,6 +45,7 @@ import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; +import java.net.URL; import java.util.HashSet; import java.util.Iterator; @@ -70,8 +70,6 @@ private Locator locator; - private FOTreeControl treeControl; - /** * Collection of objects that have registered to be notified about * FOTreeEvent firings. @@ -93,11 +91,11 @@ private GraphicServer graphicServer; private TextServer textServer; private FontConsumer fontConsumer; + URL[] graphicSearchPath; + boolean cachingGraphics; - public FOTreeBuilder(FOrayFOTreeServer server, FOTreeControl treeControl, - Log logger) { + public FOTreeBuilder(FOrayFOTreeServer server, Log logger) { this.server = server; - this.treeControl = treeControl; this.logger = logger; } @@ -343,10 +341,6 @@ } } - public FOTreeControl getFOTreeControl() { - return this.treeControl; - } - public NamespaceFO getFONamespace() { return getTreeServer().getFONamespace(); } @@ -423,4 +417,20 @@ return this.fontConsumer; } + public void setGraphicSearchPath(URL[] graphicSearchPath) { + this.graphicSearchPath = graphicSearchPath; + } + + public URL[] getGraphicSearchPath() { + return this.graphicSearchPath; + } + + public void setCachingGraphics(boolean cachingGraphics) { + this.cachingGraphics = cachingGraphics; + } + + public boolean getCachingGraphics() { + return this.cachingGraphics; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -31,7 +31,6 @@ import org.axsl.common.Constants; import org.axsl.font.FontConsumer; import org.axsl.font.FontUse; -import org.axsl.fotree.FOTreeControl; import org.axsl.fotree.FOTreeException; import org.axsl.fotree.ShadowEffect; import org.axsl.fotree.Shape; @@ -247,10 +246,6 @@ return getFObjParent().getFlow(); } - public FOTreeControl getFOTreeControl() { - return getFOTreeBuilder().getFOTreeControl(); - } - public FOTreeBuilder getFOTreeBuilder() { return getFObjParent().getFOTreeBuilder(); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -31,13 +31,13 @@ import org.foray.fotree.svg.NamespaceSVG; import org.foray.fotree.xml.NamespaceXML; -import org.axsl.fotree.FOTreeControl; import org.axsl.fotree.FOTreeServer; import org.axsl.graphic.GraphicServer; import org.axsl.text.TextServer; import org.apache.commons.logging.Log; +import java.net.URL; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; @@ -52,6 +52,8 @@ Log logger; GraphicServer graphicServer; TextServer textServer; + URL[] graphicSearchPath; + boolean cachingGraphics; /** * Map whose key is a String of the namespace URI, and whose value is @@ -65,10 +67,13 @@ private NamespaceXML namespaceXML; public FOrayFOTreeServer(Log logger, GraphicServer graphicServer, - TextServer textServer) { + TextServer textServer, URL[] graphicSearchPath, + boolean cachingGraphics) { this.logger = logger; this.graphicServer = graphicServer; this.textServer = textServer; + this.graphicSearchPath = graphicSearchPath; + this.cachingGraphics = cachingGraphics; setupNamespaces(); } @@ -194,12 +199,12 @@ /** * {@inheritDoc} */ - public org.axsl.fotree.FOTreeBuilder makeTreeBuilder( - FOTreeControl control) { - FOTreeBuilder foTreeBuilder = new FOTreeBuilder(this, control, - this.getLogger()); + public org.axsl.fotree.FOTreeBuilder makeTreeBuilder() { + FOTreeBuilder foTreeBuilder = new FOTreeBuilder(this, this.getLogger()); foTreeBuilder.setGraphicServer(this.graphicServer); foTreeBuilder.setTextServer(this.textServer); + foTreeBuilder.setGraphicSearchPath(this.graphicSearchPath); + foTreeBuilder.setCachingGraphics(this.cachingGraphics); return foTreeBuilder; } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -84,8 +84,8 @@ makeGraphicAttempted = true; try { this.graphic = getGraphicServer().makeGraphic(traitSrc(), - getFOTreeControl().getGraphicSearchPath(), - getFOTreeControl().getCachingGraphics()); + getFOTreeBuilder().getGraphicSearchPath(), + getFOTreeBuilder().getCachingGraphics()); } catch (GraphicException e) { getLogger().error(e.getMessage() + "\n" + this.getContextMessage()); Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -95,8 +95,8 @@ Graphic backgroundImage = null; try { backgroundImage = fobj.getGraphicServer().makeGraphic(src, - fobj.getFOTreeControl().getGraphicSearchPath(), - fobj.getFOTreeControl().getCachingGraphics()); + fobj.getFOTreeBuilder().getGraphicSearchPath(), + fobj.getFOTreeBuilder().getCachingGraphics()); } catch (GraphicException imgex) { backgroundImage = null; fobj.getLogger().error("Error creating background image: " Modified: trunk/foray/foray-output/src/java/org/foray/output/OutputControl.java =================================================================== --- trunk/foray/foray-output/src/java/org/foray/output/OutputControl.java 2006-05-03 19:13:12 UTC (rev 7122) +++ trunk/foray/foray-output/src/java/org/foray/output/OutputControl.java 2006-05-03 19:43:11 UTC (rev 7123) @@ -47,13 +47,6 @@ public URL getBaseURL() ; /** - * Tells whether graphics should be cached in memory for reuse. - * @return True if graphics should be cached in memory, false if they - * should be removed after being used. - */ - public boolean getCachingGraphics() ; - - /** * @return The FontConsumer implementation which should be used by this * renderer. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 19:13:23
|
Revision: 7122 Author: victormote Date: 2006-05-03 12:13:12 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7122&view=rev Log Message: ----------- Conform to new aXSL requirements regarding movement of some FOTreeControl methods to FOTreeBuilder setters. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-03 18:41:57 UTC (rev 7121) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-03 19:13:12 UTC (rev 7122) @@ -233,6 +233,7 @@ public synchronized void processTarget(FOrayTarget target) throws FOrayException { this.setTarget(target); + this.treeBuilder.setFontConsumer(this.getFontConsumer()); try { if (this.jaxpTransformer == null) { // Regular SAX Input Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-05-03 18:41:57 UTC (rev 7121) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-05-03 19:13:12 UTC (rev 7122) @@ -31,6 +31,7 @@ import org.foray.fotree.svg.NamespaceSVG; import org.foray.fotree.xml.NamespaceXML; +import org.axsl.font.FontConsumer; import org.axsl.fotree.FOTreeControl; import org.axsl.fotree.FOTreeEvent; import org.axsl.fotree.FOTreeException; @@ -91,6 +92,7 @@ private GraphicServer graphicServer; private TextServer textServer; + private FontConsumer fontConsumer; public FOTreeBuilder(FOrayFOTreeServer server, FOTreeControl treeControl, Log logger) { @@ -413,4 +415,12 @@ return this.textServer; } + public void setFontConsumer(FontConsumer consumer) { + this.fontConsumer = consumer; + } + + public FontConsumer getFontConsumer() { + return this.fontConsumer; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-03 18:41:57 UTC (rev 7121) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-03 19:13:12 UTC (rev 7122) @@ -364,7 +364,7 @@ } public FontConsumer getFontConsumer() { - return getFOTreeControl().getFontConsumer(); + return getFOTreeBuilder().getFontConsumer(); } public GraphicServer getGraphicServer() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 18:42:15
|
Revision: 7121 Author: victormote Date: 2006-05-03 11:41:57 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7121&view=rev Log Message: ----------- Conform to new aXSL requirements regarding movement of some FOTreeControl methods to FOTreeBuilder setters. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-03 18:14:06 UTC (rev 7120) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-03 18:41:57 UTC (rev 7121) @@ -235,7 +235,8 @@ if (this.foTreeServer != null) { return; } - this.foTreeServer = new FOrayFOTreeServer(this.getLogger()); + this.foTreeServer = new FOrayFOTreeServer(this.getLogger(), + this.getGraphicServer(), this.getTextServer()); } public GraphicServer getGraphicServer() { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-05-03 18:14:06 UTC (rev 7120) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-05-03 18:41:57 UTC (rev 7121) @@ -35,6 +35,8 @@ import org.axsl.fotree.FOTreeEvent; import org.axsl.fotree.FOTreeException; import org.axsl.fotree.FOTreeListener; +import org.axsl.graphic.GraphicServer; +import org.axsl.text.TextServer; import org.apache.commons.logging.Log; @@ -87,6 +89,9 @@ private Log logger; + private GraphicServer graphicServer; + private TextServer textServer; + public FOTreeBuilder(FOrayFOTreeServer server, FOTreeControl treeControl, Log logger) { this.server = server; @@ -392,4 +397,20 @@ return this.unsupportedPropertiesFO; } + public void setGraphicServer(GraphicServer graphicServer) { + this.graphicServer = graphicServer; + } + + public GraphicServer getGraphicServer() { + return this.graphicServer; + } + + public void setTextServer(TextServer textServer) { + this.textServer = textServer; + } + + public TextServer getTextServer() { + return this.textServer; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-03 18:14:06 UTC (rev 7120) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-03 18:41:57 UTC (rev 7121) @@ -368,11 +368,11 @@ } public GraphicServer getGraphicServer() { - return getFOTreeControl().getGraphicServer(); + return getFOTreeBuilder().getGraphicServer(); } public TextServer getTextServer() { - return getFOTreeControl().getTextServer(); + return getFOTreeBuilder().getTextServer(); } /** Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2006-05-03 18:14:06 UTC (rev 7120) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2006-05-03 18:41:57 UTC (rev 7121) @@ -33,6 +33,8 @@ import org.axsl.fotree.FOTreeControl; import org.axsl.fotree.FOTreeServer; +import org.axsl.graphic.GraphicServer; +import org.axsl.text.TextServer; import org.apache.commons.logging.Log; @@ -48,6 +50,8 @@ public class FOrayFOTreeServer implements FOTreeServer { Log logger; + GraphicServer graphicServer; + TextServer textServer; /** * Map whose key is a String of the namespace URI, and whose value is @@ -60,8 +64,11 @@ private NamespaceSVG namespaceSVG; private NamespaceXML namespaceXML; - public FOrayFOTreeServer(Log logger) { + public FOrayFOTreeServer(Log logger, GraphicServer graphicServer, + TextServer textServer) { this.logger = logger; + this.graphicServer = graphicServer; + this.textServer = textServer; setupNamespaces(); } @@ -189,7 +196,11 @@ */ public org.axsl.fotree.FOTreeBuilder makeTreeBuilder( FOTreeControl control) { - return new FOTreeBuilder(this, control, this.getLogger()); + FOTreeBuilder foTreeBuilder = new FOTreeBuilder(this, control, + this.getLogger()); + foTreeBuilder.setGraphicServer(this.graphicServer); + foTreeBuilder.setTextServer(this.textServer); + return foTreeBuilder; } public Log getLogger() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 18:30:31
|
Revision: 7120 Author: victormote Date: 2006-05-03 11:14:06 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7120&view=rev Log Message: ----------- Conform to new aXSL requirements regarding movement of some FOTreeControl methods to FOTreeBuilder setters. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-03 17:15:54 UTC (rev 7119) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-03 18:14:06 UTC (rev 7120) @@ -304,38 +304,6 @@ return this.session.getLogger(); } - /** - * The client application can use this method to add a list of FO objects - * that it does not support, and that it wishes to have flagged for the - * user at parse time. The object will be created within the FOTree, but the - * user will receive a logged message warning them that the object is not - * supported. - * Note that multiple arrays can be added, and the relationship is OR, so - * that if a given item appears in any one or more of the arrays, it will - * be flagged. - * @param unsupportedObjectList An array of bytes, each element of which - * represents an element which should be flagged to the user. - */ - public void setUnsupportedObjects(byte[] unsupportedObjectList) { - this.unsupportedObjects = unsupportedObjectList; - } - - /** - * The client application can use this method to add a list of FO properties - * that it does not support, and that it wishes to have flagged for the - * user at parse time. The property will be created within the FOTree, but - * the user will receive a logged message warning them that the object is - * not supported. - * Note that multiple arrays can be added, and the relationship is OR, so - * that if a given item appears in any one or more of the arrays, it will - * be flagged. - * @param unsupportedPropertyList An array of shorts, each element of which - * represents an attribute which should be flagged to the user. - */ - public void setUnsupportedProperties(short[] unsupportedPropertyList) { - this.unsupportedProperties = unsupportedPropertyList; - } - public FontServer getFontServer() { return this.session.getFontServer(); } @@ -406,14 +374,6 @@ return this.treeBuilder; } - public byte[] unsupportedObjectsFO() { - return this.unsupportedObjects; - } - - public short[] unsupportedPropertiesFO() { - return this.unsupportedProperties; - } - /** * Factory method that makes a new Renderer instance for the standard * renderers. Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-05-03 17:15:54 UTC (rev 7119) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2006-05-03 18:14:06 UTC (rev 7120) @@ -52,6 +52,9 @@ public class FOTreeBuilder extends DefaultHandler implements org.axsl.fotree.FOTreeBuilder { + byte[] unsupportedObjectsFO; + short[] unsupportedPropertiesFO; + /** * current formatting object being handled */ @@ -373,4 +376,20 @@ return this.server; } + public void setUnsupportedObjectsFO(byte[] unsupportedObjectsFO) { + this.unsupportedObjectsFO = unsupportedObjectsFO; + } + + public byte[] getUnsupportedObjectsFO() { + return this.unsupportedObjectsFO; + } + + public void setUnsupportedPropertiesFO(short[] unsupportedPropertiesFO) { + this.unsupportedPropertiesFO = unsupportedPropertiesFO; + } + + public short[] getUnsupportedPropertiesFO() { + return this.unsupportedPropertiesFO; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java 2006-05-03 17:15:54 UTC (rev 7119) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java 2006-05-03 18:14:06 UTC (rev 7120) @@ -24,7 +24,6 @@ package org.foray.fotree; -import org.axsl.fotree.FOTreeControl; import org.axsl.fotree.FOTreeException; import org.xml.sax.Attributes; @@ -254,8 +253,7 @@ public void checkSupportedElement(FOTreeBuilder builder, String localName, Locator locator) { - FOTreeControl control = builder.getFOTreeControl(); - byte[] unsupportedObjects = control.unsupportedObjectsFO(); + byte[] unsupportedObjects = builder.getUnsupportedObjectsFO(); if (unsupportedObjects == null) { return; } @@ -271,8 +269,7 @@ public void checkSupportedAttribute(FOTreeBuilder builder, String attributeName, Locator locator) { - FOTreeControl control = builder.getFOTreeControl(); - short[] unsupportedProperties = control.unsupportedPropertiesFO(); + short[] unsupportedProperties = builder.getUnsupportedPropertiesFO(); if (unsupportedProperties == null) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 17:15:59
|
Revision: 7119 Author: victormote Date: 2006-05-03 10:15:54 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7119&view=rev Log Message: ----------- Bug fix: was skipping the last item in the bookmark tree. Modified Paths: -------------- trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2006-05-03 16:26:58 UTC (rev 7118) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2006-05-03 17:15:54 UTC (rev 7119) @@ -136,7 +136,7 @@ return; } BookmarkTreeArea bmtArea = new BookmarkTreeArea(bookmarkTree, this); - for (int i = 0; i < bookmarkTree.getChildren().size() - 1; i++) { + for (int i = 0; i < bookmarkTree.getChildren().size(); i++) { Bookmark bookmark = (Bookmark) bookmarkTree.getChildren().get(i); layoutBookmark(bookmark, bmtArea); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 16:27:13
|
Revision: 7118 Author: victormote Date: 2006-05-03 09:26:58 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7118&view=rev Log Message: ----------- Tie the related methods together for consistency. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2006-05-03 16:19:34 UTC (rev 7117) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2006-05-03 16:26:58 UTC (rev 7118) @@ -95,15 +95,29 @@ return propertyType; } + /** + * Creates an "Unexpected value" message suitable for user messages or + * exception reporting. + * @param value The property value as submitted in the input. + * @param propertyList The PropertyList instance for this property. + * @return A formatted, ready-to-present message describing the error. + * @see #unexpectedValueMessage(String, String, PropertyList) + */ public String unexpectedValueMessage(String value, PropertyList propertyList) { - FObj fobj = propertyList.getFObj(); - return "Unexpected value for " - + Constants.expandPropertyNameEnumeration(propertyType) - + ": \"" - + value + "\"\n" + fobj.getContextMessage(); + return unexpectedValueMessage(null, value, propertyList); } + /** + * Creates an "Unexpected value" message suitable for user messages or + * exception reporting. + * @param reason A description of the reason the value is considered + * invalid. Set this to null if the reason is self-explanatory. + * @param value The property value as submitted in the input. + * @param propertyList The PropertyList instance for this property. + * @return A formatted, ready-to-present message describing the error. + * @see #unexpectedValueMessage(String, PropertyList) + */ public String unexpectedValueMessage(String reason, String value, PropertyList propertyList) { StringBuffer buffer = new StringBuffer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 16:19:46
|
Revision: 7117 Author: victormote Date: 2006-05-03 09:19:34 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7117&view=rev Log Message: ----------- Use factory method instead of parser. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java 2006-05-03 16:18:49 UTC (rev 7116) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java 2006-05-03 16:19:34 UTC (rev 7117) @@ -42,12 +42,12 @@ private PropertyValue createPropertyValue(PropertyList propertyList, String value) throws PropertyException { - PropertyValue pv = standardParse(propertyList, value, false, false); - if (pv instanceof DtName) { - return pv; + DtName pv = DtName.makeNameDT(value); + if (pv == null) { + throw new PropertyException(unexpectedValueMessage("Invalid NCName", + value, propertyList)); } - throw new PropertyException(unexpectedValueMessage(value, - propertyList)); + return pv; } public String getValue() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 16:19:04
|
Revision: 7116 Author: victormote Date: 2006-05-03 09:18:49 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7116&view=rev Log Message: ----------- Add overloaded version of unexpectedValueMessage so that a reason can be included, if known. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2006-05-03 16:08:01 UTC (rev 7115) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2006-05-03 16:18:49 UTC (rev 7116) @@ -104,6 +104,20 @@ + value + "\"\n" + fobj.getContextMessage(); } + public String unexpectedValueMessage(String reason, String value, + PropertyList propertyList) { + StringBuffer buffer = new StringBuffer(); + FObj fobj = propertyList.getFObj(); + buffer.append("Unexpected value for "); + buffer.append(Constants.expandPropertyNameEnumeration(propertyType)); + buffer.append(": \"" + value + "\"\n"); + if (reason != null) { + buffer.append(" Reason: " + reason + "\n"); + } + buffer.append(fobj.getContextMessage()); + return buffer.toString(); + } + public static String invalidPropertyName(String propertyName) { return "Invalid property: " + propertyName + "'."; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-03 16:08:13
|
Revision: 7115 Author: victormote Date: 2006-05-03 09:08:01 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7115&view=rev Log Message: ----------- Add local variable to assist with debugging. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/PropertyMakerFO.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/PropertyMakerFO.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/PropertyMakerFO.java 2006-05-02 23:28:29 UTC (rev 7114) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/PropertyMakerFO.java 2006-05-03 16:08:01 UTC (rev 7115) @@ -150,8 +150,9 @@ */ public static short enumeratePropertyName(String propertyName) { propertyName = Property.getBasePropertyName(propertyName); - return (short) Arrays.binarySearch(Constants.propertyNameList, - propertyName); + short enumerated = (short) Arrays.binarySearch( + Constants.propertyNameList, propertyName); + return enumerated; } public static Property makeProperty(String propertyFullName, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-02 23:28:36
|
Revision: 7114 Author: victormote Date: 2006-05-02 16:28:29 -0700 (Tue, 02 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7114&view=rev Log Message: ----------- Fix bug. Character entities were transformed to characters. Setting feature on parser to prevent this. Aborts if the feature cannot be set. 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-05-02 23:19:58 UTC (rev 7113) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java 2006-05-02 23:28:29 UTC (rev 7114) @@ -178,6 +178,28 @@ } catch (SAXNotSupportedException e1) { logError("Parser unable to validate."); } + + /* Sadly, this only works with Xerces. + * This feature, or something like it is very important. + * Without it, character entities get transformed into characters + * without notification. + * When notified, we can (and do) ignore the transformed characters + * and use the character entities instead. + * We do NOT want to change the user's content. */ + try { + parser.setFeature("http://apache.org/xml/features/scanner/" + + "notify-char-refs", true); + } catch (SAXNotRecognizedException e) { + /* Make this a fatal error. */ + logError("Parser cannot report character entities. Aborting."); + cleanup(); + return; + } catch (SAXNotSupportedException e) { + /* Make this a fatal error. */ + logError("Parser cannot report character entities. Aborting."); + cleanup(); + return; + } parser.setContentHandler(this); parser.parse(this.input); cleanup(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-02 23:20:10
|
Revision: 7113 Author: victormote Date: 2006-05-02 16:19:58 -0700 (Tue, 02 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7113&view=rev Log Message: ----------- Fix entity problem. Modified Paths: -------------- trunk/foray/doc/web/app/resources/other.html Modified: trunk/foray/doc/web/app/resources/other.html =================================================================== --- trunk/foray/doc/web/app/resources/other.html 2006-05-01 23:21:53 UTC (rev 7112) +++ trunk/foray/doc/web/app/resources/other.html 2006-05-02 23:19:58 UTC (rev 7113) @@ -142,7 +142,7 @@ href="http://www.phptr.com/bookstore/product.asp?isbn=0131403745&rl=1">Definitive XSL-FO</a>, by G. Ken Holman, Prentice Hall PTR, 2003, ISBN 0-131-40374-5.</li> <li>[book] <a rel="external" -href="http://www.samspublishing.com/bookstore/product.asp?isbn=0672322811&rl=1">XSL +href="http://www.samspublishing.com/bookstore/product.asp?isbn=0672322811&rl=1">XSL Formatting Objects Developer's Handbook</a>, by Doug Lovell, Sams, 2002, ISBN 0-672-32281-1.</li> <li>[book] <a rel="external" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-01 23:22:01
|
Revision: 7112 Author: victormote Date: 2006-05-01 16:21:53 -0700 (Mon, 01 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7112&view=rev Log Message: ----------- Fix broken or redirected links. Modified Paths: -------------- trunk/foray/doc/web/app/resources/other.html trunk/foray/doc/web/robots.txt Modified: trunk/foray/doc/web/app/resources/other.html =================================================================== --- trunk/foray/doc/web/app/resources/other.html 2006-05-01 22:40:51 UTC (rev 7111) +++ trunk/foray/doc/web/app/resources/other.html 2006-05-01 23:21:53 UTC (rev 7112) @@ -142,7 +142,7 @@ href="http://www.phptr.com/bookstore/product.asp?isbn=0131403745&rl=1">Definitive XSL-FO</a>, by G. Ken Holman, Prentice Hall PTR, 2003, ISBN 0-131-40374-5.</li> <li>[book] <a rel="external" -href="http://www.samspublishing.com/title/0672322811">XSL +href="http://www.samspublishing.com/bookstore/product.asp?isbn=0672322811&rl=1">XSL Formatting Objects Developer's Handbook</a>, by Doug Lovell, Sams, 2002, ISBN 0-672-32281-1.</li> <li>[book] <a rel="external" Modified: trunk/foray/doc/web/robots.txt =================================================================== --- trunk/foray/doc/web/robots.txt 2006-05-01 22:40:51 UTC (rev 7111) +++ trunk/foray/doc/web/robots.txt 2006-05-01 23:21:53 UTC (rev 7112) @@ -7,6 +7,6 @@ # Don't try to validate the link that does the link validation. Disallow: http://validator.w3.org/ -# Don't try to validate Apache Bugzilla entries. Even if they links +# Don't try to validate Apache Bugzilla entries. Even if the links # work they can't be verified. -Disallow: http://issues.apache.org/bugzilla/ +Disallow: http://issues.apache.org/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-01 22:41:04
|
Revision: 7111 Author: victormote Date: 2006-05-01 15:40:51 -0700 (Mon, 01 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7111&view=rev Log Message: ----------- Fix broken or redirected links. Modified Paths: -------------- trunk/foray/doc/web/app/resources/other.html trunk/foray/doc/web/dev/font/index.html trunk/foray/doc/web/robots.txt Modified: trunk/foray/doc/web/app/resources/other.html =================================================================== --- trunk/foray/doc/web/app/resources/other.html 2006-05-01 21:56:34 UTC (rev 7110) +++ trunk/foray/doc/web/app/resources/other.html 2006-05-01 22:40:51 UTC (rev 7111) @@ -59,7 +59,7 @@ href="http://www.w3.org/TR/2001/REC-xsl-20011015/">XSL-FO Recommendation (15 October 2001)</a></li> <li><a rel="external" -href="http://www.renderx.com/Tests/validator/fo.dtd.html">Unofficial DTD for +href="http://www.renderx.com/tools/validators.html">Unofficial DTD for the XSL-FO Recommendation</a> provided by N. Grigoriev from RenderX.</li> </ul> @@ -100,7 +100,7 @@ <h3><a name="specs-pdf">PDF</a></h3> <ul> <li><a rel="external" -href="http://partners.adobe.com/asn/tech/pdf/specifications.jsp">Portable +href="http://partners.adobe.com/public/developer/pdf/index_reference.html">Portable Document Format (PDF) Reference Manual</a></li> </ul> @@ -142,7 +142,7 @@ href="http://www.phptr.com/bookstore/product.asp?isbn=0131403745&rl=1">Definitive XSL-FO</a>, by G. Ken Holman, Prentice Hall PTR, 2003, ISBN 0-131-40374-5.</li> <li>[book] <a rel="external" -href="http://www.amazon.com/gp/product/0672322811/">XSL +href="http://www.samspublishing.com/title/0672322811">XSL Formatting Objects Developer's Handbook</a>, by Doug Lovell, Sams, 2002, ISBN 0-672-32281-1.</li> <li>[book] <a rel="external" @@ -174,10 +174,6 @@ Content in XML Documents</a>, by John E. Simpson, O'Reilly & Associates, 2002, ISBN 0-596-00291-2.</li> <li>[book] <a rel="external" -href="http://www.amazon.com/gp/product/0471416207/">XSL -Essentials</a>, by Michael Fitzgerald, John Wiley & Sons, 2001, ISBN -0-471-41620-7.</li> - <li>[book] <a rel="external" href="http://www.oreilly.com/catalog/javaxslt/">Java and XSLT</a>, by Eric M. Burke, O'Reilly & Associates, 2001, ISBN 0-596-00143-6.</li> </ul> @@ -187,11 +183,12 @@ <ul> <li>[online book] <a rel="external" href="http://www.ibiblio.org/xml/books/bible2/">The XML Bible</a>, by Elliotte -Rusty Harold. See hardcopy version below.</li> - <li>[book] <a rel="external" -href="http://www.amazon.com/gp/product/0764547607/">The XML -Bible</a>, by Elliotte Rusty Harold, John Wiley & Sons, ISBN 0-764-54760-7. -See online version above.</li> +Rusty Harold.</li> + <li>[book] <a rel="external" href="http://www.oreilly.com/catalog/xmlnut3/">XML +in a Nutshell</a>, by Elliotte Rusty Harold, W. Scott Means, O'Reilly & +Associates, 2004, ISBN 0-596-00764-7.</li> + <li>[book] <a rel="external" href="http://www.oreilly.com/catalog/learnxml2/">Learning +XML</a>, by By Erik T. Ray, O'Reilly & Associates, 2003, ISBN 0-596-00420-6.</li> <li>[online resource] A great number of additional XML-related books and articles can be found at the <a rel="external" href="http://www.oreilly.com/pub/topic/xml">O'Reilly XML Site</a>.</li> Modified: trunk/foray/doc/web/dev/font/index.html =================================================================== --- trunk/foray/doc/web/dev/font/index.html 2006-05-01 21:56:34 UTC (rev 7110) +++ trunk/foray/doc/web/dev/font/index.html 2006-05-01 22:40:51 UTC (rev 7111) @@ -116,30 +116,9 @@ <h2><a name="resource-dev">Developer Font Resources</a></h2> <ul> - <li><a href="http://partners.adobe.com/asn/tech/type/ftechnotes.jsp" -rel="external">Adobe’s - Type Technology page</a> contains links to many of the Adobe resources - listed below.</li> - <li><a href="http://partners.adobe.com/asn/developer/pdfs/tn/T1_SPEC.PDF" -rel="external">Adobe - Type 1 Font Format</a></li> - <li><a href="http://partners.adobe.com/asn/developer/pdfs/tn/5178.PFM.pdf" -rel="external">Adobe - Technical Note #5178</a>: Building PFM Files for Postscript-Language CJK - Fonts</li> - <li><a href="http://partners.adobe.com/asn/developer/pdfs/tn/5004.AFM_Spec.pdf" -rel="external">Adobe - Technical Note #5004</a>: Adobe Font Metrics File Format Specification</li> - <li><a href="http://partners.adobe.com/asn/developer/pdfs/tn/5040.Download_Fonts.pdf" -rel="external">Adobe - Technical Note #5040</a>: Supporting Downloadable Postscript Language - Fonts.</li> - <li><a href="http://partners.adobe.com/asn/developer/pdfs/tn/5092.CID_Overview.pdf" -rel="external">Adobe - Technical Note #5092</a>: CID-Keyed Font Technology Overview.</li> - <li><a href="http://partners.adobe.com/asn/developer/pdfs/tn/5014.CMap_CIDFont_Spec.pdf" -rel="external">Adobe - Technical Note #5014</a>: Adobe CMap and CID Font Files Specification.</li> + <li>Adobe’s <a href="http://partners.adobe.com/public/developer/opentype/index.html" +rel="external">Type Technology</a> page contains links to many important type-related +documents.</li> <li>Links to TrueType specification fragments can be found at the <a href="http://www.microsoft.com/typography/SpecificationsOverview.mspx" rel="external">Microsoft @@ -147,9 +126,6 @@ <li><a href="http://download.microsoft.com/download/Typography/archive/v1.4/WIN98MeXP/EN-US/otsp14.exe" rel="external">OpenType specification</a></li> - <li>The Adobe <a href="http://www.adobe.com/type/opentype/main.html" -rel="external">Introduction - to OpenType fonts</a>.</li> <li>The article <a href="http://www.postscript.org/FAQs/language/node40.html" rel="external">“How does Macintosh Store PostScript Fonts?”</a>.</li> Modified: trunk/foray/doc/web/robots.txt =================================================================== --- trunk/foray/doc/web/robots.txt 2006-05-01 21:56:34 UTC (rev 7110) +++ trunk/foray/doc/web/robots.txt 2006-05-01 22:40:51 UTC (rev 7111) @@ -7,6 +7,6 @@ # Don't try to validate the link that does the link validation. Disallow: http://validator.w3.org/ -# Don't try to validate Amazon product links. They apparently don't -# allow HEAD requests. -Disallow: http://www.amazon.com/gp/product/ +# Don't try to validate Apache Bugzilla entries. Even if they links +# work they can't be verified. +Disallow: http://issues.apache.org/bugzilla/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |