[FOray-commit] SF.net SVN: foray:[12584] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2022-02-10 17:43:17
|
Revision: 12584
http://sourceforge.net/p/foray/code/12584
Author: victormote
Date: 2022-02-10 17:43:14 +0000 (Thu, 10 Feb 2022)
Log Message:
-----------
1. Conform to aXSL change: For non-text line content, remove implementation of IndivisibleContent, which will now be used by wrappers. 2. Add foray-content project to hold those new wrappers.
Modified Paths:
--------------
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/ExternalGraphic4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Leader4a.java
trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
trunk/foray/foray-pioneer/build.gradle
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ExternalGraphicPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/InstreamForeignObjectPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/LeaderPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PageNumberCitationPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PageNumberPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/lb/EagerLineBreaker.java
trunk/foray/settings.gradle
Added Paths:
-----------
trunk/foray/foray-content/
trunk/foray/foray-content/build.gradle
trunk/foray/foray-content/src/
trunk/foray/foray-content/src/main/
trunk/foray/foray-content/src/main/java/
trunk/foray/foray-content/src/main/java/org/
trunk/foray/foray-content/src/main/java/org/foray/
trunk/foray/foray-content/src/main/java/org/foray/content/
trunk/foray/foray-content/src/main/java/org/foray/content/LeaderContent.java
trunk/foray/foray-content/src/main/java/org/foray/content/PageReferenceContent.java
trunk/foray/foray-content/src/main/java/org/foray/content/ScaledContent.java
trunk/foray/foray-content/src/main/java/org/foray/content/package-info.java
Added: trunk/foray/foray-content/build.gradle
===================================================================
--- trunk/foray/foray-content/build.gradle (rev 0)
+++ trunk/foray/foray-content/build.gradle 2022-02-10 17:43:14 UTC (rev 12584)
@@ -0,0 +1,25 @@
+description = 'foray-content'
+
+dependencies {
+ api group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
+
+ /* Turn transitive resolution OFF for both aXSL and FOray modules, for greater design visibility. */
+
+ api (group: 'org.axsl', name: 'axsl-content', version: axslVersion) { transitive = false }
+ api (group: 'org.axsl', name: 'axsl-fotree', version: axslVersion) { transitive = false }
+ api (group: 'org.axsl', name: 'axsl-font', version: axslVersion) { transitive = false }
+ api (group: 'org.axsl', name: 'axsl-value', version: axslVersion) { transitive = false }
+
+ implementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackClassicVersion
+
+ testImplementation group: 'junit', name: 'junit', version: junitVersion
+ testImplementation group: 'org.mockito', name: 'mockito-core', version: mockitoVersion
+}
+
+javadoc {
+ options.windowTitle = "FOray Content API"
+ options.docTitle = "FOray Content API"
+ options.header = "FOray Content API ${version}"
+}
+
+/* Last line of script. */
Property changes on: trunk/foray/foray-content/build.gradle
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-content/src/main/java/org/foray/content/LeaderContent.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/LeaderContent.java (rev 0)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/LeaderContent.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2022 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.content;
+
+import org.axsl.content.IndivisibleContent;
+import org.axsl.fotree.Fo;
+import org.axsl.fotree.fo.Leader;
+
+/**
+ * Content wrapper for {@link org.axsl.fotree.fo.Leader}.
+ */
+public class LeaderContent implements IndivisibleContent {
+
+ /** The wrapped content. */
+ private Leader content;
+
+ /**
+ * Constructor.
+ * @param content The wrapped content.
+ */
+ public LeaderContent(final Leader content) {
+ this.content = content;
+ }
+
+ @Override
+ public Leader getContent() {
+ return this.content;
+ }
+
+ @Override
+ public int inlineSizeOptimum(final int lineLength) {
+ return this.content.traitLeaderLengthOpt(null);
+ }
+
+ @Override
+ public int inlineSizeMinimum(final int lineLength) {
+ return this.content.traitLeaderLengthMin(null);
+ }
+
+ @Override
+ public int inlineSizeMaximum(final int lineLength) {
+ return this.content.traitLeaderLengthMax(null);
+ }
+
+ @Override
+ public boolean isLastItemInBlock() {
+ /* TODO: This is not right. */
+ final Fo parent = this.content.getParent();
+ final int qtySiblings = parent.qtyFormattingObjectChildren();
+ final int myIndex = parent.getIndex(this.content);
+ return myIndex >= qtySiblings - 1;
+ }
+
+}
Property changes on: trunk/foray/foray-content/src/main/java/org/foray/content/LeaderContent.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-content/src/main/java/org/foray/content/PageReferenceContent.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/PageReferenceContent.java (rev 0)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/PageReferenceContent.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2022 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.content;
+
+import org.axsl.content.IndivisibleContent;
+import org.axsl.font.FontUse;
+import org.axsl.fotree.fo.prop.CommonFontPa;
+
+/**
+ * Content wrapper for {@link org.axsl.fotree.fo.PageNumber}, {@link org.axsl.fotree.fo.PageNumberCitation}, and
+ * {@link org.axsl.fotree.fo.PageNumberCitationLast}.
+ */
+public class PageReferenceContent implements IndivisibleContent {
+
+ /** The number of placeholder digits that should be used when we do not yet know what the actual page-number is. */
+ private static final byte QTY_PLACEHOLDER_DIGITS = 3;
+
+ /** The wrapped content. */
+ private CommonFontPa content;
+
+ /**
+ * Constructor.
+ * @param content The wrapped content.
+ */
+ public PageReferenceContent(final CommonFontPa content) {
+ this.content = content;
+ }
+
+ @Override
+ public CommonFontPa getContent() {
+ return this.content;
+ }
+
+ @Override
+ public int inlineSizeOptimum(final int lineLength) {
+ /* TODO: Fix this method after we add the context to this class. */
+ final CommonFontPa asText = (CommonFontPa) this.content;
+ final FontUse fontUse = asText.getPrimaryFont(null);
+ final int fontSize = asText.traitFontSize(null);
+ final int zeroWidth = fontUse.width('0', fontSize);
+ // This is an estimate for purposes of layout.
+ return zeroWidth * QTY_PLACEHOLDER_DIGITS;
+ }
+
+ @Override
+ public int inlineSizeMinimum(final int lineLength) {
+ /* TODO: Fix this method after we add the context to this class. */
+ return inlineSizeOptimum(lineLength);
+ }
+
+ @Override
+ public int inlineSizeMaximum(final int lineLength) {
+ /* TODO: Fix this method after we add the context to this class. */
+ return inlineSizeOptimum(lineLength);
+ }
+
+ @Override
+ public boolean isLastItemInBlock() {
+ /* TODO: This is not right. */
+ return false;
+ }
+
+}
Property changes on: trunk/foray/foray-content/src/main/java/org/foray/content/PageReferenceContent.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-content/src/main/java/org/foray/content/ScaledContent.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/ScaledContent.java (rev 0)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/ScaledContent.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2022 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.content;
+
+import org.axsl.content.IndivisibleContent;
+import org.axsl.fotree.Fo;
+import org.axsl.fotree.FoScaled;
+
+/**
+ * Content wrapper for {@link org.axsl.fotree.FoScaled}.
+ */
+public class ScaledContent implements IndivisibleContent {
+
+ /** The wrapped content. */
+ private FoScaled content;
+
+ /**
+ * Constructor.
+ * @param content The wrapped content.
+ */
+ public ScaledContent(final FoScaled content) {
+ this.content = content;
+ }
+
+ @Override
+ public FoScaled getContent() {
+ return this.content;
+ }
+
+ @Override
+ public int inlineSizeOptimum(final int lineLength) {
+ /* TODO: Fix this method after we add the context to this class. */
+ return this.content.viewportIpd(null);
+ }
+
+ @Override
+ public int inlineSizeMinimum(final int lineLength) {
+ /* TODO: Fix this method after we add the context to this class. */
+ return inlineSizeOptimum(lineLength);
+ }
+
+ @Override
+ public int inlineSizeMaximum(final int lineLength) {
+ /* TODO: Fix this method after we add the context to this class. */
+ return inlineSizeOptimum(lineLength);
+ }
+
+ @Override
+ public boolean isLastItemInBlock() {
+ /* TODO: This is not right. */
+ final Fo parent = this.content.getParent();
+ final int qtySiblings = parent.qtyFormattingObjectChildren();
+ final int myIndex = parent.getIndex(this.content);
+ return myIndex >= qtySiblings - 1;
+ }
+
+}
Property changes on: trunk/foray/foray-content/src/main/java/org/foray/content/ScaledContent.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-content/src/main/java/org/foray/content/package-info.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/package-info.java (rev 0)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/package-info.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2022 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$
+ */
+
+/**
+ * <p>Classes that wrap content for purposes of line-breaking.</p>
+ */
+
+package org.foray.content;
Property changes on: trunk/foray/foray-content/src/main/java/org/foray/content/package-info.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/AbstractPageReference.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageReference.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractPageReference.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.content.IndivisibleContent;
import org.axsl.fotree.FoTreeException;
import java.util.List;
@@ -41,12 +40,8 @@
* Abstract superclass for page-number, page-number-citation, and
* page-number-citation-last.
*/
-public abstract class AbstractPageReference extends FoObj implements IndivisibleContent {
+public abstract class AbstractPageReference extends FoObj {
- /** The number of placeholder digits that should be used when we do not yet
- * know what the actual page-number is. */
- protected static final byte QTY_PLACEHOLDER_DIGITS = 3;
-
/** The property list for this object. */
private PropertyList propertyList;
@@ -112,29 +107,6 @@
}
@Override
- public int inlineSizeOptimum(final int lineLength) {
- final int zeroWidth = getPrimaryFont(null).width('0', traitFontSize(null));
- // This is an estimate for purposes of layout.
- return (zeroWidth + traitLetterSpacingOpt(null))
- * AbstractPageReference.QTY_PLACEHOLDER_DIGITS;
- }
-
- @Override
- public int inlineSizeMinimum(final int lineLength) {
- return inlineSizeOptimum(lineLength);
- }
-
- @Override
- public int inlineSizeMaximum(final int lineLength) {
- return inlineSizeOptimum(lineLength);
- }
-
- @Override
- public boolean isLastItemInBlock() {
- return this.getNextSibling() == null;
- }
-
- @Override
public PropertyList getPropertyList() {
return this.propertyList;
}
Modified: 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/ExternalGraphic4a.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/ExternalGraphic4a.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -175,26 +175,6 @@
}
@Override
- public int inlineSizeOptimum(final int lineLength) {
- return this.viewportIpd(null);
- }
-
- @Override
- public int inlineSizeMinimum(final int lineLength) {
- return this.viewportIpd(null);
- }
-
- @Override
- public int inlineSizeMaximum(final int lineLength) {
- return this.viewportIpd(null);
- }
-
- @Override
- public boolean isLastItemInBlock() {
- return this.getNextSibling() == null;
- }
-
- @Override
public FoObj getParent() {
return this.parent;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -123,26 +123,6 @@
}
@Override
- public int inlineSizeOptimum(final int lineLength) {
- return this.viewportIpd(null);
- }
-
- @Override
- public int inlineSizeMinimum(final int lineLength) {
- return this.viewportIpd(null);
- }
-
- @Override
- public int inlineSizeMaximum(final int lineLength) {
- return this.viewportIpd(null);
- }
-
- @Override
- public boolean isLastItemInBlock() {
- return this.getNextSibling() == null;
- }
-
- @Override
public FoObj getParent() {
return this.parent;
}
Modified: 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/Leader4a.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Leader4a.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -102,21 +102,6 @@
return this.getFoTree().getFONamespace();
}
- @Override
- public int inlineSizeOptimum(final int lineLength) {
- return traitLeaderLengthOpt(null);
- }
-
- @Override
- public int inlineSizeMinimum(final int lineLength) {
- return traitLeaderLengthMin(null);
- }
-
- @Override
- public int inlineSizeMaximum(final int lineLength) {
- return traitLeaderLengthMax(null);
- }
-
/**
* {@inheritDoc}
* Overrides FoObj method, because this is the Leader being sought.
@@ -127,11 +112,6 @@
}
@Override
- public boolean isLastItemInBlock() {
- return this.getNextSibling() == null;
- }
-
- @Override
public <T> T acceptVisitor(final FoVisitor<T> visitor) {
return visitor.visit(this);
}
Modified: trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
===================================================================
--- trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -133,25 +133,26 @@
}
@Override
- public void handleLineBreakNonText(final OutputLine lineOutput,
- final IndivisibleContent nonText, final int sizeInline)
- throws TextException {
+ public void handleLineBreakNonText(final OutputLine lineOutput, final IndivisibleContent nonText,
+ final int sizeInline) throws TextException {
checkLayoutTarget(lineOutput);
final LineArea lineArea = (LineArea) lineOutput;
- IndivisibleContent nonTextToUse = nonText;
- if (nonTextToUse instanceof IndivisibleContent) {
- final IndivisibleContent foLineNonText = (IndivisibleContent) nonTextToUse;
- nonTextToUse = foLineNonText; //.getWrapped();
- }
+// IndivisibleContent nonTextToUse = nonText;
+// if (nonTextToUse instanceof IndivisibleContent) {
+// final IndivisibleContent foLineNonText = (IndivisibleContent) nonTextToUse;
+// nonTextToUse = foLineNonText; //.getWrapped();
+// }
LineContentFactory factory = lineArea;
if (this.areaStack.size() > 0) {
factory = this.areaStack.peek();
}
+
+ final Object nonTextToUse = nonText.getContent();
+
if (nonTextToUse instanceof InstreamForeignObject) {
- final InstreamForeignObject ifo = (InstreamForeignObject)
- nonTextToUse;
+ final InstreamForeignObject ifo = (InstreamForeignObject) nonTextToUse;
factory.makeForeignObjectArea(ifo, sizeInline);
} else if (nonTextToUse instanceof ExternalGraphic) {
final ExternalGraphic graphic = (ExternalGraphic) nonTextToUse;
Modified: trunk/foray/foray-pioneer/build.gradle
===================================================================
--- trunk/foray/foray-pioneer/build.gradle 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-pioneer/build.gradle 2022-02-10 17:43:14 UTC (rev 12584)
@@ -16,6 +16,7 @@
api project(':foray-common')
api project(':foray-layout')
+ api project(':foray-content')
implementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackClassicVersion
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ExternalGraphicPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ExternalGraphicPnr.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/ExternalGraphicPnr.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -28,6 +28,8 @@
package org.foray.pioneer;
+import org.foray.content.ScaledContent;
+
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.LineArea;
@@ -66,8 +68,7 @@
return Status.OK;
}
final int height = this.realFONode.viewportBpd(areaNode);
- if (areaNode.nearestArea().pdAvailable()
- < height) {
+ if (areaNode.nearestArea().pdAvailable() < height) {
return Status.AREA_FULL_NONE;
}
@@ -76,7 +77,7 @@
// Not enough room on the page for this.
return Status.AREA_FULL_NONE;
}
- return addNonTextContent(lineArea);
+ return addNonTextContent(lineArea, new ScaledContent(this.realFONode));
}
@Override
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FoNodePnr.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -224,16 +224,14 @@
* not fit onto the current line.
* @throws AreaTreeException For errors during layout.
*/
- protected int addNonTextItemToLine(final LineArea lineArea,
- final IndivisibleContent nonText, final FoContext foContext)
- throws AreaTreeException {
+ protected int addNonTextItemToLine(final LineArea lineArea, final IndivisibleContent nonText,
+ final FoContext foContext) throws AreaTreeException {
EagerLineBreaker lb = this.layout.getEagerLineBreaker();
if (lb == null) {
final AreaTree areaTree = lineArea.getAreaTree();
final TextServer4a textServer = getLayout().getTextServer();
final FontConsumer fontConsumer = areaTree.getFontConsumer();
- lb = textServer.provideEagerLineBreaker(null,
- this.layout, fontConsumer);
+ lb = textServer.provideEagerLineBreaker(null, this.layout, fontConsumer);
}
int status = 0;
final IndivisibleContent contextAware = nonText;
@@ -251,17 +249,20 @@
/**
* Add this object's non-text line content to a line.
* @param inputLineArea The line to which the content should be added.
+ * @param content The content item to be added to {@code inputLineArea}.
* @return The status of the layout attempt.
* @throws AreaTreeException For errors during layout.
*/
- protected Status addNonTextContent(final LineArea inputLineArea) throws AreaTreeException {
+ protected Status addNonTextContent(final LineArea inputLineArea, final IndivisibleContent content)
+ throws AreaTreeException {
final FoContext foContext = inputLineArea;
final Fo node = this.getFONode();
LineArea lineArea = inputLineArea;
- if (! (node instanceof IndivisibleContent)) {
- return Status.UNKNOWN;
- }
- final IndivisibleContent nonText = (IndivisibleContent) node;
+// if (! (node instanceof IndivisibleContent)) {
+// return Status.UNKNOWN;
+// }
+// final IndivisibleContent nonText = (IndivisibleContent) node;
+ final IndivisibleContent nonText = content;
// this should start a new page
if (lineArea == null) {
return Status.AREA_FULL_SOME;
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/InstreamForeignObjectPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/InstreamForeignObjectPnr.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/InstreamForeignObjectPnr.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -28,6 +28,8 @@
package org.foray.pioneer;
+import org.foray.content.ScaledContent;
+
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.LineArea;
@@ -59,7 +61,7 @@
// Not enough room on the page for this.
return Status.AREA_FULL_NONE;
}
- return addNonTextContent(lineArea);
+ return addNonTextContent(lineArea, new ScaledContent(this.node));
}
@Override
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/LeaderPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/LeaderPnr.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/LeaderPnr.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -28,6 +28,8 @@
package org.foray.pioneer;
+import org.foray.content.LeaderContent;
+
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.LineArea;
@@ -58,7 +60,7 @@
// Not enough room on the page for this.
return Status.AREA_FULL_NONE;
}
- return addNonTextContent(lineArea);
+ return addNonTextContent(lineArea, new LeaderContent(this.node));
}
@Override
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PageNumberCitationPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PageNumberCitationPnr.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PageNumberCitationPnr.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -28,6 +28,8 @@
package org.foray.pioneer;
+import org.foray.content.PageReferenceContent;
+
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.LineArea;
@@ -59,7 +61,7 @@
// Not enough room on the page for this.
return Status.AREA_FULL_NONE;
}
- return addNonTextContent(lineArea);
+ return addNonTextContent(lineArea, new PageReferenceContent(this.node));
}
@Override
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PageNumberPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PageNumberPnr.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PageNumberPnr.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -28,6 +28,8 @@
package org.foray.pioneer;
+import org.foray.content.PageReferenceContent;
+
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.LineArea;
@@ -58,7 +60,7 @@
// Not enough room on the page for this.
return Status.AREA_FULL_NONE;
}
- return addNonTextContent(lineArea);
+ return addNonTextContent(lineArea, new PageReferenceContent(this.node));
}
@Override
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/lb/EagerLineBreaker.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/lb/EagerLineBreaker.java 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/lb/EagerLineBreaker.java 2022-02-10 17:43:14 UTC (rev 12584)
@@ -126,14 +126,12 @@
/**
* Standard processing of non-text items for eager line breaking systems.
- * @param nonTextItem The non-text item that should be added to the current
- * line.
- * @return If the item was successfully added to the current line, returns
- * 1, or returns 0 if there is not enough room on the line for it.
+ * @param nonTextItem The non-text item that should be added to the current line.
+ * @return If the item was successfully added to the current line, returns 1, or returns 0 if there is not enough
+ * room on the line for it.
* @throws TextException For errors during processing.
*/
- protected int processLineNonText(final IndivisibleContent nonTextItem)
- throws TextException {
+ protected int processLineNonText(final IndivisibleContent nonTextItem) throws TextException {
final int lineLength = lineReceivingContent().capacityTotal();
final int itemSize = nonTextItem.inlineSizeMinimum(lineLength);
if (itemSize > lineReceivingContent().capacityRemaining()) {
Modified: trunk/foray/settings.gradle
===================================================================
--- trunk/foray/settings.gradle 2022-02-09 18:03:04 UTC (rev 12583)
+++ trunk/foray/settings.gradle 2022-02-10 17:43:14 UTC (rev 12584)
@@ -3,6 +3,7 @@
include 'foray-app'
include 'foray-areatree'
include 'foray-common'
+include 'foray-content'
include 'foray-core'
include 'foray-font'
include 'foray-fotree'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|