foray-commit Mailing List for FOray (Page 256)
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-06-09 22:51:27
|
Revision: 7486 Author: victormote Date: 2006-06-09 15:51:22 -0700 (Fri, 09 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7486&view=rev Log Message: ----------- Conform to axsl change: Remove interface for table-column. This is not a real area, and was only used to paint the background in the renderer. Modified Paths: -------------- trunk/foray/foray-render/src/java/org/foray/render/Renderer.java Modified: trunk/foray/foray-render/src/java/org/foray/render/Renderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2006-06-09 22:38:49 UTC (rev 7485) +++ trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2006-06-09 22:51:22 UTC (rev 7486) @@ -63,7 +63,6 @@ import org.axsl.areaR.TableArea; import org.axsl.areaR.TableBodyContainer; import org.axsl.areaR.TableCellArea; -import org.axsl.areaR.TableColumnArea; import org.axsl.areaR.TableFooterContainer; import org.axsl.areaR.TableHeaderContainer; import org.axsl.areaR.TableRowContainer; @@ -409,6 +408,10 @@ * @param area The TableRA instance to render. */ protected void render(TableArea area) { + /* TODO: Add logic that tries to paint the background as efficiently + * as possible. Contiguous cells should have their backgrounds painted + * at the same time (at least to the extent they are in the same + * rectangle. */ doFrame(area); List children = area.getChildren(); @@ -435,11 +438,6 @@ } } - protected void render(TableColumnArea area) { - markBackground(area); - renderChildren(area); - } - protected void render(TableRowContainer area) { doFrame(area); renderChildren(area); @@ -635,7 +633,6 @@ return; } case ConstantsAreaTree.AREATYPE_TABLE_COLUMN_RA: { - render((TableColumnArea) atNode); return; } case ConstantsAreaTree.AREATYPE_TABLE_ROW_RA: { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 22:38:54
|
Revision: 7485 Author: victormote Date: 2006-06-09 15:38:49 -0700 (Fri, 09 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7485&view=rev Log Message: ----------- Standardize error messages. Modified Paths: -------------- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableRowPL.java Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableRowPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableRowPL.java 2006-06-09 21:18:19 UTC (rev 7484) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableRowPL.java 2006-06-09 22:38:49 UTC (rev 7485) @@ -82,34 +82,30 @@ // cell.setColumnNumber(colNum); // If cellColNum "off the end", this cell is in limbo! if (colNum < 1) { - throw new AreaWException("Cell (#"+i+") implicitly " + throw new AreaWException("Cell (#" + i + ") implicitly " + "positioned beyond number of columns"); } cellColNum = colNum; } else if (cellColNum > columns.size()) { // Explicit colomn number specification out of range, skip it. - layout.getLogger().error(" " + cell.getSystemId() + ':' - + cell.getLine() + ':' - + cell.getColumn() + ": Cell (#" + i - + ") explicitely positioned beyond number of columns, " - + "dropped"); + layout.getLogger().error("Cell (#" + i + ") explicitly " + + "positioned beyond number of columns, dropped:\n" + + cell.getContextMessage()); continue; } // see if it fits and doesn't overwrite anything if (cellColNum + numCols - 1 > columns.size()) { // Too many columns spanned. - layout.getLogger().error(" " + cell.getSystemId() + ':' - + cell.getLine() + ':' - + cell.getColumn() + ": Cell (#" + i - + ") spans columns beyond available number, clipped"); + layout.getLogger().error("Cell (#" + i + ") spans columns " + + "beyond available number, clipped:\n" + + cell.getContextMessage()); numCols = columns.size() - cellColNum + 1; } // Check for overwriting other cells (returns false) if (cellArray.storeCell(cell, cellColNum, numCols) == false) { - layout.getLogger().error(" " + cell.getSystemId() + ':' - + cell.getLine() + ':' - + cell.getColumn() + ": Cell +(#" + i - + ") overwrites other cells"); + layout.getLogger().error("Cell (#" + i + ") overwrites other " + + "cells:\n" + + cell.getContextMessage()); } if (cellColNum > colNum) { // Cells are initialized as empty already @@ -117,9 +113,8 @@ } else if (cellColNum < colNum) { // Cells out of order colNum = cellColNum; // CR "to the letter"! - layout.getLogger().debug(" " + getReal().getSystemId() + ':' - + getReal().getLine() + ':' + getReal().getColumn() - + ": Cell positioned out of order"); + layout.getLogger().debug("Cell positioned out of order:\n" + + cell.getContextMessage()); } colNum += numCols; // next cell in this column } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 21:18:24
|
Revision: 7484 Author: victormote Date: 2006-06-09 14:18:19 -0700 (Fri, 09 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7484&view=rev Log Message: ----------- Clean up doc a bit. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java Modified: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2006-06-09 19:35:47 UTC (rev 7483) +++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2006-06-09 21:18:19 UTC (rev 7484) @@ -36,7 +36,7 @@ * traversal needs. * * <p>Consideration was given to using - * javax.swing.tree.DefaultMutableTreeNode instead of creating this class. + * {@link DefaultMutableTreeNode} instead of creating this class. * However, the data portion of that class was not deemed suitable.</p> */ public abstract class OrderedTreeNode @@ -92,6 +92,9 @@ this.parent = parent; } + /** + * {@inheritDoc} + */ public Enumeration children() { if (getChildren() == null || getChildren().size() == 0) { return EMPTY_ENUMERATION; @@ -99,10 +102,19 @@ return new ListEnumeration(getChildren()); } + /** + * {@inheritDoc} + */ public abstract List getChildren(); + /** + * {@inheritDoc} + */ public abstract boolean getAllowsChildren(); + /** + * {@inheritDoc} + */ public TreeNode getChildAt(int childIndex) { if (childIndex < 0) { return null; @@ -113,6 +125,9 @@ return (TreeNode) getChildren().get(childIndex); } + /** + * {@inheritDoc} + */ public int getChildCount() { if (getChildren() == null) { return 0; @@ -120,6 +135,9 @@ return getChildren().size(); } + /** + * {@inheritDoc} + */ public int getIndex(TreeNode node) { if (getChildren() == null) { return -1; @@ -127,10 +145,16 @@ return getChildren().indexOf(node); } + /** + * {@inheritDoc} + */ public TreeNode getParent() { return this.parent; } + /** + * {@inheritDoc} + */ public boolean isLeaf() { if (getChildCount() < 1) { return true; @@ -138,6 +162,9 @@ return false; } + /** + * {@inheritDoc} + */ public List getSiblings() { if (parent == null) { return null; @@ -150,7 +177,7 @@ } /** - * @return The index to "this" in the parent's children. + * {@inheritDoc} */ public int siblingIndex() { List siblings = getSiblings(); @@ -161,8 +188,7 @@ } /** - * @return Return the sibling immediately preceding "this" in the parent's - * children, or null if this is the first child. + * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getPreviousSibling() { int mySiblingIndex = siblingIndex(); @@ -173,8 +199,7 @@ } /** - * @return Return the sibling immediately following "this" in the parent's - * children, or null if this is the last child. + * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode getNextSibling() { int mySiblingIndex = siblingIndex(); @@ -188,12 +213,16 @@ return (OrderedTreeNode) getSiblings().get(mySiblingIndex + 1); } + /** + * Changes this nodes parent. + * @param newParent The new parent of this node. + */ public void setParent(OrderedTreeNode newParent) { this.parent = newParent; } /** - * @return True if this AreaNode has any children, false if it has none. + * {@inheritDoc} */ public boolean hasChildren() { if (getChildCount() > 0) { @@ -202,6 +231,9 @@ return false; } + /** + * {@inheritDoc} + */ public org.axsl.common.OrderedTreeNode getFirstChild() { List children = getChildren(); if (children == null) { @@ -213,6 +245,9 @@ return (OrderedTreeNode) children.get(0); } + /** + * {@inheritDoc} + */ public org.axsl.common.OrderedTreeNode getLastChild() { List children = getChildren(); if (children == null) { @@ -225,9 +260,7 @@ } /** - * Returns the next node in the tree relative to the current node, in - * pre-order traversal order. This is also known as breadth-first order. - * @return The next pre-order node, or null if there is none. + * {@inheritDoc} */ public org.axsl.common.OrderedTreeNode nextPreOrderNode() { // Any children? @@ -248,14 +281,8 @@ } /** - * Finds and returns the first leaf that is a descendant of this node -- - * either this node or its first child's first leaf. - * Returns this node if it is a leaf. - * (Liberated from {@link DefaultMutableTreeNode}). - * - * @see #isLeaf - * @see DefaultMutableTreeNode#isNodeDescendant - * @return the first leaf in the subtree rooted at this node + * {@inheritDoc} + * This implementation was liberated from {@link DefaultMutableTreeNode}). */ public org.axsl.common.OrderedTreeNode getFirstLeaf() { org.axsl.common.OrderedTreeNode node = this; @@ -265,16 +292,9 @@ return node; } - /** - * Finds and returns the last leaf that is a descendant of this node -- - * either this node or its last child's last leaf. - * Returns this node if it is a leaf. - * (Liberated from {@link DefaultMutableTreeNode}). - * - * @see #isLeaf - * @see DefaultMutableTreeNode#isNodeDescendant - * @return the last leaf in the subtree rooted at this node + * {@inheritDoc} + * This implementation was liberated from {@link DefaultMutableTreeNode}). */ public org.axsl.common.OrderedTreeNode getLastLeaf() { org.axsl.common.OrderedTreeNode node = this; @@ -284,26 +304,9 @@ return node; } - /** - * Returns the leaf after this node or null if this node is the - * last leaf in the tree. - * <p> - * In this implementation of the <code>MutableNode</code> interface, - * this operation is very inefficient. In order to determine the - * next node, this method first performs a linear search in the - * parent's child-list in order to find the current node. - * <p> - * That implementation makes the operation suitable for short - * traversals from a known position. But to traverse all of the - * leaves in the tree, you should use <code>depthFirstEnumeration</code> - * to enumerate the nodes in the tree and use <code>isLeaf</code> - * on each node to determine which are leaves. - * (Liberated from {@link DefaultMutableTreeNode}). - * - * @see DefaultMutableTreeNode#depthFirstEnumeration - * @see #isLeaf - * @return returns the next leaf past this node + * {@inheritDoc} + * This implementation was liberated from {@link DefaultMutableTreeNode}). */ public org.axsl.common.OrderedTreeNode getNextLeaf() { org.axsl.common.OrderedTreeNode nextSibling; @@ -318,26 +321,9 @@ return myParent.getNextLeaf(); // tail recursion } - /** - * Returns the leaf before this node or null if this node is the - * first leaf in the tree. - * <p> - * In this implementation of the <code>MutableNode</code> interface, - * this operation is very inefficient. In order to determine the - * previous node, this method first performs a linear search in the - * parent's child-list in order to find the current node. - * <p> - * That implementation makes the operation suitable for short - * traversals from a known position. But to traverse all of the - * leaves in the tree, you should use <code>depthFirstEnumeration</code> - * to enumerate the nodes in the tree and use <code>isLeaf</code> - * on each node to determine which are leaves. - * (Liberated from {@link DefaultMutableTreeNode}). - * - * @see DefaultMutableTreeNode#depthFirstEnumeration - * @see #isLeaf - * @return returns the leaf before this node + * {@inheritDoc} + * This implementation was liberated from {@link DefaultMutableTreeNode}). */ public org.axsl.common.OrderedTreeNode getPreviousLeaf() { org.axsl.common.OrderedTreeNode previousSibling; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 19:35:54
|
Revision: 7483 Author: victormote Date: 2006-06-09 12:35:47 -0700 (Fri, 09 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7483&view=rev Log Message: ----------- Remove unused method. Modified Paths: -------------- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2006-06-09 18:41:35 UTC (rev 7482) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2006-06-09 19:35:47 UTC (rev 7483) @@ -25,7 +25,6 @@ package org.foray.pioneer; import org.axsl.areaW.Area; -import org.axsl.areaW.AreaNode; import org.axsl.areaW.AreaWException; import org.axsl.areaW.FOLinkage; import org.axsl.areaW.LineArea; @@ -272,12 +271,4 @@ return linkage; } - public AreaNode getLastGeneratedBy() { - FOLinkage linkage = getFOLinkage(); - if (linkage == null) { - return null; - } - return linkage.getLastGeneratedBy(); - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 18:41:41
|
Revision: 7482 Author: victormote Date: 2006-06-09 11:41:35 -0700 (Fri, 09 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7482&view=rev Log Message: ----------- 1. Before creating FOText, make sure its heritage is valid. 2. Ignore ignorable whitespace. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java Modified: trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2006-06-09 18:41:22 UTC (rev 7481) +++ trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2006-06-09 18:41:35 UTC (rev 7482) @@ -469,8 +469,9 @@ } /** - * Tests a character for inclusion in XML whitespace. The definition of - * XML whitespace is obtained from the XML 1.0 Recommendation, Section 2.3. + * Tests a character for inclusion in XML whitespace. + * The definition of XML whitespace is obtained from the XML 1.0 + * Recommendation, Section 2.3. * @param c The character to be tested. * @return True iff the character is XML whitespace. */ @@ -489,6 +490,26 @@ } /** + * Tests whether a given sequence of chars is all XML whitespace. + * The definition of XML whitespace is obtained from the XML 1.0 + * Recommendation, Section 2.3. + * @param chars The sequence of character to be tested. + * @return True iff every character in <code>chars</code> is XML whitespace. + */ + public static boolean isXMLWhitespace(char[] chars) { + if (chars == null) { + return true; + } + for (int i = 0; i < chars.length; i ++) { + char c = chars[i]; + if (! isXMLWhitespace(c)) { + return false; + } + } + return true; + } + + /** * Indicates whether the argument is a valid NAME as defined by XSL. * @see <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">The NCName * definition for XML</a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 18:41:34
|
Revision: 7481 Author: victormote Date: 2006-06-09 11:41:22 -0700 (Fri, 09 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7481&view=rev Log Message: ----------- 1. Before creating FOText, make sure its heritage is valid. 2. Ignore ignorable whitespace. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Wrapper.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java 2006-06-09 17:46:41 UTC (rev 7480) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java 2006-06-09 18:41:22 UTC (rev 7481) @@ -24,6 +24,8 @@ package org.foray.fotree; +import org.foray.common.XMLCharacter; + import org.axsl.foR.FOContext; import org.axsl.foR.FOTreeException; @@ -49,14 +51,47 @@ } protected void finalizeText() throws FOTreeException { - if (textBuffer != null && textBuffer.length() > 0) { - char[] charArray = textBuffer.toString().toCharArray(); - FOText ft = new FOText(this, charArray); - super.addChild(ft); - textBuffer.setLength(0); + if (! this.shouldCreateFOText()) { + return; } + char[] charArray = textBuffer.toString().toCharArray(); + FOText ft = new FOText(this, charArray); + super.addChild(ft); + textBuffer.setLength(0); } + private boolean shouldCreateFOText() throws FOTreeException { + if (textBuffer == null) { + return false; + } + if (textBuffer.length() < 1) { + return false; + } + if (! this.blockMustEnclosePCDATA()) { + return true; + } + if (this.getContainingBlock(null) != null) { + return true; + } + /* We are not inside a block. If it is ignorable whitespace, + * we will ignore it by not creating an FOText. Otherwise, it + * should be reported as an error. */ + char[] charArray = this.textBuffer.toString().toCharArray(); + if (XMLCharacter.isXMLWhitespace(charArray)) { + return false; + } + this.throwException("PCDATA content must be inside an fo:block"); + return false; + } + + /** + * Indicates whether any PCDATA (text) found in this element must have an + * ancestor block element. + * @return True iff PCDATA in this element must have an ancestor block + * element. + */ + public abstract boolean blockMustEnclosePCDATA() ; + protected void end() throws FOTreeException { finalizeText(); textBuffer = null; Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2006-06-09 17:46:41 UTC (rev 7480) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2006-06-09 18:41:22 UTC (rev 7481) @@ -146,4 +146,11 @@ return outsideList; } + /** + * {@inheritDoc} + */ + public boolean blockMustEnclosePCDATA() { + return true; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2006-06-09 17:46:41 UTC (rev 7480) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2006-06-09 18:41:22 UTC (rev 7481) @@ -59,4 +59,11 @@ return this.getFOTreeBuilder().getFONamespace(); } + /** + * {@inheritDoc} + */ + public boolean blockMustEnclosePCDATA() { + return false; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2006-06-09 17:46:41 UTC (rev 7480) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2006-06-09 18:41:22 UTC (rev 7481) @@ -59,4 +59,11 @@ return true; } + /** + * {@inheritDoc} + */ + public boolean blockMustEnclosePCDATA() { + return true; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2006-06-09 17:46:41 UTC (rev 7480) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2006-06-09 18:41:22 UTC (rev 7481) @@ -109,4 +109,11 @@ return this.getNextSibling() == null; } + /** + * {@inheritDoc} + */ + public boolean blockMustEnclosePCDATA() { + return true; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java 2006-06-09 17:46:41 UTC (rev 7480) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java 2006-06-09 18:41:22 UTC (rev 7481) @@ -97,4 +97,11 @@ return this.getFOTreeBuilder().getFONamespace(); } + /** + * {@inheritDoc} + */ + public boolean blockMustEnclosePCDATA() { + return true; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Wrapper.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Wrapper.java 2006-06-09 17:46:41 UTC (rev 7480) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Wrapper.java 2006-06-09 18:41:22 UTC (rev 7481) @@ -103,4 +103,11 @@ } } + /** + * {@inheritDoc} + */ + public boolean blockMustEnclosePCDATA() { + return true; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 17:46:48
|
Revision: 7480 Author: victormote Date: 2006-06-09 10:46:41 -0700 (Fri, 09 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7480&view=rev Log Message: ----------- 1. Remove unused and unneeded methods. 2. Remove no-longer-needed class. Modified Paths: -------------- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java Removed Paths: ------------- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageSequencePL.java Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java 2006-06-09 17:35:37 UTC (rev 7479) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java 2006-06-09 17:46:41 UTC (rev 7480) @@ -27,7 +27,6 @@ import org.axsl.areaW.Area; import org.axsl.areaW.AreaWException; -import org.axsl.areaW.FOLinkage; import org.axsl.foR.FONode; import org.axsl.foR.FObj; @@ -92,35 +91,6 @@ return ((FObj) this.getFONode()).getChildren(); } - /** - * Find the parent Area into which this FO should start generating the - * Areas that it needs to generate. - * If RealFObj is a block, this does not necessarily return a BlockArea, - * but rather the Area which should be the parent of the BlockAreas that - * RealFObj generates. - * @return The Area into which this should start generating Areas. - */ - org.axsl.areaW.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.getFONode(); - FObj previousSibling = realFObj.getPreviousSiblingFObj(); - if (previousSibling == null) { - return null; - } - // Find the last Area generated by that FO - FOLinkage linkage = (FOLinkage) previousSibling.getResult(); - if (linkage == null) { - return null; - } - org.axsl.areaW.AreaNode lastGenerated = linkage.getLastGeneratedBy(); - if (lastGenerated == null) { - return null; - } - // Find the parent of that node - return lastGenerated.getWritableParentArea(); - } - protected int layoutChildren(Area area) throws AreaWException { FONode node = this.getFONode(); int start = getProgress(); Deleted: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageSequencePL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageSequencePL.java 2006-06-09 17:35:37 UTC (rev 7479) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageSequencePL.java 2006-06-09 17:46:41 UTC (rev 7480) @@ -1,44 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.pioneer; - -import org.axsl.areaW.Area; -import org.axsl.areaW.PageArea; -import org.axsl.areaW.PageCollection; - -import org.axsl.foR.fo.PageSequence; - -public class PageSequencePL extends FObjPL { - - public PageSequencePL(PageSequence realFObj, PioneerLS layout) { - super(realFObj, layout); - } - - Area findStartingLayoutArea() { - PageCollection pc = (PageCollection) this.getLastGeneratedBy(); - PageArea page = (PageArea) pc.getLastChild(); - return page.getWritableRegionBody().getWritableMainRA(); - } -} Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java 2006-06-09 17:35:37 UTC (rev 7479) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java 2006-06-09 17:46:41 UTC (rev 7480) @@ -264,7 +264,7 @@ return new ContinuedLabelPL((ContinuedLabel) node, this); } case FONode.NODE_PAGE_SEQUENCE: { - return new PageSequencePL((PageSequence) node, this); + return new NoLayoutPL((PageSequence) node, this); } case FONode.NODE_DESTINATION: { return new NoLayoutPL((FObj) node, this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 17:35:41
|
Revision: 7479 Author: victormote Date: 2006-06-09 10:35:37 -0700 (Fri, 09 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7479&view=rev Log Message: ----------- Conform to axsl changes: Move document context methods up from FObj to FONode, so that error reporting on text items is more feasible. Modified Paths: -------------- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java =================================================================== --- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2006-06-09 17:35:28 UTC (rev 7478) +++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2006-06-09 17:35:37 UTC (rev 7479) @@ -248,9 +248,9 @@ blockArea = area.ancestorWritableNormalBlockArea(); } if (blockArea == null) { - FObj fobj = area.traitGeneratedBy(); + FONode foNode = this.realFONode; throw new AreaWException("Layout of inline objects must be inside " - + "a block:\n" + fobj.getContextMessage()); + + "a block:\n" + foNode.getContextMessage()); } BlockPL blockPL = this.layout.getBlockPL(blockArea); return blockPL.getCurrentLineArea(blockArea); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 17:35:35
|
Revision: 7478 Author: victormote Date: 2006-06-09 10:35:28 -0700 (Fri, 09 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7478&view=rev Log Message: ----------- Conform to axsl changes: Move document context methods up from FObj to FONode, so that error reporting on text items is more feasible. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2006-06-09 01:22:15 UTC (rev 7477) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2006-06-09 17:35:28 UTC (rev 7478) @@ -145,4 +145,17 @@ return (FONode) super.getChildAt(childIndex); } + /** + * {@inheritDoc} + */ + public String getContextMessage() { + return getContextMessage(this.getSystemId(), this.getLine(), + this.getColumn()); + } + + public String getContextMessage(String systemId, int line, int column) { + return " Context: " + systemId + "\n" + + " (Line " + line + ", Column " + column + ")"; + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-06-09 01:22:15 UTC (rev 7477) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2006-06-09 17:35:28 UTC (rev 7478) @@ -930,4 +930,16 @@ return returnArray; } + public String getSystemId() { + return this.parentFO().getSystemId(); + } + + public int getLine() { + return this.parentFO().getLine(); + } + + public int getColumn() { + return this.parentFO().getColumn(); + } + } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-06-09 01:22:15 UTC (rev 7477) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-06-09 17:35:28 UTC (rev 7478) @@ -348,18 +348,6 @@ getLogger().warn(message + "\n" + getContextMessage()); } - /** - * {@inheritDoc} - */ - public String getContextMessage() { - return getContextMessage(this.systemId, this.line, this.column); - } - - public String getContextMessage(String systemId, int line, int column) { - return " Context: " + systemId + "\n" - + " (Line " + line + ", Column " + column + ")"; - } - public FontConsumer getFontConsumer() { return getFOTreeBuilder().getFontConsumer(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 01:22:20
|
Revision: 7477 Author: victormote Date: 2006-06-08 18:22:15 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7477&view=rev Log Message: ----------- Change the use of hyphenation to properly exclude the zero or negative values. Modified Paths: -------------- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-09 01:18:03 UTC (rev 7476) +++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-09 01:22:15 UTC (rev 7477) @@ -396,11 +396,18 @@ - spaceWidth - getHyphenWidth(this.currentLineText); int[] hyphenationPoints = hyph.getHyphenationPoints(); + byte[] hyphenationWeights = hyph.getHyphenationWeights(); int index = -1; String wordBegin = ""; for (int i = 0; i < hyphenationPoints.length; i++) { + byte hyphenationWeight = hyphenationWeights[i]; + if (hyphenationWeight < 1) { + /* If the weight is zero or less, it is not a suitable + * hyphenation point. */ + continue; + } wordBegin = word.substring(0, hyphenationPoints[i]); int provisionalWordWidth = getWordWidth(lineText, wordBegin); if (provisionalWordWidth > remainingWidth) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 01:18:07
|
Revision: 7476 Author: victormote Date: 2006-06-08 18:18:03 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7476&view=rev Log Message: ----------- Extract method for clarity and consistency. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-09 01:10:55 UTC (rev 7475) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-09 01:18:03 UTC (rev 7476) @@ -298,33 +298,9 @@ if (hyphenation != null) { return hyphenation; } - - - // use algorithm to get hyphenation points - int[] result = new int[len + 1]; - byte[] values = new byte[result.length]; - int k = 0; - word[0] = '.'; // word start marker - word[len + 1] = '.'; // word end marker - word[len + 2] = 0; // null terminated - byte[] il = new byte[len + 3]; // initialized to zero - for (int i = 0; i < len + 1; i++) { - searchPatterns(word, i, il); - } - - // hyphenation points are located where interletter value is odd - for (int i = 0; i < len; i++) { - int interletterValue = il[i + 1]; - if (interletterValue != 0 - && i >= remainCharCount - && i <= (len - pushCharCount)) { - k++; - result[k] = i; - byte weight = convertLiangToWeight(interletterValue); - values[k] = weight; - } - } - return createHyphenation(theWord, result, values, k); + hyphenation = checkAlgorithm(theWord, remainCharCount, pushCharCount, + word); + return hyphenation; } /** @@ -416,6 +392,36 @@ return createHyphenation(sw, result, values, k); } + private Hyphenation checkAlgorithm(String theWord, int remainCharCount, + int pushCharCount, char[] word) { + int len = theWord.length(); + // use algorithm to get hyphenation points + int[] result = new int[len + 1]; + byte[] values = new byte[result.length]; + int k = 0; + word[0] = '.'; // word start marker + word[len + 1] = '.'; // word end marker + word[len + 2] = 0; // null terminated + byte[] il = new byte[len + 3]; // initialized to zero + for (int i = 0; i < len + 1; i++) { + searchPatterns(word, i, il); + } + + /* We report all of the non-zero values. */ + for (int i = 0; i < len; i++) { + int interletterValue = il[i + 1]; + if (interletterValue != 0 + && i >= remainCharCount + && i <= (len - pushCharCount)) { + k++; + result[k] = i; + byte weight = convertLiangToWeight(interletterValue); + values[k] = weight; + } + } + return createHyphenation(theWord, result, values, k); + } + /** * Add a character class to the tree. It is used by * {@link PatternParser PatternParser} as callback to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 01:11:00
|
Revision: 7475 Author: victormote Date: 2006-06-08 18:10:55 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7475&view=rev Log Message: ----------- 1. Return all values, including the negative values. 2. Return the weights. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-09 00:50:28 UTC (rev 7474) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-09 01:10:55 UTC (rev 7475) @@ -302,6 +302,7 @@ // use algorithm to get hyphenation points int[] result = new int[len + 1]; + byte[] values = new byte[result.length]; int k = 0; word[0] = '.'; // word start marker word[len + 1] = '.'; // word end marker @@ -313,28 +314,58 @@ // hyphenation points are located where interletter value is odd for (int i = 0; i < len; i++) { - if (((il[i + 1] & 1) == 1) && i >= remainCharCount + int interletterValue = il[i + 1]; + if (interletterValue != 0 + && i >= remainCharCount && i <= (len - pushCharCount)) { - result[k++] = i; + k++; + result[k] = i; + byte weight = convertLiangToWeight(interletterValue); + values[k] = weight; } } - return createHyphenation(theWord, result, k); + return createHyphenation(theWord, result, values, k); } /** + * Converts the raw value from the Liang data to a weighted value. + * In the Liang system, 1) even values are negative, 2) odd values are + * positive, and the magnitude of the number conveys the magnitude of + * the direction. + * @param liangValue A value in the range 0-9 that contains the Liang + * algorithm weight. + * @return A value in the range -4 to +5 that reflects the numeric weight + * of the raw Liang value. + */ + public static byte convertLiangToWeight(int liangValue) { + switch (liangValue) { + case 0: return 0; + case 1: return 1; + case 2: return -1; + case 3: return 2; + case 4: return -2; + case 5: return 3; + case 6: return -3; + case 7: return 4; + case 8: return -4; + case 9: return 5; + default: return 0; + } + } + + /** * @param result * @param k * @return The new Hyphenation instance. */ - private Hyphenation createHyphenation(String theWord, - int[] result, int k) { + private Hyphenation createHyphenation(String theWord, int[] result, + byte[] values, int k) { if (k > 0) { // trim result array int[] res = new int[k]; System.arraycopy(result, 0, res, 0, k); /* TODO: values needs to be populated. Also both positive and * negative values should be returned. */ - byte[] values = new byte[res.length]; return new Hyphenation(theWord, res, values); } return null; @@ -377,7 +408,12 @@ } } } - return createHyphenation(sw, result, k); + /* Assume that all found points have a value of 1. */ + byte[] values = new byte[result.length]; + for (int i = 0; i < values.length; i++) { + values[i] = 1; + } + return createHyphenation(sw, result, values, k); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 00:50:32
|
Revision: 7474 Author: victormote Date: 2006-06-08 17:50:28 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7474&view=rev Log Message: ----------- Reverse sense of test to flatten logic. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-09 00:48:13 UTC (rev 7473) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-09 00:50:28 UTC (rev 7474) @@ -357,28 +357,27 @@ private Hyphenation checkExceptions(String sw, int remainCharCount, int pushCharCount) { - // check exception list first - if (stoplist.containsKey(sw)) { - int length = sw.length(); - int[] result = new int[length + 1]; - int k = 0; - /* assume only simple hyphens (Hyphen.pre="-", - * Hyphen.post = Hyphen.no = null) */ - ArrayList hw = (ArrayList)stoplist.get(sw); - int j = 0; - for (int i = 0; i < hw.size(); i++) { - Object o = hw.get(i); - if (o instanceof String) { - j += ((String)o).length(); - if (j >= remainCharCount - && j < (length - pushCharCount)) { - result[k++] = j; - } + if (! stoplist.containsKey(sw)) { + return null; + } + int length = sw.length(); + int[] result = new int[length + 1]; + int k = 0; + /* assume only simple hyphens (Hyphen.pre="-", + * Hyphen.post = Hyphen.no = null) */ + ArrayList hw = (ArrayList)stoplist.get(sw); + int j = 0; + for (int i = 0; i < hw.size(); i++) { + Object o = hw.get(i); + if (o instanceof String) { + j += ((String)o).length(); + if (j >= remainCharCount + && j < (length - pushCharCount)) { + result[k++] = j; } } - return createHyphenation(sw, result, k); } - return null; + return createHyphenation(sw, result, k); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-09 00:48:21
|
Revision: 7473 Author: victormote Date: 2006-06-08 17:48:13 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7473&view=rev Log Message: ----------- Extract some methods for simplicity and clarity. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-08 23:53:02 UTC (rev 7472) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-09 00:48:13 UTC (rev 7473) @@ -292,45 +292,42 @@ return null; } + String theWord = new String(w, offset, len); + Hyphenation hyphenation = checkExceptions(theWord, remainCharCount, + pushCharCount); + if (hyphenation != null) { + return hyphenation; + } + + + // use algorithm to get hyphenation points int[] result = new int[len + 1]; int k = 0; + word[0] = '.'; // word start marker + word[len + 1] = '.'; // word end marker + word[len + 2] = 0; // null terminated + byte[] il = new byte[len + 3]; // initialized to zero + for (int i = 0; i < len + 1; i++) { + searchPatterns(word, i, il); + } - // check exception list first - String sw = new String(word, 1, len); - if (stoplist.containsKey(sw)) { - /* assume only simple hyphens (Hyphen.pre="-", - * Hyphen.post = Hyphen.no = null) */ - ArrayList hw = (ArrayList)stoplist.get(sw); - int j = 0; - for (int i = 0; i < hw.size(); i++) { - Object o = hw.get(i); - if (o instanceof String) { - j += ((String)o).length(); - if (j >= remainCharCount && j < (len - pushCharCount)) { - result[k++] = j; - } - } + // hyphenation points are located where interletter value is odd + for (int i = 0; i < len; i++) { + if (((il[i + 1] & 1) == 1) && i >= remainCharCount + && i <= (len - pushCharCount)) { + result[k++] = i; } - } else { - // use algorithm to get hyphenation points - word[0] = '.'; // word start marker - word[len + 1] = '.'; // word end marker - word[len + 2] = 0; // null terminated - byte[] il = new byte[len + 3]; // initialized to zero - for (int i = 0; i < len + 1; i++) { - searchPatterns(word, i, il); - } - - // hyphenation points are located where interletter value is odd - for (int i = 0; i < len; i++) { - if (((il[i + 1] & 1) == 1) && i >= remainCharCount - && i <= (len - pushCharCount)) { - result[k++] = i; - } - } } + return createHyphenation(theWord, result, k); + } - + /** + * @param result + * @param k + * @return The new Hyphenation instance. + */ + private Hyphenation createHyphenation(String theWord, + int[] result, int k) { if (k > 0) { // trim result array int[] res = new int[k]; @@ -338,7 +335,7 @@ /* TODO: values needs to be populated. Also both positive and * negative values should be returned. */ byte[] values = new byte[res.length]; - return new Hyphenation(new String(w, offset, len), res, values); + return new Hyphenation(theWord, res, values); } return null; } @@ -358,6 +355,32 @@ return word; } + private Hyphenation checkExceptions(String sw, int remainCharCount, + int pushCharCount) { + // check exception list first + if (stoplist.containsKey(sw)) { + int length = sw.length(); + int[] result = new int[length + 1]; + int k = 0; + /* assume only simple hyphens (Hyphen.pre="-", + * Hyphen.post = Hyphen.no = null) */ + ArrayList hw = (ArrayList)stoplist.get(sw); + int j = 0; + for (int i = 0; i < hw.size(); i++) { + Object o = hw.get(i); + if (o instanceof String) { + j += ((String)o).length(); + if (j >= remainCharCount + && j < (length - pushCharCount)) { + result[k++] = j; + } + } + } + return createHyphenation(sw, result, k); + } + return null; + } + /** * Add a character class to the tree. It is used by * {@link PatternParser PatternParser} as callback to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 23:53:09
|
Revision: 7472 Author: victormote Date: 2006-06-08 16:53:02 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7472&view=rev Log Message: ----------- 1. Extract a method for clarity. 2. Steps toward returning the values. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java 2006-06-08 23:06:06 UTC (rev 7471) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java 2006-06-08 23:53:02 UTC (rev 7472) @@ -34,30 +34,30 @@ */ public class Hyphenation implements org.axsl.hyphenR.Hyphenation { - int[] hyphenPoints; - String word; + private String word; - /** - * rawWord as made of alternating strings and {@link Hyphen Hyphen} - * instances - */ - Hyphenation(String word, int[] points) { + private int[] hyphenPoints; + + private byte[] hyphenValues; + + Hyphenation(String word, int[] points, byte[] values) { this.word = word; - hyphenPoints = points; + this.hyphenPoints = points; + this.hyphenValues = values; } /** * {@inheritDoc} */ public int[] getHyphenationPoints() { - return hyphenPoints; + return this.hyphenPoints; } /** * {@inheritDoc} */ public byte[] getHyphenationWeights() { - return null; + return this.hyphenValues; } public String toString() { Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-08 23:06:06 UTC (rev 7471) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2006-06-08 23:53:02 UTC (rev 7472) @@ -286,19 +286,12 @@ * the hyphenated word or null if word is not hyphenated. */ public org.axsl.hyphenR.Hyphenation hyphenate(char[] w, int offset, int len, - int remainCharCount, int pushCharCount) { - char[] word = new char[len + 3]; + int remainCharCount, int pushCharCount) { + char[] word = normalizeWord(w, offset, len); + if (word == null) { + return null; + } - // normalize word - char[] c = new char[2]; - for (int i = 1; i <= len; i++) { - c[0] = w[offset + i - 1]; - int nc = classmap.find(c, 0); - if (nc < 0) { // found a non-letter character, abort - return null; - } - word[i] = (char)nc; - } int[] result = new int[len + 1]; int k = 0; @@ -342,11 +335,29 @@ // trim result array int[] res = new int[k]; System.arraycopy(result, 0, res, 0, k); - return new Hyphenation(new String(w, offset, len), res); + /* TODO: values needs to be populated. Also both positive and + * negative values should be returned. */ + byte[] values = new byte[res.length]; + return new Hyphenation(new String(w, offset, len), res, values); } return null; } + private char[] normalizeWord(char[] w, int offset, int len) { + char[] word = new char[len + 3]; + + char[] c = new char[2]; + for (int i = 1; i <= len; i++) { + c[0] = w[offset + i - 1]; + int nc = classmap.find(c, 0); + if (nc < 0) { // found a non-letter character, abort + return null; + } + word[i] = (char)nc; + } + return word; + } + /** * Add a character class to the tree. It is used by * {@link PatternParser PatternParser} as callback to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 23:06:11
|
Revision: 7471 Author: victormote Date: 2006-06-08 16:06:06 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7471&view=rev Log Message: ----------- Partial conformity to axsl changes: Add new method to return the hyphenation values. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java 2006-06-08 22:00:18 UTC (rev 7470) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/Hyphenation.java 2006-06-08 23:06:06 UTC (rev 7471) @@ -33,6 +33,7 @@ * This class represents a hyphenated word. */ public class Hyphenation implements org.axsl.hyphenR.Hyphenation { + int[] hyphenPoints; String word; @@ -46,12 +47,19 @@ } /** - * @return the hyphenation points + * {@inheritDoc} */ public int[] getHyphenationPoints() { return hyphenPoints; } + /** + * {@inheritDoc} + */ + public byte[] getHyphenationWeights() { + return null; + } + public String toString() { StringBuffer str = new StringBuffer(); int start = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 22:00:25
|
Revision: 7470 Author: victormote Date: 2006-06-08 15:00:18 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7470&view=rev Log Message: ----------- Conform to axsl changes: Add method parameters to allow i18n. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 22:00:06 UTC (rev 7469) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 22:00:18 UTC (rev 7470) @@ -288,7 +288,8 @@ /** * {@inheritDoc} */ - public int wordSize(char[] characters, int wordStart) { + public int wordSize(char[] characters, int wordStart, String language, + String country) { if (characters == null) { return 0; } @@ -311,11 +312,13 @@ /** * {@inheritDoc} */ - public int wordSize(CharSequence characters, int wordStart) { + public int wordSize(CharSequence characters, int wordStart, String language, + String country) { if (characters == null) { return 0; } - return wordSize(characters.toString().toCharArray(), wordStart); + return wordSize(characters.toString().toCharArray(), wordStart, + language, country); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 22:00:11
|
Revision: 7469 Author: victormote Date: 2006-06-08 15:00:06 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7469&view=rev Log Message: ----------- Conform to axsl changes: Add method parameters to allow i18n. Modified Paths: -------------- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-08 21:55:12 UTC (rev 7468) +++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-08 22:00:06 UTC (rev 7469) @@ -361,7 +361,8 @@ } int nonWordChars = actualWordStart - wordStart; // Extract the word that should be evaluated by the hyphenation system. - int wordSize = server.wordSize(this.currentChars, actualWordStart); + int wordSize = server.wordSize(this.currentChars, actualWordStart, + language, country); String wordToHyphenate = new String(this.currentChars, actualWordStart, wordSize); // See if there are discretionary hyphenation points. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 21:55:16
|
Revision: 7468 Author: victormote Date: 2006-06-08 14:55:12 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7468&view=rev Log Message: ----------- Conform to axsl change: Add overloaded version of method to take a CharSequence instead of char[]. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 21:49:21 UTC (rev 7467) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 21:55:12 UTC (rev 7468) @@ -286,9 +286,12 @@ } /** - * extracts a complete word from the character data + * {@inheritDoc} */ public int wordSize(char[] characters, int wordStart) { + if (characters == null) { + return 0; + } boolean wordendFound = false; int counter = 0; int[] newWord = new int[characters.length]; // create a buffer @@ -308,6 +311,16 @@ /** * {@inheritDoc} */ + public int wordSize(CharSequence characters, int wordStart) { + if (characters == null) { + return 0; + } + return wordSize(characters.toString().toCharArray(), wordStart); + } + + /** + * {@inheritDoc} + */ public int wordStarts(char[] characters, int startIndex, String language, String country) { if (characters == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 21:49:25
|
Revision: 7467 Author: victormote Date: 2006-06-08 14:49:21 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7467&view=rev Log Message: ----------- Conform to axsl change: Rename and change return type for method, so that it now returns a size instead of a constructed word. This provides more flexibility to the client application about what should be done with the output. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 21:49:13 UTC (rev 7466) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 21:49:21 UTC (rev 7467) @@ -288,7 +288,7 @@ /** * extracts a complete word from the character data */ - public String getHyphenationWord(char[] characters, int wordStart) { + public int wordSize(char[] characters, int wordStart) { boolean wordendFound = false; int counter = 0; int[] newWord = new int[characters.length]; // create a buffer @@ -302,7 +302,7 @@ wordendFound = true; } } - return StringUtilPre5.newString(newWord, 0, counter); + return counter; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 21:49:18
|
Revision: 7466 Author: victormote Date: 2006-06-08 14:49:13 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7466&view=rev Log Message: ----------- Conform to axsl change: Rename and change return type for method, so that it now returns a size instead of a constructed word. This provides more flexibility to the client application about what should be done with the output. Modified Paths: -------------- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-08 21:39:07 UTC (rev 7465) +++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-08 21:49:13 UTC (rev 7466) @@ -361,8 +361,9 @@ } int nonWordChars = actualWordStart - wordStart; // Extract the word that should be evaluated by the hyphenation system. - String wordToHyphenate = server.getHyphenationWord( - this.currentChars, actualWordStart); + int wordSize = server.wordSize(this.currentChars, actualWordStart); + String wordToHyphenate = new String(this.currentChars, actualWordStart, + wordSize); // See if there are discretionary hyphenation points. Hyphenation hyph = server.hyphenate(wordToHyphenate, 0, wordToHyphenate.length(), language, country, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 21:39:13
|
Revision: 7465 Author: victormote Date: 2006-06-08 14:39:07 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7465&view=rev Log Message: ----------- Implement overloaded axsl method. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 21:15:02 UTC (rev 7464) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 21:39:07 UTC (rev 7465) @@ -310,6 +310,9 @@ */ public int wordStarts(char[] characters, int startIndex, String language, String country) { + if (characters == null) { + return -1; + } /* TODO: We need to handle language and country here. */ for (int i = startIndex; i < characters.length; i++) { char c = characters[i]; @@ -327,4 +330,16 @@ return -1; } + /** + * {@inheritDoc} + */ + public int wordStarts(CharSequence characters, int startIndex, + String language, String country) { + if (characters == null) { + return -1; + } + return wordStarts(characters.toString().toCharArray(), startIndex, + language, country); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 21:15:13
|
Revision: 7464 Author: victormote Date: 2006-06-08 14:15:02 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7464&view=rev Log Message: ----------- Conform to axsl changes: Add method parameters to allow i18n. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 21:14:53 UTC (rev 7463) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 21:15:02 UTC (rev 7464) @@ -308,7 +308,9 @@ /** * {@inheritDoc} */ - public int wordStarts(char[] characters, int startIndex) { + public int wordStarts(char[] characters, int startIndex, String language, + String country) { + /* TODO: We need to handle language and country here. */ for (int i = startIndex; i < characters.length; i++) { char c = characters[i]; switch(c) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 21:15:00
|
Revision: 7463 Author: victormote Date: 2006-06-08 14:14:53 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7463&view=rev Log Message: ----------- Conform to axsl changes: Add method parameters to allow i18n. Modified Paths: -------------- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-08 20:57:44 UTC (rev 7462) +++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-08 21:14:53 UTC (rev 7463) @@ -351,8 +351,11 @@ * LineText items to find the beginning of the word. */ HyphenationServer server = this.getHyphenationServer(); + String language = this.currentLineText.inlineLanguage(); + String country = this.currentLineText.inlineCountry(); // Count the number of chars at the beginning that should be ignored. - int actualWordStart = server.wordStarts(this.currentChars, wordStart); + int actualWordStart = server.wordStarts(this.currentChars, wordStart, + language, country); if (actualWordStart < 0) { return this.wordStart; } @@ -362,9 +365,7 @@ this.currentChars, actualWordStart); // See if there are discretionary hyphenation points. Hyphenation hyph = server.hyphenate(wordToHyphenate, 0, - wordToHyphenate.length(), - this.currentLineText.inlineLanguage(), - this.currentLineText.inlineCountry(), + wordToHyphenate.length(), language, country, this.currentLineText.inlineHyphenationRemainCount(), this.currentLineText.inlineHyphenationPushCount()); // If none, the word cannot be hyphenated. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-06-08 20:57:51
|
Revision: 7462 Author: victormote Date: 2006-06-08 13:57:44 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7462&view=rev Log Message: ----------- Conform to axsl changes: Rename method and change its meaning from returning the number of characters to skip to the index to the first character to be used. Modified Paths: -------------- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 20:57:37 UTC (rev 7461) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationServer.java 2006-06-08 20:57:44 UTC (rev 7462) @@ -306,22 +306,23 @@ } /** - * Returns the count of non-word characters at the beginning of the text - * being evaluated. This includes characters like " and ' which are not - * really part of the word, but which must be passed through to the output. - * @param characters The char array being evaluated. - * @param startIndex Index into the first character in characters that - * should be evaluated. - * @return The number of characters at the start that should be ignored for - * purposes of forming a word to be evaluated for hyphenation. + * {@inheritDoc} */ - public int nonWordChars(char[] characters, int startIndex) { - int count = 0; - // Look for ' or " at the beginning of the word. - if (characters[startIndex] == '"' || characters[startIndex] == '\'') { - count ++; + public int wordStarts(char[] characters, int startIndex) { + for (int i = startIndex; i < characters.length; i++) { + char c = characters[i]; + switch(c) { + case '"': + case '\'': { + + continue; + } + default: { + return i; + } + } } - return count; + return -1; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |