[FOray-commit] SF.net SVN: foray:[12604] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2022-02-18 14:49:56
|
Revision: 12604
http://sourceforge.net/p/foray/code/12604
Author: victormote
Date: 2022-02-18 14:49:53 +0000 (Fri, 18 Feb 2022)
Log Message:
-----------
Improvements to word-based text processing.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java
trunk/foray/foray-content/src/main/java/org/foray/content/TextTokensContent4a.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 2022-02-17 22:02:59 UTC (rev 12603)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-02-18 14:49:53 UTC (rev 12604)
@@ -292,7 +292,9 @@
@Override
public NormalBlockArea4a makeNormalBlockArea(final BlockDiscrete blockDiscrete) {
final Block containingBlock = blockDiscrete.getParent();
- return NormalBlockArea4a.makeNormalBlockArea(containingBlock, this);
+ final NormalBlockArea4a nbArea = NormalBlockArea4a.makeNormalBlockArea(containingBlock, this);
+ this.children.add(nbArea);
+ return nbArea;
}
@Override
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-02-17 22:02:59 UTC (rev 12603)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-02-18 14:49:53 UTC (rev 12604)
@@ -58,6 +58,12 @@
public TextAreaWords(final LineArea4a parentArea, final Link<FoTextWords> generatedBy,
final TextTokenFlowLocation startLocation, final TextTokenFlowLocation endLocation) {
super(parentArea);
+ if (startLocation == null) {
+ throw new IllegalArgumentException("startLocation cannot be null.");
+ }
+ if (endLocation == null) {
+ throw new IllegalArgumentException("endLocation cannot be null.");
+ }
this.foLink = generatedBy;
this.startLocation = startLocation;
this.endLocation = endLocation;
Modified: trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java 2022-02-17 22:02:59 UTC (rev 12603)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java 2022-02-18 14:49:53 UTC (rev 12604)
@@ -36,10 +36,19 @@
import org.axsl.content.Content;
import org.axsl.content.ContentTree;
import org.axsl.fotree.Fo;
+import org.axsl.fotree.fo.BasicLink;
+import org.axsl.fotree.fo.Block;
import org.axsl.fotree.fo.BlockDiscrete;
import org.axsl.fotree.fo.ExternalGraphic;
import org.axsl.fotree.fo.FoTextWords;
+import org.axsl.fotree.fo.Footnote;
+import org.axsl.fotree.fo.Inline;
import org.axsl.fotree.fo.InstreamForeignObject;
+import org.axsl.fotree.fo.Leader;
+import org.axsl.fotree.fo.Marker;
+import org.axsl.fotree.fo.PageNumber;
+import org.axsl.fotree.fo.RetrieveMarker;
+import org.axsl.fotree.fo.Wrapper;
import org.axsl.kp.KpBranch;
import org.axsl.kp.KpContext;
import org.axsl.kp.KpLeaf;
@@ -102,6 +111,26 @@
final InstreamForeignObject instreamForeign = (InstreamForeignObject) fo;
this.children.add(new ScaledContent(instreamForeign, context));
return;
+ } else if (fo instanceof Inline) {
+ return;
+ } else if (fo instanceof RetrieveMarker) {
+ return;
+ } else if (fo instanceof Block) {
+ return;
+ } else if (fo instanceof BasicLink) {
+ return;
+ } else if (fo instanceof Marker) {
+ return;
+ } else if (fo instanceof Footnote) {
+ return;
+ } else if (fo instanceof Leader) {
+ return;
+ } else if (fo instanceof Wrapper) {
+ return;
+ } else if (fo instanceof PageNumber) {
+ final PageNumber pageNumber = (PageNumber) fo;
+ this.children.add(new PageReferenceContent(pageNumber, context));
+ return;
}
throw new IllegalStateException("Don't know how to create content for: " + fo.getClass().getName());
}
Modified: trunk/foray/foray-content/src/main/java/org/foray/content/TextTokensContent4a.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/TextTokensContent4a.java 2022-02-17 22:02:59 UTC (rev 12603)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/TextTokensContent4a.java 2022-02-18 14:49:53 UTC (rev 12604)
@@ -29,6 +29,7 @@
package org.foray.content;
import org.foray.common.FontContext4a;
+import org.foray.common.WellKnownConstants;
import org.foray.common.kp.KpLeafIterator4a;
import org.axsl.area.LineArea;
@@ -173,7 +174,9 @@
} else {
/* We are now sitting on a different content element. That means that all of the previous
* content item belongs on this line. */
- lineArea.makeGlyphAreaSequence(this.content, start, null, false);
+ final TextTokenFlowLocation end =
+ foTextTokenFlow.markLocation(tokenIndex, WellKnownConstants.MAX_7_BIT_UNSIGNED_VALUE, 0);
+ lineArea.makeGlyphAreaSequence(this.content, start, end, false);
return iterator.nextIndex();
}
}
@@ -185,7 +188,9 @@
return iterator.nextIndex();
}
/* The iterator is out of content. All of this content item goes on this line. */
- lineArea.makeGlyphAreaSequence(this.content, start, null, false);
+ final TextTokenFlowLocation end =
+ foTextTokenFlow.markLocation(tokenIndex, WellKnownConstants.MAX_7_BIT_UNSIGNED_VALUE, 0);
+ lineArea.makeGlyphAreaSequence(this.content, start, end, false);
return iterator.nextIndex();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|