foray-commit Mailing List for FOray (Page 69)
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
(4) |
Dec
|
|
From: <vic...@us...> - 2021-12-06 17:31:40
|
Revision: 12177
http://sourceforge.net/p/foray/code/12177
Author: victormote
Date: 2021-12-06 17:31:37 +0000 (Mon, 06 Dec 2021)
Log Message:
-----------
Progress on restricting Block4a children.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-06 16:09:56 UTC (rev 12176)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-06 17:31:37 UTC (rev 12177)
@@ -120,6 +120,7 @@
import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.common.value.WrapOption;
import org.axsl.fo.Fo;
+import org.axsl.fo.FoContentModelBlockOnly;
import org.axsl.fo.FoContext;
import org.axsl.fo.FoInlineContext;
import org.axsl.fo.FoTreeException;
@@ -217,6 +218,11 @@
@Override
public abstract List<? extends FoObj> getChildren();
+ @Override
+ public FoObj getChildAt(final int childIndex) {
+ return getChildren().get(childIndex);
+ }
+
/**
* Return this node's effective parent, cast as an FoObj.
* This differs from the value returned by
@@ -3927,4 +3933,22 @@
return server.getOrthography(writingSystem);
}
+ /**
+ * Indicates whether this object has an descendants that are block-level items.
+ * Instances of classes that <em>might</em> be block-level items, but that are not and have no descendants that are
+ * should not be counted as blocks for purposes of this method.
+ * @return True if and only if this object has at least one descendant block-level item.
+ */
+ public boolean hasDescendantBlocks() {
+ for (int index = 0; index < getChildCount(); index ++) {
+ final FoObj foobj = this.getChildAt(index);
+ if (foobj instanceof FoContentModelBlockOnly) {
+ return true;
+ } else if (foobj.hasDescendantBlocks()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete.java 2021-12-06 16:09:56 UTC (rev 12176)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete.java 2021-12-06 17:31:37 UTC (rev 12177)
@@ -26,137 +26,129 @@
* $LastChangedBy$
*/
-//package org.foray.fotree.fo.obj;
-//
-//import org.foray.fotree.FoObj;
-//import org.foray.fotree.Namespace;
-//import org.foray.fotree.PropertyList;
-//
-//import org.axsl.fo.Fo;
-//import org.axsl.fo.FoContentModelBlock;
-//import org.axsl.fo.FoContentModelText;
-//import org.axsl.fo.FoContext;
-//import org.axsl.fo.FoTreeException;
-//import org.axsl.fo.ProxyFactory;
-//import org.axsl.font.FontUse;
-//
-//import java.util.ArrayList;
-//import java.util.List;
-//
-///**
-// * A container for pure text and inline items.
-// * This is a pass-thru pseudo-element that is always a child of a {@link Block4a} and that has no
-// * {@link FoContentModelBlock} descendants.
-// * In other words, it is content that can be laid out as a discrete paragraph.
-// */
-//public class BlockDiscrete extends FoObj {
-//
-// /** The parent of this node. */
-// private Block4a parent;
-// /** The children of this object. */
-// private List<FoObj> children = new ArrayList<FoObj>();
-//
-// /**
-// * Constructor.
-// * @param parent The parent FoObj.
-// */
-// public BlockDiscrete(final Block4a parent) {
-// super(parent);
-// this.parent = parent;
-// }
-//
-// @Override
-// public Fo getChildAt(int childIndex) {
-// // TODO Auto-generated method stub
-// return null;
-// }
-//
-// @Override
-// public Object acceptProxyFactory(ProxyFactory factory) {
-// // TODO Auto-generated method stub
-// return null;
-// }
-//
-// @Override
-// public boolean isValid() {
-// // TODO Auto-generated method stub
-// return false;
-// }
-//
-// @Override
-// public FontUse getPrimaryFont(final FoContext context) {
-// return this.parent.getPrimaryFont(context);
-// }
-//
-// @Override
-// public Block4a getParent() {
-// return this.parent;
-// }
-//
-// @Override
-// public List<? extends FoObj> getChildren() {
-// return this.children;
-// }
-//
-// @Override
-// protected void validateAncestry() throws FoTreeException {
-// }
-//
-// @Override
-// protected void validateProperties() throws FoTreeException {
-// }
-//
-// @Override
-// protected void setup() throws FoTreeException {
-// }
-//
-// @Override
-// protected void validateDescendants() throws FoTreeException {
-// }
-//
-// @Override
-// protected void end() throws FoTreeException {
-// }
-//
-// @Override
-// public void addChild(final FoObj child) throws FoTreeException {
-// // TODO Auto-generated method stub
-// if (child instanceof FoContentModelText
-// || child instanceof FoContent) {
-// this.children.add(child);
-// }
-//
-// }
-//
-// @Override
-// public Namespace getNamespace() {
-// return this.parent.getNamespace();
-// }
-//
-// @Override
-// public boolean isContentBlock() {
-// return true;
-// }
-//
-// @Override
-// public boolean isContentInline() {
-// return false;
-// }
-//
-// @Override
-// public boolean isContentPcdata() {
-// return false;
-// }
-//
-// @Override
-// public String getName() {
-// return "block-discrete-(pseudo)";
-// }
-//
-// @Override
-// public PropertyList getPropertyList() {
-// return this.parent.getPropertyList();
-// }
-//
-//
-//}
+package org.foray.fotree.fo.obj;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.Namespace;
+import org.foray.fotree.PropertyList;
+
+import org.axsl.fo.FoContentModelInlineOnly;
+import org.axsl.fo.FoContentModelText;
+import org.axsl.fo.FoContext;
+import org.axsl.fo.FoTreeException;
+import org.axsl.fo.ProxyFactory;
+import org.axsl.font.FontUse;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A container for only text and inline items.
+ * This is a pass-thru pseudo-element that is always a child of a {@link Block4a} and that has no
+ * {@link org.axsl.fo.FoContentModelBlock} descendants.
+ * In other words, it is content that can be laid out as a discrete paragraph, uninterrupted by other blocks.
+ */
+public class BlockDiscrete extends FoObj {
+
+ /** The parent of this node. */
+ private Block4a parent;
+
+ /** The children of this object. */
+ private List<FoObj> children = new ArrayList<FoObj>();
+
+ /**
+ * Constructor.
+ * @param parent The parent FoObj.
+ */
+ public BlockDiscrete(final Block4a parent) {
+ super(parent);
+ this.parent = parent;
+ }
+
+ @Override
+ public Object acceptProxyFactory(final ProxyFactory factory) {
+ return null;
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+ @Override
+ public FontUse getPrimaryFont(final FoContext context) {
+ return this.parent.getPrimaryFont(context);
+ }
+
+ @Override
+ public Block4a getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public List<? extends FoObj> getChildren() {
+ return this.children;
+ }
+
+ @Override
+ protected void validateAncestry() throws FoTreeException {
+ }
+
+ @Override
+ protected void validateProperties() throws FoTreeException {
+ }
+
+ @Override
+ protected void setup() throws FoTreeException {
+ }
+
+ @Override
+ protected void validateDescendants() throws FoTreeException {
+ }
+
+ @Override
+ protected void end() throws FoTreeException {
+ }
+
+ @Override
+ public void addChild(final FoObj child) throws FoTreeException {
+ if (child instanceof FoContentModelText
+ || child instanceof FoContentModelInlineOnly) {
+ this.children.add(child);
+ } else {
+ throw new IllegalStateException("Cannot add item to " + this.getClass().getName());
+ }
+ }
+
+ @Override
+ public Namespace getNamespace() {
+ return this.parent.getNamespace();
+ }
+
+ @Override
+ public boolean isContentBlock() {
+ return true;
+ }
+
+ @Override
+ public boolean isContentInline() {
+ return false;
+ }
+
+ @Override
+ public boolean isContentPcdata() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return "block-discrete-(pseudo)";
+ }
+
+ @Override
+ public PropertyList getPropertyList() {
+ return this.parent.getPropertyList();
+ }
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-06 16:09:59
|
Revision: 12176
http://sourceforge.net/p/foray/code/12176
Author: victormote
Date: 2021-12-06 16:09:56 +0000 (Mon, 06 Dec 2021)
Log Message:
-----------
Add generic type to AbstractOrderedTreeNode.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java
trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreeNode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2021-12-05 21:22:58 UTC (rev 12175)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2021-12-06 16:09:56 UTC (rev 12176)
@@ -157,10 +157,10 @@
*/
protected String getText(final AreaNode4a node) {
final StringBuilder builder = new StringBuilder();
- final Iterator<OrderedTreeNode> iterator =
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator =
node.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode otn = iterator.next();
+ final OrderedTreeNode<AreaNode4a> otn = iterator.next();
if (otn instanceof TextArea) {
final TextArea textArea = (TextArea) otn;
final CharSequence text = textArea.getRawText();
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractInlineArea.java 2021-12-05 21:22:58 UTC (rev 12175)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractInlineArea.java 2021-12-06 16:09:56 UTC (rev 12176)
@@ -215,7 +215,7 @@
*/
public boolean isFirstLeafOnLine() {
final LineArea4a ancestorLine = this.ancestorLineArea();
- final OrderedTreeNode firstLeaf = ancestorLine.getFirstLeaf();
+ final OrderedTreeNode<AreaNode4a> firstLeaf = ancestorLine.getFirstLeaf();
return this == firstLeaf;
}
@@ -225,7 +225,7 @@
*/
public boolean isLastLeafOnLine() {
final LineArea4a ancestorLine = this.ancestorLineArea();
- final OrderedTreeNode lastLeaf = ancestorLine.getLastLeaf();
+ final OrderedTreeNode<AreaNode4a> lastLeaf = ancestorLine.getLastLeaf();
return this == lastLeaf;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-05 21:22:58 UTC (rev 12175)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-06 16:09:56 UTC (rev 12176)
@@ -51,7 +51,7 @@
/**
* Abstract superclass for all nodes in the AreaTree.
*/
-public abstract class AreaNode4a extends AbstractOrderedTreeNode implements AreaNode {
+public abstract class AreaNode4a extends AbstractOrderedTreeNode<AreaNode4a> implements AreaNode {
/**
* Constructor.
@@ -73,7 +73,7 @@
public abstract AreaNode4a getParent();
@Override
- public OrderedTreeNode getOrderedParent() {
+ public OrderedTreeNode<AreaNode4a> getOrderedParent() {
return this.getParent();
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2021-12-05 21:22:58 UTC (rev 12175)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2021-12-06 16:09:56 UTC (rev 12176)
@@ -168,10 +168,10 @@
}
this.optimized = true;
/* Resolve the page-number-citations. */
- final Iterator<OrderedTreeNode> iterator =
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode o = iterator.next();
+ final OrderedTreeNode<AreaNode4a> o = iterator.next();
if (o instanceof PageNumberCitationArea) {
final PageNumberCitationArea pia = (PageNumberCitationArea) o;
pia.getText();
@@ -227,10 +227,10 @@
if (leaderSpaceAvailable == 0) {
return;
}
- final Iterator<OrderedTreeNode> iterator =
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode object = iterator.next();
+ final OrderedTreeNode<AreaNode4a> object = iterator.next();
if (object instanceof LeaderArea) {
final LeaderArea leader = (LeaderArea) object;
boolean prorating = false;
@@ -256,10 +256,10 @@
private int computeLeaderCapacity(final int unusedSpace) {
// First, compute how much capacity the leaders have.
int leaderSpaceAvailable = 0;
- final Iterator<OrderedTreeNode> iterator =
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode object = iterator.next();
+ final OrderedTreeNode<AreaNode4a> object = iterator.next();
if (object instanceof LeaderArea) {
final LeaderArea leader = (LeaderArea) object;
if (unusedSpace > 0) {
@@ -329,9 +329,9 @@
if (wordSpacingCapacity == 0) {
return;
}
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator = this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
+ final OrderedTreeNode<AreaNode4a> descendant = iterator.next();
if (descendant instanceof TextArea) {
final TextArea text = (TextArea) descendant;
boolean prorating = false;
@@ -354,9 +354,9 @@
*/
private int computeWordSpacingCapacity(final int unusedSpace) {
int wordSpacingCapacity = 0;
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator = this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
+ final OrderedTreeNode<AreaNode4a> descendant = iterator.next();
if (descendant instanceof TextArea) {
final TextArea text = (TextArea) descendant;
if (unusedSpace > 0) {
@@ -417,9 +417,9 @@
if (letterSpacingCapacity == 0) {
return;
}
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator = this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
+ final OrderedTreeNode<AreaNode4a> descendant = iterator.next();
if (descendant instanceof TextArea) {
final TextArea text = (TextArea) descendant;
boolean prorating = false;
@@ -442,9 +442,9 @@
*/
private int computeLetterSpacingCapacity(final int unusedSpace) {
int letterSpacingCapacity = 0;
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator = this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
+ final OrderedTreeNode<AreaNode4a> descendant = iterator.next();
if (descendant instanceof TextArea) {
final TextArea text = (TextArea) descendant;
if (unusedSpace > 0) {
@@ -506,9 +506,9 @@
* absorb a relatively larger share of the change in word-space.
*/
int totalDenominator = 0;
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator = this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
+ final OrderedTreeNode<AreaNode4a> descendant = iterator.next();
if (descendant instanceof TextArea) {
final TextArea text = (TextArea) descendant;
final int denominator = text.countSpaces()
@@ -519,9 +519,9 @@
if (totalDenominator == 0) {
return;
}
- final Iterator<OrderedTreeNode> iterator2 = this.postOrderDescendantIterator();
+ final Iterator<OrderedTreeNode<AreaNode4a>> iterator2 = this.postOrderDescendantIterator();
while (iterator2.hasNext()) {
- final OrderedTreeNode descendant = iterator2.next();
+ final OrderedTreeNode<AreaNode4a> descendant = iterator2.next();
if (descendant instanceof TextArea) {
final TextArea text = (TextArea) descendant;
final int numSpaces = text.countSpaces();
@@ -621,7 +621,7 @@
}
/* "... any lines in the block ending in U+000A." */
- final OrderedTreeNode lastLeaf = this.getLastLeaf();
+ final OrderedTreeNode<AreaNode4a> lastLeaf = this.getLastLeaf();
if (lastLeaf instanceof TextArea) {
final TextArea textArea = (TextArea) lastLeaf;
if (textArea.endsWithLinefeed()) {
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java 2021-12-05 21:22:58 UTC (rev 12175)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java 2021-12-06 16:09:56 UTC (rev 12176)
@@ -44,11 +44,12 @@
* <p>Consideration was given to using {@link DefaultMutableTreeNode} instead of
* creating this class.
* However, the data portion of that class was not deemed suitable.</p>
+ * @param <T> The type of node.
*/
-public abstract class AbstractOrderedTreeNode implements OrderedTreeNode {
+public abstract class AbstractOrderedTreeNode<T> implements OrderedTreeNode<T> {
@Override
- public Enumeration<? extends OrderedTreeNode> children() {
+ public Enumeration<? extends OrderedTreeNode<T>> children() {
return Collections.enumeration(this.getChildren());
}
@@ -57,7 +58,7 @@
* in post-traversal (depth-first) order.
* @return A post-traversal iterator of this node's descendants.
*/
- public Iterator<OrderedTreeNode> postOrderDescendantIterator() {
+ public Iterator<OrderedTreeNode<T>> postOrderDescendantIterator() {
return new PostOrderDescendantIterator(this);
}
@@ -65,7 +66,7 @@
* Return the List of this node's children.
* @return The List of this node's children.
*/
- public abstract List<? extends OrderedTreeNode>
+ public abstract List<? extends OrderedTreeNode<T>>
getChildren();
@Override
@@ -100,11 +101,11 @@
* node.
* @return The List of this node's parent's children.
*/
- public abstract List<? extends OrderedTreeNode> getSiblings();
+ public abstract List<? extends OrderedTreeNode<T>> getSiblings();
@Override
public int siblingIndex() {
- final List<? extends OrderedTreeNode> siblings = getSiblings();
+ final List<? extends OrderedTreeNode<T>> siblings = getSiblings();
if (siblings == null) {
return -1;
}
@@ -112,7 +113,7 @@
}
@Override
- public OrderedTreeNode getPreviousSibling() {
+ public OrderedTreeNode<T> getPreviousSibling() {
final int mySiblingIndex = siblingIndex();
if (mySiblingIndex < 1) {
return null;
@@ -121,7 +122,7 @@
}
@Override
- public OrderedTreeNode getNextSibling() {
+ public OrderedTreeNode<T> getNextSibling() {
final int mySiblingIndex = siblingIndex();
if (mySiblingIndex < 0) {
return null;
@@ -142,8 +143,8 @@
}
@Override
- public OrderedTreeNode getFirstChild() {
- final List<? extends OrderedTreeNode> children = getChildren();
+ public OrderedTreeNode<T> getFirstChild() {
+ final List<? extends OrderedTreeNode<T>> children = getChildren();
if (children == null) {
return null;
}
@@ -154,8 +155,8 @@
}
@Override
- public OrderedTreeNode getLastChild() {
- final List<? extends OrderedTreeNode> children = getChildren();
+ public OrderedTreeNode<T> getLastChild() {
+ final List<? extends OrderedTreeNode<T>> children = getChildren();
if (children == null) {
return null;
}
@@ -166,12 +167,12 @@
}
@Override
- public OrderedTreeNode nextPreOrderNode() {
+ public OrderedTreeNode<T> nextPreOrderNode() {
// Any children?
if (getChildCount() > 0) {
return getChildren().get(0);
}
- OrderedTreeNode currentNode = this;
+ OrderedTreeNode<T> currentNode = this;
while (currentNode != null) {
currentNode = currentNode.getNextSibling();
if (currentNode != null) {
@@ -189,10 +190,10 @@
* post-order traversal order. This is also known as depth-first order.
* @return The next post-order node, or null if there is none.
*/
- public OrderedTreeNode nextPostOrderNode() {
+ public OrderedTreeNode<T> nextPostOrderNode() {
/* All of the children would come before this. */
/* If there are siblings, they or their descendants come next. */
- final OrderedTreeNode nextSibling = this.getNextSibling();
+ final OrderedTreeNode<T> nextSibling = this.getNextSibling();
if (nextSibling != null) {
return nextSibling.getFirstLeaf();
}
@@ -207,8 +208,8 @@
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
@Override
- public OrderedTreeNode getFirstLeaf() {
- OrderedTreeNode node = this;
+ public OrderedTreeNode<T> getFirstLeaf() {
+ OrderedTreeNode<T> node = this;
while (!node.isLeaf()) {
node = node.getFirstChild();
}
@@ -220,8 +221,8 @@
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
@Override
- public OrderedTreeNode getLastLeaf() {
- OrderedTreeNode node = this;
+ public OrderedTreeNode<T> getLastLeaf() {
+ OrderedTreeNode<T> node = this;
while (!node.isLeaf()) {
node = node.getLastChild();
}
@@ -233,13 +234,13 @@
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
@Override
- public OrderedTreeNode getNextLeaf() {
- final OrderedTreeNode myParent = getOrderedParent();
+ public OrderedTreeNode<T> getNextLeaf() {
+ final OrderedTreeNode<T> myParent = getOrderedParent();
if (myParent == null) {
return null;
}
/* Linear search. */
- final OrderedTreeNode nextSibling = getNextSibling();
+ final OrderedTreeNode<T> nextSibling = getNextSibling();
if (nextSibling != null) {
return nextSibling.getFirstLeaf();
}
@@ -252,13 +253,13 @@
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
@Override
- public OrderedTreeNode getPreviousLeaf() {
- final OrderedTreeNode myParent = getOrderedParent();
+ public OrderedTreeNode<T> getPreviousLeaf() {
+ final OrderedTreeNode<T> myParent = getOrderedParent();
if (myParent == null) {
return null;
}
/* Linear search. */
- final OrderedTreeNode previousSibling = getPreviousSibling();
+ final OrderedTreeNode<T> previousSibling = getPreviousSibling();
if (previousSibling != null) {
return previousSibling.getLastLeaf();
}
@@ -267,11 +268,11 @@
}
@Override
- public boolean isNodeAncestor(final OrderedTreeNode anotherNode) {
+ public boolean isNodeAncestor(final OrderedTreeNode<T> anotherNode) {
if (anotherNode == null) {
return false;
}
- OrderedTreeNode ancestor = this;
+ OrderedTreeNode<T> ancestor = this;
do {
if (ancestor == anotherNode) {
return true;
@@ -293,7 +294,7 @@
* @param anotherNode Node to test as descendant of this node.
* @return True if this node is an ancestor of {@code anotherNode}
*/
- public boolean isNodeDescendant(final OrderedTreeNode anotherNode) {
+ public boolean isNodeDescendant(final OrderedTreeNode<T> anotherNode) {
if (anotherNode == null) {
return false;
}
@@ -313,7 +314,7 @@
* @return nearest ancestor common to this node and {@code aNode},
* or null if none
*/
- public OrderedTreeNode getSharedAncestor(final OrderedTreeNode aNode) {
+ public OrderedTreeNode<T> getSharedAncestor(final OrderedTreeNode<T> aNode) {
if (aNode == this) {
return this;
} else if (aNode == null) {
@@ -323,8 +324,8 @@
final int level1;
final int level2;
int diff;
- OrderedTreeNode node1;
- OrderedTreeNode node2;
+ OrderedTreeNode<T> node1;
+ OrderedTreeNode<T> node2;
level1 = getLevel();
level2 = aNode.getLevel();
@@ -370,7 +371,7 @@
@Override
public int getLevel() {
int levels = 0;
- OrderedTreeNode ancestor = this;
+ OrderedTreeNode<T> ancestor = this;
while ((ancestor = ancestor.getOrderedParent()) != null) {
levels++;
}
@@ -381,13 +382,13 @@
* A post-order iterator over the descendants of a given node.
*/
public final class PostOrderDescendantIterator
- implements java.util.Iterator<OrderedTreeNode> {
+ implements java.util.Iterator<OrderedTreeNode<T>> {
/** The root node whose descendants are being iterated. */
- private OrderedTreeNode root;
+ private OrderedTreeNode<T> root;
/** The next post-order node to be returned. */
- private OrderedTreeNode nextPostOrderNode;
+ private OrderedTreeNode<T> nextPostOrderNode;
/**
* Private constructor.
@@ -394,8 +395,7 @@
* @param root The node whose descendants should be iterated by this
* iterator.
*/
- private PostOrderDescendantIterator(
- final OrderedTreeNode root) {
+ private PostOrderDescendantIterator(final OrderedTreeNode<T> root) {
this.root = root;
if (root.getChildCount() < 1) {
this.nextPostOrderNode = null;
@@ -411,12 +411,12 @@
}
@Override
- public OrderedTreeNode next() {
+ public OrderedTreeNode<T> next() {
if (this.nextPostOrderNode == null) {
throw new NoSuchElementException("This iterator has no more "
+ "nodes.");
}
- final OrderedTreeNode returnNode = this.nextPostOrderNode;
+ final OrderedTreeNode<T> returnNode = this.nextPostOrderNode;
this.setNextNode();
return returnNode;
}
@@ -425,7 +425,7 @@
* Finds and records the next node to be returned by the iterator.
*/
private void setNextNode() {
- final OrderedTreeNode provisionalNextNode =
+ final OrderedTreeNode<T> provisionalNextNode =
this.nextPostOrderNode.nextPostOrderNode();
if (provisionalNextNode == null) {
this.nextPostOrderNode = null;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreeNode.java 2021-12-05 21:22:58 UTC (rev 12175)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/OrderedTreeNode.java 2021-12-06 16:09:56 UTC (rev 12176)
@@ -35,14 +35,15 @@
* A {@link TreeNode} that is aware of its relationships not only to its parents
* and children, but also to its siblings.
* The order and placement of children is significant.
+ * @param <T> The type of node.
*/
-public interface OrderedTreeNode extends TreeNode {
+public interface OrderedTreeNode<T> extends TreeNode {
/**
* Returns the parent of this node, cast as an OrderedTreeNode.
* @return The parent of this node.
*/
- OrderedTreeNode getOrderedParent();
+ OrderedTreeNode<T> getOrderedParent();
/**
* Returns this node's position within the siblings.
@@ -55,7 +56,7 @@
* @return Return the sibling immediately preceding "this" in the parent's
* children, or null if this is the first child.
*/
- OrderedTreeNode getPreviousSibling();
+ OrderedTreeNode<T> getPreviousSibling();
/**
* Returns the next sibling node.
@@ -62,7 +63,7 @@
* @return Return the sibling immediately following "this" in the parent's
* children, or null if this is the last child.
*/
- OrderedTreeNode getNextSibling();
+ OrderedTreeNode<T> getNextSibling();
/**
* Reports whether this node has any children.
@@ -75,7 +76,7 @@
* @return The first child of this node, or null if this node has no
* children.
*/
- OrderedTreeNode getFirstChild();
+ OrderedTreeNode<T> getFirstChild();
/**
* Returns the last child of this node.
@@ -82,7 +83,7 @@
* @return The last child of this node, or null if this node has no
* children.
*/
- OrderedTreeNode getLastChild();
+ OrderedTreeNode<T> getLastChild();
/**
* Returns the next node in the tree relative to the current node, in
@@ -89,7 +90,7 @@
* pre-order traversal order. This is also known as breadth-first order.
* @return The next pre-order node, or null if there is none.
*/
- OrderedTreeNode nextPreOrderNode();
+ OrderedTreeNode<T> nextPreOrderNode();
/**
* Returns the next node in the tree relative to the current node, in
@@ -96,7 +97,7 @@
* post-order traversal order. This is also known as depth-first order.
* @return The next post-order node, or null if there is none.
*/
- OrderedTreeNode nextPostOrderNode();
+ OrderedTreeNode<T> nextPostOrderNode();
/**
* Finds and returns the first leaf that is a descendant of this node --
@@ -108,7 +109,7 @@
* @see DefaultMutableTreeNode#isNodeDescendant
* @return the first leaf in the subtree rooted at this node
*/
- OrderedTreeNode getFirstLeaf();
+ OrderedTreeNode<T> getFirstLeaf();
/**
@@ -121,7 +122,7 @@
* @see DefaultMutableTreeNode#isNodeDescendant
* @return the last leaf in the subtree rooted at this node
*/
- OrderedTreeNode getLastLeaf();
+ OrderedTreeNode<T> getLastLeaf();
/**
* Returns the leaf after this node or null if this node is the
@@ -143,7 +144,7 @@
* @see TreeNode#isLeaf
* @return returns the next leaf past this node
*/
- OrderedTreeNode getNextLeaf();
+ OrderedTreeNode<T> getNextLeaf();
/**
@@ -166,7 +167,7 @@
* @see TreeNode#isLeaf
* @return returns the leaf before this node
*/
- OrderedTreeNode getPreviousLeaf();
+ OrderedTreeNode<T> getPreviousLeaf();
/**
* Returns the number of levels above this node -- the distance from
@@ -186,6 +187,6 @@
* @param anotherNode node to test as an ancestor of this node
* @return true if this node is a descendant of {@code anotherNode}
*/
- boolean isNodeAncestor(OrderedTreeNode anotherNode);
+ boolean isNodeAncestor(OrderedTreeNode<T> anotherNode);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-05 21:22:58 UTC (rev 12175)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-06 16:09:56 UTC (rev 12176)
@@ -154,7 +154,7 @@
/**
* Base class for formatting objects.
*/
-public abstract class FoObj extends AbstractOrderedTreeNode implements Fo, ParaConfig {
+public abstract class FoObj extends AbstractOrderedTreeNode<FoObj> implements Fo, ParaConfig {
/** A static empty and immutable list of children, suitable for return by
* objects that have no children. */
@@ -210,7 +210,7 @@
}
@Override
- public OrderedTreeNode getOrderedParent() {
+ public OrderedTreeNode<FoObj> getOrderedParent() {
return this.getParent();
}
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete.java 2021-12-06 16:09:56 UTC (rev 12176)
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2021 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+//package org.foray.fotree.fo.obj;
+//
+//import org.foray.fotree.FoObj;
+//import org.foray.fotree.Namespace;
+//import org.foray.fotree.PropertyList;
+//
+//import org.axsl.fo.Fo;
+//import org.axsl.fo.FoContentModelBlock;
+//import org.axsl.fo.FoContentModelText;
+//import org.axsl.fo.FoContext;
+//import org.axsl.fo.FoTreeException;
+//import org.axsl.fo.ProxyFactory;
+//import org.axsl.font.FontUse;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+// * A container for pure text and inline items.
+// * This is a pass-thru pseudo-element that is always a child of a {@link Block4a} and that has no
+// * {@link FoContentModelBlock} descendants.
+// * In other words, it is content that can be laid out as a discrete paragraph.
+// */
+//public class BlockDiscrete extends FoObj {
+//
+// /** The parent of this node. */
+// private Block4a parent;
+// /** The children of this object. */
+// private List<FoObj> children = new ArrayList<FoObj>();
+//
+// /**
+// * Constructor.
+// * @param parent The parent FoObj.
+// */
+// public BlockDiscrete(final Block4a parent) {
+// super(parent);
+// this.parent = parent;
+// }
+//
+// @Override
+// public Fo getChildAt(int childIndex) {
+// // TODO Auto-generated method stub
+// return null;
+// }
+//
+// @Override
+// public Object acceptProxyFactory(ProxyFactory factory) {
+// // TODO Auto-generated method stub
+// return null;
+// }
+//
+// @Override
+// public boolean isValid() {
+// // TODO Auto-generated method stub
+// return false;
+// }
+//
+// @Override
+// public FontUse getPrimaryFont(final FoContext context) {
+// return this.parent.getPrimaryFont(context);
+// }
+//
+// @Override
+// public Block4a getParent() {
+// return this.parent;
+// }
+//
+// @Override
+// public List<? extends FoObj> getChildren() {
+// return this.children;
+// }
+//
+// @Override
+// protected void validateAncestry() throws FoTreeException {
+// }
+//
+// @Override
+// protected void validateProperties() throws FoTreeException {
+// }
+//
+// @Override
+// protected void setup() throws FoTreeException {
+// }
+//
+// @Override
+// protected void validateDescendants() throws FoTreeException {
+// }
+//
+// @Override
+// protected void end() throws FoTreeException {
+// }
+//
+// @Override
+// public void addChild(final FoObj child) throws FoTreeException {
+// // TODO Auto-generated method stub
+// if (child instanceof FoContentModelText
+// || child instanceof FoContent) {
+// this.children.add(child);
+// }
+//
+// }
+//
+// @Override
+// public Namespace getNamespace() {
+// return this.parent.getNamespace();
+// }
+//
+// @Override
+// public boolean isContentBlock() {
+// return true;
+// }
+//
+// @Override
+// public boolean isContentInline() {
+// return false;
+// }
+//
+// @Override
+// public boolean isContentPcdata() {
+// return false;
+// }
+//
+// @Override
+// public String getName() {
+// return "block-discrete-(pseudo)";
+// }
+//
+// @Override
+// public PropertyList getPropertyList() {
+// return this.parent.getPropertyList();
+// }
+//
+//
+//}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockDiscrete.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java 2021-12-05 21:22:58 UTC (rev 12175)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java 2021-12-06 16:09:56 UTC (rev 12176)
@@ -379,7 +379,7 @@
@Override
public void addChild(final FoObj child) throws FoTreeException {
- final OrderedTreeNode lastChild = this.getLastChild();
+ final OrderedTreeNode<FoObj> lastChild = this.getLastChild();
if (child instanceof LayoutMasterSet4a) {
if (lastChild != null) {
child.throwExceptionInvalidLocation();
@@ -437,7 +437,7 @@
private final class PageSequenceIterator implements Iterator<PageSequence4a> {
/** An iterator over the descendants of our enclosing Root instance. */
- private Iterator<OrderedTreeNode> descendantIterator;
+ private Iterator<OrderedTreeNode<FoObj>> descendantIterator;
/** The next PageSequence instance to be returned by this iterator. */
private PageSequence4a nextPageSequence;
@@ -460,7 +460,7 @@
if (! this.descendantIterator.hasNext()) {
return;
}
- final OrderedTreeNode node = this.descendantIterator.next();
+ final OrderedTreeNode<FoObj> node = this.descendantIterator.next();
if (node instanceof PageSequence4a) {
this.nextPageSequence = (PageSequence4a) node;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-05 21:23:01
|
Revision: 12175
http://sourceforge.net/p/foray/code/12175
Author: victormote
Date: 2021-12-05 21:22:58 +0000 (Sun, 05 Dec 2021)
Log Message:
-----------
Implement new aXSL interface for fo:character.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character4a.java 2021-12-05 15:55:38 UTC (rev 12174)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character4a.java 2021-12-05 21:22:58 UTC (rev 12175)
@@ -39,7 +39,7 @@
import org.axsl.fo.FoContext;
import org.axsl.fo.FoTreeException;
import org.axsl.fo.ProxyFactory;
-import org.axsl.fo.fo.CharacterSequence;
+import org.axsl.fo.fo.Character;
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.font.Font;
import org.axsl.font.FontContext;
@@ -52,7 +52,7 @@
/**
* A "character" object in XSL-FO.
*/
-public class Character4a extends FoObj implements CharacterSequence {
+public class Character4a extends FoObj implements Character {
/** The parent of this node. */
private FoObj parent;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-05 15:55:41
|
Revision: 12174
http://sourceforge.net/p/foray/code/12174
Author: victormote
Date: 2021-12-05 15:55:38 +0000 (Sun, 05 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Move Area method for returning the area class to aXSL.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-05 15:13:59 UTC (rev 12173)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-05 15:55:38 UTC (rev 12174)
@@ -877,11 +877,7 @@
return true;
}
- /**
- * Returns the area-class trait for this Area.
- * @return The area-class trait for this Area.
- * @see "XSL-FO 1.1, Section 4.2.5."
- */
+ @Override
public AreaClass traitAreaClass() {
/* TODO: This method is incomplete. */
final FootnoteRa footnoteArea = this.nearestFootnoteArea();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-05 15:14:02
|
Revision: 12173
http://sourceforge.net/p/foray/code/12173
Author: victormote
Date: 2021-12-05 15:13:59 +0000 (Sun, 05 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Move AreaClass enum to aXSL.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockArea.java
Removed Paths:
-------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaClass.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-04 13:06:29 UTC (rev 12172)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-05 15:13:59 UTC (rev 12173)
@@ -31,6 +31,7 @@
import org.foray.common.WellKnownConstants;
import org.axsl.area.Area;
+import org.axsl.area.AreaClass;
import org.axsl.area.AreaTreeException;
import org.axsl.area.BlockContainerRefArea;
import org.axsl.common.value.AbsoluteAxis;
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaClass.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaClass.java 2021-12-04 13:06:29 UTC (rev 12172)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaClass.java 2021-12-05 15:13:59 UTC (rev 12173)
@@ -1,142 +0,0 @@
-/*
- * Copyright 2007 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
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-/**
- * Enumeration of valid area classes.
- * @see "XSL-FO 1.1, Section 4.2.5."
- */
-public enum AreaClass {
-
- /** The area is stacked with other areas in sequence. */
- XSL_NORMAL(true, false, false, false, true),
-
- /** The area is inside a footnote, and will be placed by the ancestor
- * page-sequence, but is stackable. */
- XSL_FOOTNOTE(false, true, false, false, true),
-
- /** The area is inside a before-float, and will be placed by the
- * ancestor page-sequence, but is stackable. */
- XSL_BEFORE_FLOAT(false, true, false, false, true),
-
- /** The area is in a fixed location, and will be placed by the ancestor
- * page-sequence. It is not stackable. */
- XSL_FIXED(false, true, false, false, false),
-
- /** The area is part of a side-float, and will be placed by the FO
- * generating the relevant reference-area. */
- XSL_SIDE_FLOAT(false, false, true, false, false),
-
- /** The area is absolutely positioned, and will be placed by the FO
- * generating the relevant reference-area. */
- XSL_ABSOLUTE(false, false, true, false, false),
-
- /** The area is an anchor area, is placed arbitrarily, and does not
- * affect stacking. */
- XSL_ANCHOR(false, false, false, true, false);
-
- /** Indicates whether the Area is a normal area. */
- private boolean isNormal;
-
- /** Indicates whether the Area is a page-level-out-of-line area. */
- private boolean isPageLevelOutOfLine;
-
- /** Indicates whether the Area is a reference-level-out-of-line area. */
- private boolean isReferenceLevelOutOfLine;
-
- /** Indicates whether the Area is an anchor area. */
- private boolean isAnchor;
-
- /** Indicates whether the Area is stackable. */
- private boolean isStackable;
-
- /**
- * Private Constructor.
- * @param isNormal Indicates whether the Area is a normal area.
- * @param isPageLevelOutOfLine Indicates whether the Area is a
- * page-level-out-of-line area.
- * @param isReferenceLevelOutOfLine Indicates whether the Area is a
- * reference-level-out-of-line area.
- * @param isAnchor Indicates whether the Area is an anchor area.
- * @param isStackable Indicates whether the Area is stackable.
- */
- AreaClass(final boolean isNormal,
- final boolean isPageLevelOutOfLine,
- final boolean isReferenceLevelOutOfLine,
- final boolean isAnchor,
- final boolean isStackable) {
- this.isNormal = isNormal;
- this.isPageLevelOutOfLine = isPageLevelOutOfLine;
- this.isReferenceLevelOutOfLine = isReferenceLevelOutOfLine;
- this.isAnchor = isAnchor;
- this.isStackable = isStackable;
- }
-
- /**
- * Indicates whether the Area is an anchor area.
- * @return True iff the Area is an anchor area.
- */
- protected boolean isAnchor() {
- return this.isAnchor;
- }
-
- /**
- * Indicates whether the Area is a normal area.
- * @return True iff the Area is a normal area.
- */
- protected boolean isNormal() {
- return this.isNormal;
- }
-
- /**
- * Indicates whether the Area is a page-level-out-of-line area.
- * @return True iff the Area is a page-level-out-of-line area.
- */
- protected boolean isPageLevelOutOfLine() {
- return this.isPageLevelOutOfLine;
- }
-
- /**
- * Indicates whether the Area is a reference-level-out-of-line area.
- * @return True iff the Area is a reference-level-out-of-line area.
- */
- protected boolean isReferenceLevelOutOfLine() {
- return this.isReferenceLevelOutOfLine;
- }
-
- /**
- * Indicates whether the Area is stackable.
- * @return True iff the Area is stackable.
- */
- protected boolean isStackable() {
- return this.isStackable;
- }
-
-}
-
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockArea.java 2021-12-04 13:06:29 UTC (rev 12172)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockArea.java 2021-12-05 15:13:59 UTC (rev 12173)
@@ -32,8 +32,7 @@
import org.axsl.fo.fo.Block;
/**
- * Superclass for normal block-areas (NormalBlockArea) and line-areas
- * (LineArea).
+ * Superclass for {@link NormalBlockArea4a} and {@link LineArea4a}.
*/
public abstract class BlockArea extends AreaFlexible {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-04 13:06:32
|
Revision: 12172
http://sourceforge.net/p/foray/code/12172
Author: victormote
Date: 2021-12-04 13:06:29 +0000 (Sat, 04 Dec 2021)
Log Message:
-----------
Allow FoObjMixed objects to capture accumulated text as a child before starting the creation of a new non-text child.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-03 16:44:22 UTC (rev 12171)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-04 13:06:29 UTC (rev 12172)
@@ -273,9 +273,8 @@
}
@Override
- public void startElement(final String namespaceURI, final String localName,
- final String rawName, final Attributes attlist)
- throws SAXException {
+ public void startElement(final String namespaceURI, final String localName, final String rawName,
+ final Attributes attlist) throws SAXException {
if (this.activeForeignXML != null) {
// If inside foreign XML, let the ForeignXml instance handle it.
this.activeForeignXML.startElement(namespaceURI, localName, rawName,
@@ -290,11 +289,13 @@
/* the formatting object started */
FoObj fobj = null;
try {
+ /* Before creating the new object, allow an existing FoObjMixed to capture any text that has accumulated, so
+ * that the text will be a sibling of the new object. */
+ finalizeText();
final PropertyList list = namespace.createNewPropertyList(attlist);
if (this.currentFObj == null) {
if (! "root".equals(localName)) {
- throw new SAXException("fo:root must be first element "
- + "parsed");
+ throw new SAXException("fo:root must be first element parsed");
}
}
fobj = namespace.parseElement(this.foTree, localName, this.currentFObj, list, getLocator(), this);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-03 16:44:25
|
Revision: 12171
http://sourceforge.net/p/foray/code/12171
Author: victormote
Date: 2021-12-03 16:44:22 +0000 (Fri, 03 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Allow the tokenization process to throw a checked exception if it fails.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-03 16:04:25 UTC (rev 12170)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-03 16:44:22 UTC (rev 12171)
@@ -39,6 +39,7 @@
import org.axsl.fo.FoTreeException;
import org.axsl.fo.FoTreeListener;
import org.axsl.fo.FoTreeParser;
+import org.axsl.orthography.OrthographyException;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
@@ -181,11 +182,11 @@
}
/**
- * Flushes any remaining text into an FOText item.
- * @throws FoTreeException If the new text item cannot be added as a child
- * to this.
+ * Pushes any text into an FOText item.
+ * @throws FoTreeException If the new text item cannot be added as a child to the element being parsed.
+ * @throws SAXException For problems during text tokenization.
*/
- protected void finalizeText() throws FoTreeException {
+ protected void finalizeText() throws FoTreeException, SAXException {
if (this.textBuffer.length() < 1) {
return;
}
@@ -203,7 +204,13 @@
switch (this.textStrategy) {
case WORD: {
- final FoWordSequence wordSequence = new FoWordSequence(mixed, this.textBuffer);
+ final FoWordSequence wordSequence;
+ try {
+ wordSequence = new FoWordSequence(mixed, this.textBuffer);
+ } catch (final OrthographyException e) {
+ this.errorMessage(e.getMessage());
+ throw new SAXException(e);
+ }
mixed.addTextNode(wordSequence);
break;
}
@@ -219,8 +226,7 @@
}
@Override
- public void endElement(final String uri, final String localName,
- final String rawName) throws SAXException {
+ public void endElement(final String uri, final String localName, final String rawName) throws SAXException {
if (this.activeForeignXML != null) {
// If inside foreign XML, let the ForeignXml instance handle it.
this.activeForeignXML.endElement(uri, localName, rawName);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-12-03 16:04:25 UTC (rev 12170)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-12-03 16:44:22 UTC (rev 12171)
@@ -38,6 +38,7 @@
import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.fo.FoContext;
import org.axsl.orthography.Orthography;
+import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.OrthographyServer;
import java.util.ArrayList;
@@ -55,8 +56,9 @@
* Constructor.
* @param parent The FoObj parent of this text.
* @param content The raw characters for this node.
+ * @throws OrthographyException For errors tokenizing the word sequence.
*/
- public FoWordSequence(final FoObj parent, final CharSequence content) {
+ public FoWordSequence(final FoObj parent, final CharSequence content) throws OrthographyException {
super(parent);
final OrthographyServer orthographyServer = getOrthographyServer();
final Orthography orthography = orthographyServer.getOrthography(getWritingSystem());
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-12-03 16:04:25 UTC (rev 12170)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-12-03 16:44:22 UTC (rev 12171)
@@ -37,6 +37,7 @@
import org.foray.orthography.wrapper.UppercaseWord;
import org.axsl.orthography.Orthography;
+import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.Word;
import org.axsl.orthography.optional.Dictionary;
import org.axsl.orthography.optional.Lexer;
@@ -405,7 +406,8 @@
}
@Override
- public ParaBranch4a tokenizeWordSequence(final CharSequence characters, final int startIndex, final int length) {
+ public ParaBranch4a tokenizeWordSequence(final CharSequence characters, final int startIndex, final int length)
+ throws OrthographyException {
final ParaBranch4a wordSequence = new ParaBranch4a(null);
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
final List<CharSequence> chunks = this.lexer.tokenize(sequence);
@@ -434,7 +436,8 @@
return wordSequence;
}
- private void parseInterwordContent(final ParaBranch4a wordSequence, final CharSequence interword) {
+ private void parseInterwordContent(final ParaBranch4a wordSequence, final CharSequence interword)
+ throws OrthographyException {
int index = 0;
while (index < interword.length()) {
final char contentChar = interword.charAt(index);
@@ -447,7 +450,7 @@
wordSequence.add(whitespace);
index ++;
} else {
- throw new IllegalStateException("Don't know how to handle interword content: " + contentChar);
+ throw new OrthographyException("Don't know how to handle interword content: " + contentChar);
}
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-12-03 16:04:25 UTC (rev 12170)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-12-03 16:44:22 UTC (rev 12171)
@@ -76,9 +76,10 @@
/**
* Test of {@link HyphenationConsumer4a#parseWordSequence(CharSequence, int, int, ParaConfig)}.
+ * @throws OrthographyException Not expected here.
*/
@Test
- public void parseWordSequenceTest() {
+ public void parseWordSequenceTest() throws OrthographyException {
/* Spoken by Henry, Henry V, Act III Scene 1. */
final String testString = "Once more unto the breach, dear friends, once more;";
final ParaBranch4a wordSequence =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-03 16:04:27
|
Revision: 12170
http://sourceforge.net/p/foray/code/12170
Author: victormote
Date: 2021-12-03 16:04:25 +0000 (Fri, 03 Dec 2021)
Log Message:
-----------
Move text-related parsing logic out of FoObjMixed back into the parser.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObjMixed.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Wrapper4a.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java 2021-12-03 13:39:08 UTC (rev 12169)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/xml/SaxParser.java 2021-12-03 16:04:25 UTC (rev 12170)
@@ -314,17 +314,28 @@
@Override
public void warning(final SAXParseException ex) {
- this.logger.warn(getLocationString() + ": " + ex.getMessage());
+ this.logger.warn(ex.getMessage());
}
+ /**
+ * Logs a warning message, noting the location currently being parsed.
+ * @param message The message to be logged.
+ */
+ public void warningMessage(final String message) {
+ this.logger.warn(getLocationString() + ": " + message);
+ }
+
@Override
public void error(final SAXParseException ex) {
- this.logger.error(getLocationString() + ": " + ex.getMessage());
+ this.logger.error(ex.getMessage());
}
- @Override
- public void fatalError(final SAXParseException ex) throws SAXException {
- throw new SAXException(ex);
+ /**
+ * Logs an error message, noting the location currently being parsed.
+ * @param message The message to be logged.
+ */
+ public void errorMessage(final String message) {
+ this.logger.error(getLocationString() + ": " + message);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObjMixed.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObjMixed.java 2021-12-03 13:39:08 UTC (rev 12169)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObjMixed.java 2021-12-03 16:04:25 UTC (rev 12170)
@@ -29,10 +29,7 @@
package org.foray.fotree;
import org.foray.fotree.fo.obj.AbstractCharacterSequence;
-import org.foray.fotree.fo.obj.CharacterSequence4a;
-import org.foray.fotree.fo.obj.FoWordSequence;
-import org.axsl.fo.FoContext;
import org.axsl.fo.FoTreeException;
/**
@@ -40,28 +37,9 @@
*/
public abstract class FoObjMixed extends FoObj {
- /**
- * Enumeration of strategies to use for handling text.
- */
- private enum Strategy {
- /** Store text in a collection of characters. */
- CHARACTER,
-
- /** Store text in a collection of words. */
- WORD
- }
-
/** The property list for this object. */
private PropertyList propertyList;
- /** The text buffer used to accumulate the text portion of the mixed
- * content. */
- private StringBuilder textBuffer;
-
- /* TODO: This should possibly be configurable. */
- /** The strategy to use for storing text. */
- private Strategy strategy = Strategy.WORD;
-
/**
* Constructor.
* @param parent The parent FoObj.
@@ -72,66 +50,7 @@
this.propertyList = propertyList;
}
- @Override
- protected void addCharacters(final char data[], final int start,
- final int length, final String systemId, final int line,
- final int column) {
- if (this.textBuffer == null) {
- this.textBuffer = new StringBuilder();
- }
- this.textBuffer.append(data, start, length);
- }
-
/**
- * Flushes any remaining text into an FOText item.
- * @param context An object that knows how to resolve FoTree context issues.
- * @throws FoTreeException If the new text item cannot be added as a child
- * to this.
- */
- protected void finalizeText(final FoContext context)
- throws FoTreeException {
- if (! this.shouldCreateFOText()) {
- return;
- }
- switch (this.strategy) {
- case WORD: {
- final FoWordSequence wordSequence = new FoWordSequence(this, this.textBuffer);
- this.addTextNode(wordSequence);
- break;
- }
- case CHARACTER: {
- final char[] charArray = this.textBuffer.toString().toCharArray();
- final CharacterSequence4a ft = new CharacterSequence4a(this, charArray);
- this.addTextNode(ft);
- break;
- }
- default: throw new IllegalArgumentException("Unrecognized text storage strategy. ");
- }
- this.textBuffer.setLength(0);
- }
-
- /**
- * Indicates whether an FOText item should be created from the buffer.
- * @return True iff an FOText item should be created from the buffer
- * contents.
- */
- private boolean shouldCreateFOText() {
- if (this.textBuffer == null) {
- return false;
- }
- if (this.textBuffer.length() < 1) {
- return false;
- }
- if (! this.blockMustEnclosePCDATA()) {
- return true;
- }
- if (this.getContainingBlock(null) != null) {
- return true;
- }
- 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
@@ -140,36 +59,23 @@
public abstract boolean blockMustEnclosePCDATA();
@Override
- protected void end() throws FoTreeException {
- finalizeText(null);
- this.textBuffer = null;
- }
+ protected void end() throws FoTreeException { }
@Override
public void addChild(final FoObj child) throws FoTreeException {
- /* Before adding the child element, see if there is any text in the
- * buffer. If so, create an FOText node before adding the element
- * just parsed. */
- finalizeText(null);
- /* Now add the element. */
- this.addNonTextNode(child);
+ if (child instanceof AbstractCharacterSequence) {
+ addTextNode((AbstractCharacterSequence) child);
+ } else {
+ this.addNonTextNode(child);
+ }
}
/**
- * Returns the text buffer.
- * @return Returns the textBuffer.
- */
- public StringBuilder getTextBuffer() {
- return this.textBuffer;
- }
-
- /**
* Add a text node to the children of this object.
* @param textNode The text node to be added.
* @throws FoTreeException If the new content is not valid.
*/
- public abstract void addTextNode(AbstractCharacterSequence textNode)
- throws FoTreeException;
+ public abstract void addTextNode(AbstractCharacterSequence textNode) throws FoTreeException;
/**
* Add a non-text node to the children of this object.
@@ -176,8 +82,7 @@
* @param nonTextNode The non-text node to be added.
* @throws FoTreeException If the new content is not valid.
*/
- public abstract void addNonTextNode(FoObj nonTextNode)
- throws FoTreeException;
+ public abstract void addNonTextNode(FoObj nonTextNode) throws FoTreeException;
@Override
public PropertyList getPropertyList() {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-03 13:39:08 UTC (rev 12169)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-03 16:04:25 UTC (rev 12170)
@@ -28,7 +28,10 @@
package org.foray.fotree;
+import org.foray.common.primitive.StringUtils;
import org.foray.common.xml.SaxParser;
+import org.foray.fotree.fo.obj.CharacterSequence4a;
+import org.foray.fotree.fo.obj.FoWordSequence;
import org.foray.fotree.fo.obj.PageSequence4a;
import org.foray.fotree.fo.obj.Root4a;
@@ -55,6 +58,20 @@
*/
public class FoTreeParser4a extends SaxParser<FoTree4a> implements FoTreeParser {
+ /** The initial size of the text buffer for accumulating text. */
+ private static final int INITIAL_TEXT_BUFFER_SIZE = 4096;
+
+ /**
+ * Enumeration of strategies to use for handling text.
+ */
+ private enum TextStrategy {
+ /** Store text in a collection of characters. */
+ CHARACTER,
+
+ /** Store text in a collection of words. */
+ WORD
+ }
+
/** The FO tree being created by this parser. */
private FoTree4a foTree;
@@ -76,6 +93,13 @@
/** Externally-provided parser, if any. */
private XMLReader parser;
+ /** The text buffer used to accumulate the text portion of the mixed content. */
+ private StringBuilder textBuffer = new StringBuilder(INITIAL_TEXT_BUFFER_SIZE);
+
+ /* TODO: This should possibly be configurable. */
+ /** The strategy to use for storing text. */
+ private TextStrategy textStrategy = TextStrategy.WORD;
+
/**
* Constructor.
* @param server The parent server.
@@ -94,6 +118,7 @@
this.currentFObj = null;
this.rootFObj = null;
this.foTreeListeners.clear();
+ StringUtils.clear(this.textBuffer);
this.foTree = new FoTree4a(this.server, this);
foTree.setGraphicServer(this.server.getGraphicServer());
foTree.setOrthographyServer(this.server.getOrthographyServer());
@@ -136,18 +161,63 @@
this.activeForeignXML.characters(data, start, length);
return;
}
- if (this.currentFObj != null) {
- try {
- this.currentFObj.addCharacters(data, start, length,
- getLocator().getSystemId(),
- getLocator().getLineNumber(),
- getLocator().getColumnNumber());
- } catch (final FoTreeException e) {
- throw new SAXException(e);
+ if (this.currentFObj == null) {
+ errorMessage("Attempting to add text to a null object.");
+ }
+
+ /* We are, of necessity, using a non-validating parser, which can't distinguish between text content and
+ * ignorable whitespace. Unless we are parsing an object that knows how to handle text, we should throw it away
+ * after looking for non-whitespace content, which would indicate essentially a validation error. */
+ if (this.currentFObj instanceof FoObjMixed) {
+ this.textBuffer.append(data, start, length);
+ } else {
+ for (int index = start; index < (start + length); index ++) {
+ final char c = data[index];
+ if (! Character.isWhitespace(c)) {
+ errorMessage("Text content is not allowed here.");
+ }
}
}
}
+ /**
+ * Flushes any remaining text into an FOText item.
+ * @throws FoTreeException If the new text item cannot be added as a child
+ * to this.
+ */
+ protected void finalizeText() throws FoTreeException {
+ if (this.textBuffer.length() < 1) {
+ return;
+ }
+
+ if (! (this.currentFObj instanceof FoObjMixed)) {
+ return;
+ }
+
+ final FoObjMixed mixed = (FoObjMixed) this.currentFObj;
+ if (mixed.blockMustEnclosePCDATA()) {
+ if (mixed.getContainingBlock(null) == null) {
+ return;
+ }
+ }
+
+ switch (this.textStrategy) {
+ case WORD: {
+ final FoWordSequence wordSequence = new FoWordSequence(mixed, this.textBuffer);
+ mixed.addTextNode(wordSequence);
+ break;
+ }
+ case CHARACTER: {
+ final char[] charArray = this.textBuffer.toString().toCharArray();
+ final CharacterSequence4a ft = new CharacterSequence4a(mixed, charArray);
+ mixed.addTextNode(ft);
+ break;
+ }
+ default: throw new IllegalArgumentException("Unrecognized text storage strategy. ");
+ }
+ this.textBuffer.setLength(0);
+ }
+
@Override
public void endElement(final String uri, final String localName,
final String rawName) throws SAXException {
@@ -160,6 +230,7 @@
}
}
try {
+ finalizeText();
this.currentFObj.end();
this.currentFObj.validateDescendants();
} catch (final FoTreeException e) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Wrapper4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Wrapper4a.java 2021-12-03 13:39:08 UTC (rev 12169)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Wrapper4a.java 2021-12-03 16:04:25 UTC (rev 12170)
@@ -124,29 +124,29 @@
return ancestor;
}
- /**
- * Overrides FoObjMixed method to avoid creating FOText nodes if they are
- * not permitted by the parent.
- * @param context An object that knows how to resolve FoTree context issues.
- * @throws FoTreeException If the ancestor contains text but is not allowed
- * to.
- */
- @Override
- protected void finalizeText(final FoContext context)
- throws FoTreeException {
- final FoObj ancestor = getNonWrapperAncestor(context);
- if (ancestor instanceof FoObjMixed) {
- super.finalizeText(context);
- return;
- }
- /* The ancestor may not contain PCDATA. If the buffer contains anything
- * but white-space, it is an error. */
- final char[] chars = getTextBuffer().toString().toCharArray();
- if (containsText(chars, 0, chars.length)) {
- throwException("Wrapper may not contain text that its parent "
- + "cannot.");
- }
- }
+// /**
+// * Overrides FoObjMixed method to avoid creating FOText nodes if they are
+// * not permitted by the parent.
+// * @param context An object that knows how to resolve FoTree context issues.
+// * @throws FoTreeException If the ancestor contains text but is not allowed
+// * to.
+// */
+// @Override
+// protected void finalizeText(final FoContext context)
+// throws FoTreeException {
+// final FoObj ancestor = getNonWrapperAncestor(context);
+// if (ancestor instanceof FoObjMixed) {
+// super.finalizeText(context);
+// return;
+// }
+// /* The ancestor may not contain PCDATA. If the buffer contains anything
+// * but white-space, it is an error. */
+// final char[] chars = getTextBuffer().toString().toCharArray();
+// if (containsText(chars, 0, chars.length)) {
+// throwException("Wrapper may not contain text that its parent "
+// + "cannot.");
+// }
+// }
@Override
public boolean blockMustEnclosePCDATA() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-03 13:39:11
|
Revision: 12169
http://sourceforge.net/p/foray/code/12169
Author: victormote
Date: 2021-12-03 13:39:08 +0000 (Fri, 03 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Rename interface for clarity.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/AbstractMixedInlinePnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockContainerPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ListBlockPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/TablePnr.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java 2021-12-02 16:13:13 UTC (rev 12168)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java 2021-12-03 13:39:08 UTC (rev 12169)
@@ -29,7 +29,7 @@
package org.foray.area;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.BlockContentFactory;
+import org.axsl.area.BlockLevelAreaFactory;
import org.axsl.fo.fo.Block;
import org.axsl.fo.fo.BlockContainer;
import org.axsl.fo.fo.GraftingPoint;
@@ -45,8 +45,7 @@
* An AreaNode containing the areas generated by the children of a
* list-item-label.
*/
-public abstract class AbstractListItemContent extends NonArea
- implements BlockContentFactory {
+public abstract class AbstractListItemContent extends NonArea implements BlockLevelAreaFactory {
/** The "generated-by" trait, as defined in Section 6.1.1. */
private FoLinkage generatedBy;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-02 16:13:13 UTC (rev 12168)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-03 13:39:08 UTC (rev 12169)
@@ -33,7 +33,7 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.BlockContentFactory;
+import org.axsl.area.BlockLevelAreaFactory;
import org.axsl.fo.Fo;
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.fo.fo.Table;
@@ -504,15 +504,15 @@
}
@Override
- public BlockContentFactory ancestorBlockContentFactory() {
+ public BlockLevelAreaFactory ancestorBlockLevelAreaFactory() {
final AreaNode4a parent = getParent();
if (parent == null) {
return null;
}
- if (parent instanceof BlockContentFactory) {
- return (BlockContentFactory) parent;
+ if (parent instanceof BlockLevelAreaFactory) {
+ return (BlockLevelAreaFactory) parent;
}
- return parent.ancestorBlockContentFactory();
+ return parent.ancestorBlockLevelAreaFactory();
}
/**
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2021-12-02 16:13:13 UTC (rev 12168)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2021-12-03 13:39:08 UTC (rev 12169)
@@ -31,7 +31,7 @@
import org.foray.common.para.DiscretionaryHyphen4a;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.BlockContentFactory;
+import org.axsl.area.BlockLevelAreaFactory;
import org.axsl.area.NormalBlockArea;
import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaControl;
@@ -133,11 +133,11 @@
if (overflow == null) {
throw new AreaTreeException("BlockArea overflow failed.");
}
- if (! (overflow instanceof BlockContentFactory)) {
+ if (! (overflow instanceof BlockLevelAreaFactory)) {
throw new AreaTreeException("NormalBlockArea overflow parent "
- + "expected to be a BlockContentFactory.");
+ + "expected to be a BlockLevelAreaFactory.");
}
- final BlockContentFactory bcFactory = (BlockContentFactory) overflow;
+ final BlockLevelAreaFactory bcFactory = (BlockLevelAreaFactory) overflow;
final Block block = this.traitGeneratedBy();
final org.axsl.area.NormalBlockArea nbArea
= bcFactory.makeNormalBlockArea(block,
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/AbstractMixedInlinePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/AbstractMixedInlinePnr.java 2021-12-02 16:13:13 UTC (rev 12168)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/AbstractMixedInlinePnr.java 2021-12-03 13:39:08 UTC (rev 12169)
@@ -31,7 +31,7 @@
import org.axsl.area.AncestralNormalInlineArea;
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.BlockContentFactory;
+import org.axsl.area.BlockLevelAreaFactory;
import org.axsl.area.LineArea;
import org.axsl.area.LineContentFactory;
import org.axsl.area.NormalBlockArea;
@@ -73,11 +73,11 @@
* content.*/
inlineArea = null;
/* Since this is block content, it cannot be laid out in a
- * line. We need to find the ancestor BlockContentFactory
+ * line. We need to find the ancestor BlockLevelAreaFactory
* and lay out the item in it. */
- final BlockContentFactory blockContentFactory =
- areaNode.ancestorBlockContentFactory();
- status = layoutProxy.layout(blockContentFactory, graftingPoint);
+ final BlockLevelAreaFactory blockLevelAreaFactory =
+ areaNode.ancestorBlockLevelAreaFactory();
+ status = layoutProxy.layout(blockLevelAreaFactory, graftingPoint);
} else {
if (inlineArea == null) {
final LineContentFactory lineContentFactory = getLineContentFactory(areaNode);
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockContainerPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockContainerPnr.java 2021-12-02 16:13:13 UTC (rev 12168)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockContainerPnr.java 2021-12-03 13:39:08 UTC (rev 12169)
@@ -31,7 +31,7 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.BlockContainerRefArea;
-import org.axsl.area.BlockContentFactory;
+import org.axsl.area.BlockLevelAreaFactory;
import org.axsl.fo.Fo;
import org.axsl.fo.fo.BlockContainer;
import org.axsl.fo.fo.GraftingPoint;
@@ -58,11 +58,11 @@
@Override
public Status layout(final AreaNode areaNode,
final GraftingPoint graftingPoint) throws AreaTreeException {
- if (! (areaNode instanceof BlockContentFactory)) {
+ if (! (areaNode instanceof BlockLevelAreaFactory)) {
throw new AreaTreeException("Area \"" + areaNode.getAreaName()
+ "\" cannot contain a BlockContentArea.");
}
- final BlockContentFactory bcArea = (BlockContentFactory) areaNode;
+ final BlockLevelAreaFactory bcArea = (BlockLevelAreaFactory) areaNode;
if (getProgress() == FoNodePnr.START) {
setProgress(0);
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockPnr.java 2021-12-02 16:13:13 UTC (rev 12168)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockPnr.java 2021-12-03 13:39:08 UTC (rev 12169)
@@ -30,7 +30,7 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.BlockContentFactory;
+import org.axsl.area.BlockLevelAreaFactory;
import org.axsl.area.LineArea;
import org.axsl.area.NormalBlockArea;
import org.axsl.fo.Fo;
@@ -86,11 +86,11 @@
@Override
public Status layout(final AreaNode areaNode,
final GraftingPoint graftingPoint) throws AreaTreeException {
- if (! (areaNode instanceof BlockContentFactory)) {
+ if (! (areaNode instanceof BlockLevelAreaFactory)) {
throw new AreaTreeException("Area \"" + areaNode.getAreaName()
+ "\" cannot contain a NormalBlockArea.");
}
- final BlockContentFactory bcArea = (BlockContentFactory) areaNode;
+ final BlockLevelAreaFactory bcArea = (BlockLevelAreaFactory) areaNode;
if (! this.breakStatusBeforeChecked) {
this.breakStatusBeforeChecked = true;
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ListBlockPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ListBlockPnr.java 2021-12-02 16:13:13 UTC (rev 12168)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ListBlockPnr.java 2021-12-03 13:39:08 UTC (rev 12169)
@@ -30,7 +30,7 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.BlockContentFactory;
+import org.axsl.area.BlockLevelAreaFactory;
import org.axsl.area.ListBlockArea;
import org.axsl.area.NormalBlockArea;
import org.axsl.fo.fo.GraftingPoint;
@@ -58,11 +58,11 @@
@Override
public Status layout(final AreaNode areaNode,
final GraftingPoint graftingPoint) throws AreaTreeException {
- if (! (areaNode instanceof BlockContentFactory)) {
+ if (! (areaNode instanceof BlockLevelAreaFactory)) {
throw new AreaTreeException("Area \"" + areaNode.getAreaName()
+ "\" cannot contain a ListBlockArea.");
}
- final BlockContentFactory bcArea = (BlockContentFactory) areaNode;
+ final BlockLevelAreaFactory bcArea = (BlockLevelAreaFactory) areaNode;
final ListBlockPnr listBlockPL = (ListBlockPnr) getLayoutProxy(this.node);
if (listBlockPL.getProgress() == FoNodePnr.START) {
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/TablePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/TablePnr.java 2021-12-02 16:13:13 UTC (rev 12168)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/TablePnr.java 2021-12-03 13:39:08 UTC (rev 12169)
@@ -30,7 +30,7 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.BlockContentFactory;
+import org.axsl.area.BlockLevelAreaFactory;
import org.axsl.area.NormalBlockArea;
import org.axsl.area.TableArea;
import org.axsl.area.TableFooterContainer;
@@ -73,11 +73,11 @@
return Status.OK;
}
- if (! (areaNode instanceof BlockContentFactory)) {
+ if (! (areaNode instanceof BlockLevelAreaFactory)) {
throw new AreaTreeException("Area \"" + areaNode.getAreaName()
+ "\" cannot contain a TableArea.");
}
- final BlockContentFactory bcArea = (BlockContentFactory) areaNode;
+ final BlockLevelAreaFactory bcArea = (BlockLevelAreaFactory) areaNode;
if (getProgress() == FoNodePnr.START) {
if (areaNode instanceof NormalBlockArea) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-02 16:13:22
|
Revision: 12168
http://sourceforge.net/p/foray/code/12168
Author: victormote
Date: 2021-12-02 16:13:13 +0000 (Thu, 02 Dec 2021)
Log Message:
-----------
(remainder) Rename some FOray FO implementation classes for clarity.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
trunk/foray/foray-app/src/test/java/org/foray/app/fo/AbstractFoTreeTest.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/ObjectMakerFo.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFlow.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFolioDescriptor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageMaster.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractTablePart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BookmarkTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Flow4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowMap4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowTargetList4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageSequenceTemplate.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/SubSequenceSpecifier.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderPrecedence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractMargin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPageDimension.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnGap.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdExtent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMargin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPadding.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdWritingMode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTest.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Leader4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ListBlock4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ListItem4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ListItemBody4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ListItemLabel4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Marker4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiCase4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiProperties4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiPropertySet4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiSwitch4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiToggle4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageMasterResolver4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumber4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitation4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitationLast4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageSequence4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageSequenceMaster4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageSequenceWrapper4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Region4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionAfter4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionBefore4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionBody4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionEnd4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionNameSpecifier4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionStart4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RepeatablePmAlternatives4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RepeatablePmReference4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RetrieveMarker4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RetrieveTableMarker4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ScalingValueCitation4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/SimplePageMaster4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/SinglePageMasterReference4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/StaticContent4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Table4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableAndCaption4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableBody4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableCaption4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableCell4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableColumn4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableFooter4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableHeader4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableRow4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Title4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Wrapper4a.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Leader.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ListBlock.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ListItem.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ListItemBody.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ListItemLabel.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Marker.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiCase.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiProperties.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiPropertySet.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiSwitch.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/MultiToggle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageMasterResolver.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageNumberCitationLast.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageSequence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageSequenceMaster.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageSequenceWrapper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Region.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionAfter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionBefore.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionBody.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionNameSpecifier.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RepeatablePmAlternatives.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RepeatablePmReference.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RetrieveMarker.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RetrieveTableMarker.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ScalingValueCitation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/SimplePageMaster.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/StaticContent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Table.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableAndCaption.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableBody.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableCaption.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableCell.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableColumn.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableFooter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableHeader.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableRow.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Title.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Wrapper.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -36,8 +36,8 @@
import org.foray.core.ForayException;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeServer4a;
-import org.foray.fotree.fo.obj.PageSequence;
-import org.foray.fotree.fo.obj.Root;
+import org.foray.fotree.fo.obj.PageSequence4a;
+import org.foray.fotree.fo.obj.Root4a;
import org.foray.pioneer.PioneerFactory;
import org.foray.pioneer.PioneerLayoutStrategy;
@@ -108,12 +108,12 @@
throws ForayException {
final FoDocumentReader foReader = FoDocumentReader.getInstance();
final FoTree4a foTree = foReader.buildFoTree(file);
- final Root root = foTree.getRootFo();
+ final Root4a root = foTree.getRootFo();
final AreaTree4a areaTree = this.areaTreeFactory.makeAreaTree(foTree, textServer, lbFactory);
final PioneerLayoutStrategy layout = this.layoutFactory.makeLayout();
- final Iterator<PageSequence> iterator = root.getPageSequenceIterator();
+ final Iterator<PageSequence4a> iterator = root.getPageSequenceIterator();
while (iterator.hasNext()) {
- final PageSequence pageSequence = iterator.next();
+ final PageSequence4a pageSequence = iterator.next();
try {
final PageCollection collection = areaTree.makePageCollection(
pageSequence);
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/AbstractFoTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/AbstractFoTreeTest.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/AbstractFoTreeTest.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -31,8 +31,8 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.fo.obj.Flow4a;
-import org.foray.fotree.fo.obj.PageSequence;
-import org.foray.fotree.fo.obj.Root;
+import org.foray.fotree.fo.obj.PageSequence4a;
+import org.foray.fotree.fo.obj.Root4a;
import org.junit.Assert;
@@ -47,10 +47,10 @@
* @return The first flow in {@code foTree}.
*/
protected Flow4a getFlow(final FoTree4a foTree) {
- final Root root = foTree.getRootFo();
+ final Root4a root = foTree.getRootFo();
FoObj node = root.getChildAt(1);
- Assert.assertTrue(node instanceof PageSequence);
- final PageSequence sequence = (PageSequence) node;
+ Assert.assertTrue(node instanceof PageSequence4a);
+ final PageSequence4a sequence = (PageSequence4a) node;
node = sequence.getChildAt(0);
Assert.assertTrue(node instanceof Flow4a);
final Flow4a flow = (Flow4a) node;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -47,12 +47,12 @@
import org.foray.fotree.fo.obj.Block4a;
import org.foray.fotree.fo.obj.CharacterSequence4a;
import org.foray.fotree.fo.obj.Flow4a;
-import org.foray.fotree.fo.obj.Leader;
-import org.foray.fotree.fo.obj.ListBlock;
-import org.foray.fotree.fo.obj.ListItem;
-import org.foray.fotree.fo.obj.Root;
-import org.foray.fotree.fo.obj.StaticContent;
-import org.foray.fotree.fo.obj.Table;
+import org.foray.fotree.fo.obj.Leader4a;
+import org.foray.fotree.fo.obj.ListBlock4a;
+import org.foray.fotree.fo.obj.ListItem4a;
+import org.foray.fotree.fo.obj.Root4a;
+import org.foray.fotree.fo.obj.StaticContent4a;
+import org.foray.fotree.fo.obj.Table4a;
import org.foray.fotree.fo.prop.AbstractAllowedAxisScale;
import org.foray.fotree.fo.prop.PdChangeBarOffset;
import org.foray.fotree.fo.prop.PdWritingMode;
@@ -184,7 +184,7 @@
*/
protected FoObj(final FoObj parent) {
if (parent == null) {
- assert this instanceof Root : "Non-root FONode has null parent.";
+ assert this instanceof Root4a : "Non-root FONode has null parent.";
/* We reserve and hard-code zero for the root node. */
this.sequentialIndex = 0;
} else {
@@ -598,7 +598,7 @@
* issues.
* @return Self or the nearest ancestor FoObj that is a ListItem.
*/
- public ListItem getNearestListItem(
+ public ListItem4a getNearestListItem(
final FoContext context) {
return effectiveParent(context).getNearestListItem(context);
}
@@ -609,13 +609,13 @@
* issues.
* @return The nearest ancestor FoObj that is a ListBlock.
*/
- public ListBlock getNearestAncestorListBlock(
+ public ListBlock4a getNearestAncestorListBlock(
final FoContext context) {
if (getParent() == null) {
return null;
}
- if (getParent() instanceof ListBlock) {
- return (ListBlock) getParent();
+ if (getParent() instanceof ListBlock4a) {
+ return (ListBlock4a) getParent();
}
return effectiveParent(context).getNearestAncestorListBlock(context);
}
@@ -624,7 +624,7 @@
* Return the root of this tree.
* @return The root of this tree.
*/
- public Root getRoot() {
+ public Root4a getRoot() {
return getParent().getRoot();
}
@@ -655,13 +655,13 @@
}
/**
- * Returns the ancestor {@link StaticContent}, if any.
+ * Returns the ancestor {@link StaticContent4a}, if any.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @return The ancestor {@link StaticContent}, or null if this object does
- * not descend from a {@link StaticContent}.
+ * @return The ancestor {@link StaticContent4a}, or null if this object does
+ * not descend from a {@link StaticContent4a}.
*/
- public StaticContent ancestorStaticContent(final FoContext context) {
+ public StaticContent4a ancestorStaticContent(final FoContext context) {
if (getParent() == null) {
return null;
}
@@ -669,7 +669,7 @@
}
@Override
- public Table ancestorTable(final FoContext context) {
+ public Table4a ancestorTable(final FoContext context) {
return effectiveParent(context).ancestorTable(context);
}
@@ -680,7 +680,7 @@
* @return The nearest ancestor Leader instance, or null if there is no
* ancestor Leader.
*/
- public Leader getNearestLeader(final FoContext context) {
+ public Leader4a getNearestLeader(final FoContext context) {
return effectiveParent(context).getNearestLeader(context);
}
@@ -3691,8 +3691,8 @@
}
/* If either is within a Leader, they both need to be in the same one.
*/
- final Leader thisLeader = effectiveParent.getNearestLeader(context);
- final Leader testLeader = leafToTest.effectiveParent(context)
+ final Leader4a thisLeader = effectiveParent.getNearestLeader(context);
+ final Leader4a testLeader = leafToTest.effectiveParent(context)
.getNearestLeader(context);
if (thisLeader != testLeader) {
return null;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -30,7 +30,7 @@
import org.foray.fotree.axsl.NamespaceAxsl;
import org.foray.fotree.fo.NamespaceFo;
-import org.foray.fotree.fo.obj.Root;
+import org.foray.fotree.fo.obj.Root4a;
import org.foray.fotree.foray.NamespaceForay;
import org.foray.fotree.math.MathNamespace;
import org.foray.fotree.svg.NamespaceSvg;
@@ -55,7 +55,7 @@
private FoTreeParser4a treeBuilder;
/** The root of the FO tree. */
- private org.foray.fotree.fo.obj.Root root;
+ private org.foray.fotree.fo.obj.Root4a root;
// /** Listeners that have registered to be notified about FOTreeEvent firings. */
// private List<FoTreeListener> foTreeListeners = new ArrayList<FoTreeListener>();
@@ -98,12 +98,12 @@
return this.root != null;
}
- public void setRootFo(final Root root) {
+ public void setRootFo(final Root4a root) {
this.root = root;
}
@Override
- public org.foray.fotree.fo.obj.Root getRootFo() {
+ public org.foray.fotree.fo.obj.Root4a getRootFo() {
return this.root;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -29,8 +29,8 @@
package org.foray.fotree;
import org.foray.common.xml.SaxParser;
-import org.foray.fotree.fo.obj.PageSequence;
-import org.foray.fotree.fo.obj.Root;
+import org.foray.fotree.fo.obj.PageSequence4a;
+import org.foray.fotree.fo.obj.Root4a;
import org.axsl.fo.FoTreeEvent;
import org.axsl.fo.FoTreeException;
@@ -62,7 +62,7 @@
private FoObj currentFObj = null;
/** The root of the formatting object tree. */
- private Root rootFObj = null;
+ private Root4a rootFObj = null;
/** Collection of objects that have registered to be notified about FOTreeEvent firings. */
private List<FoTreeListener> foTreeListeners = new ArrayList<FoTreeListener>();
@@ -168,9 +168,9 @@
try {
notifyFObjComplete(this.currentFObj);
- if (this.currentFObj instanceof PageSequence) {
+ if (this.currentFObj instanceof PageSequence4a) {
// Notify the listeners that this page-sequence is complete.
- notifyPageSequenceComplete((PageSequence) this.currentFObj);
+ notifyPageSequenceComplete((PageSequence4a) this.currentFObj);
}
} catch (final FoTreeException e) {
throw new SAXException(e);
@@ -258,8 +258,8 @@
if (this.rootFObj != null) {
return;
}
- if (fobj instanceof Root) {
- this.rootFObj = (Root) fobj;
+ if (fobj instanceof Root4a) {
+ this.rootFObj = (Root4a) fobj;
this.rootFObj.setFOTreeBuilder(this.foTree);
return;
}
@@ -332,7 +332,7 @@
* @param pageSequence The PageSequence instance that was just completed.
* @throws FoTreeException For errors while the event is being processed.
*/
- private void notifyPageSequenceComplete(final PageSequence pageSequence)
+ private void notifyPageSequenceComplete(final PageSequence4a pageSequence)
throws FoTreeException {
final FoTreeEvent event = new FoTreeEvent(this, pageSequence);
for (int i = 0; i < this.foTreeListeners.size(); i++) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -32,7 +32,7 @@
import org.foray.common.i18n.Country4a;
import org.foray.fotree.fo.FoProperty;
import org.foray.fotree.fo.FoValue;
-import org.foray.fotree.fo.obj.Region;
+import org.foray.fotree.fo.obj.Region4a;
import org.foray.fotree.fo.prop.AbstractAbsoluteDimension;
import org.foray.fotree.fo.prop.AbstractAbsoluteOffset;
import org.foray.fotree.fo.prop.AbstractAudioDial;
@@ -1415,8 +1415,8 @@
if (property != null) {
return property.getValue();
}
- if (fobj instanceof Region) {
- return ((Region) fobj).getDefaultRegionName();
+ if (fobj instanceof Region4a) {
+ return ((Region4a) fobj).getDefaultRegionName();
}
return null;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/ObjectMakerFo.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/ObjectMakerFo.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/ObjectMakerFo.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -69,50 +69,50 @@
import org.foray.fotree.fo.obj.Inline4a;
import org.foray.fotree.fo.obj.InlineContainer4a;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
-import org.foray.fotree.fo.obj.LayoutMasterSet;
-import org.foray.fotree.fo.obj.Leader;
-import org.foray.fotree.fo.obj.ListBlock;
-import org.foray.fotree.fo.obj.ListItem;
-import org.foray.fotree.fo.obj.ListItemBody;
-import org.foray.fotree.fo.obj.ListItemLabel;
-import org.foray.fotree.fo.obj.Marker;
-import org.foray.fotree.fo.obj.MultiCase;
-import org.foray.fotree.fo.obj.MultiProperties;
-import org.foray.fotree.fo.obj.MultiPropertySet;
-import org.foray.fotree.fo.obj.MultiSwitch;
-import org.foray.fotree.fo.obj.MultiToggle;
-import org.foray.fotree.fo.obj.PageNumber;
-import org.foray.fotree.fo.obj.PageNumberCitation;
-import org.foray.fotree.fo.obj.PageNumberCitationLast;
-import org.foray.fotree.fo.obj.PageSequence;
-import org.foray.fotree.fo.obj.PageSequenceMaster;
-import org.foray.fotree.fo.obj.PageSequenceWrapper;
-import org.foray.fotree.fo.obj.RegionAfter;
-import org.foray.fotree.fo.obj.RegionBefore;
-import org.foray.fotree.fo.obj.RegionBody;
-import org.foray.fotree.fo.obj.RegionEnd;
-import org.foray.fotree.fo.obj.RegionNameSpecifier;
-import org.foray.fotree.fo.obj.RegionStart;
-import org.foray.fotree.fo.obj.RepeatablePmAlternatives;
-import org.foray.fotree.fo.obj.RepeatablePmReference;
-import org.foray.fotree.fo.obj.RetrieveMarker;
-import org.foray.fotree.fo.obj.RetrieveTableMarker;
-import org.foray.fotree.fo.obj.Root;
-import org.foray.fotree.fo.obj.ScalingValueCitation;
-import org.foray.fotree.fo.obj.SimplePageMaster;
-import org.foray.fotree.fo.obj.SinglePageMasterReference;
-import org.foray.fotree.fo.obj.StaticContent;
-import org.foray.fotree.fo.obj.Table;
-import org.foray.fotree.fo.obj.TableAndCaption;
-import org.foray.fotree.fo.obj.TableBody;
-import org.foray.fotree.fo.obj.TableCaption;
-import org.foray.fotree.fo.obj.TableCell;
-import org.foray.fotree.fo.obj.TableColumn;
-import org.foray.fotree.fo.obj.TableFooter;
-import org.foray.fotree.fo.obj.TableHeader;
-import org.foray.fotree.fo.obj.TableRow;
-import org.foray.fotree.fo.obj.Title;
-import org.foray.fotree.fo.obj.Wrapper;
+import org.foray.fotree.fo.obj.LayoutMasterSet4a;
+import org.foray.fotree.fo.obj.Leader4a;
+import org.foray.fotree.fo.obj.ListBlock4a;
+import org.foray.fotree.fo.obj.ListItem4a;
+import org.foray.fotree.fo.obj.ListItemBody4a;
+import org.foray.fotree.fo.obj.ListItemLabel4a;
+import org.foray.fotree.fo.obj.Marker4a;
+import org.foray.fotree.fo.obj.MultiCase4a;
+import org.foray.fotree.fo.obj.MultiProperties4a;
+import org.foray.fotree.fo.obj.MultiPropertySet4a;
+import org.foray.fotree.fo.obj.MultiSwitch4a;
+import org.foray.fotree.fo.obj.MultiToggle4a;
+import org.foray.fotree.fo.obj.PageNumber4a;
+import org.foray.fotree.fo.obj.PageNumberCitation4a;
+import org.foray.fotree.fo.obj.PageNumberCitationLast4a;
+import org.foray.fotree.fo.obj.PageSequence4a;
+import org.foray.fotree.fo.obj.PageSequenceMaster4a;
+import org.foray.fotree.fo.obj.PageSequenceWrapper4a;
+import org.foray.fotree.fo.obj.RegionAfter4a;
+import org.foray.fotree.fo.obj.RegionBefore4a;
+import org.foray.fotree.fo.obj.RegionBody4a;
+import org.foray.fotree.fo.obj.RegionEnd4a;
+import org.foray.fotree.fo.obj.RegionNameSpecifier4a;
+import org.foray.fotree.fo.obj.RegionStart4a;
+import org.foray.fotree.fo.obj.RepeatablePmAlternatives4a;
+import org.foray.fotree.fo.obj.RepeatablePmReference4a;
+import org.foray.fotree.fo.obj.RetrieveMarker4a;
+import org.foray.fotree.fo.obj.RetrieveTableMarker4a;
+import org.foray.fotree.fo.obj.Root4a;
+import org.foray.fotree.fo.obj.ScalingValueCitation4a;
+import org.foray.fotree.fo.obj.SimplePageMaster4a;
+import org.foray.fotree.fo.obj.SinglePageMasterReference4a;
+import org.foray.fotree.fo.obj.StaticContent4a;
+import org.foray.fotree.fo.obj.Table4a;
+import org.foray.fotree.fo.obj.TableAndCaption4a;
+import org.foray.fotree.fo.obj.TableBody4a;
+import org.foray.fotree.fo.obj.TableCaption4a;
+import org.foray.fotree.fo.obj.TableCell4a;
+import org.foray.fotree.fo.obj.TableColumn4a;
+import org.foray.fotree.fo.obj.TableFooter4a;
+import org.foray.fotree.fo.obj.TableHeader4a;
+import org.foray.fotree.fo.obj.TableRow4a;
+import org.foray.fotree.fo.obj.Title4a;
+import org.foray.fotree.fo.obj.Wrapper4a;
import org.axsl.fo.FoTreeException;
@@ -195,7 +195,7 @@
return new Float4a(parent, propertyList);
}
case FLOW: {
- final PageSequence pageSequence = parentPageSequence(enumeration,
+ final PageSequence4a pageSequence = parentPageSequence(enumeration,
parent, locator);
return new Flow4a(pageSequence, propertyList);
}
@@ -204,7 +204,7 @@
return new FlowAssignment4a(flowMap, propertyList);
}
case FLOW_MAP: {
- final LayoutMasterSet layoutMasterSet = parentLayoutMasterSet(
+ final LayoutMasterSet4a layoutMasterSet = parentLayoutMasterSet(
enumeration, parent, locator);
return new FlowMap4a(layoutMasterSet, propertyList);
}
@@ -272,145 +272,145 @@
return new InstreamForeignObject4a(parent, propertyList);
}
case LAYOUT_MASTER_SET: {
- final Root root = parentRoot(enumeration, parent, locator);
- return new LayoutMasterSet(root, propertyList);
+ final Root4a root = parentRoot(enumeration, parent, locator);
+ return new LayoutMasterSet4a(root, propertyList);
}
case LEADER: {
- return new Leader(parent, propertyList);
+ return new Leader4a(parent, propertyList);
}
case LIST_BLOCK: {
- return new ListBlock(parent, propertyList);
+ return new ListBlock4a(parent, propertyList);
}
case LIST_ITEM: {
- return new ListItem(parent, propertyList);
+ return new ListItem4a(parent, propertyList);
}
case LIST_ITEM_BODY: {
- return new ListItemBody(parent, propertyList);
+ return new ListItemBody4a(parent, propertyList);
}
case LIST_ITEM_LABEL: {
- return new ListItemLabel(parent, propertyList);
+ return new ListItemLabel4a(parent, propertyList);
}
case MARKER: {
- return new Marker(parent, propertyList);
+ return new Marker4a(parent, propertyList);
}
case MULTI_CASE: {
- return new MultiCase(parent, propertyList);
+ return new MultiCase4a(parent, propertyList);
}
case MULTI_PROPERTIES: {
- return new MultiProperties(parent, propertyList);
+ return new MultiProperties4a(parent, propertyList);
}
case MULTI_PROPERTY_SET: {
- return new MultiPropertySet(parent, propertyList);
+ return new MultiPropertySet4a(parent, propertyList);
}
case MULTI_SWITCH: {
- return new MultiSwitch(parent, propertyList);
+ return new MultiSwitch4a(parent, propertyList);
}
case MULTI_TOGGLE: {
- return new MultiToggle(parent, propertyList);
+ return new MultiToggle4a(parent, propertyList);
}
case PAGE_NUMBER: {
- return new PageNumber(parent, propertyList);
+ return new PageNumber4a(parent, propertyList);
}
case PAGE_NUMBER_CITATION: {
- return new PageNumberCitation(parent, propertyList);
+ return new PageNumberCitation4a(parent, propertyList);
}
case PAGE_NUMBER_CITATION_LAST: {
- return new PageNumberCitationLast(parent, propertyList);
+ return new PageNumberCitationLast4a(parent, propertyList);
}
case PAGE_SEQUENCE: {
- final Root root = parentRoot(enumeration, parent, locator);
- return new PageSequence(root, propertyList);
+ final Root4a root = parentRoot(enumeration, parent, locator);
+ return new PageSequence4a(root, propertyList);
}
case PAGE_SEQUENCE_MASTER: {
- return new PageSequenceMaster(parent, propertyList);
+ return new PageSequenceMaster4a(parent, propertyList);
}
case PAGE_SEQUENCE_WRAPPER: {
- return new PageSequenceWrapper(parent, propertyList);
+ return new PageSequenceWrapper4a(parent, propertyList);
}
case REGION_AFTER: {
- final SimplePageMaster simplePageMaster = parentSimplePageMaster(
+ final SimplePageMaster4a simplePageMaster = parentSimplePageMaster(
enumeration, parent, locator);
- return new RegionAfter(simplePageMaster, propertyList);
+ return new RegionAfter4a(simplePageMaster, propertyList);
}
case REGION_BEFORE: {
- final SimplePageMaster simplePageMaster = parentSimplePageMaster(
+ final SimplePageMaster4a simplePageMaster = parentSimplePageMaster(
enumeration, parent, locator);
- return new RegionBefore(simplePageMaster, propertyList);
+ return new RegionBefore4a(simplePageMaster, propertyList);
}
case REGION_BODY: {
- final SimplePageMaster simplePageMaster = parentSimplePageMaster(
+ final SimplePageMaster4a simplePageMaster = parentSimplePageMaster(
enumeration, parent, locator);
- return new RegionBody(simplePageMaster, propertyList);
+ return new RegionBody4a(simplePageMaster, propertyList);
}
case REGION_END: {
- final SimplePageMaster simplePageMaster = parentSimplePageMaster(
+ final SimplePageMaster4a simplePageMaster = parentSimplePageMaster(
enumeration, parent, locator);
- return new RegionEnd(simplePageMaster, propertyList);
+ return new RegionEnd4a(simplePageMaster, propertyList);
}
case REGION_NAME_SPECIFIER: {
final FlowTargetList4a flowTargetList = parentFlowTargetList(
enumeration, parent, locator);
- return new RegionNameSpecifier(flowTargetList, propertyList);
+ return new RegionNameSpecifier4a(flowTargetList, propertyList);
}
case REGION_START: {
- final SimplePageMaster simplePageMaster = parentSimplePageMaster(
+ final SimplePageMaster4a simplePageMaster = parentSimplePageMaster(
enumeration, parent, locator);
- return new RegionStart(simplePageMaster, propertyList);
+ return new RegionStart4a(simplePageMaster, propertyList);
}
case REPEATABLE_PAGE_MASTER_ALTERNATIVES: {
- return new RepeatablePmAlternatives(parent, propertyList);
+ return new RepeatablePmAlternatives4a(parent, propertyList);
}
case REPEATABLE_PAGE_MASTER_REFERENCE: {
- return new RepeatablePmReference(parent, propertyList);
+ return new RepeatablePmReference4a(parent, propertyList);
}
case RETRIEVE_MARKER: {
- return new RetrieveMarker(parent, propertyList);
+ return new RetrieveMarker4a(parent, propertyList);
}
case RETRIEVE_TABLE_MARKER: {
- return new RetrieveTableMarker(parent, propertyList);
+ return new RetrieveTableMarker4a(parent, propertyList);
}
case ROOT: {
- final Root root = new Root(foTree, propertyList);
+ final Root4a root = new Root4a(foTree, propertyList);
foTree.setRootFo(root);
return root;
}
case SCALING_VALUE_CITATION: {
- return new ScalingValueCitation(parent, propertyList);
+ return new ScalingValueCitation4a(parent, propertyList);
}
case SIMPLE_PAGE_MASTER: {
- final LayoutMasterSet layoutMasterSet = parentLayoutMasterSet(
+ final LayoutMasterSet4a layoutMasterSet = parentLayoutMasterSet(
enumeration, parent, locator);
- return new SimplePageMaster(layoutMasterSet, propertyList);
+ return new SimplePageMaster4a(layoutMasterSet, propertyList);
}
case SINGLE_PAGE_MASTER_REFERENCE: {
- return new SinglePageMasterReference(parent, propertyList);
+ return new SinglePageMasterReference4a(parent, propertyList);
}
case STATIC_CONTENT: {
- final PageSequence pageSequence = parentPageSequence(enumeration,
+ final PageSequence4a pageSequence = parentPageSequence(enumeration,
parent, locator);
- return new StaticContent(pageSequence, propertyList);
+ return new StaticContent4a(pageSequence, propertyList);
}
case TABLE: {
- return new Table(parent, propertyList);
+ return new Table4a(parent, propertyList);
}
case TABLE_AND_CAPTION: {
- return new TableAndCaption(parent, propertyList);
+ return new TableAndCaption4a(parent, propertyList);
}
case TABLE_BODY: {
- final Table table = parentTable(enumeration, parent, locator);
- return new TableBody(table, propertyList);
+ final Table4a table = parentTable(enumeration, parent, locator);
+ return new TableBody4a(table, propertyList);
}
case TABLE_CAPTION: {
- return new TableCaption(parent, propertyList);
+ return new TableCaption4a(parent, propertyList);
}
case TABLE_CELL: {
- if (parent instanceof TableRow) {
- final TableRow parentRow = (TableRow) parent;
- return new TableCell(parentRow, propertyList);
+ if (parent instanceof TableRow4a) {
+ final TableRow4a parentRow = (TableRow4a) parent;
+ return new TableCell4a(parentRow, propertyList);
}
if (parent instanceof AbstractTablePart) {
final AbstractTablePart tablePart = (AbstractTablePart) parent;
- return new TableCell(tablePart, propertyList);
+ return new TableCell4a(tablePart, propertyList);
}
throwException(locator, "fo:" + enumeration.toXslFo()
+ " must be child of fo:table-row, fo:table-body, " +
@@ -418,25 +418,25 @@
return null;
}
case TABLE_COLUMN: {
- return new TableColumn(parent, propertyList);
+ return new TableColumn4a(parent, propertyList);
}
case TABLE_FOOTER: {
- final Table table = parentTable(enumeration, parent, locator);
- return new TableFooter(table, propertyList);
+ final Table4a table = parentTable(enumeration, parent, locator);
+ return new TableFooter4a(table, propertyList);
}
case TABLE_HEADER: {
- final Table table = parentTable(enumeration, parent, locator);
- return new TableHeader(table, propertyList);
+ final Table4a table = parentTable(enumeration, parent, locator);
+ return new TableHeader4a(table, propertyList);
}
case TABLE_ROW: {
- return new TableRow(parent, propertyList,
+ return new TableRow4a(parent, propertyList,
false);
}
case TITLE: {
- return new Title(parent, propertyList);
+ return new Title4a(parent, propertyList);
}
case WRAPPER: {
- return new Wrapper(parent, propertyList);
+ return new Wrapper4a(parent, propertyList);
}
default: {
return null;
@@ -468,19 +468,19 @@
}
/**
- * Converts the parent object to a {@link Table} if it can, or throws an
+ * Converts the parent object to a {@link Table4a} if it can, or throws an
* exception otherwise.
* @param newObject The type of the new object to be created.
* @param parent The parent object.
* @param locator The SAX locator describing the location of the object
* that is trying to be constructed.
- * @return The parent object cast as a {@link Table}.
- * @throws FoTreeException If parent cannot be converted to a {@link Table}.
+ * @return The parent object cast as a {@link Table4a}.
+ * @throws FoTreeException If parent cannot be converted to a {@link Table4a}.
*/
- private static Table parentTable(final FoObject newObject,
+ private static Table4a parentTable(final FoObject newObject,
final FoObj parent, final Locator locator) throws FoTreeException {
- if (parent instanceof Table) {
- return (Table) parent;
+ if (parent instanceof Table4a) {
+ return (Table4a) parent;
}
throwException(locator, "fo:" + newObject.toXslFo()
+ " must be child of fo:table.");
@@ -488,20 +488,20 @@
}
/**
- * Converts the parent object to a {@link PageSequence} if it can, or throws
+ * Converts the parent object to a {@link PageSequence4a} if it can, or throws
* an exception otherwise.
* @param newObject The type of the new object to be created.
* @param parent The parent object.
* @param locator The SAX locator describing the location of the object
* that is trying to be constructed.
- * @return The parent object cast as a {@link PageSequence}.
+ * @return The parent object cast as a {@link PageSequence4a}.
* @throws FoTreeException If parent cannot be converted to a
- * {@link PageSequence}.
+ * {@link PageSequence4a}.
*/
- private static PageSequence parentPageSequence(final FoObject newObject,
+ private static PageSequence4a parentPageSequence(final FoObject newObject,
final FoObj parent, final Locator locator) throws FoTreeException {
- if (parent instanceof PageSequence) {
- return (PageSequence) parent;
+ if (parent instanceof PageSequence4a) {
+ return (PageSequence4a) parent;
}
throwException(locator, "fo:" + newObject.toXslFo()
+ " must be child of fo:page-sequence.");
@@ -509,20 +509,20 @@
}
/**
- * Converts the parent object to a {@link Root} if it can, or throws
+ * Converts the parent object to a {@link Root4a} if it can, or throws
* an exception otherwise.
* @param newObject The type of the new object to be created.
* @param parent The parent object.
* @param locator The SAX locator describing the location of the object
* that is trying to be constructed.
- * @return The parent object cast as a {@link Root}.
+ * @return The parent object cast as a {@link Root4a}.
* @throws FoTreeException If parent cannot be converted to a
- * {@link Root}.
+ * {@link Root4a}.
*/
- private static Root parentRoot(final FoObject newObject,
+ private static Root4a parentRoot(final FoObject newObject,
final FoObj parent, final Locator locator) throws FoTreeException {
- if (parent instanceof Root) {
- return (Root) parent;
+ if (parent instanceof Root4a) {
+ return (Root4a) parent;
}
throwException(locator, "fo:" + newObject.toXslFo()
+ " must be child of fo:root.");
@@ -530,21 +530,21 @@
}
/**
- * Converts the parent object to a {@link SimplePageMaster} if it can, or
+ * Converts the parent object to a {@link SimplePageMaster4a} if it can, or
* throws an exception otherwise.
* @param newObject The type of the new object to be created.
* @param parent The parent object.
* @param locator The SAX locator describing the location of the object
* that is trying to be constructed.
- * @return The parent object cast as a {@link SimplePageMaster}.
+ * @return The parent object cast as a {@link SimplePageMaster4a}.
* @throws FoTreeException If parent cannot be converted to a
- * {@link SimplePageMaster}.
+ * {@link SimplePageMaster4a}.
*/
- private static SimplePageMaster parentSimplePageMaster(
+ private static SimplePageMaster4a parentSimplePageMaster(
final FoObject newObject, final FoObj parent, final Locator locator)
throws FoTreeException {
- if (parent instanceof SimplePageMaster) {
- return (SimplePageMaster) parent;
+ if (parent instanceof SimplePageMaster4a) {
+ return (SimplePageMaster4a) parent;
}
throwException(locator, "fo:" + newObject.toXslFo()
+ " must be child of fo:simple-page-master.");
@@ -552,21 +552,21 @@
}
/**
- * Converts the parent object to a {@link LayoutMasterSet} if it can, or
+ * Converts the parent object to a {@link LayoutMasterSet4a} if it can, or
* throws an exception otherwise.
* @param newObject The type of the new object to be created.
* @param parent The parent object.
* @param locator The SAX locator describing the location of the object
* that is trying to be constructed.
- * @return The parent object cast as a {@link LayoutMasterSet}.
+ * @return The parent object cast as a {@link LayoutMasterSet4a}.
* @throws FoTreeException If parent cannot be converted to a
- * {@link LayoutMasterSet}.
+ * {@link LayoutMasterSet4a}.
*/
- private static LayoutMasterSet parentLayoutMasterSet(
+ private static LayoutMasterSet4a parentLayoutMasterSet(
final FoObject newObject, final FoObj parent, final Locator locator)
throws FoTreeException {
- if (parent instanceof LayoutMasterSet) {
- return (LayoutMasterSet) parent;
+ if (parent instanceof LayoutMasterSet4a) {
+ return (LayoutMasterSet4a) parent;
}
throwException(locator, "fo:" + newObject.toXslFo()
+ " must be child of fo:layout-master-set.");
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFlow.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFlow.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFlow.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -47,7 +47,7 @@
private PropertyList propertyList;
/** The parent of this node. */
- private PageSequence parent;
+ private PageSequence4a parent;
/** The children of this object. */
private List<FoObj> children = new ArrayList<FoObj>();
@@ -61,7 +61,7 @@
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
*/
- protected AbstractFlow(final PageSequence parent,
+ protected AbstractFlow(final PageSequence4a parent,
final PropertyList propertyList) {
super(parent);
this.parent = parent;
@@ -106,7 +106,7 @@
}
@Override
- public PageSequence getParent() {
+ public PageSequence4a getParent() {
return this.parent;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFolioDescriptor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFolioDescriptor.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFolioDescriptor.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -119,9 +119,9 @@
nonTextNode.throwException("Child of " + this.getFullName()
+ " must be #PCDATA or %inline.");
}
- if (nonTextNode instanceof PageNumber
- || nonTextNode instanceof PageNumberCitation
- || nonTextNode instanceof PageNumberCitationLast) {
+ if (nonTextNode instanceof PageNumber4a
+ || nonTextNode instanceof PageNumberCitation4a
+ || nonTextNode instanceof PageNumberCitationLast4a) {
nonTextNode.throwException(nonTextNode.getFullName()
+ " is not allowed as child of " + this.getFullName()
+ ".");
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageMaster.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageMaster.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageMaster.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -43,7 +43,7 @@
public abstract class AbstractPageMaster extends FoObj {
/** The parent of this node. */
- private LayoutMasterSet parent;
+ private LayoutMasterSet4a parent;
/** The children of this object. */
private List<FoObj> children = new ArrayList<FoObj>();
@@ -56,7 +56,7 @@
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
*/
- public AbstractPageMaster(final LayoutMasterSet parent,
+ public AbstractPageMaster(final LayoutMasterSet4a parent,
final PropertyList propertyList) {
super(parent);
this.parent = parent;
@@ -83,7 +83,7 @@
public abstract boolean hasRegion(String flowName);
@Override
- public LayoutMasterSet getParent() {
+ public LayoutMasterSet4a getParent() {
return this.parent;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractTablePart.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractTablePart.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractTablePart.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -45,10 +45,10 @@
public abstract class AbstractTablePart extends FoObj {
/** The parent of this node. */
- private Table parent;
+ private Table4a parent;
/** The children of this object. */
- private List<TableRow> children = new ArrayList<TableRow>();
+ private List<TableRow4a> children = new ArrayList<TableRow4a>();
/** The property list for this object. */
private PropertyList propertyList;
@@ -63,13 +63,13 @@
/** If the children of this are table-cells instead of table-rows, this
* keeps track of the current pseudo row that is inserted as a parent of
* the table-cells. */
- private transient TableRow currentPseudoTableRow;
+ private transient TableRow4a currentPseudoTableRow;
/** If the children of this are table-cells instead of table-rows, this
* keeps track of the last table-cell for which a pseudo table-row was
* provided. This is needed so that its "ends-row" property can be
* checked.*/
- private transient TableCell lastTableCell;
+ private transient TableCell4a lastTableCell;
/**
* Constructor.
@@ -76,7 +76,7 @@
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
*/
- public AbstractTablePart(final Table parent,
+ public AbstractTablePart(final Table4a parent,
final PropertyList propertyList) {
super(parent);
this.parent = parent;
@@ -119,11 +119,11 @@
* or row spanning causing an overlap." */
final int qtyRows = this.getChildCount();
final int qtyColumns = this.parent.numberOfColumns();
- final TableCell[][] cellArray = new TableCell[qtyRows][qtyColumns];
+ final TableCell4a[][] cellArray = new TableCell4a[qtyRows][qtyColumns];
for (int startingRow = 0; startingRow < qtyRows; startingRow++) {
- final TableRow tableRow = this.getChildAt(startingRow);
+ final TableRow4a tableRow = this.getChildAt(startingRow);
for (int i = 0; i < tableRow.getChildCount(); i++) {
- final TableCell tableCell = (TableCell) tableRow.getChildAt(i);
+ final TableCell4a tableCell = (TableCell4a) tableRow.getChildAt(i);
if (tableCell != null) {
validateOverlapCell(cellArray, startingRow, tableCell);
}
@@ -139,8 +139,8 @@
* @param tableCell The cell being tested.
* @throws FoTreeException If the cell overlaps previously tested cells.
*/
- private void validateOverlapCell(final TableCell[][] cellArray,
- final int startingRow, final TableCell tableCell)
+ private void validateOverlapCell(final TableCell4a[][] cellArray,
+ final int startingRow, final TableCell4a tableCell)
throws FoTreeException {
if (tableCell == null) {
throw new NullPointerException("Error attempting to test a null "
@@ -155,9 +155,9 @@
+ tableCell.traitNumberColumnsSpanned()
- 1;
for (int j = startingRow; j <= endingRow; j++) {
- final TableCell[] cellArrayThisRow = cellArray[j];
+ final TableCell4a[] cellArrayThisRow = cellArray[j];
for (int k = startingColumn; k <= endingColumn; k++) {
- final TableCell existingCell = cellArrayThisRow[k];
+ final TableCell4a existingCell = cellArrayThisRow[k];
if (existingCell == null) {
cellArrayThisRow[k] = tableCell;
} else {
@@ -180,7 +180,7 @@
* @param tableCell The table cell for which a parent table row is needed.
* @return The pseudo parent table row.
*/
- private TableRow getPseudoTableRow(final TableCell tableCell) {
+ private TableRow4a getPseudoTableRow(final TableCell4a tableCell) {
if (tableCell == null) {
throw new NullPointerException("tableCell parameter may not be "
+ "null");
@@ -198,7 +198,7 @@
}
if (newRowNeeded) {
final PropertyList propertyList = new PropertyList(0);
- this.currentPseudoTableRow = new TableRow(this, propertyList, true);
+ this.currentPseudoTableRow = new TableRow4a(this, propertyList, true);
this.children.add(this.currentPseudoTableRow);
}
this.lastTableCell = tableCell;
@@ -211,7 +211,7 @@
}
@Override
- public List<TableRow> getChildren() {
+ public List<TableRow4a> getChildren() {
return this.children;
}
@@ -218,7 +218,7 @@
@Override
public void addChild(final FoObj child) throws FoTreeException {
if (! this.childTypeIsSet) {
- if (child instanceof TableRow) {
+ if (child instanceof TableRow4a) {
this.childTypeIsRow = true;
} else {
/* If it is not a table-cell, that will be caught below. */
@@ -226,20 +226,20 @@
}
this.childTypeIsSet = true;
}
- if (child instanceof TableRow) {
+ if (child instanceof TableRow4a) {
if (! this.childTypeIsRow) {
child.throwException(this.getFullName() + " already has "
+ "table-cell children, table-row not allowed.");
}
- this.children.add((TableRow) child);
+ this.children.add((TableRow4a) child);
return;
}
- if (child instanceof TableCell) {
+ if (child instanceof TableCell4a) {
/* We can't have TableCell children, so we need to get the
* interposed TableRow instance and make the cell a child of it
* instead of a child of this. */
- final TableCell childCell = (TableCell) child;
- final TableRow interposedRow = this.getPseudoTableRow(childCell);
+ final TableCell4a childCell = (TableCell4a) child;
+ final TableRow4a interposedRow = this.getPseudoTableRow(childCell);
childCell.setParent(interposedRow);
interposedRow.addChild(childCell);
return;
@@ -273,7 +273,7 @@
}
@Override
- public TableRow getChildAt(final int index) {
+ public TableRow4a getChildAt(final int index) {
return this.children.get(index);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BookmarkTree4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BookmarkTree4a.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BookmarkTree4a.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -68,7 +68,7 @@
@Override
protected void validateAncestry() throws FoTreeException {
// Validate that this is a child of fo:root.
- if (! (this.getParent() instanceof Root)) {
+ if (! (this.getParent() instanceof Root4a)) {
throwException(getFullName() + " must be child of fo:root.");
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference4a.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference4a.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -68,7 +68,7 @@
@Override
protected void validateAncestry() throws FoTreeException {
- if (! (this.getParent() instanceof RepeatablePmAlternatives)) {
+ if (! (this.getParent() instanceof RepeatablePmAlternatives4a)) {
throwException(getFullName() + " must be child of "
+ "fo:repeatable-page-master-alternatives.");
}
@@ -110,9 +110,9 @@
* Convenience method returning the parent.
* @return The parent, properly cast.
*/
- public RepeatablePmAlternatives repeatablePMAlternatives() {
+ public RepeatablePmAlternatives4a repeatablePMAlternatives() {
/* Cast verified at construction. */
- return (RepeatablePmAlternatives) this.getParent();
+ return (RepeatablePmAlternatives4a) this.getParent();
}
/**
@@ -119,7 +119,7 @@
* Convenience method returning the grandparent, properly cast.
* @return The grandparent PageSequenceMaster.
*/
- public PageSequenceMaster pageSequenceMaster() {
+ public PageSequenceMaster4a pageSequenceMaster() {
return repeatablePMAlternatives().pageSequenceMaster();
}
@@ -127,7 +127,7 @@
* Convenience method returning the great-grandparent, properly cast.
* @return The great-grandparent LayoutMasterSet.
*/
- public LayoutMasterSet layoutMasterSet() {
+ public LayoutMasterSet4a layoutMasterSet() {
return pageSequenceMaster().layoutMasterSet();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Flow4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Flow4a.java 2021-12-02 15:43:07 UTC (rev 12167)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Flow4a.java 2021-12-02 16:13:13 UTC (rev 12168)
@@ -49,7 +49,7 @@
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
*/
- public Flow4a(final PageSequence parent, final PropertyList propertyList) {
+ public Flow4a(final PageSequence4a parent, final PropertyList propertyList) {
super(parent, propertyList);
}
@@ -92,7 +92,7 @@
* beginning of the content. The Markers check that themselves as
* they are created.
*/
- if (child instanceof Marker) {
+ if (child instanceof Marker4a) {
continue;
}
throwException(getFullName() + "has invalid content: "
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowMap4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowMap4a.java 2021-12-02 15:43:07 UTC (rev ...
[truncated message content] |
|
From: <vic...@us...> - 2021-12-02 15:43:13
|
Revision: 12167
http://sourceforge.net/p/foray/code/12167
Author: victormote
Date: 2021-12-02 15:43:07 +0000 (Thu, 02 Dec 2021)
Log Message:
-----------
(partial) Rename some FOray FO implementation classes for clarity.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/fo/AbstractFoTreeTest.java
trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java
trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/ObjectMakerFo.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageReference.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/CharacterSequence4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageMasterResolver.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageSequence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RegionNameSpecifier.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/RepeatablePmAlternatives.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Title.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentAdjust.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDecoration.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathObjectMaker.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/ObjectMakerSvg.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockPnr.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BasicLink4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BidiOverride4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockContainer4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Bookmark4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BookmarkTitle4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BookmarkTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ChangeBarBegin4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ChangeBarEnd4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ColorProfile4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Declarations4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ExternalGraphic4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Float4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Flow4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowAssignment4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowMap4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowNameSpecifier4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowSourceList4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowTargetList4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FolioPrefix4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FolioSuffix4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Footnote4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FootnoteBody4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexKeyReference4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageCitationList4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageCitationListSeparator4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageCitationRangeSeparator4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageNumberPrefix4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageNumberSuffix4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexRangeBegin4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexRangeEnd4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InitialPropertySet4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Inline4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InlineContainer4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BasicLink.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BidiOverride.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BlockContainer.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Bookmark.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BookmarkTitle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BookmarkTree.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ChangeBarBegin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ChangeBarEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ColorProfile.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Declarations.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ExternalGraphic.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Float.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Flow.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowAssignment.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowMap.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowNameSpecifier.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowSourceList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FlowTargetList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FolioPrefix.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FolioSuffix.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Footnote.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FootnoteBody.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexKeyReference.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageCitationList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageCitationListSeparator.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageCitationRangeSeparator.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageNumberPrefix.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexPageNumberSuffix.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexRangeBegin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/IndexRangeEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InitialPropertySet.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Inline.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InlineContainer.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/AbstractFoTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/AbstractFoTreeTest.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/AbstractFoTreeTest.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -30,7 +30,7 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
-import org.foray.fotree.fo.obj.Flow;
+import org.foray.fotree.fo.obj.Flow4a;
import org.foray.fotree.fo.obj.PageSequence;
import org.foray.fotree.fo.obj.Root;
@@ -46,14 +46,14 @@
* @param foTree The fo tree whose first flow is needed.
* @return The first flow in {@code foTree}.
*/
- protected Flow getFlow(final FoTree4a foTree) {
+ protected Flow4a getFlow(final FoTree4a foTree) {
final Root root = foTree.getRootFo();
FoObj node = root.getChildAt(1);
Assert.assertTrue(node instanceof PageSequence);
final PageSequence sequence = (PageSequence) node;
node = sequence.getChildAt(0);
- Assert.assertTrue(node instanceof Flow);
- final Flow flow = (Flow) node;
+ Assert.assertTrue(node instanceof Flow4a);
+ final Flow4a flow = (Flow4a) node;
return flow;
}
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -31,8 +31,8 @@
import org.foray.core.ForayException;
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
-import org.foray.fotree.fo.obj.Block;
-import org.foray.fotree.fo.obj.Flow;
+import org.foray.fotree.fo.obj.Block4a;
+import org.foray.fotree.fo.obj.Flow4a;
import org.axsl.font.Font;
@@ -57,11 +57,11 @@
final FoDocumentReader reader = FoDocumentReader.getInstance();
final FoTree4a foTree = reader.buildFoTree(
"fo/font-family-001.fo");
- final Flow flow = this.getFlow(foTree);
+ final Flow4a flow = this.getFlow(foTree);
FoObj node = flow.getChildAt(0);
- Assert.assertTrue(node instanceof Block);
- Block block = (Block) node;
+ Assert.assertTrue(node instanceof Block4a);
+ Block4a block = (Block4a) node;
List<String> fontFamilies = block.traitFontFamily(null);
Assert.assertEquals(1, fontFamilies.size());
/* The default font-family is "serif". */
@@ -68,8 +68,8 @@
Assert.assertEquals("serif", fontFamilies.get(0));
node = flow.getChildAt(1);
- Assert.assertTrue(node instanceof Block);
- block = (Block) node;
+ Assert.assertTrue(node instanceof Block4a);
+ block = (Block4a) node;
fontFamilies = block.traitFontFamily(null);
Assert.assertEquals(1, fontFamilies.size());
Assert.assertEquals("Base14-Courier", fontFamilies.get(0));
@@ -87,24 +87,24 @@
public void testFontSize001() throws ForayException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
final FoTree4a foTree = reader.buildFoTree("fo/font-size-001.fo");
- final Flow flow = this.getFlow(foTree);
+ final Flow4a flow = this.getFlow(foTree);
FoObj node = flow.getChildAt(0);
- Assert.assertTrue(node instanceof Block);
- Block block = (Block) node;
+ Assert.assertTrue(node instanceof Block4a);
+ Block4a block = (Block4a) node;
int fontSize = block.traitFontSize(null);
/* The default font size is 12 points. */
Assert.assertEquals(12000, fontSize);
node = flow.getChildAt(1);
- Assert.assertTrue(node instanceof Block);
- block = (Block) node;
+ Assert.assertTrue(node instanceof Block4a);
+ block = (Block4a) node;
fontSize = block.traitFontSize(null);
Assert.assertEquals(8000, fontSize);
node = flow.getChildAt(2);
- Assert.assertTrue(node instanceof Block);
- block = (Block) node;
+ Assert.assertTrue(node instanceof Block4a);
+ block = (Block4a) node;
final Font font = node.getPrimaryFont(null).getFont();
Assert.assertEquals("Courier", font.getFamilyName());
Assert.assertEquals(426, font.getXheight(1000));
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -31,9 +31,9 @@
import org.foray.core.ForayException;
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
-import org.foray.fotree.fo.obj.Block;
-import org.foray.fotree.fo.obj.Flow;
-import org.foray.fotree.fo.obj.InstreamForeignObject;
+import org.foray.fotree.fo.obj.Block4a;
+import org.foray.fotree.fo.obj.Flow4a;
+import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.foray.fotree.svg.obj.InstreamSvgElement;
import org.junit.Assert;
@@ -52,17 +52,17 @@
final FoDocumentReader reader = FoDocumentReader.getInstance();
final FoTree4a foTree = reader.buildFoTree(
"fo/graphic-001.fo");
- final Flow flow = this.getFlow(foTree);
+ final Flow4a flow = this.getFlow(foTree);
/* The second child should be a block ... */
FoObj node = flow.getChildAt(1);
- Assert.assertTrue(node instanceof Block);
- final Block block = (Block) node;
+ Assert.assertTrue(node instanceof Block4a);
+ final Block4a block = (Block4a) node;
/* ... which contains an InstreamForeignObject ... */
node = block.getChildAt(0);
- Assert.assertTrue(node instanceof InstreamForeignObject);
- final InstreamForeignObject ifo = (InstreamForeignObject) node;
+ Assert.assertTrue(node instanceof InstreamForeignObject4a);
+ final InstreamForeignObject4a ifo = (InstreamForeignObject4a) node;
/* ... which contains an SVGElement ... */
node = ifo.getChildAt(0);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -43,10 +43,10 @@
import org.foray.fotree.fo.FoValue;
import org.foray.fotree.fo.enums.Scaling;
import org.foray.fotree.fo.enums.ScalingMethod;
-import org.foray.fotree.fo.obj.BasicLink;
-import org.foray.fotree.fo.obj.Block;
+import org.foray.fotree.fo.obj.BasicLink4a;
+import org.foray.fotree.fo.obj.Block4a;
import org.foray.fotree.fo.obj.CharacterSequence4a;
-import org.foray.fotree.fo.obj.Flow;
+import org.foray.fotree.fo.obj.Flow4a;
import org.foray.fotree.fo.obj.Leader;
import org.foray.fotree.fo.obj.ListBlock;
import org.foray.fotree.fo.obj.ListItem;
@@ -636,18 +636,18 @@
* the nearest ancestor that is a Block, or null if there is no ancestor
* Block.
*/
- public Block getContainingBlock(final FoContext context) {
+ public Block4a getContainingBlock(final FoContext context) {
return effectiveParent(context).getContainingBlock(context);
}
/**
- * Returns the ancestor {@link Flow}, if any.
+ * Returns the ancestor {@link Flow4a}, if any.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @return The ancestor {@link Flow}, or null if this object does not
- * descend from a {@link Flow}.
+ * @return The ancestor {@link Flow4a}, or null if this object does not
+ * descend from a {@link Flow4a}.
*/
- public Flow ancestorFlow(final FoContext context) {
+ public Flow4a ancestorFlow(final FoContext context) {
if (getParent() == null) {
return null;
}
@@ -685,7 +685,7 @@
}
@Override
- public BasicLink ancestorBasicLink(final FoContext context) {
+ public BasicLink4a ancestorBasicLink(final FoContext context) {
return effectiveParent(context).ancestorBasicLink(context);
}
@@ -3697,9 +3697,9 @@
if (thisLeader != testLeader) {
return null;
}
- final Block thisBlock =
+ final Block4a thisBlock =
this.effectiveParent(context).getContainingBlock(context);
- final Block testBlock = leafToTest.effectiveParent(context)
+ final Block4a testBlock = leafToTest.effectiveParent(context)
.getContainingBlock(context);
if (thisBlock != testBlock) {
return null;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -28,7 +28,7 @@
package org.foray.fotree;
-import org.foray.fotree.fo.obj.InstreamForeignObject;
+import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.axsl.fo.FoContext;
import org.axsl.fo.FoTreeException;
@@ -60,12 +60,12 @@
* All other elements of the foreign XML are added to the DOM instance, which
* is encapsulated in the ForeignXml instance.</p>
*
- * @see InstreamForeignObject
+ * @see InstreamForeignObject4a
*/
public abstract class ForeignXml extends FoObj implements org.axsl.fo.FoForeignXml {
/** The parent of this node. */
- private InstreamForeignObject parent;
+ private InstreamForeignObject4a parent;
/** The property list for this object. */
private PropertyList propertyList;
@@ -92,7 +92,7 @@
* @param propertyList The property list for this FoObj.
* @throws FoTreeException For errors during construction.
*/
- public ForeignXml(final InstreamForeignObject parent,
+ public ForeignXml(final InstreamForeignObject4a parent,
final PropertyListUnparsed propertyList) throws FoTreeException {
super(parent);
this.parent = parent;
@@ -256,7 +256,7 @@
public abstract int intrinsicContentHeight();
@Override
- public InstreamForeignObject getParent() {
+ public InstreamForeignObject4a getParent() {
return this.parent;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -38,7 +38,7 @@
import org.foray.fotree.axsl.prop.AxslEnumerated;
import org.foray.fotree.fo.obj.AbstractCharacterSequence;
import org.foray.fotree.fo.obj.CharacterSequence4a;
-import org.foray.fotree.fo.obj.Declarations;
+import org.foray.fotree.fo.obj.Declarations4a;
import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.TextTransform;
@@ -74,7 +74,7 @@
@Override
protected void validateAncestry() throws FoTreeException {
- if (! (this.parent instanceof Declarations)) {
+ if (! (this.parent instanceof Declarations4a)) {
throwException(this.getFullName()
+ " must be child of fo:declarations.");
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/ObjectMakerFo.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/ObjectMakerFo.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/ObjectMakerFo.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -32,43 +32,43 @@
import org.foray.fotree.FoTree4a;
import org.foray.fotree.PropertyList;
import org.foray.fotree.fo.obj.AbstractTablePart;
-import org.foray.fotree.fo.obj.BasicLink;
-import org.foray.fotree.fo.obj.BidiOverride;
-import org.foray.fotree.fo.obj.Block;
-import org.foray.fotree.fo.obj.BlockContainer;
-import org.foray.fotree.fo.obj.Bookmark;
-import org.foray.fotree.fo.obj.BookmarkTitle;
-import org.foray.fotree.fo.obj.BookmarkTree;
-import org.foray.fotree.fo.obj.ChangeBarBegin;
-import org.foray.fotree.fo.obj.ChangeBarEnd;
-import org.foray.fotree.fo.obj.Character;
-import org.foray.fotree.fo.obj.ColorProfile;
-import org.foray.fotree.fo.obj.ConditionalPageMasterReference;
-import org.foray.fotree.fo.obj.Declarations;
-import org.foray.fotree.fo.obj.ExternalGraphic;
-import org.foray.fotree.fo.obj.Float;
-import org.foray.fotree.fo.obj.Flow;
-import org.foray.fotree.fo.obj.FlowAssignment;
-import org.foray.fotree.fo.obj.FlowMap;
-import org.foray.fotree.fo.obj.FlowNameSpecifier;
-import org.foray.fotree.fo.obj.FlowSourceList;
-import org.foray.fotree.fo.obj.FlowTargetList;
-import org.foray.fotree.fo.obj.FolioPrefix;
-import org.foray.fotree.fo.obj.FolioSuffix;
-import org.foray.fotree.fo.obj.Footnote;
-import org.foray.fotree.fo.obj.FootnoteBody;
-import org.foray.fotree.fo.obj.IndexKeyReference;
-import org.foray.fotree.fo.obj.IndexPageCitationList;
-import org.foray.fotree.fo.obj.IndexPageCitationListSeparator;
-import org.foray.fotree.fo.obj.IndexPageCitationRangeSeparator;
-import org.foray.fotree.fo.obj.IndexPageNumberPrefix;
-import org.foray.fotree.fo.obj.IndexPageNumberSuffix;
-import org.foray.fotree.fo.obj.IndexRangeBegin;
-import org.foray.fotree.fo.obj.IndexRangeEnd;
-import org.foray.fotree.fo.obj.InitialPropertySet;
-import org.foray.fotree.fo.obj.Inline;
-import org.foray.fotree.fo.obj.InlineContainer;
-import org.foray.fotree.fo.obj.InstreamForeignObject;
+import org.foray.fotree.fo.obj.BasicLink4a;
+import org.foray.fotree.fo.obj.BidiOverride4a;
+import org.foray.fotree.fo.obj.Block4a;
+import org.foray.fotree.fo.obj.BlockContainer4a;
+import org.foray.fotree.fo.obj.Bookmark4a;
+import org.foray.fotree.fo.obj.BookmarkTitle4a;
+import org.foray.fotree.fo.obj.BookmarkTree4a;
+import org.foray.fotree.fo.obj.ChangeBarBegin4a;
+import org.foray.fotree.fo.obj.ChangeBarEnd4a;
+import org.foray.fotree.fo.obj.Character4a;
+import org.foray.fotree.fo.obj.ColorProfile4a;
+import org.foray.fotree.fo.obj.ConditionalPageMasterReference4a;
+import org.foray.fotree.fo.obj.Declarations4a;
+import org.foray.fotree.fo.obj.ExternalGraphic4a;
+import org.foray.fotree.fo.obj.Float4a;
+import org.foray.fotree.fo.obj.Flow4a;
+import org.foray.fotree.fo.obj.FlowAssignment4a;
+import org.foray.fotree.fo.obj.FlowMap4a;
+import org.foray.fotree.fo.obj.FlowNameSpecifier4a;
+import org.foray.fotree.fo.obj.FlowSourceList4a;
+import org.foray.fotree.fo.obj.FlowTargetList4a;
+import org.foray.fotree.fo.obj.FolioPrefix4a;
+import org.foray.fotree.fo.obj.FolioSuffix4a;
+import org.foray.fotree.fo.obj.Footnote4a;
+import org.foray.fotree.fo.obj.FootnoteBody4a;
+import org.foray.fotree.fo.obj.IndexKeyReference4a;
+import org.foray.fotree.fo.obj.IndexPageCitationList4a;
+import org.foray.fotree.fo.obj.IndexPageCitationListSeparator4a;
+import org.foray.fotree.fo.obj.IndexPageCitationRangeSeparator4a;
+import org.foray.fotree.fo.obj.IndexPageNumberPrefix4a;
+import org.foray.fotree.fo.obj.IndexPageNumberSuffix4a;
+import org.foray.fotree.fo.obj.IndexRangeBegin4a;
+import org.foray.fotree.fo.obj.IndexRangeEnd4a;
+import org.foray.fotree.fo.obj.InitialPropertySet4a;
+import org.foray.fotree.fo.obj.Inline4a;
+import org.foray.fotree.fo.obj.InlineContainer4a;
+import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.foray.fotree.fo.obj.LayoutMasterSet;
import org.foray.fotree.fo.obj.Leader;
import org.foray.fotree.fo.obj.ListBlock;
@@ -150,126 +150,126 @@
}
switch (enumeration) {
case BASIC_LINK: {
- return new BasicLink(parent, propertyList);
+ return new BasicLink4a(parent, propertyList);
}
case BIDI_OVERRIDE: {
- return new BidiOverride(parent, propertyList);
+ return new BidiOverride4a(parent, propertyList);
}
case BLOCK: {
- return new Block(parent, propertyList);
+ return new Block4a(parent, propertyList);
}
case BLOCK_CONTAINER: {
- return new BlockContainer(parent, propertyList);
+ return new BlockContainer4a(parent, propertyList);
}
case BOOKMARK: {
- return new Bookmark(parent, propertyList);
+ return new Bookmark4a(parent, propertyList);
}
case BOOKMARK_TITLE: {
- return new BookmarkTitle(parent, propertyList);
+ return new BookmarkTitle4a(parent, propertyList);
}
case BOOKMARK_TREE: {
- return new BookmarkTree(parent, propertyList);
+ return new BookmarkTree4a(parent, propertyList);
}
case CHANGE_BAR_BEGIN: {
- return new ChangeBarBegin(parent, propertyList);
+ return new ChangeBarBegin4a(parent, propertyList);
}
case CHANGE_BAR_END: {
- return new ChangeBarEnd(parent, propertyList);
+ return new ChangeBarEnd4a(parent, propertyList);
}
case CHARACTER: {
- return new Character(parent, propertyList);
+ return new Character4a(parent, propertyList);
}
case COLOR_PROFILE: {
- return new ColorProfile(parent, propertyList);
+ return new ColorProfile4a(parent, propertyList);
}
case CONDITIONAL_PAGE_MASTER_REFERENCE: {
- return new ConditionalPageMasterReference(parent, propertyList);
+ return new ConditionalPageMasterReference4a(parent, propertyList);
}
case DECLARATIONS: {
- return new Declarations(parent, propertyList);
+ return new Declarations4a(parent, propertyList);
}
case EXTERNAL_GRAPHIC: {
- return new ExternalGraphic(parent, propertyList);
+ return new ExternalGraphic4a(parent, propertyList);
}
case FLOAT: {
- return new Float(parent, propertyList);
+ return new Float4a(parent, propertyList);
}
case FLOW: {
final PageSequence pageSequence = parentPageSequence(enumeration,
parent, locator);
- return new Flow(pageSequence, propertyList);
+ return new Flow4a(pageSequence, propertyList);
}
case FLOW_ASSIGNMENT: {
- final FlowMap flowMap = parentFlowMap(enumeration, parent, locator);
- return new FlowAssignment(flowMap, propertyList);
+ final FlowMap4a flowMap = parentFlowMap(enumeration, parent, locator);
+ return new FlowAssignment4a(flowMap, propertyList);
}
case FLOW_MAP: {
final LayoutMasterSet layoutMasterSet = parentLayoutMasterSet(
enumeration, parent, locator);
- return new FlowMap(layoutMasterSet, propertyList);
+ return new FlowMap4a(layoutMasterSet, propertyList);
}
case FLOW_NAME_SPECIFIER: {
- final FlowSourceList flowSourceList = parentFlowSourceList(
+ final FlowSourceList4a flowSourceList = parentFlowSourceList(
enumeration, parent, locator);
- return new FlowNameSpecifier(flowSourceList, propertyList);
+ return new FlowNameSpecifier4a(flowSourceList, propertyList);
}
case FLOW_SOURCE_LIST: {
- final FlowAssignment flowAssignment = parentFlowAssignment(
+ final FlowAssignment4a flowAssignment = parentFlowAssignment(
enumeration, parent, locator);
- return new FlowSourceList(flowAssignment, propertyList);
+ return new FlowSourceList4a(flowAssignment, propertyList);
}
case FLOW_TARGET_LIST: {
- final FlowAssignment flowAssignment = parentFlowAssignment(
+ final FlowAssignment4a flowAssignment = parentFlowAssignment(
enumeration, parent, locator);
- return new FlowTargetList(flowAssignment, propertyList);
+ return new FlowTargetList4a(flowAssignment, propertyList);
}
case FOLIO_PREFIX: {
- return new FolioPrefix(parent, propertyList);
+ return new FolioPrefix4a(parent, propertyList);
}
case FOLIO_SUFFIX: {
- return new FolioSuffix(parent, propertyList);
+ return new FolioSuffix4a(parent, propertyList);
}
case FOOTNOTE: {
- return new Footnote(parent, propertyList);
+ return new Footnote4a(parent, propertyList);
}
case FOOTNOTE_BODY: {
- return new FootnoteBody(parent, propertyList);
+ return new FootnoteBody4a(parent, propertyList);
}
case INDEX_KEY_REFERENCE: {
- return new IndexKeyReference(parent, propertyList);
+ return new IndexKeyReference4a(parent, propertyList);
}
case INDEX_PAGE_CITATION_LIST: {
- return new IndexPageCitationList(parent, propertyList);
+ return new IndexPageCitationList4a(parent, propertyList);
}
case INDEX_PAGE_CITATION_LIST_SEPARATOR: {
- return new IndexPageCitationListSeparator(parent, propertyList);
+ return new IndexPageCitationListSeparator4a(parent, propertyList);
}
case INDEX_PAGE_CITATION_RANGE_SEPARATOR: {
- return new IndexPageCitationRangeSeparator(parent, propertyList);
+ return new IndexPageCitationRangeSeparator4a(parent, propertyList);
}
case INDEX_PAGE_NUMBER_PREFIX: {
- return new IndexPageNumberPrefix(parent, propertyList);
+ return new IndexPageNumberPrefix4a(parent, propertyList);
}
case INDEX_PAGE_NUMBER_SUFFIX: {
- return new IndexPageNumberSuffix(parent, propertyList);
+ return new IndexPageNumberSuffix4a(parent, propertyList);
}
case INDEX_RANGE_BEGIN: {
- return new IndexRangeBegin(parent, propertyList);
+ return new IndexRangeBegin4a(parent, propertyList);
}
case INDEX_RANGE_END: {
- return new IndexRangeEnd(parent, propertyList);
+ return new IndexRangeEnd4a(parent, propertyList);
}
case INITIAL_PROPERTY_SET: {
- return new InitialPropertySet(parent, propertyList);
+ return new InitialPropertySet4a(parent, propertyList);
}
case INLINE: {
- return new Inline(parent, propertyList);
+ return new Inline4a(parent, propertyList);
}
case INLINE_CONTAINER: {
- return new InlineContainer(parent, propertyList);
+ return new InlineContainer4a(parent, propertyList);
}
case INSTREAM_FOREIGN_OBJECT: {
- return new InstreamForeignObject(parent, propertyList);
+ return new InstreamForeignObject4a(parent, propertyList);
}
case LAYOUT_MASTER_SET: {
final Root root = parentRoot(enumeration, parent, locator);
@@ -348,7 +348,7 @@
return new RegionEnd(simplePageMaster, propertyList);
}
case REGION_NAME_SPECIFIER: {
- final FlowTargetList flowTargetList = parentFlowTargetList(
+ final FlowTargetList4a flowTargetList = parentFlowTargetList(
enumeration, parent, locator);
return new RegionNameSpecifier(flowTargetList, propertyList);
}
@@ -574,21 +574,21 @@
}
/**
- * Converts the parent object to a {@link FlowMap} if it can, or
+ * Converts the parent object to a {@link FlowMap4a} if it can, or
* throws an exception otherwise.
* @param newObject The type of the new object to be created.
* @param parent The parent object.
* @param locator The SAX locator describing the location of the object
* that is trying to be constructed.
- * @return The parent object cast as a {@link FlowMap}.
+ * @return The parent object cast as a {@link FlowMap4a}.
* @throws FoTreeException If parent cannot be converted to a
- * {@link FlowMap}.
+ * {@link FlowMap4a}.
*/
- private static FlowMap parentFlowMap(
+ private static FlowMap4a parentFlowMap(
final FoObject newObject, final FoObj parent, final Locator locator)
throws FoTreeException {
- if (parent instanceof FlowMap) {
- return (FlowMap) parent;
+ if (parent instanceof FlowMap4a) {
+ return (FlowMap4a) parent;
}
throwException(locator, "fo:" + newObject.toXslFo()
+ " must be child of fo:flow-map.");
@@ -596,21 +596,21 @@
}
/**
- * Converts the parent object to a {@link FlowTargetList} if it can, or
+ * Converts the parent object to a {@link FlowTargetList4a} if it can, or
* throws an exception otherwise.
* @param newObject The type of the new object to be created.
* @param parent The parent object.
* @param locator The SAX locator describing the location of the object
* that is trying to be constructed.
- * @return The parent object cast as a {@link FlowTargetList}.
+ * @return The parent object cast as a {@link FlowTargetList4a}.
* @throws FoTreeException If parent cannot be converted to a
- * {@link FlowTargetList}.
+ * {@link FlowTargetList4a}.
*/
- private static FlowAssignment parentFlowAssignment(
+ private static FlowAssignment4a parentFlowAssignment(
final FoObject newObject, final FoObj parent, final Locator locator)
throws FoTreeException {
- if (parent instanceof FlowAssignment) {
- return (FlowAssignment) parent;
+ if (parent instanceof FlowAssignment4a) {
+ return (FlowAssignment4a) parent;
}
throwException(locator, "fo:" + newObject.toXslFo()
+ " must be child of fo:flow-assignment.");
@@ -618,21 +618,21 @@
}
/**
- * Converts the parent object to a {@link FlowTargetList} if it can, or
+ * Converts the parent object to a {@link FlowTargetList4a} if it can, or
* throws an exception otherwise.
* @param newObject The type of the new object to be created.
* @param parent The parent object.
* @param locator The SAX locator describing the location of the object
* that is trying to be constructed.
- * @return The parent object cast as a {@link FlowTargetList}.
+ * @return The parent object cast as a {@link FlowTargetList4a}.
* @throws FoTreeException If parent cannot be converted to a
- * {@link FlowTargetList}.
+ * {@link FlowTargetList4a}.
*/
- private static FlowTargetList parentFlowTargetList(
+ private static FlowTargetList4a parentFlowTargetList(
final FoObject newObject, final FoObj parent, final Locator locator)
throws FoTreeException {
- if (parent instanceof FlowTargetList) {
- return (FlowTargetList) parent;
+ if (parent instanceof FlowTargetList4a) {
+ return (FlowTargetList4a) parent;
}
throwException(locator, "fo:" + newObject.toXslFo()
+ " must be child of fo:flow-target-list.");
@@ -640,21 +640,21 @@
}
/**
- * Converts the parent object to a {@link FlowSourceList} if it can, or
+ * Converts the parent object to a {@link FlowSourceList4a} if it can, or
* throws an exception otherwise.
* @param newObject The type of the new object to be created.
* @param parent The parent object.
* @param locator The SAX locator describing the location of the object
* that is trying to be constructed.
- * @return The parent object cast as a {@link FlowSourceList}.
+ * @return The parent object cast as a {@link FlowSourceList4a}.
* @throws FoTreeException If parent cannot be converted to a
- * {@link FlowSourceList}.
+ * {@link FlowSourceList4a}.
*/
- private static FlowSourceList parentFlowSourceList(
+ private static FlowSourceList4a parentFlowSourceList(
final FoObject newObject, final FoObj parent, final Locator locator)
throws FoTreeException {
- if (parent instanceof FlowSourceList) {
- return (FlowSourceList) parent;
+ if (parent instanceof FlowSourceList4a) {
+ return (FlowSourceList4a) parent;
}
throwException(locator, "fo:" + newObject.toXslFo()
+ " must be child of fo:flow-source-list.");
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageReference.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageReference.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageReference.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -43,8 +43,7 @@
* Abstract superclass for page-number, page-number-citation, and
* page-number-citation-last.
*/
-public abstract class AbstractPageReference extends FoObj
- implements org.axsl.fo.FoLineNonText {
+public abstract class AbstractPageReference extends FoObj implements FoLineNonText {
/** The number of placeholder digits that should be used when we do not yet
* know what the actual page-number is. */
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BasicLink.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BasicLink.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BasicLink.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -1,169 +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
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.fo.obj;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.FoObjMixed;
-import org.foray.fotree.Namespace;
-import org.foray.fotree.PropertyList;
-
-import org.axsl.fo.FoContext;
-import org.axsl.fo.FoTreeException;
-import org.axsl.fo.ProxyFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A "basic-link" object in XSL-FO.
- */
-public class BasicLink extends FoObjMixed implements org.axsl.fo.fo.BasicLink {
-
- /** The parent of this node. */
- private FoObj parent;
-
- /** The children of this object. */
- private List<FoObj> children = new ArrayList<FoObj>();
-
- /**
- * Constructor.
- * @param parent The parent FoObj.
- * @param propertyList The property list for this FoObj.
- */
- public BasicLink(final FoObj parent, final PropertyList propertyList) {
- super(parent, propertyList);
- this.parent = parent;
- }
-
- @Override
- protected void validateAncestry() throws FoTreeException {
- return;
- }
-
- @Override
- protected void validateProperties() throws FoTreeException {
- if (! isValid()) {
- throwException(getFullName() + " must specify internal-destination "
- + "or external-destination.");
- }
- }
-
- @Override
- public void setup() throws FoTreeException {
- return;
- }
-
- @Override
- protected void validateDescendants() throws FoTreeException {
- return;
- }
-
- @Override
- public boolean isValid() {
- if (this.getLinkType() == null) {
- return false;
- }
- return true;
- }
-
- @Override
- public String getName() {
- return "basic-link";
- }
-
- /**
- * {@inheritDoc}
- * Override the FONode method, because "this" is the object being sought.
- */
- @Override
- public BasicLink ancestorBasicLink(final FoContext context) {
- return this;
- }
-
- @Override
- public boolean isContentInline() {
- return true;
- }
-
- @Override
- public Namespace getNamespace() {
- return this.getFoTree().getFONamespace();
- }
-
- @Override
- public boolean blockMustEnclosePCDATA() {
- return true;
- }
-
- @Override
- public Object acceptProxyFactory(final ProxyFactory factory) {
- return factory.makeProxy(this);
- }
-
- @Override
- public FoObj getParent() {
- return this.parent;
- }
-
- @Override
- public List<FoObj> getChildren() {
- return this.children;
- }
-
- @Override
- public void addTextNode(final AbstractCharacterSequence textNode) {
- this.children.add(textNode);
- }
-
- @Override
- public void addNonTextNode(final FoObj nonTextNode) {
- this.children.add(nonTextNode);
- }
-
- @Override
- public boolean isContentBlock() {
- return false;
- }
-
- @Override
- public boolean isContentPcdata() {
- return false;
- }
-
- @Override
- public org.axsl.font.FontUse getPrimaryFont(final FoContext context) {
- return this.getParent().getPrimaryFont(context);
- }
-
- @Override
- public FoObj getChildAt(final int index) {
- return this.children.get(index);
- }
-
-}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BasicLink4a.java (from rev 12032, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BasicLink.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BasicLink4a.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BasicLink4a.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -0,0 +1,170 @@
+/*
+ * 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.fo.obj;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.FoObjMixed;
+import org.foray.fotree.Namespace;
+import org.foray.fotree.PropertyList;
+
+import org.axsl.fo.FoContext;
+import org.axsl.fo.FoTreeException;
+import org.axsl.fo.ProxyFactory;
+import org.axsl.fo.fo.BasicLink;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A "basic-link" object in XSL-FO.
+ */
+public class BasicLink4a extends FoObjMixed implements BasicLink {
+
+ /** The parent of this node. */
+ private FoObj parent;
+
+ /** The children of this object. */
+ private List<FoObj> children = new ArrayList<FoObj>();
+
+ /**
+ * Constructor.
+ * @param parent The parent FoObj.
+ * @param propertyList The property list for this FoObj.
+ */
+ public BasicLink4a(final FoObj parent, final PropertyList propertyList) {
+ super(parent, propertyList);
+ this.parent = parent;
+ }
+
+ @Override
+ protected void validateAncestry() throws FoTreeException {
+ return;
+ }
+
+ @Override
+ protected void validateProperties() throws FoTreeException {
+ if (! isValid()) {
+ throwException(getFullName() + " must specify internal-destination "
+ + "or external-destination.");
+ }
+ }
+
+ @Override
+ public void setup() throws FoTreeException {
+ return;
+ }
+
+ @Override
+ protected void validateDescendants() throws FoTreeException {
+ return;
+ }
+
+ @Override
+ public boolean isValid() {
+ if (this.getLinkType() == null) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String getName() {
+ return "basic-link";
+ }
+
+ /**
+ * {@inheritDoc}
+ * Override the FONode method, because "this" is the object being sought.
+ */
+ @Override
+ public BasicLink4a ancestorBasicLink(final FoContext context) {
+ return this;
+ }
+
+ @Override
+ public boolean isContentInline() {
+ return true;
+ }
+
+ @Override
+ public Namespace getNamespace() {
+ return this.getFoTree().getFONamespace();
+ }
+
+ @Override
+ public boolean blockMustEnclosePCDATA() {
+ return true;
+ }
+
+ @Override
+ public Object acceptProxyFactory(final ProxyFactory factory) {
+ return factory.makeProxy(this);
+ }
+
+ @Override
+ public FoObj getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public List<FoObj> getChildren() {
+ return this.children;
+ }
+
+ @Override
+ public void addTextNode(final AbstractCharacterSequence textNode) {
+ this.children.add(textNode);
+ }
+
+ @Override
+ public void addNonTextNode(final FoObj nonTextNode) {
+ this.children.add(nonTextNode);
+ }
+
+ @Override
+ public boolean isContentBlock() {
+ return false;
+ }
+
+ @Override
+ public boolean isContentPcdata() {
+ return false;
+ }
+
+ @Override
+ public org.axsl.font.FontUse getPrimaryFont(final FoContext context) {
+ return this.getParent().getPrimaryFont(context);
+ }
+
+ @Override
+ public FoObj getChildAt(final int index) {
+ return this.children.get(index);
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BidiOverride.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BidiOverride.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BidiOverride.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -1,166 +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
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.fo.obj;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.FoObjMixed;
-import org.foray.fotree.Namespace;
-import org.foray.fotree.PropertyList;
-
-import org.axsl.fo.FoContext;
-import org.axsl.fo.FoTreeException;
-import org.axsl.fo.ProxyFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A "bidi-override" object in XSL-FO.
- */
-public class BidiOverride extends FoObjMixed
- implements org.axsl.fo.fo.BidiOverride {
-
- /** The parent of this node. */
- private FoObj parent;
-
- /** The children of this object. */
- private List<FoObj> children = new ArrayList<FoObj>();
-
- /** The resolved primary Font. */
- private org.axsl.font.FontUse resolvedFont = null;
-
- /**
- * Constructor.
- * @param parent The parent FoObj.
- * @param propertyList The property list for this FoObj.
- */
- public BidiOverride(final FoObj parent, final PropertyList propertyList) {
- super(parent, propertyList);
- this.parent = parent;
- }
-
- @Override
- protected void validateAncestry() throws FoTreeException {
- return;
- }
-
- @Override
- protected void validateProperties() throws FoTreeException {
- return;
- }
-
- @Override
- protected void setup() throws FoTreeException {
- return;
- }
-
- @Override
- protected void end() throws FoTreeException {
- return;
- }
-
- @Override
- protected void validateDescendants() throws FoTreeException {
- return;
- }
-
- @Override
- public String getName() {
- return "bidi-override";
- }
-
- @Override
- public Namespace getNamespace() {
- return this.getFoTree().getFONamespace();
- }
-
- @Override
- public boolean isContentInline() {
- return true;
- }
-
- @Override
- public boolean blockMustEnclosePCDATA() {
- return true;
- }
-
- @Override
- public Object acceptProxyFactory(final ProxyFactory factory) {
- return factory.makeProxy(this);
- }
-
- @Override
- public FoObj getParent() {
- return this.parent;
- }
-
- @Override
- public List<FoObj> getChildren() {
- return this.children;
- }
-
- @Override
- public void addTextNode(final AbstractCharacterSequence textNode) {
- this.children.add(textNode);
- }
-
- @Override
- public void addNonTextNode(final FoObj nonTextNode) {
- this.children.add(nonTextNode);
- }
-
- @Override
- public boolean isContentBlock() {
- return false;
- }
-
- @Override
- public boolean isContentPcdata() {
- return false;
- }
-
- @Override
- public org.axsl.font.FontUse getPrimaryFont(final FoContext context) {
- if (this.resolvedFont == null) {
- this.resolvedFont = resolvePrimaryFont(context);
- }
- return this.resolvedFont;
- }
-
- @Override
- public FoObj getChildAt(final int index) {
- return this.children.get(index);
- }
-
- @Override
- public boolean isValid() {
- return true;
- }
-
-}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BidiOverride4a.java (from rev 12032, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BidiOverride.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BidiOverride4a.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/BidiOverride4a.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -0,0 +1,166 @@
+/*
+ * 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.fo.obj;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.FoObjMixed;
+import org.foray.fotree.Namespace;
+import org.foray.fotree.PropertyList;
+
+import org.axsl.fo.FoContext;
+import org.axsl.fo.FoTreeException;
+import org.axsl.fo.ProxyFactory;
+import org.axsl.fo.fo.BidiOverride;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A "bidi-override" object in XSL-FO.
+ */
+public class BidiOverride4a extends FoObjMixed implements BidiOverride {
+
+ /** The parent of this node. */
+ private FoObj parent;
+
+ /** The children of this object. */
+ private List<FoObj> children = new ArrayList<FoObj>();
+
+ /** The resolved primary Font. */
+ private org.axsl.font.FontUse resolvedFont = null;
+
+ /**
+ * Constructor.
+ * @param parent The parent FoObj.
+ * @param propertyList The property list for this FoObj.
+ */
+ public BidiOverride4a(final FoObj parent, final PropertyList propertyList) {
+ super(parent, propertyList);
+ this.parent = parent;
+ }
+
+ @Override
+ protected void validateAncestry() throws FoTreeException {
+ return;
+ }
+
+ @Override
+ protected void validateProperties() throws FoTreeException {
+ return;
+ }
+
+ @Override
+ protected void setup() throws FoTreeException {
+ return;
+ }
+
+ @Override
+ protected void end() throws FoTreeException {
+ return;
+ }
+
+ @Override
+ protected void validateDescendants() throws FoTreeException {
+ return;
+ }
+
+ @Override
+ public String getName() {
+ return "bidi-override";
+ }
+
+ @Override
+ public Namespace getNamespace() {
+ return this.getFoTree().getFONamespace();
+ }
+
+ @Override
+ public boolean isContentInline() {
+ return true;
+ }
+
+ @Override
+ public boolean blockMustEnclosePCDATA() {
+ return true;
+ }
+
+ @Override
+ public Object acceptProxyFactory(final ProxyFactory factory) {
+ return factory.makeProxy(this);
+ }
+
+ @Override
+ public FoObj getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public List<FoObj> getChildren() {
+ return this.children;
+ }
+
+ @Override
+ public void addTextNode(final AbstractCharacterSequence textNode) {
+ this.children.add(textNode);
+ }
+
+ @Override
+ public void addNonTextNode(final FoObj nonTextNode) {
+ this.children.add(nonTextNode);
+ }
+
+ @Override
+ public boolean isContentBlock() {
+ return false;
+ }
+
+ @Override
+ public boolean isContentPcdata() {
+ return false;
+ }
+
+ @Override
+ public org.axsl.font.FontUse getPrimaryFont(final FoContext context) {
+ if (this.resolvedFont == null) {
+ this.resolvedFont = resolvePrimaryFont(context);
+ }
+ return this.resolvedFont;
+ }
+
+ @Override
+ public FoObj getChildAt(final int index) {
+ return this.children.get(index);
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block.java 2021-12-02 14:34:53 UTC (rev 12166)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Block.java 2021-12-02 15:43:07 UTC (rev 12167)
@@ -1,174 +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
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.fo.obj;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.FoObjMixed;
-import org.foray.fotree.Namespace;
-import org.foray.fotree.PropertyList;
-
-import org.axsl.fo.FoContext;
-import org.axsl.fo.FoTreeException;
-import org.axsl.fo.ProxyFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A "block" object in XSL-FO.
- */
-public class Block extends FoObjMixed implements org.axsl.fo.fo.Block {
-
- /** The parent of this node. */
- private FoObj parent;
-
- /** The children of this object. */
- private List<FoObj> children = new ArrayList<FoObj>();
-
- /** The resolved primary Font. */
- private org.axsl.font.FontUse resolvedFont = null;
-
- /**
- * Constructor.
- * @param parent The parent FoObj.
- * @param propertyList The property list for this FoObj.
- */
- public Block(final FoObj parent, final PropertyList propertyList) {
- super(parent, propertyList);
- this.parent = parent;
- }
-
- @Override
- protected void validateAncestry() throws FoTreeException {
- return;
- }
-
- @Override
- protected void validateProperties() throws FoTreeException {
- return;
- }
-
- @Override
- protected void setup() throws FoTreeException {
- return;
- }
-
- @Override
- protected void validateDescendants() throws FoTreeException {
- return;
- }
-
- @Override
- public String getName() {
- return "block";
- }
-
- @Override
- public boolean isBlockLevelFo() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- * Overrides the method in FoObj, because this is the containing block.
- */
- @Override
- public Block getContainingBlock(final FoContext context) {
- return this;
- }
-
- @Override
- public Namespace getNamespace() {
- return this.getFoTree().getFONamespace();
- }
-
- @Override
- public boolean...
[truncated message content] |
|
From: <vic...@us...> - 2021-12-02 14:34:57
|
Revision: 12166
http://sourceforge.net/p/foray/code/12166
Author: victormote
Date: 2021-12-02 14:34:53 +0000 (Thu, 02 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Rename iterator() method to avoid conflict with a method in axsl-fo with the same name.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2021-12-02 14:16:10 UTC (rev 12165)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaBranch4a.java 2021-12-02 14:34:53 UTC (rev 12166)
@@ -189,7 +189,7 @@
}
@Override
- public ListIterator<ParaLeaf> iterator() {
+ public ListIterator<ParaLeaf> leafIterator() {
return new ParaBranch4aIterator(this);
}
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-12-02 14:16:10 UTC (rev 12165)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-12-02 14:34:53 UTC (rev 12166)
@@ -285,7 +285,7 @@
final ParaConfig paraConfig = paragraph.getParaConfig();
final State state = new State(paraConfig, lbControl, paraControl);
- final ListIterator<ParaLeaf> leafIterator = paragraph.iterator();
+ final ListIterator<ParaLeaf> leafIterator = paragraph.leafIterator();
while (leafIterator.hasNext()) {
final ParaLeaf leaf = leafIterator.next();
final ParaPenalty penalty = leaf.asParaPenalty();
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2021-12-02 14:16:10 UTC (rev 12165)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2021-12-02 14:34:53 UTC (rev 12166)
@@ -270,7 +270,7 @@
}
@Override
- public ListIterator<ParaLeaf> iterator() {
+ public ListIterator<ParaLeaf> leafIterator() {
// TODO Auto-generated method stub
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-02 14:16:13
|
Revision: 12165
http://sourceforge.net/p/foray/code/12165
Author: victormote
Date: 2021-12-02 14:16:10 +0000 (Thu, 02 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Add method to NormalBlockArea to return the ParaControl for that Area.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2021-12-02 13:23:26 UTC (rev 12164)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2021-12-02 14:16:10 UTC (rev 12165)
@@ -28,8 +28,13 @@
package org.foray.area;
+import org.foray.common.para.DiscretionaryHyphen4a;
+
import org.axsl.area.AreaTreeException;
import org.axsl.area.BlockContentFactory;
+import org.axsl.area.NormalBlockArea;
+import org.axsl.common.para.DiscretionaryHyphen;
+import org.axsl.common.para.ParaControl;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.BorderStyle;
import org.axsl.common.value.RelativeAxis;
@@ -53,8 +58,7 @@
* This class represents a Block Area.
* A block area is made up of a sequence of Line Areas.
*/
-public final class NormalBlockArea4a extends BlockArea
- implements org.axsl.area.NormalBlockArea, LineBreakControl {
+public final class NormalBlockArea4a extends BlockArea implements NormalBlockArea, LineBreakControl, ParaControl {
/** The "generated-by" trait, as defined in Section 6.1.1. */
private FoLinkage generatedBy;
@@ -504,4 +508,15 @@
return this;
}
+ @Override
+ public int getCost(final DiscretionaryHyphen.Quality quality) {
+ /* TODO: This should be more configurable. */
+ return DiscretionaryHyphen4a.DEFAULT_PENALTY;
+ }
+
+ @Override
+ public ParaControl getParaControl() {
+ return this;
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java 2021-12-02 13:23:26 UTC (rev 12164)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java 2021-12-02 14:16:10 UTC (rev 12165)
@@ -42,6 +42,10 @@
*/
public final class DiscretionaryHyphen4a extends ParaLeaf4a implements DiscretionaryHyphen {
+ /** The default penalty for a discretionary hyphen using the Knuth-Plass model. Derived from [KP-03], p. 74, Table
+ * 1.*/
+ public static final int DEFAULT_PENALTY = 50;
+
/** Pre-built "acceptable" hyphenation point. */
public static final DiscretionaryHyphen4a ACCEPTABLE =
new DiscretionaryHyphen4a(DiscretionaryHyphen.Quality.ACCEPTABLE);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-02 13:23:29
|
Revision: 12164
http://sourceforge.net/p/foray/code/12164
Author: victormote
Date: 2021-12-02 13:23:26 +0000 (Thu, 02 Dec 2021)
Log Message:
-----------
Use aXSL changes to remove some direct dependencies on axsl-galley.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BasicLinkArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BidiOverrideArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ExternalGraphicArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/IndexPageCitationListArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java
Added Paths:
-----------
trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
Removed Paths:
-------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -31,8 +31,8 @@
import org.foray.area.AreaNode4a;
import org.foray.area.AreaTree4a;
-import org.foray.area.LineArea;
-import org.foray.area.NormalBlockArea;
+import org.foray.area.LineArea4a;
+import org.foray.area.NormalBlockArea4a;
import org.foray.area.NormalFlowRa;
import org.foray.area.PageCollection;
import org.foray.area.TextArea;
@@ -78,8 +78,8 @@
/* The outer block area. */
AreaNode4a node = firstNormalFlowArea.getChildAt(0);
- Assert.assertTrue(node instanceof NormalBlockArea);
- final NormalBlockArea outerBlockArea = (NormalBlockArea) node;
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
+ final NormalBlockArea4a outerBlockArea = (NormalBlockArea4a) node;
/* 1 inch left margin. */
Assert.assertEquals(72000, outerBlockArea.crOriginX());
/* 10 inches from bottom (11 inches high, 1 inch top margin). */
@@ -90,8 +90,8 @@
/* The first child of the outer block area is a line-area. */
node = outerBlockArea.getChildAt(0);
- Assert.assertTrue(node instanceof LineArea);
- LineArea lineArea = (LineArea) node;
+ Assert.assertTrue(node instanceof LineArea4a);
+ LineArea4a lineArea = (LineArea4a) node;
/* Should have anterior space of one half-leading, which comes from the
* space-before of this line. */
Assert.assertEquals(1200, lineArea.getAnteriorSpace());
@@ -109,8 +109,8 @@
/* The second child of the outer block area is a block-area. */
node = outerBlockArea.getChildAt(1);
- Assert.assertTrue(node instanceof NormalBlockArea);
- final NormalBlockArea insideBlockArea = (NormalBlockArea) node;
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
+ final NormalBlockArea4a insideBlockArea = (NormalBlockArea4a) node;
/* Should have anterior space of one half-leading, which comes from the
* space-after of the previous line. */
Assert.assertEquals(1200, insideBlockArea.getAnteriorSpace());
@@ -127,8 +127,8 @@
/* The third child of the outer block area is another line-area. */
node = outerBlockArea.getChildAt(2);
- Assert.assertTrue(node instanceof LineArea);
- lineArea = (LineArea) node;
+ Assert.assertTrue(node instanceof LineArea4a);
+ lineArea = (LineArea4a) node;
/* Should have anterior space of one half-leading, which comes from the
* space-before of this line. */
Assert.assertEquals(1200, lineArea.getAnteriorSpace());
@@ -144,8 +144,8 @@
/* The fourth child of the outer block area is another line-area. */
node = outerBlockArea.getChildAt(3);
- Assert.assertTrue(node instanceof LineArea);
- lineArea = (LineArea) node;
+ Assert.assertTrue(node instanceof LineArea4a);
+ lineArea = (LineArea4a) node;
/* Should have anterior space of two half-leadings, one from the space-
* after of the previous line, one from the space-before of this
* line. */
@@ -257,8 +257,8 @@
/* Test location and dimensions of the block area. */
AreaNode4a node = firstNormalFlowArea.getChildAt(0);
- Assert.assertTrue(node instanceof NormalBlockArea);
- final NormalBlockArea blockArea = (NormalBlockArea) node;
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
+ final NormalBlockArea4a blockArea = (NormalBlockArea4a) node;
/* 1 inch left margin. */
Assert.assertEquals(72000, blockArea.crOriginX());
/* 10 inches from bottom (11 inches high, 1 inch top margin). */
@@ -269,8 +269,8 @@
/* Test location and dimensions of the line area. */
node = blockArea.getChildAt(0);
- Assert.assertTrue(node instanceof LineArea);
- final LineArea lineArea = (LineArea) node;
+ Assert.assertTrue(node instanceof LineArea4a);
+ final LineArea4a lineArea = (LineArea4a) node;
/* x same as the parent block. */
Assert.assertEquals(72000, lineArea.crOriginX());
/* y adjusted for half-leading = 12,000 * .2 * .5 = 1200. */
@@ -320,8 +320,8 @@
/* Test location and dimensions of the block area. */
AreaNode4a node = firstNormalFlowArea.getChildAt(0);
- Assert.assertTrue(node instanceof NormalBlockArea);
- final NormalBlockArea blockArea = (NormalBlockArea) node;
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
+ final NormalBlockArea4a blockArea = (NormalBlockArea4a) node;
/* 1 inch left margin. */
Assert.assertEquals(72000, blockArea.crOriginX());
/* 10 inches from bottom (11 inches high, 1 inch top margin). */
@@ -332,8 +332,8 @@
/* Test location and dimensions of the line area. */
node = blockArea.getChildAt(0);
- Assert.assertTrue(node instanceof LineArea);
- final LineArea lineArea = (LineArea) node;
+ Assert.assertTrue(node instanceof LineArea4a);
+ final LineArea4a lineArea = (LineArea4a) node;
/* x same as the parent block. */
Assert.assertEquals(72000, lineArea.crOriginX());
/* y adjusted for half-leading = 12,000 * .2 * .5 = 1200. */
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -30,7 +30,7 @@
import org.foray.area.AreaNode4a;
import org.foray.area.AreaTree4a;
-import org.foray.area.NormalBlockArea;
+import org.foray.area.NormalBlockArea4a;
import org.foray.area.NormalFlowRa;
import org.foray.core.ForayException;
@@ -57,8 +57,8 @@
areaTree);
final AreaNode4a node = firstNormalFlowArea.getChildAt(0);
- Assert.assertTrue(node instanceof NormalBlockArea);
- final NormalBlockArea blockArea = (NormalBlockArea) node;
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
+ final NormalBlockArea4a blockArea = (NormalBlockArea4a) node;
Assert.assertEquals(72000, blockArea.brOriginX());
Assert.assertEquals(720000, blockArea.brOriginY());
Assert.assertEquals(432000, blockArea.brIpd());
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -31,8 +31,8 @@
import org.foray.area.AreaNode4a;
import org.foray.area.AreaTree4a;
import org.foray.area.ExternalGraphicArea;
-import org.foray.area.LineArea;
-import org.foray.area.NormalBlockArea;
+import org.foray.area.LineArea4a;
+import org.foray.area.NormalBlockArea4a;
import org.foray.area.NormalFlowRa;
import org.foray.core.ForayException;
@@ -65,12 +65,12 @@
/* The second one contains the graphic. */
AreaNode4a node = firstNormalFlowArea.getChildAt(1);
- Assert.assertTrue(node instanceof NormalBlockArea);
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
/* It has one child, a LineArea ... */
Assert.assertEquals(1, node.getChildCount());
node = node.getChildAt(0);
- Assert.assertTrue(node instanceof LineArea);
+ Assert.assertTrue(node instanceof LineArea4a);
/* ... which has one child, an ExternalGraphicArea. */
Assert.assertEquals(1, node.getChildCount());
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -31,8 +31,8 @@
import org.foray.area.AreaNode4a;
import org.foray.area.AreaTree4a;
import org.foray.area.InlineArea;
-import org.foray.area.LineArea;
-import org.foray.area.NormalBlockArea;
+import org.foray.area.LineArea4a;
+import org.foray.area.NormalBlockArea4a;
import org.foray.area.NormalFlowRa;
import org.foray.area.TextArea;
import org.foray.core.ForayException;
@@ -63,14 +63,14 @@
/* The block area. */
AreaNode4a node = firstNormalFlowArea.getChildAt(0);
- Assert.assertTrue(node instanceof NormalBlockArea);
- final NormalBlockArea blockArea = (NormalBlockArea) node;
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
+ final NormalBlockArea4a blockArea = (NormalBlockArea4a) node;
Assert.assertEquals(1, blockArea.getChildCount());
/* The only child of the block area is a line area. */
node = blockArea.getChildAt(0);
- Assert.assertTrue(node instanceof LineArea);
- final LineArea lineArea = (LineArea) node;
+ Assert.assertTrue(node instanceof LineArea4a);
+ final LineArea4a lineArea = (LineArea4a) node;
Assert.assertEquals(3, lineArea.getChildCount());
/* The first child of the line area is a text area. */
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -31,8 +31,8 @@
import org.foray.area.AreaNode4a;
import org.foray.area.AreaTree4a;
import org.foray.area.InlineArea;
-import org.foray.area.LineArea;
-import org.foray.area.NormalBlockArea;
+import org.foray.area.LineArea4a;
+import org.foray.area.NormalBlockArea4a;
import org.foray.area.NormalFlowRa;
import org.foray.area.TextArea;
import org.foray.core.ForayException;
@@ -63,8 +63,8 @@
/* The block area. */
AreaNode4a node = firstNormalFlowArea.getChildAt(0);
- Assert.assertTrue(node instanceof NormalBlockArea);
- final NormalBlockArea blockArea = (NormalBlockArea) node;
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
+ final NormalBlockArea4a blockArea = (NormalBlockArea4a) node;
final FontUse font = blockArea.getPrimaryFont();
Assert.assertEquals("Courier", font.getFont().getPostscriptName());
Assert.assertEquals(12000, blockArea.traitFontSize());
@@ -71,8 +71,8 @@
/* The first child of the block area is a line-area. */
node = blockArea.getChildAt(0);
- Assert.assertTrue(node instanceof LineArea);
- final LineArea lineArea = (LineArea) node;
+ Assert.assertTrue(node instanceof LineArea4a);
+ final LineArea4a lineArea = (LineArea4a) node;
final int lineY = lineArea.alignmentPointY();
/* The second child of the line area is an inline-area. */
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -82,7 +82,7 @@
final boolean hasDiscretionaryHyphen,
final boolean hasFauxSmallCaps, final boolean isLastItemOnLine,
final GraftingPoint graftingPoint) {
- if (LineArea.shouldCreateTextArea(foText, this, startOffset,
+ if (LineArea4a.shouldCreateTextArea(foText, this, startOffset,
sizeInChars, isLastItemOnLine, this)) {
final TextArea newTextArea = TextArea.makeTextArea(foText, this,
graftingPoint, startOffset, sizeInChars, ipd,
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractInlineArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractInlineArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -96,8 +96,8 @@
public int baselineY() {
int dominantBaselinePosition = 0;
final Area4a ancestorArea = this.ancestorArea();
- if (ancestorArea instanceof LineArea) {
- dominantBaselinePosition = ((LineArea) ancestorArea).alignmentPointY();
+ if (ancestorArea instanceof LineArea4a) {
+ dominantBaselinePosition = ((LineArea4a) ancestorArea).alignmentPointY();
} else if (ancestorArea instanceof AbstractAncestralInlineArea) {
dominantBaselinePosition = ((AbstractAncestralInlineArea) ancestorArea).baselineY();
} else {
@@ -132,14 +132,14 @@
@Override
public int crBpd() {
- final LineArea ancestorLineArea = this.ancestorLineArea();
+ final LineArea4a ancestorLineArea = this.ancestorLineArea();
return ancestorLineArea.crBpd();
}
@Override
- public LineArea getLineArea() {
- if (this.getParent() instanceof LineArea) {
- return (LineArea) this.getParent();
+ public LineArea4a getLineArea() {
+ if (this.getParent() instanceof LineArea4a) {
+ return (LineArea4a) this.getParent();
} else {
final AbstractInlineArea parentInline = (AbstractInlineArea)
this.getParent();
@@ -174,13 +174,13 @@
* parent.
* @param node The new parent node.
* @return The parent node cast as an Area.
- * @throws AreaTreeException If the node is not either a {@link LineArea} or
+ * @throws AreaTreeException If the node is not either a {@link LineArea4a} or
* an {@link AbstractInlineArea}.
*/
protected Area4a validateNewParent(final AreaNode4a node)
throws AreaTreeException {
- if (node instanceof LineArea) {
- return (LineArea) node;
+ if (node instanceof LineArea4a) {
+ return (LineArea4a) node;
}
if (node instanceof AbstractInlineArea) {
return (AbstractInlineArea) node;
@@ -214,7 +214,7 @@
* @return True iff this area is the first leaf area on the ancestory line.
*/
public boolean isFirstLeafOnLine() {
- final LineArea ancestorLine = this.ancestorLineArea();
+ final LineArea4a ancestorLine = this.ancestorLineArea();
final OrderedTreeNode firstLeaf = ancestorLine.getFirstLeaf();
return this == firstLeaf;
}
@@ -224,7 +224,7 @@
* @return True iff this area is the first leaf area on the ancestory line.
*/
public boolean isLastLeafOnLine() {
- final LineArea ancestorLine = this.ancestorLineArea();
+ final LineArea4a ancestorLine = this.ancestorLineArea();
final OrderedTreeNode lastLeaf = ancestorLine.getLastLeaf();
return this == lastLeaf;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractListItemContent.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -107,9 +107,9 @@
}
@Override
- public NormalBlockArea makeNormalBlockArea(final Block block,
+ public NormalBlockArea4a makeNormalBlockArea(final Block block,
final GraftingPoint graftingPoint) {
- final NormalBlockArea nbArea = NormalBlockArea.makeNormalBlockArea(
+ final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(
block, this, graftingPoint);
this.children.add(nbArea);
return nbArea;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -739,7 +739,7 @@
* @return The whitespace-treatment trait for this area.
*/
public WhiteSpaceTreatment traitWhiteSpaceTreatment() {
- final NormalBlockArea nearestBlockArea = this.nearestNormalBlockArea();
+ final NormalBlockArea4a nearestBlockArea = this.nearestNormalBlockArea();
final Block block = nearestBlockArea.traitGeneratedBy();
return block.traitWhiteSpaceTreatment(nearestBlockArea);
}
@@ -864,7 +864,7 @@
return false;
}
final Area4a parent = ancestorArea();
- if (parent instanceof LineArea) {
+ if (parent instanceof LineArea4a) {
/* LineArea children grow in the IPD, LineArea grows in the BPD. */
return false;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -303,7 +303,7 @@
if (parent instanceof Area4a) {
final Area4a parentArea = (Area4a) parent;
if (parentArea.isBlockArea()
- && ! (parentArea instanceof LineArea)) {
+ && ! (parentArea instanceof LineArea4a)) {
return parentArea;
}
}
@@ -323,13 +323,13 @@
}
@Override
- public NormalBlockArea ancestorNormalBlockArea() {
+ public NormalBlockArea4a ancestorNormalBlockArea() {
final AreaNode4a parent = getParent();
if (parent == null) {
return null;
}
- if (parent instanceof NormalBlockArea) {
- return (NormalBlockArea) parent;
+ if (parent instanceof NormalBlockArea4a) {
+ return (NormalBlockArea4a) parent;
}
return parent.ancestorNormalBlockArea();
}
@@ -339,7 +339,7 @@
* normal block area otherwise.
* @return The nearest normal block area, which can be this.
*/
- public NormalBlockArea nearestNormalBlockArea() {
+ public NormalBlockArea4a nearestNormalBlockArea() {
final AreaNode4a parent = this.getParent();
return parent.nearestNormalBlockArea();
}
@@ -474,7 +474,7 @@
* Returns the ancestor LineArea, if any.
* @return The ancestor LineArea, or null if there is none.
*/
- public LineArea ancestorLineArea() {
+ public LineArea4a ancestorLineArea() {
final AreaNode4a parent = getParent();
if (parent == null) {
return null;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BasicLinkArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BasicLinkArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BasicLinkArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -44,7 +44,7 @@
implements org.axsl.galley.GeneralInlineArea,
org.axsl.area.AncestralNormalInlineArea {
- /** The parent of this node. The parent can be either a {@link LineArea}
+ /** The parent of this node. The parent can be either a {@link LineArea4a}
* or another {@link AbstractInlineArea}. */
private Area4a parent;
@@ -55,7 +55,7 @@
* Private Constructor for a LineArea parent.
* @param parentArea The parent area.
*/
- private BasicLinkArea(final LineArea parentArea) {
+ private BasicLinkArea(final LineArea4a parentArea) {
this.parent = parentArea;
}
@@ -76,7 +76,7 @@
* @return The new instance.
*/
static BasicLinkArea makeBasicLinkArea(final BasicLink generatedBy,
- final LineArea parentArea, final GraftingPoint graftingPoint) {
+ final LineArea4a parentArea, final GraftingPoint graftingPoint) {
final BasicLinkArea newLinkArea = new BasicLinkArea(parentArea);
newLinkArea.generatedBy = newLinkArea.linkage(generatedBy,
graftingPoint);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BidiOverrideArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BidiOverrideArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BidiOverrideArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -43,7 +43,7 @@
implements org.axsl.galley.GeneralInlineArea,
org.axsl.area.AncestralNormalInlineArea {
- /** The parent of this node. The parent can be either a {@link LineArea}
+ /** The parent of this node. The parent can be either a {@link LineArea4a}
* or another {@link AbstractInlineArea}. */
private Area4a parent;
@@ -54,7 +54,7 @@
* Private Constructor for a LineArea parent.
* @param parentArea The parent area.
*/
- private BidiOverrideArea(final LineArea parentArea) {
+ private BidiOverrideArea(final LineArea4a parentArea) {
this.parent = parentArea;
}
@@ -75,7 +75,7 @@
* @return The new instance.
*/
static BidiOverrideArea makeBidiOverrideArea(final BidiOverride generatedBy,
- final LineArea parentArea, final GraftingPoint graftingPoint) {
+ final LineArea4a parentArea, final GraftingPoint graftingPoint) {
final BidiOverrideArea newBidiArea = new BidiOverrideArea(parentArea);
newBidiArea.generatedBy = newBidiArea.linkage(generatedBy,
graftingPoint);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -219,9 +219,9 @@
}
@Override
- public NormalBlockArea makeNormalBlockArea(final Block block,
+ public NormalBlockArea4a makeNormalBlockArea(final Block block,
final GraftingPoint graftingPoint) {
- final NormalBlockArea nbArea = NormalBlockArea.makeNormalBlockArea(
+ final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(
block, this, graftingPoint);
this.children.add(nbArea);
return nbArea;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ExternalGraphicArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ExternalGraphicArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ExternalGraphicArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -46,7 +46,7 @@
implements org.axsl.galley.ExternalGraphicArea,
org.axsl.area.NormalInlineArea {
- /** The parent of this node. The parent can be either a {@link LineArea}
+ /** The parent of this node. The parent can be either a {@link LineArea4a}
* or another {@link AbstractInlineArea}. */
private Area4a parent;
@@ -57,7 +57,7 @@
* Private Constructor.
* @param parentArea The parent area.
*/
- private ExternalGraphicArea(final LineArea parentArea) {
+ private ExternalGraphicArea(final LineArea4a parentArea) {
this.parent = parentArea;
}
@@ -108,7 +108,7 @@
*/
static ExternalGraphicArea makeExternalGraphicArea(
final ExternalGraphic generatedBy,
- final LineArea parentArea, final GraftingPoint graftingPoint,
+ final LineArea4a parentArea, final GraftingPoint graftingPoint,
final int width) {
final ExternalGraphicArea newEgArea = new ExternalGraphicArea(
parentArea);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -49,7 +49,7 @@
implements org.axsl.galley.ForeignObjectArea,
org.axsl.area.NormalInlineArea {
- /** The parent of this node. The parent can be either a {@link LineArea}
+ /** The parent of this node. The parent can be either a {@link LineArea4a}
* or another {@link AbstractInlineArea}. */
private Area4a parent;
@@ -63,7 +63,7 @@
* Private Constructor.
* @param parentArea The parent area.
*/
- private ForeignObjectArea(final LineArea parentArea) {
+ private ForeignObjectArea(final LineArea4a parentArea) {
this.parent = parentArea;
}
@@ -86,7 +86,7 @@
*/
static ForeignObjectArea makeForeignObjectArea(
final InstreamForeignObject generatedBy,
- final LineArea parentArea, final GraftingPoint graftingPoint,
+ final LineArea4a parentArea, final GraftingPoint graftingPoint,
final int width) {
final ForeignObjectArea newFoArea = new ForeignObjectArea(parentArea);
ForeignObjectArea.init(newFoArea, generatedBy, graftingPoint, width);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/IndexPageCitationListArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/IndexPageCitationListArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/IndexPageCitationListArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -43,7 +43,7 @@
implements org.axsl.galley.GeneralInlineArea,
org.axsl.area.AncestralNormalInlineArea {
- /** The parent of this node. The parent can be either a {@link LineArea}
+ /** The parent of this node. The parent can be either a {@link LineArea4a}
* or another {@link AbstractInlineArea}. */
private Area4a parent;
@@ -54,7 +54,7 @@
* Private Constructor for a LineArea parent.
* @param parentArea The parent area.
*/
- private IndexPageCitationListArea(final LineArea parentArea) {
+ private IndexPageCitationListArea(final LineArea4a parentArea) {
this.parent = parentArea;
}
@@ -76,7 +76,7 @@
*/
static IndexPageCitationListArea makeIndexPageCitationListArea(
final IndexPageCitationList generatedBy,
- final LineArea parentArea, final GraftingPoint graftingPoint) {
+ final LineArea4a parentArea, final GraftingPoint graftingPoint) {
final IndexPageCitationListArea newCitationListArea =
new IndexPageCitationListArea(parentArea);
newCitationListArea.generatedBy = newCitationListArea.linkage(
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -46,7 +46,7 @@
implements org.axsl.galley.InlineArea,
org.axsl.area.AncestralNormalInlineArea {
- /** The parent of this node. The parent can be either a {@link LineArea}
+ /** The parent of this node. The parent can be either a {@link LineArea4a}
* or another {@link AbstractInlineArea}. */
private Area4a parent;
@@ -57,7 +57,7 @@
* Private Constructor for a LineArea parent.
* @param parentArea The parent area.
*/
- private InlineArea(final LineArea parentArea) {
+ private InlineArea(final LineArea4a parentArea) {
this.parent = parentArea;
}
@@ -78,7 +78,7 @@
* @return The new instance.
*/
static InlineArea makeInlineArea(final Inline generatedBy,
- final LineArea parentArea, final GraftingPoint graftingPoint) {
+ final LineArea4a parentArea, final GraftingPoint graftingPoint) {
final InlineArea newInlineArea = new InlineArea(parentArea);
newInlineArea.generatedBy = newInlineArea.linkage(generatedBy,
graftingPoint);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/InlineContainerArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -49,7 +49,7 @@
public final class InlineContainerArea extends AbstractInlineArea
implements org.axsl.area.InlineContainerArea {
- /** The parent of this node. The parent can be either a {@link LineArea}
+ /** The parent of this node. The parent can be either a {@link LineArea4a}
* or another {@link AbstractInlineArea}. */
private Area4a parent;
@@ -63,7 +63,7 @@
* Private Constructor for a LineArea parent.
* @param parentArea The parent area.
*/
- private InlineContainerArea(final LineArea parentArea) {
+ private InlineContainerArea(final LineArea4a parentArea) {
this.parent = parentArea;
}
@@ -85,7 +85,7 @@
*/
static InlineContainerArea makeInlineContainerArea(
final InlineContainer generatedBy,
- final LineArea parentArea, final GraftingPoint graftingPoint) {
+ final LineArea4a parentArea, final GraftingPoint graftingPoint) {
final InlineContainerArea newInlineArea = new InlineContainerArea(
parentArea);
newInlineArea.generatedBy = newInlineArea.linkage(generatedBy,
@@ -251,9 +251,9 @@
}
@Override
- public NormalBlockArea makeNormalBlockArea(final Block block,
+ public NormalBlockArea4a makeNormalBlockArea(final Block block,
final GraftingPoint graftingPoint) {
- final NormalBlockArea nbArea = NormalBlockArea.makeNormalBlockArea(
+ final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(
block, this, graftingPoint);
this.children.add(nbArea);
return nbArea;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LeaderArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -70,7 +70,7 @@
implements org.axsl.galley.LeaderArea,
org.axsl.area.AncestralNormalInlineArea {
- /** The parent of this node. The parent can be either a {@link LineArea}
+ /** The parent of this node. The parent can be either a {@link LineArea4a}
* or another {@link AbstractInlineArea}. */
private Area4a parent;
@@ -81,7 +81,7 @@
* Private Constructor.
* @param parentArea The parent area.
*/
- private LeaderArea(final LineArea parentArea) {
+ private LeaderArea(final LineArea4a parentArea) {
this.parent = parentArea;
}
@@ -145,7 +145,7 @@
* length.
*/
static LeaderArea makeLeaderArea(final Leader generatedBy,
- final LineArea parentArea,
+ final LineArea4a parentArea,
final GraftingPoint graftingPoint,
final int initialProgressionDimension)
throws AreaTreeException {
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea.java 2021-12-02 13:06:14 UTC (rev 12163)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea.java 2021-12-02 13:23:26 UTC (rev 12164)
@@ -1,1460 +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
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.common.data.OrderedTreeNode;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.common.value.Conditionality;
-import org.axsl.common.value.LineStackingStrategy;
-import org.axsl.common.value.RelativeAxis;
-import org.axsl.common.value.RelativeCompass;
-import org.axsl.common.value.TextAlign;
-import org.axsl.common.value.TextAlignLast;
-import org.axsl.common.value.WhiteSpaceTreatment;
-import org.axsl.fo.FoContext;
-import org.axsl.fo.fo.BasicLink;
-import org.axsl.fo.fo.BidiOverride;
-import org.axsl.fo.fo.Block;
-import org.axsl.fo.fo.CharacterSequence;
-import org.axsl.fo.fo.ExternalGraphic;
-import org.axsl.fo.fo.GraftingPoint;
-import org.axsl.fo.fo.IndexPageCitationList;
-import org.axsl.fo.fo.Inline;
-import org.axsl.fo.fo.InlineContainer;
-import org.axsl.fo.fo.InstreamForeignObject;
-import org.axsl.fo.fo.Leader;
-import org.axsl.fo.fo.PageNumber;
-import org.axsl.fo.fo.PageNumberCitation;
-import org.axsl.fo.fo.PageNumberCitationLast;
-import org.axsl.fo.fo.ScalingValueCitation;
-import org.axsl.font.Font;
-import org.axsl.font.FontUse;
-import org.axsl.galley.GalleyVisitorException;
-import org.axsl.galley.RenderVisitor;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Area containing a line of content on the page.
- */
-public final class LineArea extends BlockArea
- implements org.axsl.galley.LineArea, org.axsl.area.LineArea {
-
- /** The "generated-by" trait, as defined in Section 6.1.1. */
- private FoLinkage generatedBy;
-
- /** The parent of this node. */
- private NormalBlockArea parent;
-
- /** The children of this node. */
- private List<AbstractInlineArea> children
- = new ArrayList<AbstractInlineArea>();
-
- /** See {@link #getProgressionDimension()} for a description of
- * "progression dimension". */
- private int progressionDimension = 0;
-
- /** Indicates whether the line has already had the leader sizes adjusted. */
- private boolean optimized = false;
-
- /**
- * Private Constructor.
- * @param parentArea The parent area.
- */
- private LineArea(final NormalBlockArea parentArea) {
- this.parent = parentArea;
- }
-
- /**
- * Package-visible Constructor.
- * @param generatedBy The FO node generating this area.
- * @param parentArea The parent area.
- * @param graftingPoint The ancestor grafting point, if any, for this
- * area.
- * @return The new instance.
- */
- static LineArea makeLineArea(final Block generatedBy,
- final NormalBlockArea parentArea,
- final GraftingPoint graftingPoint) {
- final LineArea newLineArea = new LineArea(parentArea);
- newLineArea.generatedBy = newLineArea.linkage(generatedBy,
- graftingPoint);
- newLineArea.registerWithLinkage(graftingPoint);
- newLineArea.computeInitialPD();
- final int initialPD = newLineArea.computeInitialPD();
- newLineArea.setProgressionDimension(initialPD);
- newLineArea.initializeAnteriorSpace();
- return newLineArea;
- }
-
-
- /**
- * Computes the amount that the start-edge of the line-area's
- * content-rectangle should be adjusted when rendering.
- * @return The alignment adjustment, in millipoints.
- */
- protected int alignmentAdjustment() {
- switch (traitTextAlign()) {
- case START:
- return 0;
- case END:
- return this.pdAvailable();
- case CENTER:
- return this.pdAvailable() / 2;
- case JUSTIFY:
- return 0;
- case STRING: {
- /*
- * This is a valid setting, and means that we should find the
- * string to align the text on by using
- * generatedBy.getTextAlignString(), but we don't know what to
- * do with it yet.
- */
- return 0;
- }
- default:
- getLogger().error("Invalid 'text-align': "
- + traitGeneratedBy().traitTextAlign(this));
- return 0;
- }
- }
-
- /**
- * {@inheritDoc}
- * Resolves and optimizes the line. Specifically, this method resolves any
- * page-number citations, and then adjusts leaders, letter-spacing, and
- * word-spacing to justify the line if that is neeeded.
- */
- @Override
- public boolean optimize() {
- /* Optimize in post-traversal order. Allow children to optimize
- * themselves before optimizing the line. */
- this.optimizeChildren();
- if (! this.hasChildren()) {
- return true;
- }
-
- if (this.optimized) {
- return false;
- }
- this.optimized = true;
- /* Resolve the page-number-citations. */
- final Iterator<OrderedTreeNode> iterator =
- this.postOrderDescendantIterator();
- while (iterator.hasNext()) {
- final OrderedTreeNode o = iterator.next();
- if (o instanceof PageNumberCitationArea) {
- final PageNumberCitationArea pia = (PageNumberCitationArea) o;
- pia.getText();
- }
- }
- if (traitTextAlign() == TextAlign.JUSTIFY) {
- justifyLine();
- return false;
- }
- return false;
- }
-
- /**
- * Justifies the contents of this line.
- */
- private void justifyLine() {
- /* In accordance with standard typographic practice, use up all leader
- * capacity before adjusting word spacing or other flexible items.
- * See also XSL-FO Standard 1.0, Section 7.21.4, second note. */
- optimizeLeaders();
-
- /* The next least obtrusive thing to adjust is the space between the
- * child areas, i.e. space-start and space-end. */
- optimizeInterAreaSpace();
-
- /* In accordance with standard typographic practice, which strongly
- * deprecates letter-spacing, use up all specified word-spacing
- * first. */
- optimizeSpecifiedWordSpacing();
-
- /* Now, if the user has specified letter-spacing, it is OK to use it. */
- optimizeSpecifiedLetterSpacing();
-
- /* Anything left implies that line justification requires more
- * word-spacing than the user has specified. Exceeding the
- * user-specified limits is supported by the following statement from
- * XSL-FO 1.0, Section 7.16.8: "Word spacing is also influenced by
- * justification ...". */
- optimizeImpliedWordSpacing();
- }
-
- /**
- * Optimizes the leaders to absorb as much of the line justification needs
- * as possible.
- */
- private void optimizeLeaders() {
- final int unusedSpace = this.pdAvailable();
- // If line is already justified, no optimization possible.
- if (unusedSpace == 0) {
- return;
- }
- final int leaderSpaceAvailable = computeLeaderCapacity(unusedSpace);
- if (leaderSpaceAvailable == 0) {
- return;
- }
- final Iterator<OrderedTreeNode> iterator =
- this.postOrderDescendantIterator();
- while (iterator.hasNext()) {
- final OrderedTreeNode object = iterator.next();
- if (object instanceof LeaderArea) {
- final LeaderArea leader = (LeaderArea) object;
- boolean prorating = false;
- if (Math.abs(leaderSpaceAvailable) >= Math.abs(unusedSpace)) {
- prorating = true;
- }
- optimizeLeader(leader, prorating, unusedSpace,
- leaderSpaceAvailable);
- }
- }
- }
-
- /**
- * Computes the amount of space that can be absorbed by the leaders on this
- * line.
- * @param unusedSpace The amount of space, in millipoints, to be absorbed
- * on this line. If negative, this amount means that Leaders should
- * contract if possible. If positive, this amount means that Leaders
- * should expand if possible.
- * @return The total size, in millipoints, that can be absorbed by
- * Leaders on this line.
- */
- private int computeLeaderCapacity(final int unusedSpace) {
- // First, compute how much capacity the leaders have.
- int leaderSpaceAvailable = 0;
- final Iterator<OrderedTreeNode> iterator =
- this.postOrderDescendantIterator();
- while (iterator.hasNext()) {
- final OrderedTreeNode object = iterator.next();
- if (object instanceof LeaderArea) {
- final LeaderArea leader = (LeaderArea) object;
- if (unusedSpace > 0) {
- leaderSpaceAvailable += leader.traitLeaderLengthMax()
- - leader.getProgressionDimension();
- } else {
- leaderSpaceAvailable += leader.traitLeaderLengthMin()
- - leader.getProgressionDimension();
- }
- }
- }
- return leaderSpaceAvailable;
- }
-
- /**
- * Optimizes a single leader to absorb as much justification need as
- * possible.
- * @param leader The specific leader to optimize.
- * @param prorating Indicates whether we should absorb as much of the
- * leader capacity as possible, or whether it will be prorated.
- * @param unusedSpace The amount of space that needs to be absorbed.
- * @param leaderSpaceAvailable The total amount of leader space that is
- * available from all leaders on the line.
- */
- private void optimizeLeader(final LeaderArea leader,
- final boolean prorating, final int unusedSpace,
- final int leaderSpaceAvailable) {
- int adjustment = 0;
- int maxAdjustment = 0;
- if (unusedSpace < 0) {
- maxAdjustment = leader.traitLeaderLengthMin()
- - leader.getProgressionDimension();
- } else {
- maxAdjustment = leader.traitLeaderLengthMax()
- - leader.getProgressionDimension();
- }
- if (prorating) {
- /* Prorate it. */
- final float ratio = (float) unusedSpace
- / (float) leaderSpaceAvailable;
- adjustment = Math.round(ratio * maxAdjustment);
- } else {
- /* Use all of it. */
- adjustment = maxAdjustment;
- }
- leader.incrementProgressionDimension(adjustment);
- }
-
- /**
- * Optimize the space-start and space-end between child areas.
- */
- private void optimizeInterAreaSpace() {
- /* TODO: Implement this. */
- return;
- }
-
- /**
- * Optimize the specified word-spacing.
- */
- private void optimizeSpecifiedWordSpacing() {
- final int unusedSpace = this.pdAvailable();
- // If line is already justified, no optimization possible.
- if (unusedSpace == 0) {
- return;
- }
- final int wordSpacingCapacity = computeWordSpacingCapacity(unusedSpace);
- if (wordSpacingCapacity == 0) {
- return;
- }
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
- while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
- if (descendant instanceof TextArea) {
- final TextArea text = (TextArea) descendant;
- boolean prorating = false;
- if (Math.abs(wordSpacingCapacity) >= Math.abs(unusedSpace)) {
- prorating = true;
- }
- optimizeTextSpecifiedWordSpacing(text, prorating, unusedSpace,
- wordSpacingCapacity);
- }
- }
- }
-
- /**
- * Computes the amount of space on this line that can be absorbed by
- * adjusting the word-spacing.
- * @param unusedSpace The remaining amount of space, in millipoints, that
- * needs to be absorbed on this line.
- * @return The total size, in millipoints, that can be absorbed by
- * adjusting word-spacing on this line.
- */
- private int computeWordSpacingCapacity(final int unusedSpace) {
- int wordSpacingCapacity = 0;
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
- while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
- if (descendant instanceof TextArea) {
- final TextArea text = (TextArea) descendant;
- if (unusedSpace > 0) {
- wordSpacingCapacity += text.maxWordSpacingCapacity()
- - text.wordSpacingUsed();
- } else {
- wordSpacingCapacity += text.minWordSpacingCapacity()
- - text.wordSpacingUsed();
- }
- }
- }
- return wordSpacingCapacity;
- }
-
- /**
- * Optimize the word-spacing for a specific text area.
- * @param text The text area to be optimized.
- * @param prorating Indicates whether all word-spacing capacity available
- * in the area should be used, or whether it should be prorated amongst the
- * various text-areas.
- * @param unusedSpace The amount of space that needs to be absorbed.
- * @param wordSpacingCapacity The total amount of word spacing space that is
- * available from all text areas on the line.
- */
- private void optimizeTextSpecifiedWordSpacing(final TextArea text,
- final boolean prorating, final int unusedSpace,
- final int wordSpacingCapacity) {
- int adjustment = 0;
- int maxAdjustment = 0;
- if (unusedSpace < 0) {
- maxAdjustment = text.minWordSpacingCapacity()
- - text.wordSpacingUsed();
- } else {
- maxAdjustment = text.maxWordSpacingCapacity()
- - text.wordSpacingUsed();
- }
- if (prorating) {
- // Prorate it
- adjustment = wordSpacingCapacity / unusedSpace * maxAdjustment;
- } else {
- // Use all of it
- adjustment = maxAdjustment;
- }
- text.incrementProgressionDimension(adjustment);
- }
-
- /**
- * Optimize the specified word-spacing.
- */
- private void optimizeSpecifiedLetterSpacing() {
- final int unusedSpace = this.pdAvailable();
- // If line is already justified, no optimization possible.
- if (unusedSpace == 0) {
- return;
- }
- final int letterSpacingCapacity = computeLetterSpacingCapacity(
- unusedSpace);
- if (letterSpacingCapacity == 0) {
- return;
- }
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
- while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
- if (descendant instanceof TextArea) {
- final TextArea text = (TextArea) descendant;
- boolean prorating = false;
- if (Math.abs(letterSpacingCapacity) >= Math.abs(unusedSpace)) {
- prorating = true;
- }
- optimizeTextSpecifiedLetterSpacing(text, prorating, unusedSpace,
- letterSpacingCapacity);
- }
- }
- }
-
- /**
- * Computes the amount of space on this line that can be absorbed by
- * adjusting the letter-spacing.
- * @param unusedSpace The remaining amount of space, in millipoints, that
- * needs to be absorbed on this line.
- * @return The total size, in millipoints, that can be absorbed by
- * adjusting letter-spacing on this line.
- */
- private int computeLetterSpacingCapacity(final int unusedSpace) {
- int letterSpacingCapacity = 0;
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
- while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
- if (descendant instanceof TextArea) {
- final TextArea text = (TextArea) descendant;
- if (unusedSpace > 0) {
- letterSpacingCapacity += text.maxLetterSpacingCapacity()
- - text.letterSpacingUsed();
- } else {
- letterSpacingCapacity += text.minLetterSpacingCapacity()
- - text.letterSpacingUsed();
- }
- }
- }
- return letterSpacingCapacity;
- }
-
- /**
- * Optimize the letter-spacing for a specific text area.
- * @param text The text area to be optimized.
- * @param prorating Indicates whether all letter-spacing capacity available
- * in the area should be used, or whether it should be prorated amongst the
- * various text-areas.
- * @param unusedSpace The amount of space that needs to be absorbed.
- * @param letterSpacingCapacity The total amount of letter spacing space
- * that is available from all text areas on the line.
- */
- private void optimizeTextSpecifiedLetterSpacing(final TextArea text,
- final boolean prorating, final int unusedSpace,
- final int letterSpacingCapacity) {
- int adjustment = 0;
- int maxAdjustment = 0;
- if (unusedSpace < 0) {
- maxAdjustment = text.minLetterSpacingCapacity()
- - text.letterSpacingUsed();
- } else {
- maxAdjustment = text.maxLetterSpacingCapacity()
- - text.letterSpacingUsed();
- }
- if (prorating) {
- // Prorate it
- adjustment = letterSpacingCapacity / unusedSpace * maxAdjustment;
- } else {
- // Use all of it
- adjustment = maxAdjustment;
- }
- text.incrementProgressionDimension(adjustment);
- }
-
- /**
- * Optimize this line for implied word-spacing.
- */
- private void optimizeImpliedWordSpacing() {
- final int unusedSpace = this.pdAvailable();
- // If line is already justified, no optimization possible.
- if (unusedSpace == 0) {
- return;
- }
- /*
- * Approach here is to weight the distribution among various child
- * TextAreas according to their font-size. So, a bigger font-size will
- * absorb a relatively larger share of the change in word-space.
- */
- int totalDenominator = 0;
- final Iterator<OrderedTreeNode> iterator = this.postOrderDescendantIterator();
- while (iterator.hasNext()) {
- final OrderedTreeNode descendant = iterator.next();
- if (descendant instanceof TextArea) {
- final TextArea text = (TextArea) descendant;
- final int denominator = text.countSpaces()
- * text.traitFontSize();
- totalDenominator += denominator;
- }
- }
- if (totalDenominator == 0) {
- return;
- }
- final Iterator<OrderedTreeNode> iterator2 = this.postOrderDescendantIterator();
- while (iterator2.hasNext()) {
- final OrderedTreeNode descendant = iterator2.next();
- if (descendant instanceof TextArea) {
- final TextArea text = (TextArea) descendant;
- final int numSpaces = text.countSpaces();
- if (numSpaces == 0) {
- continue;
- }
- final int numerator = numSpaces * text.traitFontSize();
- final float share = (float) numerator / (float) totalDenominator
- * unusedSpace;
- final int adjustment = Math.round(share / numSpaces);
- final int previousWordSpacing = text.wordSpacing();
- text.setResolvedWordSpacing(previousWordSpacing + adjustment);
- }
- }
- }
-
- /**
- * Balance (vertically) the inline areas within this line.
- */
- public void verticalAlign() {
- int maxHeight = this.getProgressionDimension();
- for (int i = 0; i < getChildren().size(); i++) {
- final Object o = getChildren().get(i);
- if (o instanceof AbstractInlineArea) {
- final AbstractInlineArea ia = (AbstractInlineArea) o;
- if (ia.crBpd() > maxHeight) {
- maxHeight = ia.crBpd();
- }
- }
- }
- // adjust the height of this line to the
- // resulting alignment height.
- this.setProgressionDimension(maxHeight);
- }
-
- /**
- * Indicates whether this is the first line-area generated by the parent
- * block.
- * @return True iff this is the first LineArea instance generated by the
- * parent Block.
- */
- public boolean isFirstLineAreaInBlock() {
- if (! this.isFirstChildOfParent()) {
- return false;
- }
- if (! getParent().isFirstChildOfGeneratedBy()) {
- return false;
- }
- return true;
- }
-
- /**
- * Indicates whether this is the last line-area generated by the parent
- * block.
- * @return True iff this is the last LineArea instance generated by the
- * parent Block.
- */
- public boolean isLastLineAreaInBlock() {
- if (! this.isLastChildOfParent()) {
- return false;
- }
- if (! getParent().isLastChildOfGeneratedBy()) {
- return false;
- }
- return true;
- }
-
- /**
- * Tests for the specialized case of a line qualifying for text-align-last
- * to apply to it.
- * The requirements are outlined in XSL-FO Recommendation 1.1, Section
- * 7.16.10:
- * "Specifies the alignment of the last line-area child of the last
- * block-area generated and returned by the formatting object, and to any
- * line-area generated by the formatting object whose following sibling is a
- * block-area that is not a line-area, and any lines in the block ending in
- * U+000A."
- * @return True iff the text-align-last trait should be used as the
- * alignment for this LineArea.
- */
- public boolean textAlignLastApplies() {
- /* "... last line-area child of the last block-area generated and
- * returned by the formatting object ..." */
- if (isLastLineAreaInBlock()) {
- return true;
- }
-
- /* "... any line-area generated by the formatting object whose following
- * sibling is a block-area that is not a line-area ..." */
- final Area4a nextSibling = this.getNextSiblingArea();
- if (nextSibling == null) {
- return false;
- }
- if (nextSibling.isBlockArea()
- && ! (nextSibling instanceof LineArea)) {
- return true;
- }
-
- /* "... any lines in the block ending in U+000A." */
- final OrderedTreeNode lastLeaf = this.getLastLeaf();
- if (lastLeaf instanceof TextArea) {
- final TextArea textArea = (TextArea) lastLeaf;
- if (textArea.endsWithLinefeed()) {
- return true;
- ...
[truncated message content] |
|
From: <vic...@us...> - 2021-12-02 13:06:21
|
Revision: 12163
http://sourceforge.net/p/foray/code/12163
Author: victormote
Date: 2021-12-02 13:06:14 +0000 (Thu, 02 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Add method to NormalBlockArea to return the LineBreakControl for that Area.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea.java
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/package-info.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea.java 2021-12-02 00:51:55 UTC (rev 12162)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea.java 2021-12-02 13:06:14 UTC (rev 12163)
@@ -42,6 +42,8 @@
import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
import org.axsl.graphic.Graphic;
+import org.axsl.linebreak.LineBreakControl;
+import org.axsl.linebreak.OutputLine;
import java.awt.Color;
import java.util.ArrayList;
@@ -53,7 +55,7 @@
*/
public final class NormalBlockArea extends BlockArea
implements org.axsl.galley.NormalBlockArea,
- org.axsl.area.NormalBlockArea {
+ org.axsl.area.NormalBlockArea, LineBreakControl {
/** The "generated-by" trait, as defined in Section 6.1.1. */
private FoLinkage generatedBy;
@@ -463,4 +465,44 @@
return traitGeneratedBy().getPrimaryFont(this);
}
+ @Override
+ public OutputLine getOutputLine(final int lineNumber) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getLastNonEquivalentLineNumber() {
+ /* The normal case here is zero. */
+ return 0;
+ }
+
+ @Override
+ public int getLooseness() {
+ return 0;
+ }
+
+ @Override
+ public int getConsecutiveFlaggedLinesDemerits() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getIncompatibleFitnessClassDemerits() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public float getAdjustmentRatioTolerance() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public LineBreakControl getLineBreakControl() {
+ return this;
+ }
+
}
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/package-info.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/package-info.java 2021-12-02 00:51:55 UTC (rev 12162)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/package-info.java 2021-12-02 13:06:14 UTC (rev 12163)
@@ -27,20 +27,7 @@
*/
/**
- * <p>Classes for line-breaking using the Knuth-Plass line-breaking model. This model is described in at least three
- * different places:</p>
- *
- * <ol>
- * <li>[KP-1] Knuth, Donald E., and Plass, Michael F., "Breaking Paragraphs into Lines," article in <cite>Software
- * Practice and Experience,</cite> Vol. 11, 1981, pages 1119-1184.</li>
- * <li>[KP-2] Plass, Michael F., and Knuth, Donald E., "Choosing Better Line Breaks," article in <cite>Document
- * Preparation Systems,</cite> 1982, North-Holland Publishing Company.</li>
- * <li>[KP-3] Knuth, Donald E., and Plass, Michael F., "Digital Typography", 1999, Center for the Study of Language
- * and Information, Leland Stanford Junior University, Chapter 3, pages 67-155.
- * This book is a compendium of Knuth works related to typography.
- * In the Addendum on page 154, Item 2 above is described as "a shorter version of this artice ... which generalizes
- * and simplifies the box/glue/penalty model by introducing the notion of a <em>kerf</em>..."</li>
- * </ol>
+ * <p>Implementation of the Knuth-Plass line-breaking model. See {@link org.axsl.linebreak} for more information.</p>
*/
package org.foray.linebreak;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-02 00:51:58
|
Revision: 12162
http://sourceforge.net/p/foray/code/12162
Author: victormote
Date: 2021-12-02 00:51:55 +0000 (Thu, 02 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Add method for AreaTree to return its LineBreakerFactory.
Modified Paths:
--------------
trunk/foray/foray-areatree/build.gradle
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java
Modified: trunk/foray/foray-areatree/build.gradle
===================================================================
--- trunk/foray/foray-areatree/build.gradle 2021-12-01 20:17:16 UTC (rev 12161)
+++ trunk/foray/foray-areatree/build.gradle 2021-12-02 00:51:55 UTC (rev 12162)
@@ -1,9 +1,12 @@
description = 'foray-areatree'
dependencies {
+
+ /* Do *** NOT *** add a dependency on axsl-galley, as axsl-area should be a superset of axsl-galley. If not, fix
+ that instead. */
+
api group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
api group: 'org.axsl', name: 'axsl-area', version: axslVersion
- api group: 'org.axsl', name: 'axsl-galley', version: axslVersion
api project(':foray-common')
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2021-12-01 20:17:16 UTC (rev 12161)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2021-12-02 00:51:55 UTC (rev 12162)
@@ -43,6 +43,7 @@
import org.axsl.galley.Galley;
import org.axsl.galley.GalleyVisitorException;
import org.axsl.galley.RenderVisitor;
+import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.text.TextServer;
import org.slf4j.Logger;
@@ -74,6 +75,9 @@
/** The text server for this area tree. */
private TextServer textServer;
+ /** The LineBreakerFactory for this area tree. */
+ private LineBreakerFactory lbFactory;
+
/** The logger. */
private Logger logger;
@@ -118,15 +122,17 @@
* @param foTree The FO tree instance that generates this area tree.
* @param fontConsumer The Font Consumer.
* @param textServer The Text Server.
+ * @param lbFactory The Line Breaker Factory.
* @param logger The logger.
*/
- private AreaTree4a(final FoTree foTree, final FontConsumer fontConsumer,
- final TextServer textServer, final Logger logger) {
+ private AreaTree4a(final FoTree foTree, final FontConsumer fontConsumer, final TextServer textServer,
+ final LineBreakerFactory lbFactory, final Logger logger) {
/* AreaTree has no parent with which to register. And it cannot
* create linkage because the AreaTreeControl isn't registered.*/
this.foTree = foTree;
this.fontConsumer = fontConsumer;
this.textServer = textServer;
+ this.lbFactory = lbFactory;
this.logger = logger;
}
@@ -134,11 +140,13 @@
* Package-visible factory method.
* @param foTree The FO tree instance that generates this area tree.
* @param textServer The text server.
+ * @param lbFactory The Line Breaker Factory.
* @param logger The logger.
* @return The new instance.
*/
- static AreaTree4a makeAreaTree(final FoTree foTree, final TextServer textServer, final Logger logger) {
- final AreaTree4a newAreaTree = new AreaTree4a(foTree, foTree.getFontConsumer(), textServer, logger);
+ static AreaTree4a makeAreaTree(final FoTree foTree, final TextServer textServer, final LineBreakerFactory lbFactory,
+ final Logger logger) {
+ final AreaTree4a newAreaTree = new AreaTree4a(foTree, foTree.getFontConsumer(), textServer, lbFactory, logger);
/*
* These registration steps must take place after the AreaTreeControl
* has been stored.
@@ -465,4 +473,9 @@
return this.bookmarkTreeArea;
}
+ @Override
+ public LineBreakerFactory getLineBreakerFactory() {
+ return this.lbFactory;
+ }
+
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java 2021-12-01 20:17:16 UTC (rev 12161)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java 2021-12-02 00:51:55 UTC (rev 12162)
@@ -56,7 +56,7 @@
@Override
public AreaTree4a makeAreaTree(final FoTree foTree, final TextServer textServer,
final LineBreakerFactory lbFactory) {
- final AreaTree4a areaTree = AreaTree4a.makeAreaTree(foTree, textServer, getLogger());
+ final AreaTree4a areaTree = AreaTree4a.makeAreaTree(foTree, textServer, lbFactory, getLogger());
return areaTree;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-01 20:17:19
|
Revision: 12161
http://sourceforge.net/p/foray/code/12161
Author: victormote
Date: 2021-12-01 20:17:16 +0000 (Wed, 01 Dec 2021)
Log Message:
-----------
Conform to aXSL changes: Incremental steps toward cleaning up the line-breaking API. Remove the PatientLineBreaker interface.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/package-info.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
Removed Paths:
-------------
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/PatientLineBreaker.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/package-info.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/package-info.java 2021-12-01 19:06:15 UTC (rev 12160)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/package-info.java 2021-12-01 20:17:16 UTC (rev 12161)
@@ -27,7 +27,20 @@
*/
/**
- * <p>Classes for line-breaking.</p>
+ * <p>Classes for line-breaking using the Knuth-Plass line-breaking model. This model is described in at least three
+ * different places:</p>
+ *
+ * <ol>
+ * <li>[KP-1] Knuth, Donald E., and Plass, Michael F., "Breaking Paragraphs into Lines," article in <cite>Software
+ * Practice and Experience,</cite> Vol. 11, 1981, pages 1119-1184.</li>
+ * <li>[KP-2] Plass, Michael F., and Knuth, Donald E., "Choosing Better Line Breaks," article in <cite>Document
+ * Preparation Systems,</cite> 1982, North-Holland Publishing Company.</li>
+ * <li>[KP-3] Knuth, Donald E., and Plass, Michael F., "Digital Typography", 1999, Center for the Study of Language
+ * and Information, Leland Stanford Junior University, Chapter 3, pages 67-155.
+ * This book is a compendium of Knuth works related to typography.
+ * In the Addendum on page 154, Item 2 above is described as "a shorter version of this artice ... which generalizes
+ * and simplifies the box/glue/penalty model by introducing the notion of a <em>kerf</em>..."</li>
+ * </ol>
*/
package org.foray.linebreak;
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java 2021-12-01 19:06:15 UTC (rev 12160)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java 2021-12-01 20:17:16 UTC (rev 12161)
@@ -35,7 +35,6 @@
import org.axsl.orthography.OrthographyServer;
import org.axsl.text.line.EagerLineBreaker;
import org.axsl.text.line.LineBreakHandler;
-import org.axsl.text.line.PatientLineBreaker;
import org.slf4j.Logger;
@@ -85,12 +84,4 @@
return new SolitaryLineBreaker(this, control, handler, fontConsumer);
}
- @Override
- public PatientLineBreaker providePatientLineBreaker(
- final LineBreakControl control, final LineBreakHandler handler,
- final FontConsumer fontConsumer) {
- /* We don't have access to any yet. */
- return null;
- }
-
}
Deleted: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/PatientLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/PatientLineBreaker.java 2021-12-01 19:06:15 UTC (rev 12160)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/PatientLineBreaker.java 2021-12-01 20:17:16 UTC (rev 12161)
@@ -1,149 +0,0 @@
-/*
- * Copyright 2007 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
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.text.line;
-
-import org.foray.text.TextServer4a;
-
-import org.axsl.font.FontConsumer;
-import org.axsl.linebreak.LineBreakControl;
-import org.axsl.linebreak.OutputLine;
-import org.axsl.text.TextException;
-import org.axsl.text.line.LineBreakHandler;
-import org.axsl.text.line.LineContent;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Abstract superclass for LineBreakers that act in a "patient" manner.
- */
-public abstract class PatientLineBreaker extends LineBreaker
- implements org.axsl.text.line.PatientLineBreaker {
-
- /** The number of new elements in the buffer that should be created when
- * it needs to increase its capacity. */
- private static final int LINE_COUNT_INCREMENT = 20;
-
- /**
- * The List of items that should be conceptually laid out by this
- * LineBreaker. The contents should <em>always</em> be implementations of
- * either LineText or LineNonText.
- */
- private List<LineContent> content = new ArrayList<LineContent>();
-
- /**
- * Contains the lines that have been requested. The client
- * application is responsible to provide these values, but they are stored
- * here for reference.
- */
- private OutputLine[] outputLines
- = new OutputLine[PatientLineBreaker.LINE_COUNT_INCREMENT];
-
- /**
- * Index into {@link #outputLines} indicating which one was last requested
- * and filled.
- */
- private int lastLineRequested = -1;
-
- /**
- * Index into {@link #outputLines} indicating which line is currently being
- * filled.
- */
- private int lineReceivingContent = -1;
-
- /**
- * Constructor.
- * @param server The "parent" TextServer.
- * @param control The client object that provides process-time information,
- * specifically by providing line length information.
- * @param handler The client object that is responsible for taking the
- * results of the line-breaking work and doing something with it.
- * @param fontConsumer Provides the line-breaking system with the
- * FontConsumer instance that should be used for interfacing with the Font
- * subsystem.
- */
- public PatientLineBreaker(final TextServer4a server,
- final LineBreakControl control,
- final LineBreakHandler handler, final FontConsumer fontConsumer) {
- super(server, control, handler, fontConsumer);
- }
-
- @Override
- public void addLineContent(final LineContent contentItem)
- throws TextException {
- this.content.add(contentItem);
- }
-
- /**
- * Returns the line currently having content placed upon it.
- * @return The line currently having content placed upon it.
- * @throws TextException If a new line is needed and cannot be created.
- */
- protected OutputLine lineReceivingContent() throws TextException {
- if (this.lineReceivingContent < 0) {
- this.lineReceivingContent ++;
- }
- updateLineLengths();
- return this.outputLines[this.lineReceivingContent];
- }
-
- /**
- * Ensures that we have enough lines in the buffer to be able to process
- * the line currently being processed.
- * @throws TextException If a new line is needed and cannot be created.
- */
- private void updateLineLengths() throws TextException {
- while (this.lineReceivingContent > this.lastLineRequested) {
- this.lastLineRequested ++;
- checkArraySize();
- this.outputLines[this.lineReceivingContent]
- = this.getLineBreakControl().getOutputLine(this.lineReceivingContent);
- }
- }
-
- /**
- * Copies the lineSize array to a new array with 100 more elements.
- * Needed because we are not using a Collection object to store the values.
- */
- private void checkArraySize() {
- if (this.lastLineRequested <= this.outputLines.length) {
- return;
- }
- // Make a new array.
- final int newSize = this.outputLines.length
- + PatientLineBreaker.LINE_COUNT_INCREMENT;
- final OutputLine[] newArray = new OutputLine[newSize];
- // Copy the old to the new.
- System.arraycopy(this.outputLines, 0, newArray, 0,
- this.outputLines.length);
- // Make the new array the active one.
- this.outputLines = newArray;
- }
-
-}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-12-01 19:06:15 UTC (rev 12160)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-12-01 20:17:16 UTC (rev 12161)
@@ -66,6 +66,23 @@
"was bored she took a golden ball, and threw it up on high and caught it; and this ball was her favorite " +
"plaything.";
+ /** A string used for testing line-breaking. This example is used in Knuth, "Digital Typography,", 1999, Chapter 3,
+ * "Breaking Paragraphs into Lines," p. 110. Knuth cites this as a quotation from Galileo Galilei. */
+ public static final String TEST_STRING_02 =
+ "The area of a circle is a mean proportional between any two regular " +
+ "and similar polygons of which one circumscribes it and the other is isoperimetric with it. In addition, " +
+ "the area of the circle is less than that of any circumscribed polygon and greater than that of any " +
+ "isoperimetric polygon. And further, of these circumscribed polygons, the one that has the greater " +
+ "number of sides has a smaller area than the one that has a lesser number; but, on the other hand, the " +
+ "isoperimetric polygon that has the greater number of sides is the larger.";
+
+ /** A string used for testing line-breaking. This example is used in Knuth, "Digital Typography,", 1999, Chapter 3,
+ * "Breaking Paragraphs into Lines," p. 110. Knuth cites this as a quotation from Blaise Pascal. */
+ public static final String TEST_STRING_03 =
+ "I turn, in the following treatises, to various uses of those " +
+ "triangles whose generator is unity. But I leave out many more than I include; it is extraordinary how " +
+ "fertile in properties this triangle is. Everyone can try his hand.";
+
/**
* Creates the tokenized content of {@link #TEST_STRING_01}.
* We could use the orthography system to build this, but the line-breaking logic is independent of that, so we
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-01 19:06:18
|
Revision: 12160
http://sourceforge.net/p/foray/code/12160
Author: victormote
Date: 2021-12-01 19:06:15 +0000 (Wed, 01 Dec 2021)
Log Message:
-----------
Conform to aXSL change: Disconnect the FoTree project from TextServer.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java
trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java
trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java
trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java
trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java
trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestMetadata.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -39,6 +39,7 @@
import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.output.OutputTarget;
+import org.axsl.text.TextServer;
import org.xml.sax.InputSource;
@@ -124,9 +125,10 @@
* Targets that do not need an OutputStream should set that parameter
* to null.
*/
+ final TextServer textServer = session.getTextServer();
final LineBreakerFactory lbFactory = session.getLineBreakerFactory();
final LayoutStrategy layout = new PioneerLayoutStrategy(session.getLogger());
- final ForayTarget target = new ForayTarget(document, outputTarget, lbFactory, layout, outputStream);
+ final ForayTarget target = new ForayTarget(document, outputTarget, textServer, lbFactory, layout, outputStream);
/*
* Everything is now ready to go. There are two different processing
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -318,7 +318,8 @@
OutputTargetFactory.makeOutputTarget(
this.task.getRendererType(), this.outputConfig, out,
session.getLogger(), session.getGraphicServer());
- new ForayTarget(document, outputTarget, session.getLineBreakerFactory(), null, out);
+ new ForayTarget(document, outputTarget, session.getTextServer(), session.getLineBreakerFactory(), null,
+ out);
session.process();
out.close();
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -311,7 +311,7 @@
rendererType, renderOptions, bos, session.getLogger(),
session.getGraphicServer());
- new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, bos);
+ new ForayTarget(document, renderer, session.getTextServer(), session.getLineBreakerFactory(), null, bos);
this.log.debug("ddir:" + this.destdir + " on:" + outname + ".pdf");
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -150,7 +150,7 @@
final AwtRenderer renderer = new AwtRenderer(null);
//Setup ForayTarget
- new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, null);
+ new ForayTarget(document, renderer, session.getTextServer(), session.getLineBreakerFactory(), null, null);
//Create preview dialog (target for the AWTRenderer)
final PreviewDialog frame;
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -77,7 +77,7 @@
session.getGraphicServer());
//Setup ForayTarget
- new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, out);
+ new ForayTarget(document, renderer, session.getTextServer(), session.getLineBreakerFactory(), null, out);
// Start the processing.
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -100,7 +100,7 @@
session.getGraphicServer());
//Setup ForayTarget
- new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, out);
+ new ForayTarget(document, renderer, session.getTextServer(), session.getLineBreakerFactory(), null, out);
// Start the processing.
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -101,7 +101,7 @@
session.getGraphicServer());
//Setup ForayTarget
- new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, out);
+ new ForayTarget(document, renderer, session.getTextServer(), session.getLineBreakerFactory(), null, out);
// Start the processing.
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -199,7 +199,7 @@
session.getLogger(), session.getGraphicServer());
// Setup ForayTarget
- new ForayTarget(document, renderer, null, null, output);
+ new ForayTarget(document, renderer, null, null, null, output);
// Run the ForaySession
session.process();
@@ -247,7 +247,7 @@
session.getLogger(), session.getGraphicServer());
// Setup ForayTarget
- new ForayTarget(document, renderer, null, null, output);
+ new ForayTarget(document, renderer, null, null, null, output);
// Run the ForaySession
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -134,7 +134,7 @@
pj.setCopies(1);
final AwtPrintRenderer renderer = new AwtPrintRenderer(null, pj);
// Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, renderer, null, null, null);
+ final ForayTarget target = new ForayTarget(document, renderer, null, null, null, null);
return target;
}
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -140,7 +140,7 @@
document.getLogger(), document.getGraphicServer());
// Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, renderer, null, null, output);
+ final ForayTarget target = new ForayTarget(document, renderer, null, null, null, output);
return target;
}
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -47,6 +47,8 @@
import org.foray.font.config.RegisteredFont;
import org.axsl.font.FontException;
+import org.axsl.linebreak.LineBreakerFactory;
+import org.axsl.text.TextServer;
import org.junit.Assert;
@@ -168,4 +170,20 @@
return builder.toString();
}
+ /**
+ * Returns the text server for these tests.
+ * @return The text server.
+ */
+ protected TextServer getTextServer() {
+ return null;
+ }
+
+ /**
+ * Returns the line-breaker factory for these tests.
+ * @return The line-breaker factory.
+ */
+ protected LineBreakerFactory getLineBreakerFactory() {
+ return null;
+ }
+
}
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -38,11 +38,12 @@
import org.foray.fotree.FoTreeServer4a;
import org.foray.fotree.fo.obj.PageSequence;
import org.foray.fotree.fo.obj.Root;
-import org.foray.linebreak.LineBreakerFactory4a;
import org.foray.pioneer.PioneerFactory;
import org.foray.pioneer.PioneerLayoutStrategy;
import org.axsl.area.AreaTreeException;
+import org.axsl.linebreak.LineBreakerFactory;
+import org.axsl.text.TextServer;
import java.io.IOException;
import java.util.Iterator;
@@ -98,14 +99,17 @@
/**
* Converts a file in the test directory to an AreaTree.
* @param file The file to be converted.
+ * @param textServer The text server.
+ * @param lbFactory The line-breaker factory.
* @return The parsed FO Tree instance.
* @throws ForayException For errors building the FO Tree.
*/
- public AreaTree4a buildAreaTree(final String file) throws ForayException {
+ public AreaTree4a buildAreaTree(final String file, final TextServer textServer, final LineBreakerFactory lbFactory)
+ throws ForayException {
final FoDocumentReader foReader = FoDocumentReader.getInstance();
final FoTree4a foTree = foReader.buildFoTree(file);
final Root root = foTree.getRootFo();
- final AreaTree4a areaTree = this.areaTreeFactory.makeAreaTree(foTree, new LineBreakerFactory4a());
+ final AreaTree4a areaTree = this.areaTreeFactory.makeAreaTree(foTree, textServer, lbFactory);
final PioneerLayoutStrategy layout = this.layoutFactory.makeLayout();
final Iterator<PageSequence> iterator = root.getPageSequenceIterator();
while (iterator.hasNext()) {
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -72,8 +72,7 @@
@Ignore
public void testBlock001() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree(
- "fo/block-001.fo");
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/block-001.fo", getTextServer(), getLineBreakerFactory());
final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
@@ -171,8 +170,7 @@
@Ignore
public void testBlock002() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree(
- "fo/block-002.fo");
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/block-002.fo", getTextServer(), getLineBreakerFactory());
final PageCollection pageCollection = this.getPageCollection(areaTree,
1);
final int numPages = pageCollection.getChildCount();
@@ -253,8 +251,7 @@
public void testBlock003() throws ForayException, FontException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree(
- "fo/block-003.fo");
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/block-003.fo", getTextServer(), getLineBreakerFactory());
final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
@@ -317,8 +314,7 @@
@Ignore
public void testBlock004() throws ForayException, FontException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree(
- "fo/block-004.fo");
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/block-004.fo", getTextServer(), getLineBreakerFactory());
final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -51,8 +51,8 @@
@Ignore
public void testBorderStyle001() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree(
- "fo/border-style-001.fo");
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/border-style-001.fo", getTextServer(),
+ getLineBreakerFactory());
final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -55,8 +55,8 @@
@Ignore
public void testGraphic002() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree(
- "fo/graphic-002.fo");
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/graphic-002.fo", getTextServer(),
+ getLineBreakerFactory());
final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -56,8 +56,7 @@
@Ignore
public void testInline001() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree(
- "fo/inline-001.fo");
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/inline-001.fo", getTextServer(), getLineBreakerFactory());
final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
Assert.assertEquals(1, firstNormalFlowArea.getChildCount());
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestMetadata.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestMetadata.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestMetadata.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -48,8 +48,8 @@
@Ignore
public void testMetadata001() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree(
- "fo/metadata-001.fo");
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/metadata-001.fo", getTextServer(),
+ getLineBreakerFactory());
Assert.assertNotNull(areaTree);
Assert.assertEquals("Test Title", areaTree.getTitle());
Assert.assertEquals("Test Author", areaTree.getAuthor());
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -56,7 +56,8 @@
@Ignore
public void testVertical001() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree("fo/vertical-001.fo");
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/vertical-001.fo", getTextServer(),
+ getLineBreakerFactory());
final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -133,12 +133,12 @@
/**
* Package-visible factory method.
* @param foTree The FO tree instance that generates this area tree.
+ * @param textServer The text server.
* @param logger The logger.
* @return The new instance.
*/
- static AreaTree4a makeAreaTree(final FoTree foTree, final Logger logger) {
- final AreaTree4a newAreaTree = new AreaTree4a(foTree, foTree.getFontConsumer(),
- foTree.getTextServer(), logger);
+ static AreaTree4a makeAreaTree(final FoTree foTree, final TextServer textServer, final Logger logger) {
+ final AreaTree4a newAreaTree = new AreaTree4a(foTree, foTree.getFontConsumer(), textServer, logger);
/*
* These registration steps must take place after the AreaTreeControl
* has been stored.
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -31,6 +31,7 @@
import org.axsl.area.AreaTreeFactory;
import org.axsl.fo.FoTree;
import org.axsl.linebreak.LineBreakerFactory;
+import org.axsl.text.TextServer;
import org.slf4j.Logger;
@@ -53,8 +54,9 @@
}
@Override
- public AreaTree4a makeAreaTree(final FoTree foTree, final LineBreakerFactory lbFactory) {
- final AreaTree4a areaTree = AreaTree4a.makeAreaTree(foTree, getLogger());
+ public AreaTree4a makeAreaTree(final FoTree foTree, final TextServer textServer,
+ final LineBreakerFactory lbFactory) {
+ final AreaTree4a areaTree = AreaTree4a.makeAreaTree(foTree, textServer, getLogger());
return areaTree;
}
@@ -69,7 +71,7 @@
/**
* Sets the logger to be used by AreaTree instances.
* If a new logger is needed for each AreaTree instance created, this method
- * should be run before running {@link #makeAreaTree(FoTree, LineBreakerFactory)}.
+ * should be run before running {@link #makeAreaTree(FoTree, TextServer, LineBreakerFactory)}.
* @param logger The new logger.
*/
public void setLogger(final Logger logger) {
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -102,6 +102,9 @@
*/
private int pageSequenceCount;
+ /** The text server. */
+ private TextServer textServer;
+
/** The line-breaker factory to be used. */
private LineBreakerFactory lbFactory;
@@ -118,14 +121,15 @@
* Constructor.
* @param document The parent document.
* @param outputTarget The output target to which the document should be processed.
+ * @param textServer The text server.
* @param lbFactory The line-breaker factory to be used.
* @param layout The layout implementation responsible for laying the document out.
* @param outputStream The output stream, if any, to which the document should be written.
* @throws ForayException For errors during document processing.
*/
- public ForayTarget(final ForayDocument document,
- final OutputTarget outputTarget, final LineBreakerFactory lbFactory, final Layout layout,
- final OutputStream outputStream) throws ForayException {
+ public ForayTarget(final ForayDocument document, final OutputTarget outputTarget, final TextServer textServer,
+ final LineBreakerFactory lbFactory, final Layout layout, final OutputStream outputStream)
+ throws ForayException {
// Validate the ForayDocument.
this.document = document;
if (this.document == null) {
@@ -143,6 +147,7 @@
throw new ForayException("OutputTarget has not been set.");
}
+ this.textServer = textServer;
this.lbFactory = lbFactory;
// Validate the LayoutStrategy. If null, create a default one.
this.layout = layout;
@@ -279,7 +284,7 @@
private org.axsl.area.AreaTree getCreatedAreaTree() {
if (this.areaTree == null) {
final FoTree foTree = this.document.getFoTreeParser().getFoTree();
- this.areaTree = this.getAreaTreeFactory().makeAreaTree(foTree, this.lbFactory);
+ this.areaTree = this.getAreaTreeFactory().makeAreaTree(foTree, this.textServer, this.lbFactory);
this.areaTree.registerListener(this);
}
return this.areaTree;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -138,7 +138,6 @@
import org.axsl.speech.SpeechException;
import org.axsl.speech.SpeechServer;
import org.axsl.speech.Voice;
-import org.axsl.text.TextServer;
import org.axsl.text.line.LineText;
import org.slf4j.Logger;
@@ -755,14 +754,6 @@
}
/**
- * Returns the text server being used by this tree.
- * @return The text server being used by this tree.
- */
- public TextServer getTextServer() {
- return getFoTree().getTextServer();
- }
-
- /**
* Gets the Namespace instance that is associated with this object.
* @return The Namespace instance that is associated with this object.
*/
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -41,7 +41,6 @@
import org.axsl.graphic.GraphicServer;
import org.axsl.orthography.OrthographyServer;
import org.axsl.speech.SpeechServer;
-import org.axsl.text.TextServer;
import org.slf4j.Logger;
@@ -64,9 +63,6 @@
/** The graphic server. */
private GraphicServer graphicServer;
- /** The text server. */
- private TextServer textServer;
-
/** The font consumer. */
private FontConsumer fontConsumer;
@@ -122,16 +118,6 @@
}
@Override
- public void setTextServer(final TextServer textServer) {
- this.textServer = textServer;
- }
-
- @Override
- public TextServer getTextServer() {
- return this.textServer;
- }
-
- @Override
public void setFontConsumer(final FontConsumer consumer) {
this.fontConsumer = consumer;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-01 18:16:19 UTC (rev 12159)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2021-12-01 19:06:15 UTC (rev 12160)
@@ -96,7 +96,6 @@
this.foTreeListeners.clear();
this.foTree = new FoTree4a(this.server, this);
foTree.setGraphicServer(this.server.getGraphicServer());
- foTree.setTextServer(this.server.getTextServer());
foTree.setOrthographyServer(this.server.getOrthographyServer());
foTree.setGraphicSearchPath(this.server.getGraphicSearchPath());
foTree.setCachingGraphics(this.server.isCachingGraphics());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-01 18:16:22
|
Revision: 12159
http://sourceforge.net/p/foray/code/12159
Author: victormote
Date: 2021-12-01 18:16:19 +0000 (Wed, 01 Dec 2021)
Log Message:
-----------
Conform to aXSL change: When creating an AreaTree, provide a LineBreakerFactory directly to it.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java
trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java
trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java
trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java
trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java
Added Paths:
-----------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/LineBreakerFactory4a.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/CommandLineStarter.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -37,6 +37,7 @@
import org.foray.layout.LayoutStrategy;
import org.foray.pioneer.PioneerLayoutStrategy;
+import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.output.OutputTarget;
import org.xml.sax.InputSource;
@@ -123,9 +124,9 @@
* Targets that do not need an OutputStream should set that parameter
* to null.
*/
+ final LineBreakerFactory lbFactory = session.getLineBreakerFactory();
final LayoutStrategy layout = new PioneerLayoutStrategy(session.getLogger());
- final ForayTarget target = new ForayTarget(document, outputTarget,
- layout, outputStream);
+ final ForayTarget target = new ForayTarget(document, outputTarget, lbFactory, layout, outputStream);
/*
* Everything is now ready to go. There are two different processing
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -36,6 +36,7 @@
import org.foray.font.FontServer4a;
import org.foray.fotree.FoTreeServer4a;
import org.foray.graphic.GraphicServer4a;
+import org.foray.linebreak.LineBreakerFactory4a;
import org.foray.orthography.OrthographyServerConfig;
import org.foray.pioneer.PioneerFactory;
import org.foray.ps.PsServer4a;
@@ -47,6 +48,7 @@
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
import org.axsl.layout.LayoutFactory;
+import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.OrthographyServer;
import org.axsl.ps.PsServer;
@@ -100,11 +102,12 @@
final FoTreeFactory foTreeServer = ForaySpecific.makeFOTreeFactory(
logger, sessionConfig, fontServer, graphicServer, textServer, hyphenServer);
final AreaTreeFactory areaTreeFactory = ForaySpecific.makeAreaTreeFactory(logger);
+ final LineBreakerFactory lbFactory = ForaySpecific.makeLineBreakerFactory();
final LayoutFactory layoutFactory = ForaySpecific.makeLayoutFactory(logger);
final SpeechServer speechServer = ForaySpecific.makeSpeechServer();
final ForaySession session = new ForaySession(logger, sessionConfig,
fontServer, hyphenServer, textServer, graphicServer,
- speechServer, foTreeServer, areaTreeFactory, layoutFactory);
+ speechServer, foTreeServer, areaTreeFactory, lbFactory, layoutFactory);
return session;
}
@@ -248,6 +251,14 @@
}
/**
+ * Make a standard LineBreakerFactory instance for use in FOray.
+ * @return The newly-created LineBreakerFactory instance.
+ */
+ public static LineBreakerFactory makeLineBreakerFactory() {
+ return new LineBreakerFactory4a();
+ }
+
+ /**
* Make a standard LayoutFactory instance for use in FOray.
* @param logger The logger.
* @return The newly-created LayoutFactory instance.
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ant/ForayAntTaskStarter.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -318,7 +318,7 @@
OutputTargetFactory.makeOutputTarget(
this.task.getRendererType(), this.outputConfig, out,
session.getLogger(), session.getGraphicServer());
- new ForayTarget(document, outputTarget, null, out);
+ new ForayTarget(document, outputTarget, session.getLineBreakerFactory(), null, out);
session.process();
out.close();
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/test/TestConverter.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -311,7 +311,7 @@
rendererType, renderOptions, bos, session.getLogger(),
session.getGraphicServer());
- new ForayTarget(document, renderer, null, bos);
+ new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, bos);
this.log.debug("ddir:" + this.destdir + " on:" + outname + ".pdf");
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoAwtViewer.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -150,7 +150,7 @@
final AwtRenderer renderer = new AwtRenderer(null);
//Setup ForayTarget
- new ForayTarget(document, renderer, null, null);
+ new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, null);
//Create preview dialog (target for the AWTRenderer)
final PreviewDialog frame;
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoFo2Pdf.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -77,7 +77,7 @@
session.getGraphicServer());
//Setup ForayTarget
- new ForayTarget(document, renderer, null, out);
+ new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, out);
// Start the processing.
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoObj2Pdf.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -100,7 +100,7 @@
session.getGraphicServer());
//Setup ForayTarget
- new ForayTarget(document, renderer, null, out);
+ new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, out);
// Start the processing.
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/DemoXml2Pdf.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -101,7 +101,7 @@
session.getGraphicServer());
//Setup ForayTarget
- new ForayTarget(document, renderer, null, out);
+ new ForayTarget(document, renderer, session.getLineBreakerFactory(), null, out);
// Start the processing.
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/AbstractDemoServlet.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -199,7 +199,7 @@
session.getLogger(), session.getGraphicServer());
// Setup ForayTarget
- new ForayTarget(document, renderer, null, output);
+ new ForayTarget(document, renderer, null, null, output);
// Run the ForaySession
session.process();
@@ -247,7 +247,7 @@
session.getLogger(), session.getGraphicServer());
// Setup ForayTarget
- new ForayTarget(document, renderer, null, output);
+ new ForayTarget(document, renderer, null, null, output);
// Run the ForaySession
session.process();
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoPrintServlet.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -134,8 +134,7 @@
pj.setCopies(1);
final AwtPrintRenderer renderer = new AwtPrintRenderer(null, pj);
// Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, renderer, null,
- null);
+ final ForayTarget target = new ForayTarget(document, renderer, null, null, null);
return target;
}
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/servlet/DemoServlet.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -140,8 +140,7 @@
document.getLogger(), document.getGraphicServer());
// Setup ForayTarget
- final ForayTarget target = new ForayTarget(document, renderer, null,
- output);
+ final ForayTarget target = new ForayTarget(document, renderer, null, null, output);
return target;
}
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -38,6 +38,7 @@
import org.foray.fotree.FoTreeServer4a;
import org.foray.fotree.fo.obj.PageSequence;
import org.foray.fotree.fo.obj.Root;
+import org.foray.linebreak.LineBreakerFactory4a;
import org.foray.pioneer.PioneerFactory;
import org.foray.pioneer.PioneerLayoutStrategy;
@@ -104,7 +105,7 @@
final FoDocumentReader foReader = FoDocumentReader.getInstance();
final FoTree4a foTree = foReader.buildFoTree(file);
final Root root = foTree.getRootFo();
- final AreaTree4a areaTree = this.areaTreeFactory.makeAreaTree(foTree);
+ final AreaTree4a areaTree = this.areaTreeFactory.makeAreaTree(foTree, new LineBreakerFactory4a());
final PioneerLayoutStrategy layout = this.layoutFactory.makeLayout();
final Iterator<PageSequence> iterator = root.getPageSequenceIterator();
while (iterator.hasNext()) {
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTreeFactory4a.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -30,6 +30,7 @@
import org.axsl.area.AreaTreeFactory;
import org.axsl.fo.FoTree;
+import org.axsl.linebreak.LineBreakerFactory;
import org.slf4j.Logger;
@@ -52,7 +53,7 @@
}
@Override
- public AreaTree4a makeAreaTree(final FoTree foTree) {
+ public AreaTree4a makeAreaTree(final FoTree foTree, final LineBreakerFactory lbFactory) {
final AreaTree4a areaTree = AreaTree4a.makeAreaTree(foTree, getLogger());
return areaTree;
}
@@ -68,7 +69,7 @@
/**
* Sets the logger to be used by AreaTree instances.
* If a new logger is needed for each AreaTree instance created, this method
- * should be run before running {@link #makeAreaTree(FoTree)}.
+ * should be run before running {@link #makeAreaTree(FoTree, LineBreakerFactory)}.
* @param logger The new logger.
*/
public void setLogger(final Logger logger) {
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -34,6 +34,7 @@
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
import org.axsl.layout.LayoutFactory;
+import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.orthography.OrthographyServer;
import org.axsl.speech.SpeechServer;
import org.axsl.text.TextServer;
@@ -91,6 +92,9 @@
/** The AreaTree factory for this session. */
private AreaTreeFactory areaTreeFactory;
+ /** The LineBreakerFactory for this session. */
+ private LineBreakerFactory lbFactory;
+
/** The default layout factory for this session. */
private LayoutFactory layoutFactory;
@@ -127,8 +131,8 @@
* session.
* @param areaTreeFactory The AreaTreeFactory that should be used for this
* session.
- * @param layoutFactory The LayoutFactory that should be used for this
- * session.
+ * @param lbFactory The LineBreakerFactory that should be used for this session.
+ * @param layoutFactory The LayoutFactory that should be used for this session.
* @throws ForayException For invalid parameters.
*/
public ForaySession(final Logger logger, final SessionConfig configuration,
@@ -137,7 +141,9 @@
final SpeechServer speechServer,
final FoTreeFactory foTreeFactory,
final AreaTreeFactory areaTreeFactory,
- final LayoutFactory layoutFactory) throws ForayException {
+ final LineBreakerFactory lbFactory,
+ final LayoutFactory layoutFactory)
+ throws ForayException {
/* Validate Logger. */
if (logger == null) {
throw new ForayException("Logger required for ForaySession.");
@@ -193,6 +199,12 @@
}
this.areaTreeFactory = areaTreeFactory;
+ /* Validate AreaTreeFactory. */
+ if (lbFactory == null) {
+ throw new ForayException("LineBreakerFactory required for ForaySession.");
+ }
+ this.lbFactory = lbFactory;
+
/* Validate LayoutFactory. */
if (layoutFactory == null) {
throw new ForayException("LayoutFactory required for "
@@ -350,4 +362,12 @@
return this.layoutFactory;
}
+ /**
+ * Returns the LineBreakerFactory.
+ * @return The LineBreakerFactory.
+ */
+ public LineBreakerFactory getLineBreakerFactory() {
+ return this.lbFactory;
+ }
+
}
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java 2021-12-01 16:01:10 UTC (rev 12158)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForayTarget.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -45,6 +45,7 @@
import org.axsl.layout.Layout;
import org.axsl.layout.LayoutException;
import org.axsl.layout.LayoutFactory;
+import org.axsl.linebreak.LineBreakerFactory;
import org.axsl.output.OutputException;
import org.axsl.output.OutputTarget;
import org.axsl.output.Renderer;
@@ -101,6 +102,9 @@
*/
private int pageSequenceCount;
+ /** The line-breaker factory to be used. */
+ private LineBreakerFactory lbFactory;
+
/** The LayoutStrategy implementation to be used for this target. */
private Layout layout;
@@ -113,16 +117,14 @@
/**
* Constructor.
* @param document The parent document.
- * @param outputTarget The output target to which the document should be
- * processed.
- * @param layout The layout implementation responsible for laying the
- * document out.
- * @param outputStream The output stream, if any, to which the document
- * should be written.
+ * @param outputTarget The output target to which the document should be processed.
+ * @param lbFactory The line-breaker factory to be used.
+ * @param layout The layout implementation responsible for laying the document out.
+ * @param outputStream The output stream, if any, to which the document should be written.
* @throws ForayException For errors during document processing.
*/
public ForayTarget(final ForayDocument document,
- final OutputTarget outputTarget, final Layout layout,
+ final OutputTarget outputTarget, final LineBreakerFactory lbFactory, final Layout layout,
final OutputStream outputStream) throws ForayException {
// Validate the ForayDocument.
this.document = document;
@@ -141,6 +143,7 @@
throw new ForayException("OutputTarget has not been set.");
}
+ this.lbFactory = lbFactory;
// Validate the LayoutStrategy. If null, create a default one.
this.layout = layout;
if (this.layout == null) {
@@ -276,7 +279,7 @@
private org.axsl.area.AreaTree getCreatedAreaTree() {
if (this.areaTree == null) {
final FoTree foTree = this.document.getFoTreeParser().getFoTree();
- this.areaTree = this.getAreaTreeFactory().makeAreaTree(foTree);
+ this.areaTree = this.getAreaTreeFactory().makeAreaTree(foTree, this.lbFactory);
this.areaTree.registerListener(this);
}
return this.areaTree;
Added: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/LineBreakerFactory4a.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/LineBreakerFactory4a.java (rev 0)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/LineBreakerFactory4a.java 2021-12-01 18:16:19 UTC (rev 12159)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2021 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
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.linebreak;
+
+import org.axsl.linebreak.LineBreaker;
+import org.axsl.linebreak.LineBreakerFactory;
+
+/**
+ * FOray implementation of {@link LineBreakerFactory}.
+ */
+public class LineBreakerFactory4a implements LineBreakerFactory {
+
+ @Override
+ public LineBreaker obtainLineBreaker() {
+ return new FirstFitLb();
+ }
+
+}
Property changes on: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/LineBreakerFactory4a.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-01 16:01:13
|
Revision: 12158
http://sourceforge.net/p/foray/code/12158
Author: victormote
Date: 2021-12-01 16:01:10 +0000 (Wed, 01 Dec 2021)
Log Message:
-----------
Add manually-computed width values to test data, where known.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2021-12-01 14:31:10 UTC (rev 12157)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2021-12-01 16:01:10 UTC (rev 12158)
@@ -47,7 +47,8 @@
@Test
public void firstFitTestSingleLine() {
final ParaBranch4aTestFixture para = new ParaBranch4aTestFixture(null, '-');
- para.addWordAndSpace("Hello World!");
+ para.addWord("Hello World!");
+ para.addSpace();
para.setParaConfig(createGrimmParaConfig());
final ParaControl paraControl = createParaControl();
final LineBreakControl lbControl = createLineBreakControl(-1);
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-12-01 14:31:10 UTC (rev 12157)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-12-01 16:01:10 UTC (rev 12158)
@@ -70,156 +70,260 @@
* Creates the tokenized content of {@link #TEST_STRING_01}.
* We could use the orthography system to build this, but the line-breaking logic is independent of that, so we
* manually build it in this method.
+ * Where effort has been expended to manually compute indexes and widths, that work is shown, as it may be useful
+ * for testing or debugging in the future.
* @return The tokenized content of {@link #TEST_STRING_01}.
*/
public ParaBranch4a createPara() {
final ParaBranch4aTestFixture para = new ParaBranch4aTestFixture(null, '-');
-// Leaf Qty
-// Index Leaves
-// ------ ------
- para.add(new ParaBox4a(18)); // Empty box (indent) 0 1
- para.addWordAndSpace("In"); // 1 2
- para.addWordAndSpace("olden"); // 3 2
- para.addWordAndSpace("times"); // 5 2
- para.addWordAndSpace("when"); // 7 2
- para.addWordAndSpace("wish-ing"); // 2 segments 9 4
- para.addWordAndSpace("still"); // 13 2
- para.addWordAndSpace("helped"); // 15 2
- para.addWord("one"); // 17 1
- para.addNodeAndSpace(Punctuation4a.COMMA); // 18 2
- para.addWordAndSpace("there"); // 20 2
- para.addWordAndSpace("lived"); // 22 2
- para.addWordAndSpace("a"); // 24 2
- para.addWordAndSpace("king"); // 26 2
- para.addWordAndSpace("whose"); // 28 2
- para.addWordAndSpace("daugh-ters"); // 2 segments 30 4
- para.addWordAndSpace("were"); // 34 2
- para.addWordAndSpace("all"); // 36 2
- para.addWord("beau-ti-ful"); // 3 segments 38 5
- para.addNodeAndSpace(Punctuation4a.SEMICOLON); // 43 2
- para.addWordAndSpace("and"); // 45 2
- para.addWordAndSpace("the"); // 47 2
- para.addWordAndSpace("young-est"); // 2 segments 49 4
- para.addWordAndSpace("was"); // 53 2
- para.addWordAndSpace("so"); // 55 2
- para.addWordAndSpace("beau-ti-ful"); // 3 segments 57 6
- para.addWordAndSpace("that"); // 63 2
- para.addWordAndSpace("the"); // 65 2
- para.addWordAndSpace("sun"); // 67 2
- para.addWord("it-self"); // 2 segments 69 3
- para.addNodeAndSpace(Punctuation4a.COMMA); // 72 2
- para.addWordAndSpace("which"); // 74 2
- para.addWordAndSpace("has"); // 76 2
- para.addWordAndSpace("seen"); // 78 2
- para.addWordAndSpace("so"); // 80 2
- para.addWord("much"); // 82 1
- para.addNodeAndSpace(Punctuation4a.COMMA); // 83 2
- para.addWordAndSpace("was"); // 85 2
- para.addWordAndSpace("aston-ished"); // 2 segments 87 4
- para.addWordAndSpace("when-ever"); // 2 segments 91 4
- para.addWordAndSpace("it"); // 95 2
- para.addWordAndSpace("shone"); // 97 2
- para.addWordAndSpace("in"); // 99 2
- para.addWordAndSpace("her"); // 101 2
- para.addWord("face"); // 103 1
- para.addNodeAndSpace(Punctuation4a.PERIOD); // 104 2
- para.addWordAndSpace("Close"); // 106 2
- para.addWordAndSpace("by"); // 108 2
- para.addWordAndSpace("the"); // 110 2
- para.addWordAndSpace("king’s"); // 112 2
- para.addWordAndSpace("castle"); // 114 2
- para.addWordAndSpace("lay"); // 116 2
- para.addWordAndSpace("a"); // 118 2
- para.addWordAndSpace("great"); // 120 2
- para.addWordAndSpace("dark"); // 122 2
- para.addWord("for-est"); // 2 segments 124 3
- para.addNodeAndSpace(Punctuation4a.COMMA); // 127 2
- para.addWordAndSpace("and"); // 129 2
- para.addWordAndSpace("un-der"); // 2 segments 131 4
- para.addWordAndSpace("an"); // 135 2
- para.addWordAndSpace("old"); // 137 2
- para.addWord("lime"); // 139 1
- para.add(Punctuation4a.MANDATORY_HYPHEN); // 140 1
- para.add(new ParaPenalty4a(0, 50, true)); // 141 1
- para.addWordAndSpace("tree"); // 142 2
- para.addWordAndSpace("in"); // 144 2
- para.addWordAndSpace("the"); // 146 2
- para.addWordAndSpace("for-est"); // 2 segments 148 4
- para.addWordAndSpace("was"); // 152 2
- para.addWordAndSpace("a"); // 154 2
- para.addWord("well"); // 156 1
- para.addNodeAndSpace(Punctuation4a.COMMA); // 157 2
- para.addWordAndSpace("and"); // 159 2
- para.addWordAndSpace("when"); // 161 2
- para.addWordAndSpace("the"); // 163 2
- para.addWordAndSpace("day"); // 165 2
- para.addWordAndSpace("was"); // 167 2
- para.addWordAndSpace("very"); // 169 2
- para.addWord("warm"); // 171 1
- para.addNodeAndSpace(Punctuation4a.COMMA); // 172 2
- para.addWordAndSpace("the"); // 174 2
- para.addWordAndSpace("king’s"); // 176 2
- para.addWordAndSpace("child"); // 178 2
- para.addWordAndSpace("went"); // 180 2
- para.addWordAndSpace("out"); // 182 2
- para.addWordAndSpace("into"); // 184 2
- para.addWordAndSpace("the"); // 186 2
- para.addWordAndSpace("for-est"); // 2 segments 188 4
- para.addWordAndSpace("and"); // 192 2
- para.addWordAndSpace("sat"); // 194 2
- para.addWordAndSpace("down"); // 196 2
- para.addWordAndSpace("by"); // 198 2
- para.addWordAndSpace("the"); // 200 2
- para.addWordAndSpace("side"); // 202 2
- para.addWordAndSpace("of"); // 204 2
- para.addWordAndSpace("the"); // 206 2
- para.addWordAndSpace("cool"); // 208 2
- para.addWord("foun-tain"); // 2 segments 210 3
- para.addNodeAndSpace(Punctuation4a.SEMICOLON); // 213 2
- para.addWordAndSpace("and"); // 215 2
- para.addWordAndSpace("when"); // 217 2
- para.addWordAndSpace("she"); // 219 2
- para.addWordAndSpace("was"); // 221 2
- para.addWordAndSpace("bored"); // 223 2
- para.addWordAndSpace("she"); // 225 2
- para.addWordAndSpace("took"); // 227 2
- para.addWordAndSpace("a"); // 229 2
- para.addWordAndSpace("golden"); // 231 2
- para.addWord("ball"); // 233 1
- para.addNodeAndSpace(Punctuation4a.COMMA); // 234 2
- para.addWordAndSpace("and"); // 236 2
- para.addWordAndSpace("threw"); // 238 2
- para.addWordAndSpace("it"); // 240 2
- para.addWordAndSpace("up"); // 242 2
- para.addWordAndSpace("on"); // 244 2
- para.addWordAndSpace("high"); // 246 2
- para.addWordAndSpace("and"); // 248 2
- para.addWordAndSpace("caught"); // 250 2
- para.addWord("it"); // 252 1
- para.addNodeAndSpace(Punctuation4a.SEMICOLON); // 253 2
- para.addWordAndSpace("and"); // 255 2
- para.addWordAndSpace("this"); // 257 2
- para.addWordAndSpace("ball"); // 259 2
- para.addWordAndSpace("was"); // 261 2
- para.addWordAndSpace("her"); // 263 2
- para.addWordAndSpace("favor-ite"); // 2 segments 265 4
- para.addWord("play-thing"); // 2 segments 269 3
- para.add(Punctuation4a.PERIOD); // 272 1
- para.add(ParaPenalty4a.DISALLOWED_BREAK); // 273 1
- para.add(ParaGlue4a.FINISHING_GLUE); // 274 1
- para.add(ParaPenalty4a.FORCED_BREAK); // 275 1
+// ----Leaf--- Ideal Cumul
+// Index Qty Width Width
+// ------ --- ----- -----
+ para.add(new ParaBox4a(18)); // 0 1 18 18 Empty box (indent)
+ para.addWord("In"); // 1 1 16 34 6+10
+ para.addSpace(); // 2 1 6 40
+ para.addWord("olden"); // 3 1 42 82 9+5+10+8+10
+ para.addSpace(); // 4 1 6 88
+ para.addWord("times"); // 5 1 42 130 7+5+15+8+7
+ para.addSpace(); // 6 1 6 136
+ para.addWord("when"); // 7 1 41 177 13+10+8+10
+ para.addSpace(); // 8 1 6 183
+ para.addWord("wish-ing"); // 9 3 59 242 13+5+7+10 5+10+9
+ para.addSpace(); // 12 1 6 248
+ para.addWord("still"); // 13 1 29 277 7+7+5+5+5
+ para.addSpace(); // 14 1 6 283
+ para.addWord("helped"); // 15 1 51 334 10+8+5+10+8+10
+ para.addSpace(); // 16 1 6 340
+ para.addWord("one"); // 17 1 27 367 9+10+8
+ para.addNode(Punctuation4a.COMMA); // 18 1 5 372
+ para.addSpace(); // 19 1 6 378
+ para.addWord("there"); // 20 1 40 418 7+10+8+7+8
+ para.addSpace(); // 21 1 6 424
+ para.addWord("lived"); // 22 1 37 461 5+5+9+8+10
+ para.addSpace(); // 23 1 6 467
+ para.addWord("a"); // 24 1 9 476 9
+ para.addSpace(); // 25 1 6 482
+ para.addWord("king"); // 26 1 34 516 10+5+10+9
+ para.addSpace(); // 27 1 6 522
+ para.addWord("whose"); // 28 1 47 569 13+10+9+7+8
+ para.addSpace(); // 29 1 6 575
+ para.addWord("daugh-ters"); // 30 3 77 652 10+9+10+9+10 7+8+7+7
+ para.addSpace(); // 33 1 6 658
+ para.addWord("were"); // 34 1 36 694 13+8+7+8
+ para.addSpace(); // 35 1 6 700
+ para.addWord("all"); // 36 1 19 719 9+5+5
+ para.addSpace(); // 37 1 6 725
+ para.addWord("beau-ti-ful"); // 38 5 70 795 10+8+9+10 7+5 6+10+5
+ para.addNode(Punctuation4a.SEMICOLON); // 43 1 5 800
+ para.addSpace(); // 44 1 6 806
+ para.addWord("and"); // 45 1 29 835 9+10+10
+ para.addSpace(); // 46 1 6 841
+ para.addWord("the"); // 47 1 25 866 7+10+8
+ para.addSpace(); // 48 1 6 872
+ para.addWord("young-est"); // 49 3 60 932 10+9+10+10+9 8+7+7
+ para.addSpace(); // 52 1 6 938
+ para.addWord("was"); // 53 1 29 967 13+9+7
+ para.addSpace(); // 54 1 6 973
+ para.addWord("so"); // 55 1 16 989 7+9
+ para.addSpace(); // 56 1 6 995
+ para.addWord("beau-ti-ful"); // 57 5 70 1065 10+8+9+10 7+5 6+10+5
+ para.addSpace(); // 62 1 6 1071
+ para.addWord("that"); // 63 1 33 1104 7+10+9+7
+ para.addSpace(); // 64 1 6 1110
+ para.addWord("the"); // 65 1 25 1135 7+10+8
+ para.addSpace(); // 66 1 6 1141
+ para.addWord("sun"); // 67 1 27 1168 7+10+10
+ para.addSpace(); // 68 1 6 1174
+ para.addWord("it-self"); // 69 3
+ para.addNode(Punctuation4a.COMMA); // 72 1
+ para.addSpace(); // 73 1 6
+ para.addWord("which"); // 74 1
+ para.addSpace(); // 75 1 6
+ para.addWord("has"); // 76 1
+ para.addSpace(); // 77 1 6
+ para.addWord("seen"); // 78 1
+ para.addSpace(); // 79 1 6
+ para.addWord("so"); // 80 1
+ para.addSpace(); // 81 1 6
+ para.addWord("much"); // 82 1
+ para.addNode(Punctuation4a.COMMA); // 83 1
+ para.addSpace(); // 84 1 6
+ para.addWord("was"); // 85 1
+ para.addSpace(); // 86 1 6
+ para.addWord("aston-ished"); // 87 3
+ para.addSpace(); // 90 1 6
+ para.addWord("when-ever"); // 91 3
+ para.addSpace(); // 94 1 6
+ para.addWord("it"); // 95 1
+ para.addSpace(); // 96 1 6
+ para.addWord("shone"); // 97 1
+ para.addSpace(); // 98 1 6
+ para.addWord("in"); // 99 1
+ para.addSpace(); // 100 1 6
+ para.addWord("her"); // 101 1
+ para.addSpace(); // 102 1 6
+ para.addWord("face"); // 103 1
+ para.addNode(Punctuation4a.PERIOD); // 104 1
+ para.addSpace(); // 105 1 6
+ para.addWord("Close"); // 106 1
+ para.addSpace(); // 107 1 6
+ para.addWord("by"); // 108 1
+ para.addSpace(); // 109 1 6
+ para.addWord("the"); // 110 1
+ para.addSpace(); // 111 1 6
+ para.addWord("king’s"); // 112 1
+ para.addSpace(); // 113 1 6
+ para.addWord("castle"); // 114 1
+ para.addSpace(); // 115 1 6
+ para.addWord("lay"); // 116 1
+ para.addSpace(); // 117 1 6
+ para.addWord("a"); // 118 1
+ para.addSpace(); // 119 1 6
+ para.addWord("great"); // 120 1
+ para.addSpace(); // 121 1 6
+ para.addWord("dark"); // 122 1
+ para.addSpace(); // 123 1 6
+ para.addWord("for-est"); // 124 3
+ para.addNode(Punctuation4a.COMMA); // 127 1
+ para.addSpace(); // 128 1 6
+ para.addWord("and"); // 129 1
+ para.addSpace(); // 130 1 6
+ para.addWord("un-der"); // 131 3
+ para.addSpace(); // 134 1 6
+ para.addWord("an"); // 135 1
+ para.addSpace(); // 136 1 6
+ para.addWord("old"); // 137 1
+ para.addSpace(); // 138 1 6
+ para.addWord("lime"); // 139 1
+ para.add(Punctuation4a.MANDATORY_HYPHEN); // 140 1
+ para.add(new ParaPenalty4a(0, 50, true)); // 141 1
+ para.addWord("tree"); // 142 1
+ para.addSpace(); // 143 1 6
+ para.addWord("in"); // 144 1
+ para.addSpace(); // 145 1 6
+ para.addWord("the"); // 146 1
+ para.addSpace(); // 147 1 6
+ para.addWord("for-est"); // 148 3
+ para.addSpace(); // 151 1 6
+ para.addWord("was"); // 152 1
+ para.addSpace(); // 153 1 6
+ para.addWord("a"); // 154 1
+ para.addSpace(); // 155 1 6
+ para.addWord("well"); // 156 1
+ para.addNode(Punctuation4a.COMMA); // 157 1
+ para.addSpace(); // 158 1 6
+ para.addWord("and"); // 159 1
+ para.addSpace(); // 160 1 6
+ para.addWord("when"); // 161 1
+ para.addSpace(); // 162 1 6
+ para.addWord("the"); // 163 1
+ para.addSpace(); // 164 1 6
+ para.addWord("day"); // 165 1
+ para.addSpace(); // 166 1 6
+ para.addWord("was"); // 167 1
+ para.addSpace(); // 168 1 6
+ para.addWord("very"); // 169 1
+ para.addSpace(); // 170 1 6
+ para.addWord("warm"); // 171 1
+ para.addNode(Punctuation4a.COMMA); // 172 1
+ para.addSpace(); // 173 1 6
+ para.addWord("the"); // 174 1
+ para.addSpace(); // 175 1 6
+ para.addWord("king’s"); // 176 1
+ para.addSpace(); // 177 1 6
+ para.addWord("child"); // 178 1
+ para.addSpace(); // 179 1 6
+ para.addWord("went"); // 180 1
+ para.addSpace(); // 181 1 6
+ para.addWord("out"); // 182 1
+ para.addSpace(); // 183 1 6
+ para.addWord("into"); // 184 1
+ para.addSpace(); // 185 1 6
+ para.addWord("the"); // 186 1
+ para.addSpace(); // 187 1 6
+ para.addWord("for-est"); // 188 3
+ para.addSpace(); // 191 1 6
+ para.addWord("and"); // 192 1
+ para.addSpace(); // 193 1 6
+ para.addWord("sat"); // 194 1
+ para.addSpace(); // 195 1 6
+ para.addWord("down"); // 196 1
+ para.addSpace(); // 197 1 6
+ para.addWord("by"); // 198 1
+ para.addSpace(); // 199 1 6
+ para.addWord("the"); // 200 1
+ para.addSpace(); // 201 1 6
+ para.addWord("side"); // 202 1
+ para.addSpace(); // 203 1 6
+ para.addWord("of"); // 204 1
+ para.addSpace(); // 205 1 6
+ para.addWord("the"); // 206 1
+ para.addSpace(); // 207 1 6
+ para.addWord("cool"); // 208 1
+ para.addSpace(); // 209 1 6
+ para.addWord("foun-tain"); // 210 3
+ para.addNode(Punctuation4a.SEMICOLON); // 213 1
+ para.addSpace(); // 214 1 6
+ para.addWord("and"); // 215 1
+ para.addSpace(); // 216 1 6
+ para.addWord("when"); // 217 1
+ para.addSpace(); // 218 1 6
+ para.addWord("she"); // 219 1
+ para.addSpace(); // 220 1 6
+ para.addWord("was"); // 221 1
+ para.addSpace(); // 222 1 6
+ para.addWord("bored"); // 223 1
+ para.addSpace(); // 224 1 6
+ para.addWord("she"); // 225 1
+ para.addSpace(); // 226 1 6
+ para.addWord("took"); // 227 1
+ para.addSpace(); // 228 1 6
+ para.addWord("a"); // 229 1
+ para.addSpace(); // 230 1 6
+ para.addWord("golden"); // 231 1
+ para.addSpace(); // 232 1 6
+ para.addWord("ball"); // 233 1
+ para.addNode(Punctuation4a.COMMA); // 234 1
+ para.addSpace(); // 235 1 6
+ para.addWord("and"); // 236 1
+ para.addSpace(); // 237 1 6
+ para.addWord("threw"); // 238 1
+ para.addSpace(); // 239 1 6
+ para.addWord("it"); // 240 1
+ para.addSpace(); // 241 1 6
+ para.addWord("up"); // 242 1
+ para.addSpace(); // 243 1 6
+ para.addWord("on"); // 244 1
+ para.addSpace(); // 245 1 6
+ para.addWord("high"); // 246 1
+ para.addSpace(); // 247 1 6
+ para.addWord("and"); // 248 1
+ para.addSpace(); // 249 1 6
+ para.addWord("caught"); // 250 1
+ para.addSpace(); // 251 1 6
+ para.addWord("it"); // 252 1
+ para.addNode(Punctuation4a.SEMICOLON); // 253 1
+ para.addSpace(); // 254 1 6
+ para.addWord("and"); // 255 1
+ para.addSpace(); // 256 1 6
+ para.addWord("this"); // 257 1
+ para.addSpace(); // 258 1 6
+ para.addWord("ball"); // 259 1
+ para.addSpace(); // 260 1 6
+ para.addWord("was"); // 261 1
+ para.addSpace(); // 262 1 6
+ para.addWord("her"); // 263 1
+ para.addSpace(); // 264 1 6
+ para.addWord("favor-ite"); // 265 3
+ para.addSpace(); // 268 1 6
+ para.addWord("play-thing"); // 269 3
+ para.add(Punctuation4a.PERIOD); // 272 1
+ para.add(ParaPenalty4a.DISALLOWED_BREAK); // 273 1
+ para.add(ParaGlue4a.FINISHING_GLUE); // 274 1
+ para.add(ParaPenalty4a.FORCED_BREAK); // 275 1
- /* The tokenized text treated "’s" as part of the attached word.
- * The compound word "lime-tree" was treated as two words divided by punctuation.
- * There are 131 lines of code creating the para.
- * Count Nodes
- * addWord 13 13
- * addNodeAndSpace 11 22
- * add 7 7
- * addWordAndSpace (forced) 100 200
- * ----- -----
- * totals 131 242
- * ===== ===== */
+ /* There are 242 lines of code creating the paragraph.
+ * Each of them adds exactly one node. */
Assert.assertEquals(242, para.paraNodeSize());
/* Of the words added, 13 are two-syllable, and 2 are three-syllable.
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java 2021-12-01 14:31:10 UTC (rev 12157)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/ParaBranch4aTestFixture.java 2021-12-01 16:01:10 UTC (rev 12158)
@@ -59,15 +59,6 @@
* Add a word and space to this dictionary.
* @param wordChars The characters in the word, including raw hyphenation points, e.g. "run-ning", "ap-ple", etc.
*/
- public void addWordAndSpace(final CharSequence wordChars) {
- addWord(wordChars);
- this.add(Whitespace4a.SPACE);
- }
-
- /**
- * Add a word and space to this dictionary.
- * @param wordChars The characters in the word, including raw hyphenation points, e.g. "run-ning", "ap-ple", etc.
- */
public void addWord(final CharSequence wordChars) {
final char partsOfSpeech = 0;
final String[] components = this.wordBreaker.split(wordChars);
@@ -75,9 +66,12 @@
this.add(word);
}
- public void addNodeAndSpace(final ParaNode node) {
- this.add(node);
+ public void addSpace() {
this.add(Whitespace4a.SPACE);
}
+ public void addNode(final ParaNode node) {
+ this.add(node);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-01 14:31:13
|
Revision: 12157
http://sourceforge.net/p/foray/code/12157
Author: victormote
Date: 2021-12-01 14:31:10 +0000 (Wed, 01 Dec 2021)
Log Message:
-----------
Minor changes for consistency.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-12-01 13:43:49 UTC (rev 12156)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-12-01 14:31:10 UTC (rev 12157)
@@ -163,6 +163,20 @@
}
/**
+ * Clears and resets all provisional content back to an empty, original state.
+ */
+ private void clearProvisionalContent() {
+ provisionalGlue.clear();
+ provisionalNonGlue.clear();
+
+ provisionalGlueIdealWidth = 0;
+ provisionalGlueShrinkability = 0;
+ provisionalGlueStretchability = 0;
+
+ provisionalNonGlueIdealWidth = 0;
+ }
+
+ /**
* Convert the provisional glue and provisional non-glue items to line content.
*/
private void acceptProvisionalWord() {
@@ -174,12 +188,7 @@
currentLineContent.addAll(provisionalGlue);
currentLineContent.addAll(provisionalNonGlue);
- provisionalGlue.clear();
- provisionalNonGlue.clear();
- provisionalGlueIdealWidth = 0;
- provisionalNonGlueIdealWidth = 0;
- provisionalGlueShrinkability = 0;
- provisionalGlueStretchability = 0;
+ clearProvisionalContent();
}
/**
@@ -203,27 +212,33 @@
* Creates a line break with whatever content is already accepted onto the current line.
*/
private void markBreakpointInternal() {
- final int base = this.breakpoints.empty() ? 0 : this.breakpoints.peek();
/* Don't create another line break if there is already one at the same location. */
if (this.currentLineContent.size() > 0) {
+ final int base = this.breakpoints.empty() ? 0 : this.breakpoints.peek();
final int newBreakpoint = base + this.currentLineContent.size();
this.breakpoints.append(newBreakpoint);
- this.currentLineContent.clear();
}
}
/**
+ * Clears the line and related accumulators, and sets up a new line.
+ */
+ private void resetLine() {
+ this.currentLineContent.clear();
+ this.currentLineIdealWidth = 0;
+ this.currentLineShrinkability = 0;
+ this.currentLineStretchability = 0;
+ this.currentLineNumber ++;
+ this.currentLine = this.lbControl.getOutputLine(currentLineNumber);
+ }
+
+ /**
* Creates a line break for the content already accepted onto the line.
*/
private void markEndOfLine() {
markBreakpointInternal();
- this.currentLineNumber ++;
- this.currentLine = this.lbControl.getOutputLine(currentLineNumber);
+ resetLine();
- this.currentLineIdealWidth = 0;
- this.currentLineShrinkability = 0;
- this.currentLineStretchability = 0;
-
/* Accept any provisional content onto the new line. */
this.acceptProvisionalWord();
}
@@ -240,10 +255,7 @@
+ provisionalIndex;
this.breakpoints.append(newBreakpoint);
- this.currentLineContent.clear();
- this.currentLineIdealWidth = 0;
- this.currentLineShrinkability = 0;
- this.currentLineStretchability = 0;
+ resetLine();
/* Copy the portion of the provisional word that was pushed to the next line. */
for (int index = provisionalIndex; index < this.provisionalNonGlue.size(); index ++) {
@@ -251,12 +263,7 @@
this.currentLineContent.add(leaf);
}
- this.provisionalGlue.clear();
- this.provisionalGlueIdealWidth = 0;
- this.provisionalGlueShrinkability = 0;
- this.provisionalGlueStretchability = 0;
- this.provisionalNonGlue.clear();
- this.provisionalNonGlueIdealWidth = 0;
+ this.clearProvisionalContent();
}
/**
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2021-12-01 13:43:49 UTC (rev 12156)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2021-12-01 14:31:10 UTC (rev 12157)
@@ -62,8 +62,6 @@
*/
@Test
public void firstFitTestGrimm() {
- /* TODO: THE CLASS BEING TESTED IS VERY INCOMPLETE, AND SO IS THIS TEST !!!!!! */
-
final ParaBranch4a para = this.createPara();
para.setParaConfig(createGrimmParaConfig());
final ParaControl paraControl = createParaControl();
@@ -73,7 +71,6 @@
final FirstFitLb out = new FirstFitLb();
final int[] actual = out.breakIntoLines(para, paraControl, lbControl);
-
final int[] expected = new int[] {19, 42, 68, 90, 113, 138, 164, 185, 209, 230, 254, 276};
Assert.assertArrayEquals(expected, actual);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-01 13:43:50
|
Revision: 12156
http://sourceforge.net/p/foray/code/12156
Author: victormote
Date: 2021-12-01 13:43:49 +0000 (Wed, 01 Dec 2021)
Log Message:
-----------
Get all first-fit tests to pass.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-12-01 00:24:27 UTC (rev 12155)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-12-01 13:43:49 UTC (rev 12156)
@@ -77,7 +77,7 @@
/** The array of breakpoints for the paragraph. */
private IntArrayBuilder breakpoints = new IntArrayBuilder(BREAKPOINTS_INIT_SIZE);
- /** The 1-based line number of the layout for this paragraphy. */
+ /** The 1-based line number of the layout for this paragraph. */
private int currentLineNumber;
/** The line onto which the next line of output from this line-breaker should be placed. */
@@ -138,6 +138,10 @@
this.currentLine = lbControl.getOutputLine(currentLineNumber);
}
+ /**
+ * Provisionally add a box or penalty item to the content.
+ * @param leaf The box or penalty item to be added.
+ */
private void addProvisionalNonGlue(final ParaLeaf leaf) {
provisionalNonGlue.add(leaf);
/* Do not include the width of penalty items. */
@@ -147,6 +151,10 @@
}
}
+ /**
+ * Provisionally add a glue item to the content.
+ * @param glue The glue item to be added.
+ */
private void addProvisionalGlue(final ParaGlue glue) {
provisionalGlue.add(glue);
provisionalGlueIdealWidth += glue.getWidth(paraConfig);
@@ -154,6 +162,9 @@
provisionalGlueStretchability += glue.getStretchability(paraConfig);
}
+ /**
+ * Convert the provisional glue and provisional non-glue items to line content.
+ */
private void acceptProvisionalWord() {
currentLineIdealWidth += provisionalGlueIdealWidth;
currentLineIdealWidth += provisionalNonGlueIdealWidth;
@@ -171,22 +182,39 @@
provisionalGlueStretchability = 0;
}
+ /**
+ * Compute the current width of the accepted line content, using its ideal width.
+ * @return The ideal current width of the accepted line content, in millipoints.
+ */
private int idealProvisionalLineWidth() {
return currentLineIdealWidth + provisionalGlueIdealWidth + provisionalNonGlueIdealWidth;
}
+ /**
+ * Compute the current width of the accepted line content, using its minimum width, i.e. using all of its
+ * shrinkability.
+ * @return The current minimum of the accepted line content.
+ */
private int minProvisionalLineWidth() {
return idealProvisionalLineWidth() - currentLineShrinkability - provisionalGlueShrinkability;
}
+ /**
+ * Creates a line break with whatever content is already accepted onto the current line.
+ */
private void markBreakpointInternal() {
final int base = this.breakpoints.empty() ? 0 : this.breakpoints.peek();
- final int newBreakpoint = base + this.currentLineContent.size();
- this.breakpoints.append(newBreakpoint);
-
- this.currentLineContent.clear();
+ /* Don't create another line break if there is already one at the same location. */
+ if (this.currentLineContent.size() > 0) {
+ final int newBreakpoint = base + this.currentLineContent.size();
+ this.breakpoints.append(newBreakpoint);
+ this.currentLineContent.clear();
+ }
}
+ /**
+ * Creates a line break for the content already accepted onto the line.
+ */
private void markEndOfLine() {
markBreakpointInternal();
this.currentLineNumber ++;
@@ -200,6 +228,12 @@
this.acceptProvisionalWord();
}
+ /**
+ * Creates a line break for the content already accepted onto the line, plus some part of the provisional
+ * content.
+ * @param provisionalIndex The index into the provisional content that marks how much of it should be included
+ * on the current line.
+ */
private void markEndOfLine(final int provisionalIndex) {
final int base = this.breakpoints.empty() ? 0 : this.breakpoints.peek();
final int newBreakpoint = base + this.currentLineContent.size() + this.provisionalGlue.size()
@@ -225,6 +259,9 @@
this.provisionalNonGlueIdealWidth = 0;
}
+ /**
+ * Marks the end of the paragraph by creating a line break there if one has not already been created there.
+ */
private void markEndOfParagraph() {
markBreakpointInternal();
}
@@ -244,6 +281,16 @@
final ListIterator<ParaLeaf> leafIterator = paragraph.iterator();
while (leafIterator.hasNext()) {
final ParaLeaf leaf = leafIterator.next();
+ final ParaPenalty penalty = leaf.asParaPenalty();
+ if (penalty != null
+ && penalty.getCost(paraControl) <= ParaPenalty.FORCED_BREAK) {
+ /* This is a forced line break. */
+ state.addProvisionalNonGlue(leaf);
+ state.acceptProvisionalWord();
+ state.markEndOfLine();
+ continue;
+ }
+
final ParaGlue glue = leaf.asParaGlue();
if (glue == null) {
/* This is non-glue word content. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-12-01 00:24:30
|
Revision: 12155
http://sourceforge.net/p/foray/code/12155
Author: victormote
Date: 2021-12-01 00:24:27 +0000 (Wed, 01 Dec 2021)
Log Message:
-----------
Improvements to first-fit line breaking and related tests.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-11-30 17:48:14 UTC (rev 12154)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-12-01 00:24:27 UTC (rev 12155)
@@ -121,14 +121,19 @@
/** The line-break control. */
private LineBreakControl lbControl;
+ /** The paragraphy control. */
+ private ParaControl paraControl;
+
/**
* Constructor.
* @param paraConfig The configuration of the paragraph being processed.
* @param lbControl The linebreak control instance.
+ * @param paraControl The paragraphy control instance.
*/
- private State(final ParaConfig paraConfig, final LineBreakControl lbControl) {
+ private State(final ParaConfig paraConfig, final LineBreakControl lbControl, final ParaControl paraControl) {
this.paraConfig = paraConfig;
this.lbControl = lbControl;
+ this.paraControl = paraControl;
this.currentLineNumber = 1;
this.currentLine = lbControl.getOutputLine(currentLineNumber);
}
@@ -191,12 +196,6 @@
this.currentLineShrinkability = 0;
this.currentLineStretchability = 0;
- /* Clear any provisional glue. */
- this.provisionalGlue.clear();
- this.provisionalGlueIdealWidth = 0;
- this.provisionalGlueStretchability = 0;
- this.provisionalGlueShrinkability = 0;
-
/* Accept any provisional content onto the new line. */
this.acceptProvisionalWord();
}
@@ -203,15 +202,27 @@
private void markEndOfLine(final int provisionalIndex) {
final int base = this.breakpoints.empty() ? 0 : this.breakpoints.peek();
- final int newBreakpoint = base + this.currentLineContent.size() + provisionalIndex;
+ final int newBreakpoint = base + this.currentLineContent.size() + this.provisionalGlue.size()
+ + provisionalIndex;
this.breakpoints.append(newBreakpoint);
this.currentLineContent.clear();
+ this.currentLineIdealWidth = 0;
+ this.currentLineShrinkability = 0;
+ this.currentLineStretchability = 0;
+
/* Copy the portion of the provisional word that was pushed to the next line. */
for (int index = provisionalIndex; index < this.provisionalNonGlue.size(); index ++) {
final ParaLeaf leaf = this.provisionalNonGlue.get(index);
this.currentLineContent.add(leaf);
}
+
+ this.provisionalGlue.clear();
+ this.provisionalGlueIdealWidth = 0;
+ this.provisionalGlueShrinkability = 0;
+ this.provisionalGlueStretchability = 0;
+ this.provisionalNonGlue.clear();
+ this.provisionalNonGlueIdealWidth = 0;
}
private void markEndOfParagraph() {
@@ -228,7 +239,7 @@
* together are the current word, and (d) is the beginning of the next word. */
final ParaConfig paraConfig = paragraph.getParaConfig();
- final State state = new State(paraConfig, lbControl);
+ final State state = new State(paraConfig, lbControl, paraControl);
final ListIterator<ParaLeaf> leafIterator = paragraph.iterator();
while (leafIterator.hasNext()) {
@@ -289,12 +300,18 @@
final ParaLeaf leaf = state.provisionalNonGlue.get(index);
final ParaPenalty penalty = leaf.asParaPenalty();
if (penalty == null) {
+ /* This is block content might get pushed to the next line. */
idealWidthToNextLine += leaf.getWidth(state.paraConfig);
} else {
+ /* This is a penalty item. */
+ /* Are we allowed to break here. */
+ if (penalty.getCost(state.paraControl) >= ParaPenalty.INFINITE_PENALTY) {
+
+ }
if (state.minProvisionalLineWidth() - idealWidthToNextLine + penalty.getWidth(state.paraConfig)
<= currentLine.capacityTotal()) {
- /* This is the breakpoint we want. */
- state.markEndOfLine(index);
+ /* This is the breakpoint we want. However, we need to break after this breakpoint. */
+ state.markEndOfLine(index + 1);
return;
}
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-30 17:48:14 UTC (rev 12154)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-12-01 00:24:27 UTC (rev 12155)
@@ -137,6 +137,7 @@
*/
public static MockFont createGrimmFont(final double conversion) {
final MockFont font = createMonotypeFont(conversion);
+ font.setWidth('-', (int) (conversion * 6));
font.setWidth(';', (int) (conversion * 5));
font.setWidth('I', (int) (conversion * 6));
font.setWidth('v', (int) (conversion * 9));
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-11-30 17:48:14 UTC (rev 12154)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-12-01 00:24:27 UTC (rev 12155)
@@ -203,11 +203,11 @@
para.addWordAndSpace("was"); // 261 2
para.addWordAndSpace("her"); // 263 2
para.addWordAndSpace("favor-ite"); // 2 segments 265 4
- para.addWord("play-thing"); // 2 segments 269 4
- para.add(Punctuation4a.PERIOD); // 273 1
- para.add(ParaPenalty4a.DISALLOWED_BREAK); // 274 1
- para.add(ParaGlue4a.FINISHING_GLUE); // 275 1
- para.add(ParaPenalty4a.FORCED_BREAK); // 276 1
+ para.addWord("play-thing"); // 2 segments 269 3
+ para.add(Punctuation4a.PERIOD); // 272 1
+ para.add(ParaPenalty4a.DISALLOWED_BREAK); // 273 1
+ para.add(ParaGlue4a.FINISHING_GLUE); // 274 1
+ para.add(ParaPenalty4a.FORCED_BREAK); // 275 1
/* The tokenized text treated "’s" as part of the attached word.
* The compound word "lime-tree" was treated as two words divided by punctuation.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-30 18:03:40
|
Revision: 12154
http://sourceforge.net/p/foray/code/12154
Author: victormote
Date: 2021-11-30 17:48:14 +0000 (Tue, 30 Nov 2021)
Log Message:
-----------
Improvements to first-fit class and related test infrastructure.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-11-30 14:10:03 UTC (rev 12153)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2021-11-30 17:48:14 UTC (rev 12154)
@@ -135,12 +135,16 @@
private void addProvisionalNonGlue(final ParaLeaf leaf) {
provisionalNonGlue.add(leaf);
- final int leafWidth = leaf.getWidth(paraConfig);
- provisionalNonGlueIdealWidth += leafWidth;
+ /* Do not include the width of penalty items. */
+ if (leaf.getParaLeafType() == ParaLeaf.Type.BOX) {
+ final int leafWidth = leaf.getWidth(paraConfig);
+ provisionalNonGlueIdealWidth += leafWidth;
+ }
}
private void addProvisionalGlue(final ParaGlue glue) {
provisionalGlue.add(glue);
+ provisionalGlueIdealWidth += glue.getWidth(paraConfig);
provisionalGlueShrinkability += glue.getShrinkability(paraConfig);
provisionalGlueStretchability += glue.getStretchability(paraConfig);
}
@@ -150,10 +154,16 @@
currentLineIdealWidth += provisionalNonGlueIdealWidth;
currentLineShrinkability += provisionalGlueShrinkability;
currentLineStretchability += provisionalGlueStretchability;
+
currentLineContent.addAll(provisionalGlue);
currentLineContent.addAll(provisionalNonGlue);
+
provisionalGlue.clear();
provisionalNonGlue.clear();
+ provisionalGlueIdealWidth = 0;
+ provisionalNonGlueIdealWidth = 0;
+ provisionalGlueShrinkability = 0;
+ provisionalGlueStretchability = 0;
}
private int idealProvisionalLineWidth() {
@@ -168,6 +178,7 @@
final int base = this.breakpoints.empty() ? 0 : this.breakpoints.peek();
final int newBreakpoint = base + this.currentLineContent.size();
this.breakpoints.append(newBreakpoint);
+
this.currentLineContent.clear();
}
@@ -175,6 +186,19 @@
markBreakpointInternal();
this.currentLineNumber ++;
this.currentLine = this.lbControl.getOutputLine(currentLineNumber);
+
+ this.currentLineIdealWidth = 0;
+ this.currentLineShrinkability = 0;
+ this.currentLineStretchability = 0;
+
+ /* Clear any provisional glue. */
+ this.provisionalGlue.clear();
+ this.provisionalGlueIdealWidth = 0;
+ this.provisionalGlueStretchability = 0;
+ this.provisionalGlueShrinkability = 0;
+
+ /* Accept any provisional content onto the new line. */
+ this.acceptProvisionalWord();
}
private void markEndOfLine(final int provisionalIndex) {
@@ -211,9 +235,10 @@
final ParaLeaf leaf = leafIterator.next();
final ParaGlue glue = leaf.asParaGlue();
if (glue == null) {
- /* This is word content. */
+ /* This is non-glue word content. */
state.addProvisionalNonGlue(leaf);
} else {
+ /* This is glue. */
if (state.provisionalNonGlue.size() < 1) {
/* This is glue at the beginning of a provisional "word." */
state.addProvisionalGlue(glue);
@@ -223,9 +248,12 @@
if (state.idealProvisionalLineWidth() <= state.currentLine.capacityTotal()) {
/* Provisional word fits into the line using ideal widths. */
state.acceptProvisionalWord();
+ /* Now add this glue. */
+ state.addProvisionalGlue(glue);
} else {
/* Provisional word does not fit into the line using ideal widths. */
processEndOfLine(state, state.currentLine);
+ state.addProvisionalGlue(glue);
}
}
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2021-11-30 14:10:03 UTC (rev 12153)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2021-11-30 17:48:14 UTC (rev 12154)
@@ -28,15 +28,12 @@
package org.foray.linebreak;
-import org.foray.common.WellKnownConstants;
import org.foray.common.para.ParaBranch4a;
-import org.foray.font.util.MockFont;
import org.axsl.common.para.ParaControl;
import org.axsl.linebreak.LineBreakControl;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -51,7 +48,7 @@
public void firstFitTestSingleLine() {
final ParaBranch4aTestFixture para = new ParaBranch4aTestFixture(null, '-');
para.addWordAndSpace("Hello World!");
- para.setParaConfig(createMonotypeParaConfig());
+ para.setParaConfig(createGrimmParaConfig());
final ParaControl paraControl = createParaControl();
final LineBreakControl lbControl = createLineBreakControl(-1);
final FirstFitLb out = new FirstFitLb();
@@ -64,18 +61,14 @@
* A test of the Grimm paragraph.
*/
@Test
- @Ignore
public void firstFitTestGrimm() {
/* TODO: THE CLASS BEING TESTED IS VERY INCOMPLETE, AND SO IS THIS TEST !!!!!! */
final ParaBranch4a para = this.createPara();
- para.setParaConfig(createMonotypeParaConfig());
+ para.setParaConfig(createGrimmParaConfig());
final ParaControl paraControl = createParaControl();
- /* Line width obtained from "Digital Typography," p. 73.*/
- final int lineWidth = (int)
- (390
- * (FONT_SIZE / WellKnownConstants.MILLIPOINTS_PER_POINT)
- * MockFont.MILLIPOINTS_PER_MONOTYPE_UNIT);
+ /* Line width obtained from "Digital Typography," p. 73. We leave it expressed here in Monotype "units". */
+ final int lineWidth = 390;
final LineBreakControl lbControl = createLineBreakControl(lineWidth);
final FirstFitLb out = new FirstFitLb();
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-30 14:10:03 UTC (rev 12153)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-30 17:48:14 UTC (rev 12154)
@@ -41,17 +41,18 @@
/**
* Private constructor. This class should never be instantiated.
*/
- private LbTestUtilities() {
- }
+ private LbTestUtilities() { }
/**
* Creates a mock font that knows some metrics for Monotype equipment.
+ * @param conversion A conversion factor to be applied to the raw Monotype "unit," allowing those units to be
+ * converted to another scheme such as millipoints.
* @return A mock font suitable for emulating Monotype equipment.
* @see <a href="https://books.google.com/books/download/The_monotype_system.pdf?id=6kU5AAAAMAAJ&output=pdf">1912,
* The Monotype System, Philadelphia, Lanston Monotype Machine Co.</a>
* @see "1999, Digital Typography, Chapter 3, page 75, table 1, for the values documented by Knuth-Plass."
*/
- public static MockFont createMonotypeFont() {
+ public static MockFont createMonotypeFont(final double conversion) {
/* The Knuth-Plass values listed were obtained from Chapter 3 of Digital Typography. They do not appear in the
* original 1981 article.
* By using the the referenced table in "The Monotype System", we have added the missing capitals that were not
@@ -64,68 +65,83 @@
/* It is unclear from the table in the Monotype manual what the width of a "normal" space is. Knuth uses 6 in
* most cases, but 8 after a period. */
- font.setMonotypeWidth(' ', 6);
- font.setMonotypeWidth('’', 5);
- font.setMonotypeWidth(',', 5);
- font.setMonotypeWidth('-', 5);
- font.setMonotypeWidth('.', 5);
- font.setMonotypeWidth(';', 6); // Knuth-Plass shows ";" as 5. Unclear which value they actually used.
+ font.setWidth(' ', (int) (conversion * 6));
+ font.setWidth('’', (int) (conversion * 5));
+ font.setWidth(',', (int) (conversion * 5));
+ font.setWidth('-', (int) (conversion * 5));
+ font.setWidth('.', (int) (conversion * 5));
+ font.setWidth(';', (int) (conversion * 6));
- font.setMonotypeWidth('A', 13);
- font.setMonotypeWidth('B', 13);
- font.setMonotypeWidth('C', 13);
- font.setMonotypeWidth('D', 14);
- font.setMonotypeWidth('E', 13);
- font.setMonotypeWidth('F', 12);
- font.setMonotypeWidth('G', 14);
- font.setMonotypeWidth('H', 15);
- font.setMonotypeWidth('I', 8); // Knuth-Plass shows "I" as 6. Unclear which value they actually used.
- font.setMonotypeWidth('J', 9);
- font.setMonotypeWidth('K', 15);
- font.setMonotypeWidth('L', 12);
- font.setMonotypeWidth('M', 18);
- font.setMonotypeWidth('N', 15);
- font.setMonotypeWidth('O', 13);
- font.setMonotypeWidth('P', 12);
- font.setMonotypeWidth('Q', 13);
- font.setMonotypeWidth('R', 14);
- font.setMonotypeWidth('S', 10);
- font.setMonotypeWidth('T', 13);
- font.setMonotypeWidth('U', 14);
- font.setMonotypeWidth('V', 13);
- font.setMonotypeWidth('W', 18);
- font.setMonotypeWidth('X', 15);
- font.setMonotypeWidth('Y', 14);
- font.setMonotypeWidth('Z', 11);
+ font.setWidth('A', (int) (conversion * 13));
+ font.setWidth('B', (int) (conversion * 13));
+ font.setWidth('C', (int) (conversion * 13));
+ font.setWidth('D', (int) (conversion * 14));
+ font.setWidth('E', (int) (conversion * 13));
+ font.setWidth('F', (int) (conversion * 12));
+ font.setWidth('G', (int) (conversion * 14));
+ font.setWidth('H', (int) (conversion * 15));
+ font.setWidth('I', (int) (conversion * 8));
+ font.setWidth('J', (int) (conversion * 9));
+ font.setWidth('K', (int) (conversion * 15));
+ font.setWidth('L', (int) (conversion * 12));
+ font.setWidth('M', (int) (conversion * 18));
+ font.setWidth('N', (int) (conversion * 15));
+ font.setWidth('O', (int) (conversion * 13));
+ font.setWidth('P', (int) (conversion * 12));
+ font.setWidth('Q', (int) (conversion * 13));
+ font.setWidth('R', (int) (conversion * 14));
+ font.setWidth('S', (int) (conversion * 10));
+ font.setWidth('T', (int) (conversion * 13));
+ font.setWidth('U', (int) (conversion * 14));
+ font.setWidth('V', (int) (conversion * 13));
+ font.setWidth('W', (int) (conversion * 18));
+ font.setWidth('X', (int) (conversion * 15));
+ font.setWidth('Y', (int) (conversion * 14));
+ font.setWidth('Z', (int) (conversion * 11));
- font.setMonotypeWidth('a', 9);
- font.setMonotypeWidth('b', 10);
- font.setMonotypeWidth('c', 8);
- font.setMonotypeWidth('d', 10);
- font.setMonotypeWidth('e', 8);
- font.setMonotypeWidth('f', 6);
- font.setMonotypeWidth('g', 9);
- font.setMonotypeWidth('h', 10);
- font.setMonotypeWidth('i', 5);
- font.setMonotypeWidth('j', 6);
- font.setMonotypeWidth('k', 10);
- font.setMonotypeWidth('l', 5);
- font.setMonotypeWidth('m', 15);
- font.setMonotypeWidth('n', 10);
- font.setMonotypeWidth('o', 9);
- font.setMonotypeWidth('p', 10);
- font.setMonotypeWidth('q', 10);
- font.setMonotypeWidth('r', 7);
- font.setMonotypeWidth('s', 7);
- font.setMonotypeWidth('t', 7);
- font.setMonotypeWidth('u', 10);
- font.setMonotypeWidth('v', 10); // Knuth-Plass shows "v" as 9. Unclear which value they actually used.
- font.setMonotypeWidth('w', 13);
- font.setMonotypeWidth('x', 9); // Knuth-Plass shows "x" as 10. However, it is not used in their example.
- font.setMonotypeWidth('y', 10);
- font.setMonotypeWidth('z', 8);
+ font.setWidth('a', (int) (conversion * 9));
+ font.setWidth('b', (int) (conversion * 10));
+ font.setWidth('c', (int) (conversion * 8));
+ font.setWidth('d', (int) (conversion * 10));
+ font.setWidth('e', (int) (conversion * 8));
+ font.setWidth('f', (int) (conversion * 6));
+ font.setWidth('g', (int) (conversion * 9));
+ font.setWidth('h', (int) (conversion * 10));
+ font.setWidth('i', (int) (conversion * 5));
+ font.setWidth('j', (int) (conversion * 6));
+ font.setWidth('k', (int) (conversion * 10));
+ font.setWidth('l', (int) (conversion * 5));
+ font.setWidth('m', (int) (conversion * 15));
+ font.setWidth('n', (int) (conversion * 10));
+ font.setWidth('o', (int) (conversion * 9));
+ font.setWidth('p', (int) (conversion * 10));
+ font.setWidth('q', (int) (conversion * 10));
+ font.setWidth('r', (int) (conversion * 7));
+ font.setWidth('s', (int) (conversion * 7));
+ font.setWidth('t', (int) (conversion * 7));
+ font.setWidth('u', (int) (conversion * 10));
+ font.setWidth('v', (int) (conversion * 10));
+ font.setWidth('w', (int) (conversion * 13));
+ font.setWidth('x', (int) (conversion * 9));
+ font.setWidth('y', (int) (conversion * 10));
+ font.setWidth('z', (int) (conversion * 8));
return font;
}
+ /**
+ * Creates a Monotype font and adjusts it for differences between it and the values used by Knuth-Plass.
+ * @param conversion A conversion factor to be applied to the raw Monotype "unit," allowing those units to be
+ * converted to another scheme such as millipoints.
+ * @return The font that represents the widths as published in Knuth-Plass.
+ */
+ public static MockFont createGrimmFont(final double conversion) {
+ final MockFont font = createMonotypeFont(conversion);
+ font.setWidth(';', (int) (conversion * 5));
+ font.setWidth('I', (int) (conversion * 6));
+ font.setWidth('v', (int) (conversion * 9));
+ font.setWidth('x', (int) (conversion * 10));
+ return font;
+ }
+
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-11-30 14:10:03 UTC (rev 12153)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-11-30 17:48:14 UTC (rev 12154)
@@ -50,8 +50,9 @@
*/
public abstract class LineBreaker4aTests {
- /** The font size, in millipoints, to be used for testing. */
- public static final int FONT_SIZE = 11_000;
+ /** The font size, in millipoints, to be used for the "Grimm" tests. We want the computations to be for one point
+ * so that the Monotype units are what is returned by the sizing mechanisms. */
+ public static final int GRIMM_FONT_SIZE = 1_000;
/** A string used for testing line-breaking. This example is used in Knuth, "Digital Typography," 1999, Chapter 3,
* "Breaking Paragraphs into Lines," p. 74 et seq. Knuth cites his source as "Grimm's Fairy Tales." By using an
@@ -243,14 +244,21 @@
}
/**
- * Create a standard paragraph configuration using the Monotype pseudo-font.
+ * Create a standard paragraph configuration for the Grimm tests, using the Monotype pseudo-font.
* @return The Monotype paragraph configuration.
*/
- public ParaConfig4a createMonotypeParaConfig() {
- final MockFont font = LbTestUtilities.createMonotypeFont();
+ public ParaConfig4a createGrimmParaConfig() {
+ /* Set the font metrics using the raw Monotype "unit." */
+ final double conversion = 1;
+ final MockFont font = LbTestUtilities.createGrimmFont(conversion);
final MockFontUse fontUse = new MockFontUse();
fontUse.setFont(font);
- final ParaConfig4a paraConfig = new ParaConfig4a(fontUse, FONT_SIZE, null, 0, 0);
+ /* Stretchability and shrinkability come from the interword values in Table 1. Note that different values are
+ * set if the space follows a comma, semicolon, or period. This may affect our test results, as we don't have
+ * a way to make such adjustments. However, we could hard-code the values into the paragraph itself. */
+ final int stretchability = 3;
+ final int shrinkability = 2;
+ final ParaConfig4a paraConfig = new ParaConfig4a(fontUse, GRIMM_FONT_SIZE, null, stretchability, shrinkability);
return paraConfig;
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-30 14:10:03 UTC (rev 12153)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-30 17:48:14 UTC (rev 12154)
@@ -49,7 +49,7 @@
/* TODO: THE CLASS BEING TESTED IS VERY INCOMPLETE, AND SO IS THIS TEST !!!!!! */
final ParaBranch4a para = this.createPara();
- para.setParaConfig(createMonotypeParaConfig());
+ para.setParaConfig(createGrimmParaConfig());
final ParaControl paraControl = createParaControl();
/* Line width obtained from "Digital Typography," p. 73.*/
final LineBreakControl lbControl = createLineBreakControl(390_000);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-30 14:10:05
|
Revision: 12153
http://sourceforge.net/p/foray/code/12153
Author: victormote
Date: 2021-11-30 14:10:03 +0000 (Tue, 30 Nov 2021)
Log Message:
-----------
Add methods to handle the Monotype "unit" sizing properly.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java 2021-11-30 12:00:19 UTC (rev 12152)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java 2021-11-30 14:10:03 UTC (rev 12153)
@@ -43,6 +43,22 @@
*/
public class MockFont extends Font4a {
+ /**
+ * The factor for conversion of Monotype units to millipoints for a font set at 1 point.
+ * According to para. 54, 18 Monotype units at 12 points is one pica (1/6 of an inch).
+ * In millipoints, this is 72,000 / 6 = 12,000.
+ * To get to 18 Monotype units at 1 point, divide by 12 = 12,000 / 12 = 1,000.
+ * To get to 1 Monotype unit at 1 point, divide by 18 = 1,000 / 18 = 55.555556 millipoints.
+ * We check this against para. 55, which computes the same value at .0007685 inches.
+ * 72000 * .0007685 = 55.332.
+ * The difference is due to the Monotype computation rounding the size of a pica to .166 inches, which is not
+ * exactly 1/6 of an inch.
+ * Since FOray consistently treats one point as being 1/72 of an inch, we will do so here as well.
+ * @see <a href="https://books.google.com/books/download/The_monotype_system.pdf?id=6kU5AAAAMAAJ&output=pdf">1912,
+ * The Monotype System, Philadelphia, Lanston Monotype Machine Co.</a>
+ */
+ public static final double MILLIPOINTS_PER_MONOTYPE_UNIT = 1000 / 18;
+
/** The character set. */
private CharSet charSet;
@@ -86,7 +102,7 @@
}
/**
- * Sets the widths to be used by this instance.
+ * Sets the width of a given codepoint.
* @param codePoint The codepoint for which the new width is to be set.
* @param width The new width, in millipoints, for {@code codePoint}.
*/
@@ -95,6 +111,18 @@
this.widths[metricIndex] = width;
}
+ /**
+ * Sets the width of a given codepoint, using the Monotype "unit" system.
+ * @param codePoint The codepoint for which the new width is to be set.
+ * @param monotypeUnits The number of Monotype "units" for {@code codePoint}.
+ * @see <a href="https://books.google.com/books/download/The_monotype_system.pdf?id=6kU5AAAAMAAJ&output=pdf">1912,
+ * The Monotype System, Philadelphia, Lanston Monotype Machine Co.</a>
+ */
+ public void setMonotypeWidth(final int codePoint, final int monotypeUnits) {
+ final int width = (int) (monotypeUnits * MILLIPOINTS_PER_MONOTYPE_UNIT);
+ setWidth(codePoint, width);
+ }
+
@Override
public boolean isEmbeddable() {
// TODO Auto-generated method stub
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2021-11-30 12:00:19 UTC (rev 12152)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2021-11-30 14:10:03 UTC (rev 12153)
@@ -28,7 +28,9 @@
package org.foray.linebreak;
+import org.foray.common.WellKnownConstants;
import org.foray.common.para.ParaBranch4a;
+import org.foray.font.util.MockFont;
import org.axsl.common.para.ParaControl;
import org.axsl.linebreak.LineBreakControl;
@@ -46,7 +48,6 @@
* Test of an extremely short line that should return no line breaks.
*/
@Test
- @Ignore
public void firstFitTestSingleLine() {
final ParaBranch4aTestFixture para = new ParaBranch4aTestFixture(null, '-');
para.addWordAndSpace("Hello World!");
@@ -71,7 +72,11 @@
para.setParaConfig(createMonotypeParaConfig());
final ParaControl paraControl = createParaControl();
/* Line width obtained from "Digital Typography," p. 73.*/
- final LineBreakControl lbControl = createLineBreakControl(390_000);
+ final int lineWidth = (int)
+ (390
+ * (FONT_SIZE / WellKnownConstants.MILLIPOINTS_PER_POINT)
+ * MockFont.MILLIPOINTS_PER_MONOTYPE_UNIT);
+ final LineBreakControl lbControl = createLineBreakControl(lineWidth);
final FirstFitLb out = new FirstFitLb();
final int[] actual = out.breakIntoLines(para, paraControl, lbControl);
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-30 12:00:19 UTC (rev 12152)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-30 14:10:03 UTC (rev 12153)
@@ -62,66 +62,68 @@
final MockFont font = new MockFont();
font.setCharSet(charSet);
- font.setWidth(' ', 6_000); // Unclear from the table in the Monotype manual what the width of a space is.
- font.setWidth('\'', 5_000);
- font.setWidth(',', 5_000);
- font.setWidth('-', 5_000);
- font.setWidth('.', 5_000);
- font.setWidth(';', 6_000); // Knuth-Plass shows ";" as 5. Unclear which value they actually used.
+ /* It is unclear from the table in the Monotype manual what the width of a "normal" space is. Knuth uses 6 in
+ * most cases, but 8 after a period. */
+ font.setMonotypeWidth(' ', 6);
+ font.setMonotypeWidth('’', 5);
+ font.setMonotypeWidth(',', 5);
+ font.setMonotypeWidth('-', 5);
+ font.setMonotypeWidth('.', 5);
+ font.setMonotypeWidth(';', 6); // Knuth-Plass shows ";" as 5. Unclear which value they actually used.
- font.setWidth('A', 13_000);
- font.setWidth('B', 13_000);
- font.setWidth('C', 13_000);
- font.setWidth('D', 14_000);
- font.setWidth('E', 13_000);
- font.setWidth('F', 12_000);
- font.setWidth('G', 14_000);
- font.setWidth('H', 15_000);
- font.setWidth('I', 8_000); // Knuth-Plass shows "I" as 6. Unclear which value they actually used.
- font.setWidth('J', 9_000);
- font.setWidth('K', 15_000);
- font.setWidth('L', 12_000);
- font.setWidth('M', 18_000);
- font.setWidth('N', 15_000);
- font.setWidth('O', 13_000);
- font.setWidth('P', 12_000);
- font.setWidth('Q', 13_000);
- font.setWidth('R', 14_000);
- font.setWidth('S', 10_000);
- font.setWidth('T', 13_000);
- font.setWidth('U', 14_000);
- font.setWidth('V', 13_000);
- font.setWidth('W', 18_000);
- font.setWidth('X', 15_000);
- font.setWidth('Y', 14_000);
- font.setWidth('Z', 11_000);
+ font.setMonotypeWidth('A', 13);
+ font.setMonotypeWidth('B', 13);
+ font.setMonotypeWidth('C', 13);
+ font.setMonotypeWidth('D', 14);
+ font.setMonotypeWidth('E', 13);
+ font.setMonotypeWidth('F', 12);
+ font.setMonotypeWidth('G', 14);
+ font.setMonotypeWidth('H', 15);
+ font.setMonotypeWidth('I', 8); // Knuth-Plass shows "I" as 6. Unclear which value they actually used.
+ font.setMonotypeWidth('J', 9);
+ font.setMonotypeWidth('K', 15);
+ font.setMonotypeWidth('L', 12);
+ font.setMonotypeWidth('M', 18);
+ font.setMonotypeWidth('N', 15);
+ font.setMonotypeWidth('O', 13);
+ font.setMonotypeWidth('P', 12);
+ font.setMonotypeWidth('Q', 13);
+ font.setMonotypeWidth('R', 14);
+ font.setMonotypeWidth('S', 10);
+ font.setMonotypeWidth('T', 13);
+ font.setMonotypeWidth('U', 14);
+ font.setMonotypeWidth('V', 13);
+ font.setMonotypeWidth('W', 18);
+ font.setMonotypeWidth('X', 15);
+ font.setMonotypeWidth('Y', 14);
+ font.setMonotypeWidth('Z', 11);
- font.setWidth('a', 9_000);
- font.setWidth('b', 10_000);
- font.setWidth('c', 8_000);
- font.setWidth('d', 10_000);
- font.setWidth('e', 8_000);
- font.setWidth('f', 6_000);
- font.setWidth('g', 9_000);
- font.setWidth('h', 10_000);
- font.setWidth('i', 5_000);
- font.setWidth('j', 6_000);
- font.setWidth('k', 10_000);
- font.setWidth('l', 5_000);
- font.setWidth('m', 15_000);
- font.setWidth('n', 10_000);
- font.setWidth('o', 9_000);
- font.setWidth('p', 10_000);
- font.setWidth('q', 10_000);
- font.setWidth('r', 7_000);
- font.setWidth('s', 7_000);
- font.setWidth('t', 7_000);
- font.setWidth('u', 10_000);
- font.setWidth('v', 10_000); // Knuth-Plass shows "v" as 9. Unclear which value they actually used.
- font.setWidth('w', 13_000);
- font.setWidth('x', 9_000); // Knuth-Plass shows "x" as 10. However, it is not used in their example.
- font.setWidth('y', 10_000);
- font.setWidth('z', 8_000);
+ font.setMonotypeWidth('a', 9);
+ font.setMonotypeWidth('b', 10);
+ font.setMonotypeWidth('c', 8);
+ font.setMonotypeWidth('d', 10);
+ font.setMonotypeWidth('e', 8);
+ font.setMonotypeWidth('f', 6);
+ font.setMonotypeWidth('g', 9);
+ font.setMonotypeWidth('h', 10);
+ font.setMonotypeWidth('i', 5);
+ font.setMonotypeWidth('j', 6);
+ font.setMonotypeWidth('k', 10);
+ font.setMonotypeWidth('l', 5);
+ font.setMonotypeWidth('m', 15);
+ font.setMonotypeWidth('n', 10);
+ font.setMonotypeWidth('o', 9);
+ font.setMonotypeWidth('p', 10);
+ font.setMonotypeWidth('q', 10);
+ font.setMonotypeWidth('r', 7);
+ font.setMonotypeWidth('s', 7);
+ font.setMonotypeWidth('t', 7);
+ font.setMonotypeWidth('u', 10);
+ font.setMonotypeWidth('v', 10); // Knuth-Plass shows "v" as 9. Unclear which value they actually used.
+ font.setMonotypeWidth('w', 13);
+ font.setMonotypeWidth('x', 9); // Knuth-Plass shows "x" as 10. However, it is not used in their example.
+ font.setMonotypeWidth('y', 10);
+ font.setMonotypeWidth('z', 8);
return font;
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-11-30 12:00:19 UTC (rev 12152)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2021-11-30 14:10:03 UTC (rev 12153)
@@ -50,6 +50,9 @@
*/
public abstract class LineBreaker4aTests {
+ /** The font size, in millipoints, to be used for testing. */
+ public static final int FONT_SIZE = 11_000;
+
/** A string used for testing line-breaking. This example is used in Knuth, "Digital Typography," 1999, Chapter 3,
* "Breaking Paragraphs into Lines," p. 74 et seq. Knuth cites his source as "Grimm's Fairy Tales." By using an
* example directly from the book, we hope to get some independent expected results. */
@@ -247,7 +250,7 @@
final MockFont font = LbTestUtilities.createMonotypeFont();
final MockFontUse fontUse = new MockFontUse();
fontUse.setFont(font);
- final ParaConfig4a paraConfig = new ParaConfig4a(fontUse, 10_000, null, 0, 0);
+ final ParaConfig4a paraConfig = new ParaConfig4a(fontUse, FONT_SIZE, null, 0, 0);
return paraConfig;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|