[FOray-commit] SF.net SVN: foray:[12791] trunk/foray/foray-fotree/src
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2022-12-06 13:46:09
|
Revision: 12791
http://sourceforge.net/p/foray/code/12791
Author: victormote
Date: 2022-12-06 13:46:05 +0000 (Tue, 06 Dec 2022)
Log Message:
-----------
Conform to aXSL change: Rename Baseline to BaselineIdentifier for clarity.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentBaseline.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDominantBaseline.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVerticalAlign.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TestVerticalAlign.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 2022-12-06 12:07:07 UTC (rev 12790)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-06 13:46:05 UTC (rev 12791)
@@ -86,7 +86,7 @@
import org.axsl.value.ActiveState;
import org.axsl.value.BackgroundAttachment;
import org.axsl.value.BackgroundRepeat;
-import org.axsl.value.Baseline;
+import org.axsl.value.BaselineIdentifier;
import org.axsl.value.BlankOrNotBlank;
import org.axsl.value.BorderModel;
import org.axsl.value.BorderStyle;
@@ -1843,7 +1843,7 @@
}
@Override
- public Baseline traitAlignmentBaseline(final FoContext context) {
+ public BaselineIdentifier traitAlignmentBaseline(final FoContext context) {
return getPropertyList().traitAlignmentBaseline(this, context);
}
@@ -1858,7 +1858,7 @@
}
@Override
- public Baseline traitDominantBaseline(final FoContext context) {
+ public BaselineIdentifier traitDominantBaseline(final FoContext context) {
return getPropertyList().traitDominantBaseline(this, context);
}
@@ -1867,7 +1867,7 @@
* @param context An object that knows how to resolve FO context issues.
* @return The value for dominant-baseline="auto".
*/
- public Baseline computeAutoBaseline(final FoContext context) {
+ public BaselineIdentifier computeAutoBaseline(final FoContext context) {
final FoObj parent = this.effectiveParent(context);
if (this.isBlockLevelFo()
|| parent == null) {
@@ -1875,9 +1875,9 @@
if ("auto".equals(script.getAlphaCode())) {
final DtWritingMode writingMode = this.traitWritingMode(context);
if (writingMode.isHorizontal()) {
- return Baseline.ALPHABETIC;
+ return BaselineIdentifier.ALPHABETIC;
} else {
- return Baseline.CENTRAL;
+ return BaselineIdentifier.CENTRAL;
}
} else {
return this.getBaselineFromScript(context);
@@ -1892,7 +1892,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return This object's dominant-baseline, as computed from its font and script.
*/
- public Baseline getBaselineFromScript(final FoContext context) {
+ public BaselineIdentifier getBaselineFromScript(final FoContext context) {
final FontUse fontUse = this.getPrimaryFont(context);
if (fontUse == null) {
throw new IllegalStateException("Unable to obtain a font for baseline computation.");
@@ -1902,17 +1902,17 @@
final String opentypeScript = FontUtil.getOpenTypeScript(script);
final Font.Baseline fontBaseline = font.baseline(opentypeScript);
switch (fontBaseline) {
- case ALPHABETIC: return Baseline.ALPHABETIC;
- case MATH: return Baseline.MATHEMATICAL;
- case HANGING: return Baseline.HANGING;
- case IDEO_BOTTOM_LEFT: return Baseline.TEXT_AFTER_EDGE;
- case IDEO_TOP_RIGHT: return Baseline.TEXT_BEFORE_EDGE;
- case ICF_BOTTOM_LEFT: return Baseline.IDEOGRAPHIC;
+ case ALPHABETIC: return BaselineIdentifier.ALPHABETIC;
+ case MATH: return BaselineIdentifier.MATHEMATICAL;
+ case HANGING: return BaselineIdentifier.HANGING;
+ case IDEO_BOTTOM_LEFT: return BaselineIdentifier.TEXT_AFTER_EDGE;
+ case IDEO_TOP_RIGHT: return BaselineIdentifier.TEXT_BEFORE_EDGE;
+ case ICF_BOTTOM_LEFT: return BaselineIdentifier.IDEOGRAPHIC;
/* TODO: There does not seem to be a good match between the font baselines provided and the
* XSL-FO baseline for ICF_TOP_RIGHT. */
- case ICF_TOP_RIGHT: return Baseline.TEXT_BEFORE_EDGE;
+ case ICF_TOP_RIGHT: return BaselineIdentifier.TEXT_BEFORE_EDGE;
}
- return Baseline.ALPHABETIC;
+ return BaselineIdentifier.ALPHABETIC;
}
@Override
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 2022-12-06 12:07:07 UTC (rev 12790)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-06 13:46:05 UTC (rev 12791)
@@ -238,7 +238,7 @@
import org.axsl.value.AbsoluteAxis;
import org.axsl.value.AbsoluteCompass;
import org.axsl.value.AbsoluteDirection;
-import org.axsl.value.Baseline;
+import org.axsl.value.BaselineIdentifier;
import org.axsl.value.BlankOrNotBlank;
import org.axsl.value.Compass;
import org.axsl.value.Conditionality;
@@ -2952,7 +2952,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The alignment-baseline property.
*/
- public Baseline traitAlignmentBaseline(final FoObj fobj, final FoContext context) {
+ public BaselineIdentifier traitAlignmentBaseline(final FoObj fobj, final FoContext context) {
final PdAlignmentBaseline property = (PdAlignmentBaseline) getProperty(FoProperty.ALIGNMENT_BASELINE);
if (property != null) {
return property.traitValue(context, fobj);
@@ -3012,7 +3012,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The dominant-baseline property.
*/
- public Baseline traitDominantBaseline(final FoObj fobj, final FoContext context) {
+ public BaselineIdentifier traitDominantBaseline(final FoObj fobj, final FoContext context) {
final PdDominantBaseline property = (PdDominantBaseline) getProperty(FoProperty.DOMINANT_BASELINE);
if (property != null) {
return property.traitValue(context, fobj);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentBaseline.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentBaseline.java 2022-12-06 12:07:07 UTC (rev 12790)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentBaseline.java 2022-12-06 13:46:05 UTC (rev 12791)
@@ -37,7 +37,7 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.fo.FoText;
-import org.axsl.value.Baseline;
+import org.axsl.value.BaselineIdentifier;
/**
* The "alignment-baseline" property in XSL-FO.
@@ -100,7 +100,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public Baseline traitValue(final FoContext context, final FoObj fobj) {
+ public BaselineIdentifier traitValue(final FoContext context, final FoObj fobj) {
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
switch (keyword) {
@@ -111,16 +111,16 @@
}
case AUTO: return computeAuto(context, fobj);
case BASELINE: return computeBaseline(context, fobj);
- case BEFORE_EDGE: return Baseline.BEFORE_EDGE;
- case TEXT_BEFORE_EDGE: return Baseline.TEXT_BEFORE_EDGE;
- case CENTRAL: return Baseline.CENTRAL;
- case MIDDLE: return Baseline.MIDDLE;
- case AFTER_EDGE: return Baseline.AFTER_EDGE;
- case TEXT_AFTER_EDGE: return Baseline.TEXT_AFTER_EDGE;
- case IDEOGRAPHIC: return Baseline.IDEOGRAPHIC;
- case ALPHABETIC: return Baseline.ALPHABETIC;
- case HANGING: return Baseline.HANGING;
- case MATHEMATICAL: return Baseline.MATHEMATICAL;
+ case BEFORE_EDGE: return BaselineIdentifier.BEFORE_EDGE;
+ case TEXT_BEFORE_EDGE: return BaselineIdentifier.TEXT_BEFORE_EDGE;
+ case CENTRAL: return BaselineIdentifier.CENTRAL;
+ case MIDDLE: return BaselineIdentifier.MIDDLE;
+ case AFTER_EDGE: return BaselineIdentifier.AFTER_EDGE;
+ case TEXT_AFTER_EDGE: return BaselineIdentifier.TEXT_AFTER_EDGE;
+ case IDEOGRAPHIC: return BaselineIdentifier.IDEOGRAPHIC;
+ case ALPHABETIC: return BaselineIdentifier.ALPHABETIC;
+ case HANGING: return BaselineIdentifier.HANGING;
+ case MATHEMATICAL: return BaselineIdentifier.MATHEMATICAL;
default: {
break;
}
@@ -135,7 +135,7 @@
* @param fobj The FO for which this value is needed.
* @return The computed value from the script.
*/
- private static Baseline computeFromScript(final FoContext context, final FoObj fobj) {
+ private static BaselineIdentifier computeFromScript(final FoContext context, final FoObj fobj) {
return fobj.getBaselineFromScript(context);
}
@@ -145,7 +145,7 @@
* @param fobj The FO for which this value is needed.
* @return The computed value for the "auto" keyword.
*/
- private static Baseline computeAuto(final FoContext context, final FoObj fobj) {
+ private static BaselineIdentifier computeAuto(final FoContext context, final FoObj fobj) {
if (fobj instanceof FoText) {
if ("auto".equals(fobj.getParent().traitScriptRaw(context))) {
return fobj.getParent().traitDominantBaseline(context);
@@ -163,7 +163,7 @@
* @param fobj The FO for which this value is needed.
* @return The computed value for the "baseline" keyword.
*/
- private static Baseline computeBaseline(final FoContext context, final FoObj fobj) {
+ private static BaselineIdentifier computeBaseline(final FoContext context, final FoObj fobj) {
/* TODO: This is not right. The dominant baseline should be provided by the parent AREA, not FO. */
return fobj.getParent().traitDominantBaseline(context);
}
@@ -174,7 +174,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static Baseline traitValueNoInstance(final FoContext context, final FoObj fobj) {
+ public static BaselineIdentifier traitValueNoInstance(final FoContext context, final FoObj fobj) {
return computeAuto(context, fobj);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDominantBaseline.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDominantBaseline.java 2022-12-06 12:07:07 UTC (rev 12790)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDominantBaseline.java 2022-12-06 13:46:05 UTC (rev 12791)
@@ -36,7 +36,7 @@
import org.foray.fotree.value.PropertyValue;
import org.axsl.fotree.FoContext;
-import org.axsl.value.Baseline;
+import org.axsl.value.BaselineIdentifier;
/**
* The "dominant-baseline" property in XSL-FO.
@@ -100,7 +100,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public Baseline traitValue(final FoContext context, final FoObj fobj) {
+ public BaselineIdentifier traitValue(final FoContext context, final FoObj fobj) {
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
final FoObj parent = fobj.effectiveParent(context);
@@ -118,32 +118,31 @@
return parent.traitDominantBaseline(context);
}
case IDEOGRAPHIC: {
- return Baseline.IDEOGRAPHIC;
+ return BaselineIdentifier.IDEOGRAPHIC;
}
case ALPHABETIC: {
- return Baseline.ALPHABETIC;
+ return BaselineIdentifier.ALPHABETIC;
}
case HANGING: {
- return Baseline.HANGING;
+ return BaselineIdentifier.HANGING;
}
case MATHEMATICAL: {
- return Baseline.MATHEMATICAL;
+ return BaselineIdentifier.MATHEMATICAL;
}
case CENTRAL: {
- return Baseline.CENTRAL;
+ return BaselineIdentifier.CENTRAL;
}
case MIDDLE: {
- return Baseline.MIDDLE;
+ return BaselineIdentifier.MIDDLE;
}
case TEXT_AFTER_EDGE: {
- return Baseline.TEXT_AFTER_EDGE;
+ return BaselineIdentifier.TEXT_AFTER_EDGE;
}
case TEXT_BEFORE_EDGE: {
- return Baseline.TEXT_BEFORE_EDGE;
+ return BaselineIdentifier.TEXT_BEFORE_EDGE;
}
case INHERIT: {
- return parent.getPropertyList().traitDominantBaseline(parent,
- context);
+ return parent.getPropertyList().traitDominantBaseline(parent, context);
}
default: {
break;
@@ -159,7 +158,7 @@
* @param context An object that knows how to resolve FO context issues.
* @return The initial value for this property.
*/
- public static Baseline traitValueNoInstance(final FoObj fobj, final FoContext context) {
+ public static BaselineIdentifier traitValueNoInstance(final FoObj fobj, final FoContext context) {
return fobj.computeAutoBaseline(context);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVerticalAlign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVerticalAlign.java 2022-12-06 12:07:07 UTC (rev 12790)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVerticalAlign.java 2022-12-06 13:46:05 UTC (rev 12791)
@@ -37,7 +37,7 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoInlineContext;
-import org.axsl.value.Baseline;
+import org.axsl.value.BaselineIdentifier;
/**
* The "vertical-align" property in XSL-FO.
@@ -105,18 +105,18 @@
* @param fobj The FO for which this value is needed.
* @return The alignment-baseline component of this shorthand property.
*/
- public Baseline getAlignmentBaseline(final FoContext context, final FoObj fobj) {
+ public BaselineIdentifier getAlignmentBaseline(final FoContext context, final FoObj fobj) {
if (value().canEvalKeyword()) {
final FoValue foValue = this.convertValueToFoValue(value());
switch (foValue) {
- case BASELINE: return Baseline.BASELINE;
- case TOP: return Baseline.BEFORE_EDGE;
- case TEXT_TOP: return Baseline.TEXT_BEFORE_EDGE;
- case MIDDLE: return Baseline.MIDDLE;
- case BOTTOM: return Baseline.AFTER_EDGE;
- case TEXT_BOTTOM: return Baseline.TEXT_AFTER_EDGE;
- case SUB: return Baseline.BASELINE;
- case SUPER: return Baseline.BASELINE;
+ case BASELINE: return BaselineIdentifier.BASELINE;
+ case TOP: return BaselineIdentifier.BEFORE_EDGE;
+ case TEXT_TOP: return BaselineIdentifier.TEXT_BEFORE_EDGE;
+ case MIDDLE: return BaselineIdentifier.MIDDLE;
+ case BOTTOM: return BaselineIdentifier.AFTER_EDGE;
+ case TEXT_BOTTOM: return BaselineIdentifier.TEXT_AFTER_EDGE;
+ case SUB: return BaselineIdentifier.BASELINE;
+ case SUPER: return BaselineIdentifier.BASELINE;
default: {
break;
}
@@ -124,10 +124,10 @@
throw unexpectedRetrieval();
}
if (value().canEvalPercentage()) {
- return Baseline.BASELINE;
+ return BaselineIdentifier.BASELINE;
}
if (value().canEvalLength()) {
- return Baseline.BASELINE;
+ return BaselineIdentifier.BASELINE;
}
throw unexpectedRetrieval();
}
@@ -218,7 +218,7 @@
* @param context An object that knows how to resolve FO context issues.
* @return The dominant-baseline component of this shorthand property.
*/
- public Baseline getDominantBaseline(final FoObj fobj, final FoContext context) {
+ public BaselineIdentifier getDominantBaseline(final FoObj fobj, final FoContext context) {
return fobj.computeAutoBaseline(context);
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TestVerticalAlign.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TestVerticalAlign.java 2022-12-06 12:07:07 UTC (rev 12790)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TestVerticalAlign.java 2022-12-06 13:46:05 UTC (rev 12791)
@@ -33,7 +33,7 @@
import org.foray.fotree.PropertyException;
import org.axsl.fotree.FoContext;
-import org.axsl.value.Baseline;
+import org.axsl.value.BaselineIdentifier;
import org.junit.Assert;
import org.junit.Test;
@@ -61,13 +61,13 @@
* @param expectedAlignmentAdjust The expected alignment-adjust value.
* @throws PropertyException For errors parsing the property value.
*/
- private void commonTest(final String rawValue, final Baseline expectedAlignmentBaseline,
+ private void commonTest(final String rawValue, final BaselineIdentifier expectedAlignmentBaseline,
final int expectedAlignmentAdjust) throws PropertyException {
final FoObj fobj = TestVerticalAlign.makeTestFObj();
final PdVerticalAlign property = createProperty(fobj, rawValue);
fobj.getPropertyList().addProperty(fobj, property);
final FoContext context = TestVerticalAlign.STD_FO_CONTEXT;
- final Baseline actualAlignmentBaseline = fobj.traitAlignmentBaseline(context);
+ final BaselineIdentifier actualAlignmentBaseline = fobj.traitAlignmentBaseline(context);
Assert.assertEquals(expectedAlignmentBaseline, actualAlignmentBaseline);
final int actualAlignmentAdjust = fobj.traitAlignmentAdjust(context, STD_FO_INLINE_CONTEXT);
Assert.assertEquals(expectedAlignmentAdjust, actualAlignmentAdjust);
@@ -80,7 +80,7 @@
*/
@Test
public void testBaseline() throws PropertyException {
- commonTest("baseline", Baseline.BASELINE, 0);
+ commonTest("baseline", BaselineIdentifier.BASELINE, 0);
}
/**
@@ -89,7 +89,7 @@
*/
@Test
public void testTop() throws PropertyException {
- commonTest("top", Baseline.BEFORE_EDGE, 0);
+ commonTest("top", BaselineIdentifier.BEFORE_EDGE, 0);
}
/**
@@ -98,7 +98,7 @@
*/
@Test
public void testTextTop() throws PropertyException {
- commonTest("text-top", Baseline.TEXT_BEFORE_EDGE, 0);
+ commonTest("text-top", BaselineIdentifier.TEXT_BEFORE_EDGE, 0);
}
/**
@@ -107,7 +107,7 @@
*/
@Test
public void testMiddle() throws PropertyException {
- commonTest("middle", Baseline.MIDDLE, 0);
+ commonTest("middle", BaselineIdentifier.MIDDLE, 0);
}
/**
@@ -116,7 +116,7 @@
*/
@Test
public void testBottom() throws PropertyException {
- commonTest("bottom", Baseline.AFTER_EDGE, 0);
+ commonTest("bottom", BaselineIdentifier.AFTER_EDGE, 0);
}
/**
@@ -125,7 +125,7 @@
*/
@Test
public void testTextBottom() throws PropertyException {
- commonTest("text-bottom", Baseline.TEXT_AFTER_EDGE, 0);
+ commonTest("text-bottom", BaselineIdentifier.TEXT_AFTER_EDGE, 0);
}
/**
@@ -134,7 +134,7 @@
*/
@Test
public void testSub() throws PropertyException {
- commonTest("sub", Baseline.BASELINE, 0);
+ commonTest("sub", BaselineIdentifier.BASELINE, 0);
}
/**
@@ -143,7 +143,7 @@
*/
@Test
public void testSuper() throws PropertyException {
- commonTest("super", Baseline.BASELINE, 0);
+ commonTest("super", BaselineIdentifier.BASELINE, 0);
}
/**
@@ -154,7 +154,7 @@
public void testPercentage() throws PropertyException {
Assert.assertEquals(12000, STD_FO_INLINE_CONTEXT.alignmentAdjustBase());
final int expectedAlignmentAdjust = (int) (12000 * .2);
- commonTest("20%", Baseline.BASELINE, expectedAlignmentAdjust);
+ commonTest("20%", BaselineIdentifier.BASELINE, expectedAlignmentAdjust);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|