foray-commit Mailing List for FOray (Page 45)
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
(2) |
Dec
|
|
From: <vic...@us...> - 2022-12-04 20:17:16
|
Revision: 12776
http://sourceforge.net/p/foray/code/12776
Author: victormote
Date: 2022-12-04 20:17:12 +0000 (Sun, 04 Dec 2022)
Log Message:
-----------
Remove some unnecessary dependencies.
Modified Paths:
--------------
trunk/foray/foray-common/build.gradle
Modified: trunk/foray/foray-common/build.gradle
===================================================================
--- trunk/foray/foray-common/build.gradle 2022-12-04 19:07:49 UTC (rev 12775)
+++ trunk/foray/foray-common/build.gradle 2022-12-04 20:17:12 UTC (rev 12776)
@@ -8,15 +8,13 @@
dependencies {
/* TODO: foray-common should probably not have a dependency on SLF4J. */
implementation (group: 'org.slf4j', name: 'slf4j-api', version: versions.slf4j)
+
implementation (group: 'commons-io', name: 'commons-io', version: versions.commonsIo)
- api (group: 'xml-resolver', name: 'xml-resolver', version: versions.xmlResolver)
api (group: 'com.ibm.icu', name: 'icu4j', version: versions.icu4j)
api (group: 'org.axsl', name: 'axsl-utility', version: versions.axsl)
api (group: 'org.axsl', name: 'axsl-i18n', version: versions.axsl)
api (group: 'org.axsl', name: 'axsl-kp-model', version: versions.axsl)
- api (group: 'org.axsl', name: 'axsl-orthography', version: versions.axsl)
- api (group: 'org.axsl', name: 'axsl-ps', version: versions.axsl)
api (group: 'org.axsl', name: 'axsl-font', version: versions.axsl)
implementation (group: 'org.axsl', name: 'axsl-unicode', version: versions.axsl)
api (group: 'org.axsl', name: 'axsl-value', version: versions.axsl)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-04 19:07:52
|
Revision: 12775
http://sourceforge.net/p/foray/code/12775
Author: victormote
Date: 2022-12-04 19:07:49 +0000 (Sun, 04 Dec 2022)
Log Message:
-----------
Remove some dependencies on KpNode.getText().
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpLayout.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-12-04 17:14:04 UTC (rev 12774)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-12-04 19:07:49 UTC (rev 12775)
@@ -109,8 +109,8 @@
public CharSequence getRawText() {
final StringBuilder builder = new StringBuilder();
for (int nodeIndex = 0; nodeIndex < this.tokenFlow.qtyTokens(); nodeIndex ++) {
- final KpNode node = this.tokenFlow.kpNodeAt(nodeIndex);
- builder.append(node.getText());
+ final FoTextToken node = this.tokenFlow.tokenAt(nodeIndex);
+ builder.append(node);
}
return builder.toString();
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpLayout.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpLayout.java 2022-12-04 17:14:04 UTC (rev 12774)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/util/DumpLayout.java 2022-12-04 19:07:49 UTC (rev 12775)
@@ -65,7 +65,7 @@
}
}
final KpLeaf leaf = branch.kpLeafAt(leafIndex);
- builder.append(leaf.getText());
+ builder.append(leaf.toString());
}
if (builder.length() > 0) {
this.output.println(builder.toString());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-04 17:14:08
|
Revision: 12774
http://sourceforge.net/p/foray/code/12774
Author: victormote
Date: 2022-12-04 17:14:04 +0000 (Sun, 04 Dec 2022)
Log Message:
-----------
Conform to aXSL change: Make WordComponent implement CharSequence.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/CompoundBreak4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/CompoundBreak4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/CompoundBreak4a.java 2022-12-03 21:57:16 UTC (rev 12773)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/CompoundBreak4a.java 2022-12-04 17:14:04 UTC (rev 12774)
@@ -28,6 +28,7 @@
package org.foray.orthography;
+import org.foray.common.MarkedIndexOutOfBoundsException;
import org.foray.common.kp.KpLeaf4a;
import org.foray.common.kp.KpLeafIterator4a;
import org.foray.common.primitive.StringUtils;
@@ -45,6 +46,8 @@
/**
* FOray implementation of {@link CompoundBreak}.
* Instances of this class are immutable.
+ * TODO: This class needs to be made more flexible or at least extendable, so that compound breaks other than "-" can
+ * be accommodated.
*/
public final class CompoundBreak4a implements CompoundBreak, KpBranch {
@@ -222,4 +225,31 @@
}
+ @Override
+ public int length() {
+ return 1;
+ }
+
+ @Override
+ public char charAt(final int index) {
+ if (index == 0) {
+ return '-';
+ }
+ throw new MarkedIndexOutOfBoundsException(index, 1);
+ }
+
+ @Override
+ public CharSequence subSequence(final int start, final int end) {
+ if (start != 0) {
+ throw new MarkedIndexOutOfBoundsException(start, 1);
+ }
+ if (end == 0) {
+ return StringUtils.EMPTY_STRING;
+ }
+ if (end == 1) {
+ return this;
+ }
+ throw new MarkedIndexOutOfBoundsException(end, 1);
+ }
+
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java 2022-12-03 21:57:16 UTC (rev 12773)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java 2022-12-04 17:14:04 UTC (rev 12774)
@@ -28,7 +28,9 @@
package org.foray.orthography;
+import org.foray.common.MarkedIndexOutOfBoundsException;
import org.foray.common.kp.KpLeaf4a;
+import org.foray.common.primitive.StringUtils;
import org.axsl.fotree.text.FoDiscretionaryHyphen;
import org.axsl.kp.KpContext;
@@ -44,6 +46,8 @@
/**
* FOray implementation of {@link DiscretionaryBreak}.
* Instances of this class are immutable.
+ * TODO: This class needs to be made more flexible or at least extendable, so that discretionary breaks other than "-"
+ * can be accommodated.
*/
public final class DiscretionaryHyphen4a extends KpLeaf4a implements FoDiscretionaryHyphen {
@@ -89,7 +93,7 @@
* Use {@link #fromQuality(org.axsl.kp.KpPenalty.Quality)} to obtain an instance of this class.
* @param quality The quality for this instance.
*/
- protected DiscretionaryHyphen4a(final DiscretionaryBreak.Quality quality) {
+ private DiscretionaryHyphen4a(final DiscretionaryBreak.Quality quality) {
this.quality = quality;
}
@@ -162,4 +166,31 @@
return 0;
}
+ @Override
+ public int length() {
+ return 1;
+ }
+
+ @Override
+ public char charAt(final int index) {
+ if (index == 0) {
+ return '-';
+ }
+ throw new MarkedIndexOutOfBoundsException(index, 1);
+ }
+
+ @Override
+ public CharSequence subSequence(final int start, final int end) {
+ if (start != 0) {
+ throw new MarkedIndexOutOfBoundsException(start, 1);
+ }
+ if (end == 0) {
+ return StringUtils.EMPTY_STRING;
+ }
+ if (end == 1) {
+ return this;
+ }
+ throw new MarkedIndexOutOfBoundsException(end, 1);
+ }
+
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java 2022-12-03 21:57:16 UTC (rev 12773)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java 2022-12-04 17:14:04 UTC (rev 12774)
@@ -34,7 +34,9 @@
package org.foray.orthography;
+import org.foray.common.MarkedIndexOutOfBoundsException;
import org.foray.common.WellKnownConstants;
+import org.foray.common.primitive.StringUtils;
import org.axsl.fotree.text.FoDiscretionaryHyphen;
import org.axsl.kp.KpContext;
@@ -213,4 +215,34 @@
return 0;
}
+ @Override
+ public int length() {
+ /* TODO: Fix this. */
+ return 1;
+ }
+
+ @Override
+ public char charAt(final int index) {
+ /* TODO: Fix this. */
+ if (index == 0) {
+ return '-';
+ }
+ throw new MarkedIndexOutOfBoundsException(index, 1);
+ }
+
+ @Override
+ public CharSequence subSequence(final int start, final int end) {
+ /* TODO: Fix this. */
+ if (start != 0) {
+ throw new MarkedIndexOutOfBoundsException(start, 1);
+ }
+ if (end == 0) {
+ return StringUtils.EMPTY_STRING;
+ }
+ if (end == 1) {
+ return this;
+ }
+ throw new MarkedIndexOutOfBoundsException(end, 1);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-03 21:57:19
|
Revision: 12773
http://sourceforge.net/p/foray/code/12773
Author: victormote
Date: 2022-12-03 21:57:16 +0000 (Sat, 03 Dec 2022)
Log Message:
-----------
Fixes to property handling in the axsl namespace.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/ObjectMakerAxsl.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/PropertyMakerAxsl.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata4a.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 2022-12-03 20:53:53 UTC (rev 12772)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-12-03 21:57:16 UTC (rev 12773)
@@ -64,9 +64,8 @@
* @throws FontException For errors during server creation.
*/
protected FontServer4a getFontServer() throws FontException {
- final FontServer4a fontServer = new FontServer4a();
-// fontServer.setup(null, null);
- return fontServer;
+ /* Use the basic font server. No need to configure additional fonts for this set of testing. */
+ return new FontServer4a();
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/ObjectMakerAxsl.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/ObjectMakerAxsl.java 2022-12-03 20:53:53 UTC (rev 12772)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/ObjectMakerAxsl.java 2022-12-03 21:57:16 UTC (rev 12773)
@@ -61,7 +61,7 @@
switch (enumeration) {
case METADATA: {
if (parent instanceof Declarations4a) {
- return new Metadata4a((Declarations4a) parent);
+ return new Metadata4a((Declarations4a) parent, propertyList);
}
throw new IllegalArgumentException("Parent of " + Metadata4a.class.getName() + " must be instance of "
+ Declarations4a.class.getName());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/PropertyMakerAxsl.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/PropertyMakerAxsl.java 2022-12-03 20:53:53 UTC (rev 12772)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/PropertyMakerAxsl.java 2022-12-03 21:57:16 UTC (rev 12773)
@@ -39,8 +39,7 @@
public final class PropertyMakerAxsl {
/**
- * Private constructor. This is a utility class and should never be
- * instantiated.
+ * Private constructor. This is a utility class and should never be instantiated.
*/
private PropertyMakerAxsl() { }
@@ -49,10 +48,8 @@
* @param inputPropertyName The property name to be enumerated.
* @return The enumerated value of the property name.
*/
- public static AxslProperty enumeratePropertyName(
- final String inputPropertyName) {
- final String propertyName = Property.getBasePropertyName(
- inputPropertyName);
+ public static AxslProperty enumeratePropertyName(final String inputPropertyName) {
+ final String propertyName = Property.getBasePropertyName(inputPropertyName);
return AxslProperty.xslValueOf(propertyName);
}
@@ -64,26 +61,20 @@
* @return The parsed Property instance.
* @throws PropertyException For errors in the property or its value.
*/
- public static Property makeProperty(final String propertyFullName,
- final String attributeValue, final FoObj fobj)
+ public static Property makeProperty(final String propertyFullName, final String attributeValue, final FoObj fobj)
throws PropertyException {
- final String basePropertyName = Property.getBasePropertyName(
- propertyFullName);
- final AxslProperty enumeration = enumeratePropertyName(
- basePropertyName);
- final Property property = checkCompoundProperty(fobj,
- enumeration, propertyFullName, attributeValue);
+ final String basePropertyName = Property.getBasePropertyName(propertyFullName);
+ final AxslProperty enumeration = enumeratePropertyName(basePropertyName);
+ final Property property = checkCompoundProperty(fobj, enumeration, propertyFullName, attributeValue);
if (property != null) {
return property;
}
if (enumeration == null) {
- throw new PropertyException("Invalid property for axsl namespace: "
- + propertyFullName);
+ throw new PropertyException("Invalid property for axsl namespace: " + propertyFullName);
}
switch (enumeration) {
case METADATA_KEY: {
- return new MetadataKey(fobj, propertyFullName,
- attributeValue);
+ return new MetadataKey(fobj, propertyFullName, attributeValue);
}
default: {
return null;
@@ -92,8 +83,8 @@
}
/**
- * Checks to see if the property has already been created. If it has, and
- * if it is a compound property, sets the value for this component.
+ * Checks to see if the property has already been created.
+ * If it has, and if it is a compound property, sets the value for this component.
* @param fobj The FoObj to which this property belongs.
* @param enumeration The parsed property type.
* @param propertyFullName The full unparsed name of the property.
@@ -101,9 +92,8 @@
* @return The parsed property.
* @throws PropertyException For errors in the property or its value.
*/
- private static Property checkCompoundProperty(final FoObj fobj,
- final AxslProperty enumeration, final String propertyFullName,
- final String attributeValue) throws PropertyException {
+ private static Property checkCompoundProperty(final FoObj fobj, final AxslProperty enumeration,
+ final String propertyFullName, final String attributeValue) throws PropertyException {
if (enumeration == null) {
return null;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata4a.java 2022-12-03 20:53:53 UTC (rev 12772)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata4a.java 2022-12-03 21:57:16 UTC (rev 12773)
@@ -35,9 +35,8 @@
import org.foray.fotree.axsl.AxslProperty;
import org.foray.fotree.axsl.AxslValue;
import org.foray.fotree.axsl.prop.AxslEnumerated;
-import org.foray.fotree.fo.obj.AbstractCharacterSequence;
import org.foray.fotree.fo.obj.Declarations4a;
-import org.foray.fotree.fo.obj.FoTextCharacters4a;
+import org.foray.fotree.fo.obj.FoText4a;
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoTreeException;
@@ -55,19 +54,24 @@
*/
public class Metadata4a extends FoObj implements Metadata {
+ /** The property list for this object. */
+ private PropertyList propertyList;
+
/** The parent of this node. */
private Declarations4a parent;
/** The children of this object. */
- private List<AbstractCharacterSequence> children = new ArrayList<AbstractCharacterSequence>(1);
+ private List<FoText4a> children = new ArrayList<FoText4a>(1);
/**
* Constructor.
* @param parent The parent FoObj.
+ * @param propertyList The property list for this FoObj.
*/
- public Metadata4a(final Declarations4a parent) {
+ public Metadata4a(final Declarations4a parent, final PropertyList propertyList) {
super(parent);
this.parent = parent;
+ this.propertyList = propertyList;
}
@Override
@@ -99,7 +103,7 @@
@Override
protected void validateDescendants() throws FoTreeException {
if (this.getChildren().size() != 1
- || ! (this.formattingObjectChildAt(0) instanceof FoTextCharacters4a)) {
+ || ! (this.formattingObjectChildAt(0) instanceof FoText4a)) {
throwException("The content model for " + this.getFullName()
+ " is: (#PCDATA).");
}
@@ -141,9 +145,8 @@
@Override
public String getMetadataValue() {
/* Existence and casting verified at validateDescendants(). */
- final FoTextCharacters4a text =
- (FoTextCharacters4a) this.formattingObjectChildAt(0);
- return text.getRefinedText(null).toString();
+ final FoText4a text = (FoText4a) this.formattingObjectChildAt(0);
+ return text.toString();
}
/**
@@ -188,14 +191,14 @@
}
@Override
- public List<AbstractCharacterSequence> getChildren() {
+ public List<FoText4a> getChildren() {
return this.children;
}
@Override
public void addChild(final FoObj fobj) throws FoTreeException {
- if (fobj instanceof AbstractCharacterSequence) {
- this.children.add((AbstractCharacterSequence) fobj);
+ if (fobj instanceof FoText4a) {
+ this.children.add((FoText4a) fobj);
} else {
fobj.throwException("Violation of parent (" + fobj.getFullName() + ")content model.");
}
@@ -223,7 +226,7 @@
@Override
public PropertyList getPropertyList() {
- return null;
+ return this.propertyList;
}
@Override
@@ -233,7 +236,7 @@
@Override
public boolean canHavePcdataChildren() {
- return false;
+ return true;
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-03 20:53:56
|
Revision: 12772
http://sourceforge.net/p/foray/code/12772
Author: victormote
Date: 2022-12-03 20:53:53 +0000 (Sat, 03 Dec 2022)
Log Message:
-----------
Remove unneeded parameter.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java
trunk/foray/foray-font/src/test/java/org/foray/font/FontServer4aTests.java
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 2022-12-03 18:53:18 UTC (rev 12771)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2022-12-03 20:53:53 UTC (rev 12772)
@@ -135,7 +135,7 @@
InputStream inputStream = null;
try {
inputStream = fontConfigURL.openStream();
- forayFontServer.setup(inputStream, null);
+ forayFontServer.setup(inputStream);
} catch (final IOException e) {
throw new ForayException(e);
} catch (final FontException e) {
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 2022-12-03 18:53:18 UTC (rev 12771)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-12-03 20:53:53 UTC (rev 12772)
@@ -65,7 +65,7 @@
*/
protected FontServer4a getFontServer() throws FontException {
final FontServer4a fontServer = new FontServer4a();
- fontServer.setup(null, null);
+// fontServer.setup(null, null);
return fontServer;
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2022-12-03 18:53:18 UTC (rev 12771)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2022-12-03 20:53:53 UTC (rev 12772)
@@ -347,20 +347,11 @@
/**
* Registers the FreeStanding fonts that are available based on font
* configuration file and options.
- *
* @param fontConfigFile The URL for the font configuration file that should
* be used during setup.
- * @param fontConfigOptions An optional Map of font configuration options.
- * Implementations that do not wish to use this should simply ignore it.
- * Clients that do not wish to use it should pass null.
- * This can be used for any purpose, but is intended primarily to allow
- * an implementation to allow keys to be embedded in font configuration
- * files, and then to replace those keys with the mapped value during
- * parsing.
* @throws FontException on font configuration error.
*/
- public void setup(final InputStream fontConfigFile,
- final Map<String, String> fontConfigOptions) throws FontException {
+ public void setup(final InputStream fontConfigFile) throws FontException {
if (this.setupCompleted) {
return;
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java 2022-12-03 18:53:18 UTC (rev 12771)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/RegisteredFontContent.java 2022-12-03 20:53:53 UTC (rev 12772)
@@ -63,10 +63,8 @@
*
* <p>The main purpose for keeping {@link RegisteredFont} separate from {@link RegisteredFontContent} is so that the
* latter can be reused without duplication of parsing.
- * A secondary benefit is that it adds clarity to the notion that the former is user-oriented and the latter is
- * system-oriented.
- * has font-content to be It is tempting to question why this separate class is needed. It is good to not
- * parse the font until it is known to be necessary.</p>
+ * A secondary benefit is that it adds clarity to the notion that the former is user-facing and the latter is
+ * system-facing.</p>
*/
public class RegisteredFontContent implements FontParserClient {
Modified: trunk/foray/foray-font/src/test/java/org/foray/font/FontServer4aTests.java
===================================================================
--- trunk/foray/foray-font/src/test/java/org/foray/font/FontServer4aTests.java 2022-12-03 18:53:18 UTC (rev 12771)
+++ trunk/foray/foray-font/src/test/java/org/foray/font/FontServer4aTests.java 2022-12-03 20:53:53 UTC (rev 12772)
@@ -65,7 +65,7 @@
} catch (final FileNotFoundException e) {
throw new FontException(e);
}
- fontServer.setup(fontConfigInputStream, null);
+ fontServer.setup(fontConfigInputStream);
FontServer4aTests.fontServer = fontServer;
}
return FontServer4aTests.fontServer;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-03 18:53:27
|
Revision: 12771
http://sourceforge.net/p/foray/code/12771
Author: victormote
Date: 2022-12-03 18:53:18 +0000 (Sat, 03 Dec 2022)
Log Message:
-----------
Rename test classes for consistency and clarity.
Added Paths:
-----------
trunk/foray/foray-app/src/test/java/org/foray/app/area/BlockTests.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/BorderTests.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/GraphicAreaTests.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/InlineTests.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/MetadataTests.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/VerticalTests.java
Removed 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/TestMetadata.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java
Copied: trunk/foray/foray-app/src/test/java/org/foray/app/area/BlockTests.java (from rev 12770, trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java)
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/BlockTests.java (rev 0)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/BlockTests.java 2022-12-03 18:53:18 UTC (rev 12771)
@@ -0,0 +1,358 @@
+/*
+ * 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.app.area;
+
+
+import org.foray.area.AreaNode4a;
+import org.foray.area.AreaTree4a;
+import org.foray.area.LineArea4a;
+import org.foray.area.NormalBlockArea4a;
+import org.foray.area.NormalFlowRa4a;
+import org.foray.area.PageCollection4a;
+import org.foray.area.TextArea;
+import org.foray.common.FontContext4a;
+
+import org.axsl.font.FontException;
+import org.axsl.font.FontUse;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests of various block-related concepts at the Area Tree level.
+ */
+public class BlockTests extends AbstractAreaTreeTest {
+
+ /** The font options. */
+ private FontContext4a fontOptionsWithKerning;
+
+ /**
+ * Setup the fixtures needed by the test.
+ */
+ @Before
+ public void setup() {
+ this.fontOptionsWithKerning = new FontContext4a();
+ this.fontOptionsWithKerning.setKerning(true);
+ }
+
+ /**
+ * Test of fo/block-001.fo.
+ */
+ @Test
+ public void testBlock001() {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/block-001.fo", getLineBreakerFactory());
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(areaTree);
+
+ /* The outer block area. */
+ AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
+ 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). */
+ Assert.assertEquals(720000, outerBlockArea.crOriginY());
+ /* Page is 8 inches wide, with 2 inches total margin. 6 * 72,000 = 432,000. */
+ Assert.assertEquals(432000, outerBlockArea.crIpd());
+
+ /* The first child of the outer block area is a line-area. */
+ node = outerBlockArea.areaNodeChildAt(0);
+ 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());
+ /* Same as parent. */
+ Assert.assertEquals(72000, lineArea.crOriginX());
+ /* Same as parent, but adjusted for a half-leading space-before.
+ * Default leading is 20% of the font-size, which is 12 points.
+ * 50% * 20% * 12,000 = 1,200.
+ * 720,000 - 1,200 = 718,800. */
+ Assert.assertEquals(718800, lineArea.crOriginY());
+ /* Same as parent. */
+ Assert.assertEquals(432000, lineArea.crIpd());
+ /* Default font-size is 12 points. */
+ Assert.assertEquals(12000, lineArea.crBpd());
+
+ /* The second child of the outer block area is a block-area. */
+ node = outerBlockArea.areaNodeChildAt(1);
+ 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());
+ /* Same as parent. */
+ Assert.assertEquals(72000, insideBlockArea.crOriginX());
+ /* Computed as that for the previous line, adjusted for one line,
+ * including another half-leading, the space-after for that line.
+ * 718,800 - 12,000 - 1,200 = 705,600. */
+ Assert.assertEquals(705600, insideBlockArea.crOriginY());
+ /* Same as parent. */
+ Assert.assertEquals(432000, insideBlockArea.crIpd());
+ /* Height of 0, as it has no content. */
+ Assert.assertEquals(0, insideBlockArea.crBpd());
+
+ /* The third child of the outer block area is another line-area. */
+ node = outerBlockArea.areaNodeChildAt(2);
+ 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());
+ /* Same as parent. */
+ Assert.assertEquals(72000, lineArea.crOriginX());
+ /* Same as the previous block, adjusted for an additional half-leading.
+ * 705,600 - 1,200 = 704,400. */
+ Assert.assertEquals(704400, lineArea.crOriginY());
+ /* Same as parent. */
+ Assert.assertEquals(432000, lineArea.crIpd());
+ /* Same as the first line. */
+ Assert.assertEquals(12000, lineArea.crBpd());
+
+ /* The fourth child of the outer block area is another line-area. */
+ node = outerBlockArea.areaNodeChildAt(3);
+ 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. */
+ Assert.assertEquals(2400, lineArea.getAnteriorSpace());
+ /* Same as parent. */
+ Assert.assertEquals(72000, lineArea.crOriginX());
+ /* Same as the previous line, adjusted for one line and two half-leadings.
+ * 704,400 - 12,000 - 1,200 - 1,200 = 690,000. */
+ Assert.assertEquals(690000, lineArea.crOriginY());
+ /* Same as parent. */
+ Assert.assertEquals(432000, lineArea.crIpd());
+ /* Same as the other lines. */
+ Assert.assertEquals(12000, lineArea.crBpd());
+ }
+
+ /**
+ * Test of fo/block-002.fo.
+ */
+ @Test
+ @Ignore
+ public void testBlock002() {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/block-002.fo", getLineBreakerFactory());
+ final PageCollection4a pageCollection = this.getPageCollection(areaTree,
+ 1);
+ final int numPages = pageCollection.qtyAreaNodeChildren();
+ Assert.assertEquals(2, numPages);
+ final String documentContent = this.getText(areaTree);
+ final String testString =
+ " This document is on a short (4 inches high) page, "
+ + "and contains one block. "
+ + "The content of that one block is intended to spill onto a "
+ + "second page, the "
+ + "purpose being to test whether all of the content ends up in "
+ + "the output document. "
+ + "This is test sentence 1. "
+ + "This is test sentence 2. "
+ + "This is test sentence 3. "
+ + "This is test sentence 4. "
+ + "This is test sentence 5. "
+ + "This is test sentence 6. "
+ + "This is test sentence 7. "
+ + "This is test sentence 8. "
+ + "This is test sentence 9. "
+ + "This is test sentence 10. "
+ + "This is test sentence 11. "
+ + "This is test sentence 12. "
+ + "This is test sentence 13. "
+ + "This is test sentence 14. "
+ + "This is test sentence 15. "
+ + "This is test sentence 16. "
+ + "This is test sentence 17. "
+ + "This is test sentence 18. "
+ + "This is test sentence 19. "
+ + "This is test sentence 20. "
+ + "This is test sentence 21. "
+ + "This is test sentence 22. "
+ + "This is test sentence 23. "
+ + "This is test sentence 24. "
+ + "This is test sentence 25. "
+ + "This is test sentence 26. "
+ + "This is test sentence 27. "
+ + "This is test sentence 28. "
+ + "This is test sentence 29. "
+ + "This is test sentence 30. "
+ + "This is test sentence 31. "
+ + "This is test sentence 32. "
+ + "This is test sentence 33. "
+ + "This is test sentence 34. "
+ + "This is test sentence 35. "
+ + "This is test sentence 36. "
+ + "This is test sentence 37. "
+ + "This is test sentence 38. "
+ + "This is test sentence 39. "
+ + "This is test sentence 40. "
+ + "This is test sentence 41. "
+ + "This is test sentence 42. "
+ + "This is test sentence 43. "
+ + "This is test sentence 44. "
+ + "This is test sentence 45. "
+ + "This is test sentence 46. "
+ + "This is test sentence 47. "
+ + "This is test sentence 48. "
+ + "This is test sentence 49. "
+ + "This is test sentence 50. "
+ + "This is test sentence 51. "
+ + "This is test sentence 52. "
+ + "This is test sentence 53. "
+ + "This is test sentence 54. ";
+ Assert.assertEquals(testString, documentContent);
+ }
+
+ /**
+ * Test of fo/block-003.fo.
+ * This is a test of simple centering of a text-area on a line.
+ * @throws FontException For errors in the font system.
+ */
+ @Test
+ @Ignore
+ public void testBlock003() throws FontException {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/block-003.fo", getLineBreakerFactory());
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
+ areaTree);
+
+ /* Test location and dimensions of the block area. */
+ AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
+ 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). */
+ Assert.assertEquals(720000, blockArea.crOriginY());
+ /* Page is 8.5 inches wide, with 2 inches total margin.
+ * 6.5 * 72,000 = 468,000. */
+ Assert.assertEquals(468000, blockArea.crIpd());
+
+ /* Test location and dimensions of the line area. */
+ node = blockArea.areaNodeChildAt(0);
+ 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. */
+ Assert.assertEquals(718800, lineArea.crOriginY());
+ /* ipd same as parent block. */
+ Assert.assertEquals(468000, lineArea.crIpd());
+
+ /* Test location and dimensions of the text area. The key thing we are
+ * testing here is that IT IS CENTERED. */
+ node = lineArea.areaNodeChildAt(0);
+ Assert.assertTrue(node instanceof TextArea);
+ final TextArea textArea = (TextArea) node;
+
+ final FontUse fontUse = getHelveticaFont();
+ /* The following computation is tested in {@link TestFont4a#testWidth()}. */
+ final String testString = "Test of Centering";
+ final int textWidth = fontUse.width(
+ testString, 0, testString.length(), 12000, 0, 0, this.fontOptionsWithKerning, null);
+ Assert.assertEquals(textWidth, textArea.crIpd());
+
+ /* The x value of the text area content rectangle should be at the x
+ * location of the parent line area + 1/2 of the unused area in the
+ * line. Total line area ipd = 468,000. Unused line area ipd =
+ * 468,000 - 90,780 = 377,220. One half of the unused line area ipd =
+ * 188,610. x = 72,000 + 188,610 = 260,610. */
+ Assert.assertEquals(260610, textArea.crOriginX());
+
+ /* The y value of the text area content rectangle should be the same as
+ * the parent line area. */
+ Assert.assertEquals(718800, textArea.crOriginY());
+ }
+
+ /**
+ * Test of fo/block-004.fo.
+ * This is a test of centering of a text-area on a line, where the text-area
+ * has word-spacing = ".3em".
+ * @throws FontException For font system errors in obtaining the font.
+ */
+ @Test
+ @Ignore
+ public void testBlock004() throws FontException {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/block-004.fo", getLineBreakerFactory());
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
+ areaTree);
+
+ /* Test location and dimensions of the block area. */
+ AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
+ 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). */
+ Assert.assertEquals(720000, blockArea.crOriginY());
+ /* Page is 8.5 inches wide, with 2 inches total margin.
+ * 6.5 * 72,000 = 468,000. */
+ Assert.assertEquals(468000, blockArea.crIpd());
+
+ /* Test location and dimensions of the line area. */
+ node = blockArea.areaNodeChildAt(0);
+ 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. */
+ Assert.assertEquals(718800, lineArea.crOriginY());
+ /* ipd same as parent block. */
+ Assert.assertEquals(468000, lineArea.crIpd());
+
+ /* Test location and dimensions of the text area. The key thing we are
+ * testing here is that IT IS CENTERED. */
+ node = lineArea.areaNodeChildAt(0);
+ Assert.assertTrue(node instanceof TextArea);
+ final TextArea textArea = (TextArea) node;
+
+ final FontUse fontUse = getHelveticaFont();
+ /* The following computation is tested in {@link TestFont4a#testWidth()}.
+ * The extra word spacing is .3em = .3 * 12000 = 3600. */
+ final String testString = "Centered with Word Spacing";
+ final int textWidth = fontUse.width(testString, 0, testString.length(), 12000, 0, 3600,
+ this.fontOptionsWithKerning, null);
+ Assert.assertEquals(textWidth, textArea.crIpd());
+
+ /* The x value of the text area content rectangle should be at the x
+ * location of the parent line area + 1/2 of the unused area in the
+ * line. Total line area ipd = 468,000. Unused line area ipd =
+ * 468,000 - 162,684 = 305,316. One half of the unused line area ipd =
+ * 152,658.
+ * x = 72,000 + 152,238 = 224,658. */
+ Assert.assertEquals(224658, textArea.crOriginX());
+
+ /* The y value of the text area content rectangle should be the same as
+ * the parent line area. */
+ Assert.assertEquals(718800, textArea.crOriginY());
+ }
+
+}
Copied: trunk/foray/foray-app/src/test/java/org/foray/app/area/BorderTests.java (from rev 12770, trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java)
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/BorderTests.java (rev 0)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/BorderTests.java 2022-12-03 18:53:18 UTC (rev 12771)
@@ -0,0 +1,69 @@
+/*
+ * 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.app.area;
+
+import org.foray.area.AreaNode4a;
+import org.foray.area.AreaTree4a;
+import org.foray.area.NormalBlockArea4a;
+import org.foray.area.NormalFlowRa4a;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests of various border-related concepts at the Area Tree level.
+ */
+public class BorderTests extends AbstractAreaTreeTest {
+
+ /**
+ * Test of fo/border-style-001.fo.
+ */
+ @Test
+ public void testBorderStyle001() {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/border-style-001.fo", getLineBreakerFactory());
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(areaTree);
+
+ final AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
+ 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());
+
+ Assert.assertEquals(72500, blockArea.prOriginX());
+ Assert.assertEquals(719500, blockArea.prOriginY());
+ Assert.assertEquals(431000, blockArea.prIpd());
+
+ Assert.assertEquals(72500, blockArea.crOriginX());
+ Assert.assertEquals(719500, blockArea.crOriginY());
+ Assert.assertEquals(431000, blockArea.crIpd());
+ }
+
+}
Copied: trunk/foray/foray-app/src/test/java/org/foray/app/area/GraphicAreaTests.java (from rev 12720, trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java)
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/GraphicAreaTests.java (rev 0)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/GraphicAreaTests.java 2022-12-03 18:53:18 UTC (rev 12771)
@@ -0,0 +1,88 @@
+/*
+ * 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.app.area;
+
+import org.foray.area.AreaNode4a;
+import org.foray.area.AreaTree4a;
+import org.foray.area.ExternalGraphicArea;
+import org.foray.area.LineArea4a;
+import org.foray.area.NormalBlockArea4a;
+import org.foray.area.NormalFlowRa4a;
+import org.foray.core.ForayException;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests of various graphic-related concepts at the Area Tree level.
+ */
+public class GraphicAreaTests extends AbstractAreaTreeTest {
+
+ /**
+ * Test of fo/graphic-002.fo, which contains a simple 200 x 50 SVG
+ * containing some text. The main thing we are testing here is that the
+ * dimensions of the viewport are correct.
+ * @throws ForayException For errors creating the FO Tree or Area Tree.
+ */
+ @Test
+ @Ignore
+ public void testGraphic002() throws ForayException {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/graphic-002.fo", getLineBreakerFactory());
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(areaTree);
+
+ /* There are two block areas. */
+ Assert.assertEquals(2, firstNormalFlowArea.qtyAreaNodeChildren());
+
+ /* The second one contains the graphic. */
+ AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(1);
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
+
+ /* It has one child, a LineArea ... */
+ Assert.assertEquals(1, node.qtyAreaNodeChildren());
+ node = node.areaNodeChildAt(0);
+ Assert.assertTrue(node instanceof LineArea4a);
+
+ /* ... which has one child, an ExternalGraphicArea. */
+ Assert.assertEquals(1, node.qtyAreaNodeChildren());
+ node = node.areaNodeChildAt(0);
+ Assert.assertTrue(node instanceof ExternalGraphicArea);
+
+ /* First test the size of the viewport. */
+ final ExternalGraphicArea ega = (ExternalGraphicArea) node;
+ final int width = ega.crIpd();
+ /* 200 pixels @ 96 pixels per inch = (200 / 96) * 72,000 millipoints
+ * = 150,000 millipoints. */
+ Assert.assertEquals(150000, width);
+
+ /* Now test the size of the content. */
+ }
+
+}
Copied: trunk/foray/foray-app/src/test/java/org/foray/app/area/InlineTests.java (from rev 12720, trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java)
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/InlineTests.java (rev 0)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/InlineTests.java 2022-12-03 18:53:18 UTC (rev 12771)
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2008 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.app.area;
+
+import org.foray.area.AreaNode4a;
+import org.foray.area.AreaTree4a;
+import org.foray.area.InlineArea;
+import org.foray.area.LineArea4a;
+import org.foray.area.NormalBlockArea4a;
+import org.foray.area.NormalFlowRa4a;
+import org.foray.area.TextArea;
+import org.foray.core.ForayException;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests of various block-related concepts at the Area Tree level.
+ */
+public class InlineTests extends AbstractAreaTreeTest {
+
+ /**
+ * Test of fo/inline-001.fo. This test simply makes sure that the nesting of the various areas
+ * created is correct.
+ * Also does some basic testing of a text area's ability to return its text.
+ * @throws ForayException For errors creating the FO Tree or Area Tree.
+ */
+ @Test
+ @Ignore
+ public void testInline001() throws ForayException {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/inline-001.fo", getLineBreakerFactory());
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
+ areaTree);
+ Assert.assertEquals(1, firstNormalFlowArea.qtyAreaNodeChildren());
+
+ /* The block area. */
+ AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
+ Assert.assertTrue(node instanceof NormalBlockArea4a);
+ final NormalBlockArea4a blockArea = (NormalBlockArea4a) node;
+ Assert.assertEquals(1, blockArea.qtyAreaNodeChildren());
+
+ /* The only child of the block area is a line area. */
+ node = blockArea.areaNodeChildAt(0);
+ Assert.assertTrue(node instanceof LineArea4a);
+ final LineArea4a lineArea = (LineArea4a) node;
+ Assert.assertEquals(3, lineArea.qtyAreaNodeChildren());
+
+ /* The first child of the line area is a text area. */
+ node = lineArea.areaNodeChildAt(0);
+ Assert.assertTrue(node instanceof TextArea);
+ final TextArea textArea1 = (TextArea) node;
+ Assert.assertEquals("Lighter(1), ", textArea1.getText().toString());
+
+ /* The second child of the line area is the outside inline area. */
+ node = lineArea.areaNodeChildAt(1);
+ Assert.assertTrue(node instanceof InlineArea);
+ final InlineArea inlineArea1 = (InlineArea) node;
+ Assert.assertEquals(3, inlineArea1.qtyAreaNodeChildren());
+
+ /* The first child of the outside inline area is a text area. */
+ node = inlineArea1.areaNodeChildAt(0);
+ Assert.assertTrue(node instanceof TextArea);
+ final TextArea textArea2 = (TextArea) node;
+ Assert.assertEquals("Bolder(1), ", textArea2.getText().toString());
+
+ /* The second child of the outside inline area is the inside inline area. */
+ node = inlineArea1.areaNodeChildAt(1);
+ Assert.assertTrue(node instanceof InlineArea);
+ final InlineArea inlineArea2 = (InlineArea) node;
+ Assert.assertEquals(1, inlineArea2.qtyAreaNodeChildren());
+
+ /* The first and only child of the inside inline area is a text area. */
+ node = inlineArea2.areaNodeChildAt(0);
+ Assert.assertTrue(node instanceof TextArea);
+ final TextArea textArea3 = (TextArea) node;
+ final String textArea3Text = textArea3.getText().toString();
+ Assert.assertEquals("Lighter(2), ", textArea3Text);
+
+ /* The third child of the outside inline area is another text area. */
+ node = inlineArea1.areaNodeChildAt(2);
+ Assert.assertTrue(node instanceof TextArea);
+ final TextArea textArea4 = (TextArea) node;
+ Assert.assertEquals("Bolder(2), ", textArea4.getText().toString());
+
+ /* The third child of the line area is another text area. */
+ node = lineArea.areaNodeChildAt(2);
+ Assert.assertTrue(node instanceof TextArea);
+ final TextArea textArea5 = (TextArea) node;
+ Assert.assertEquals("Lighter(3).", textArea5.getText().toString());
+
+ }
+
+}
Copied: trunk/foray/foray-app/src/test/java/org/foray/app/area/MetadataTests.java (from rev 12720, trunk/foray/foray-app/src/test/java/org/foray/app/area/TestMetadata.java)
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/MetadataTests.java (rev 0)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/MetadataTests.java 2022-12-03 18:53:18 UTC (rev 12771)
@@ -0,0 +1,59 @@
+/*
+ * 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.app.area;
+
+import org.foray.area.AreaTree4a;
+import org.foray.core.ForayException;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests of metadata at the Area Tree level.
+ */
+public class MetadataTests extends AbstractAreaTreeTest {
+
+ /**
+ * Test of fo/metadata-001.fo.
+ * @throws ForayException For errors creating the FO Tree or Area Tree.
+ */
+ @Test
+ @Ignore
+ public void testMetadata001() throws ForayException {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree4a areaTree = creator.buildAreaTree("fo/metadata-001.fo", getLineBreakerFactory());
+ Assert.assertNotNull(areaTree);
+ Assert.assertEquals("Test Title", areaTree.getMetadata().getTitle());
+ Assert.assertEquals("Test Author", areaTree.getMetadata().getAuthor());
+ Assert.assertEquals("Test Subject", areaTree.getMetadata().getSubject());
+ Assert.assertEquals("Test Keywords", areaTree.getMetadata().getKeywords());
+ }
+
+}
Deleted: 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 2022-12-03 18:45:44 UTC (rev 12770)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2022-12-03 18:53:18 UTC (rev 12771)
@@ -1,358 +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.app.area;
-
-
-import org.foray.area.AreaNode4a;
-import org.foray.area.AreaTree4a;
-import org.foray.area.LineArea4a;
-import org.foray.area.NormalBlockArea4a;
-import org.foray.area.NormalFlowRa4a;
-import org.foray.area.PageCollection4a;
-import org.foray.area.TextArea;
-import org.foray.common.FontContext4a;
-
-import org.axsl.font.FontException;
-import org.axsl.font.FontUse;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Tests of various block-related concepts at the Area Tree level.
- */
-public class TestBlock extends AbstractAreaTreeTest {
-
- /** The font options. */
- private FontContext4a fontOptionsWithKerning;
-
- /**
- * Setup the fixtures needed by the test.
- */
- @Before
- public void setup() {
- this.fontOptionsWithKerning = new FontContext4a();
- this.fontOptionsWithKerning.setKerning(true);
- }
-
- /**
- * Test of fo/block-001.fo.
- */
- @Test
- public void testBlock001() {
- final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree("fo/block-001.fo", getLineBreakerFactory());
- final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(areaTree);
-
- /* The outer block area. */
- AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
- 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). */
- Assert.assertEquals(720000, outerBlockArea.crOriginY());
- /* Page is 8 inches wide, with 2 inches total margin. 6 * 72,000 = 432,000. */
- Assert.assertEquals(432000, outerBlockArea.crIpd());
-
- /* The first child of the outer block area is a line-area. */
- node = outerBlockArea.areaNodeChildAt(0);
- 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());
- /* Same as parent. */
- Assert.assertEquals(72000, lineArea.crOriginX());
- /* Same as parent, but adjusted for a half-leading space-before.
- * Default leading is 20% of the font-size, which is 12 points.
- * 50% * 20% * 12,000 = 1,200.
- * 720,000 - 1,200 = 718,800. */
- Assert.assertEquals(718800, lineArea.crOriginY());
- /* Same as parent. */
- Assert.assertEquals(432000, lineArea.crIpd());
- /* Default font-size is 12 points. */
- Assert.assertEquals(12000, lineArea.crBpd());
-
- /* The second child of the outer block area is a block-area. */
- node = outerBlockArea.areaNodeChildAt(1);
- 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());
- /* Same as parent. */
- Assert.assertEquals(72000, insideBlockArea.crOriginX());
- /* Computed as that for the previous line, adjusted for one line,
- * including another half-leading, the space-after for that line.
- * 718,800 - 12,000 - 1,200 = 705,600. */
- Assert.assertEquals(705600, insideBlockArea.crOriginY());
- /* Same as parent. */
- Assert.assertEquals(432000, insideBlockArea.crIpd());
- /* Height of 0, as it has no content. */
- Assert.assertEquals(0, insideBlockArea.crBpd());
-
- /* The third child of the outer block area is another line-area. */
- node = outerBlockArea.areaNodeChildAt(2);
- 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());
- /* Same as parent. */
- Assert.assertEquals(72000, lineArea.crOriginX());
- /* Same as the previous block, adjusted for an additional half-leading.
- * 705,600 - 1,200 = 704,400. */
- Assert.assertEquals(704400, lineArea.crOriginY());
- /* Same as parent. */
- Assert.assertEquals(432000, lineArea.crIpd());
- /* Same as the first line. */
- Assert.assertEquals(12000, lineArea.crBpd());
-
- /* The fourth child of the outer block area is another line-area. */
- node = outerBlockArea.areaNodeChildAt(3);
- 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. */
- Assert.assertEquals(2400, lineArea.getAnteriorSpace());
- /* Same as parent. */
- Assert.assertEquals(72000, lineArea.crOriginX());
- /* Same as the previous line, adjusted for one line and two half-leadings.
- * 704,400 - 12,000 - 1,200 - 1,200 = 690,000. */
- Assert.assertEquals(690000, lineArea.crOriginY());
- /* Same as parent. */
- Assert.assertEquals(432000, lineArea.crIpd());
- /* Same as the other lines. */
- Assert.assertEquals(12000, lineArea.crBpd());
- }
-
- /**
- * Test of fo/block-002.fo.
- */
- @Test
- @Ignore
- public void testBlock002() {
- final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree("fo/block-002.fo", getLineBreakerFactory());
- final PageCollection4a pageCollection = this.getPageCollection(areaTree,
- 1);
- final int numPages = pageCollection.qtyAreaNodeChildren();
- Assert.assertEquals(2, numPages);
- final String documentContent = this.getText(areaTree);
- final String testString =
- " This document is on a short (4 inches high) page, "
- + "and contains one block. "
- + "The content of that one block is intended to spill onto a "
- + "second page, the "
- + "purpose being to test whether all of the content ends up in "
- + "the output document. "
- + "This is test sentence 1. "
- + "This is test sentence 2. "
- + "This is test sentence 3. "
- + "This is test sentence 4. "
- + "This is test sentence 5. "
- + "This is test sentence 6. "
- + "This is test sentence 7. "
- + "This is test sentence 8. "
- + "This is test sentence 9. "
- + "This is test sentence 10. "
- + "This is test sentence 11. "
- + "This is test sentence 12. "
- + "This is test sentence 13. "
- + "This is test sentence 14. "
- + "This is test sentence 15. "
- + "This is test sentence 16. "
- + "This is test sentence 17. "
- + "This is test sentence 18. "
- + "This is test sentence 19. "
- + "This is test sentence 20. "
- + "This is test sentence 21. "
- + "This is test sentence 22. "
- + "This is test sentence 23. "
- + "This is test sentence 24. "
- + "This is test sentence 25. "
- + "This is test sentence 26. "
- + "This is test sentence 27. "
- + "This is test sentence 28. "
- + "This is test sentence 29. "
- + "This is test sentence 30. "
- + "This is test sentence 31. "
- + "This is test sentence 32. "
- + "This is test sentence 33. "
- + "This is test sentence 34. "
- + "This is test sentence 35. "
- + "This is test sentence 36. "
- + "This is test sentence 37. "
- + "This is test sentence 38. "
- + "This is test sentence 39. "
- + "This is test sentence 40. "
- + "This is test sentence 41. "
- + "This is test sentence 42. "
- + "This is test sentence 43. "
- + "This is test sentence 44. "
- + "This is test sentence 45. "
- + "This is test sentence 46. "
- + "This is test sentence 47. "
- + "This is test sentence 48. "
- + "This is test sentence 49. "
- + "This is test sentence 50. "
- + "This is test sentence 51. "
- + "This is test sentence 52. "
- + "This is test sentence 53. "
- + "This is test sentence 54. ";
- Assert.assertEquals(testString, documentContent);
- }
-
- /**
- * Test of fo/block-003.fo.
- * This is a test of simple centering of a text-area on a line.
- * @throws FontException For errors in the font system.
- */
- @Test
- @Ignore
- public void testBlock003() throws FontException {
- final AreaTreeCreator creator = AreaTreeCreator.getInstance();
-
- final AreaTree4a areaTree = creator.buildAreaTree("fo/block-003.fo", getLineBreakerFactory());
- final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
- areaTree);
-
- /* Test location and dimensions of the block area. */
- AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
- 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). */
- Assert.assertEquals(720000, blockArea.crOriginY());
- /* Page is 8.5 inches wide, with 2 inches total margin.
- * 6.5 * 72,000 = 468,000. */
- Assert.assertEquals(468000, blockArea.crIpd());
-
- /* Test location and dimensions of the line area. */
- node = blockArea.areaNodeChildAt(0);
- 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. */
- Assert.assertEquals(718800, lineArea.crOriginY());
- /* ipd same as parent block. */
- Assert.assertEquals(468000, lineArea.crIpd());
-
- /* Test location and dimensions of the text area. The key thing we are
- * testing here is that IT IS CENTERED. */
- node = lineArea.areaNodeChildAt(0);
- Assert.assertTrue(node instanceof TextArea);
- final TextArea textArea = (TextArea) node;
-
- final FontUse fontUse = getHelveticaFont();
- /* The following computation is tested in {@link TestFont4a#testWidth()}. */
- final String testString = "Test of Centering";
- final int textWidth = fontUse.width(
- testString, 0, testString.length(), 12000, 0, 0, this.fontOptionsWithKerning, null);
- Assert.assertEquals(textWidth, textArea.crIpd());
-
- /* The x value of the text area content rectangle should be at the x
- * location of the parent line area + 1/2 of the unused area in the
- * line. Total line area ipd = 468,000. Unused line area ipd =
- * 468,000 - 90,780 = 377,220. One half of the unused line area ipd =
- * 188,610. x = 72,000 + 188,610 = 260,610. */
- Assert.assertEquals(260610, textArea.crOriginX());
-
- /* The y value of the text area content rectangle should be the same as
- * the parent line area. */
- Assert.assertEquals(718800, textArea.crOriginY());
- }
-
- /**
- * Test of fo/block-004.fo.
- * This is a test of centering of a text-area on a line, where the text-area
- * has word-spacing = ".3em".
- * @throws FontException For font system errors in obtaining the font.
- */
- @Test
- @Ignore
- public void testBlock004() throws FontException {
- final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree("fo/block-004.fo", getLineBreakerFactory());
- final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
- areaTree);
-
- /* Test location and dimensions of the block area. */
- AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
- 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). */
- Assert.assertEquals(720000, blockArea.crOriginY());
- /* Page is 8.5 inches wide, with 2 inches total margin.
- * 6.5 * 72,000 = 468,000. */
- Assert.assertEquals(468000, blockArea.crIpd());
-
- /* Test location and dimensions of the line area. */
- node = blockArea.areaNodeChildAt(0);
- 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. */
- Assert.assertEquals(718800, lineArea.crOriginY());
- /* ipd same as parent block. */
- Assert.assertEquals(468000, lineArea.crIpd());
-
- /* Test location and dimensions of the text area. The key thing we are
- * testing here is that IT IS CENTERED. */
- node = lineArea.areaNodeChildAt(0);
- Assert.assertTrue(node instanceof TextArea);
- final TextArea textArea = (TextArea) node;
-
- final FontUse fontUse = getHelveticaFont();
- /* The following computation is tested in {@link TestFont4a#testWidth()}.
- * The extra word spacing is .3em = .3 * 12000 = 3600. */
- final String testString = "Centered with Word Spacing";
- final int textWidth = fontUse.width(testString, 0, testString.length(), 12000, 0, 3600,
- this.fontOptionsWithKerning, null);
- Assert.assertEquals(textWidth, textArea.crIpd());
-
- /* The x value of the text area content rectangle should be at the x
- * location of the parent line area + 1/2 of the unused area in the
- * line. Total line area ipd = 468,000. Unused line area ipd =
- * 468,000 - 162,684 = 305,316. One half of the unused line area ipd =
- * 152,658.
- * x = 72,000 + 152,238 = 224,658. */
- Assert.assertEquals(224658, textArea.crOriginX());
-
- /* The y value of the text area content rectangle should be the same as
- * the parent line area. */
- Assert.assertEquals(718800, textArea.crOriginY());
- }
-
-}
Deleted: 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 2022-12-03 18:45:44 UTC (rev 12770)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java 2022-12-03 18:53:18 UTC (rev 12771)
@@ -1,69 +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.app.area;
-
-import org.foray.area.AreaNode4a;
-import org.foray.area.AreaTree4a;
-import org.foray.area.NormalBlockArea4a;
-import org.foray.area.NormalFlowRa4a;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Tests of various border-related concepts at the Area Tree level.
- */
-public class TestBorder extends AbstractAreaTreeTest {
-
- /**
- * Test of fo/border-style-001.fo.
- */
- @Test
- public void testBorderStyle001() {
- final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree("fo/border-style-001.fo", getLineBreakerFactory());
- final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(areaTree);
-
- final AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
- 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());
-
- Assert.assertEquals(72500, blockArea.prOriginX());
- Assert.assertEquals(719500, blockArea.prOriginY());
- Assert.assertEquals(431000, blockArea.prIpd());
-
- Assert.assertEquals(72500, blockArea.crOriginX());
- Assert.assertEquals(719500, blockArea.crOriginY());
- Assert.assertEquals(431000, blockArea.crIpd());
- }
-
-}
Deleted: 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 2022-12-03 18:45:44 UTC (rev 12770)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java 2022-12-03 18:53:18 UTC (rev 12771)
@@ -1,88 +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.app.area;
-
-import org.foray.area.AreaNode4a;
-import org.foray.area.AreaTree4a;
-import org.foray.area.ExternalGraphicArea;
-import org.foray.area.LineArea4a;
-import org.foray.area.NormalBlockArea4a;
-import org.foray.area.NormalFlowRa4a;
-import org.foray.core.ForayException;
-
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Tests of various graphic-related concepts at the Area Tree level.
- */
-public class TestGraphicArea extends AbstractAreaTreeTest {
-
- /**
- * Test of fo/graphic-002.fo, which contains a simple 200 x 50 SVG
- * containing some text. The main thing we are testing here is that the
- * dimensions of the viewport are correct.
- * @throws ForayException For errors creating the FO Tree or Area Tree.
- */
- @Test
- @Ignore
- public void testGraphic002() throws ForayException {
- final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree("fo/graphic-002.fo", getLineBreakerFactory());
- final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(areaTree);
-
- /* There are two block areas. */
- Assert.assertEquals(2, firstNormalFlowArea.qtyAreaNodeChildren());
-
- /* The second one contains the graphic. */
- AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(1);
- Assert.assertTrue(node instanceof NormalBlockArea4a);
-
- /* It has one child, a LineArea ... */
- Assert.assertEquals(1, node.qtyAreaNodeChildren());
- node = node.areaNodeChildAt(0);
- Assert.assertTrue(node instanceof LineArea4a);
-
- /* ... which has one child, an ExternalGraphicArea. */
- Assert.assertEquals(1, node.qtyAreaNodeChildren());
- node = node.areaNodeChildAt(0);
- Assert.assertTrue(node instanceof ExternalGraphicArea);
-
- /* First test the size of the viewport. */
- final ExternalGraphicArea ega = (ExternalGraphicArea) node;
- final int width = ega.crIpd();
- /* 200 pixels @ 96 pixels per inch = (200 / 96) * 72,000 millipoints
- * = 150,000 millipoints. */
- Assert.assertEquals(150000, width);
-
- /* Now test the size of the content. */
- }
-
-}
Deleted: 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 2022-12-03 18:45:44 UTC (rev 12770)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java 2022-12-03 18:53:18 UTC (rev 12771)
@@ -1,121 +0,0 @@
-/*
- * Copyright 2008 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.app.area;
-
-import org.foray.area.AreaNode4a;
-import org.foray.area.AreaTree4a;
-import org.foray.area.InlineArea;
-import org.foray.area.LineArea4a;
-import org.foray.area.NormalBlockArea4a;
-import org.foray.area.NormalFlowRa4a;
-import org.foray.area.TextArea;
-import org.foray.core.ForayException;
-
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Tests of various block-related concepts at the Area Tree level.
- */
-public class TestInline extends AbstractAreaTreeTest {
-
- /**
- * Test of fo/inline-001.fo. This test simply makes sure that the nesting of the various areas
- * created is correct.
- * Also does some basic testing of a text area's ability to return its text.
- * @throws ForayException For errors creating the FO Tree or Area Tree.
- */
- @Test
- @Ignore
- public void testInline001() throws ForayException {
- final AreaTreeCreator creator = AreaTreeCreator.getInstance();
- final AreaTree4a areaTree = creator.buildAreaTree("fo/inline-001.fo", getLineBreakerFactory());
- final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
- areaTree);
- Assert.assertEquals(1, firstNormalFlowArea.qtyAreaNodeChildren());
-
- /* The block area. */
- AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
- Assert.assertTrue(node instanceof NormalBlockArea4a);
- final NormalBlockArea4a blockArea = (NormalBlockArea4a) node;
- Assert.assertEquals(1, blockArea.qtyAreaNodeChildren());
-
- /* The only child of the block area is a line area. */
- node = blockArea.areaNodeChildAt(0);
- Assert.assertTrue(node instanceof LineArea4a);
- final LineArea4a lineArea = (LineArea4a) node;
- Assert.assertEquals(3, lineArea.qtyAreaNodeChildren());
-
- /* The first child of the line area is a text area. */
- node = lineArea.areaNodeChildAt(0);
- Assert.assertTrue(node instanceof TextArea);
- final TextArea textArea1 = (TextArea) node;
- Assert.assertEquals("Lighter(1), ", textArea1.getText().toString());
-
- /* The second child of the line area is the outside inline area. */
- node = lineArea.areaNodeChildAt(1);
- Assert.assertTrue(node instanceof InlineArea);
- final InlineArea inlineArea1 = (InlineArea) node;
- Assert.assertEquals(3, inlineArea1.qtyAreaNodeChildren());
-
- /* The first child of the outside inline area is a text area. */
- node = inlineArea1.areaNodeChildAt(0);
- Assert.assertTrue(node instanceof TextArea);
- final TextArea textArea2 = (TextArea) node;
- Assert.assertEquals("Bolder(1), ", textArea2.getText().toString());
-
- /* The second child of the outside inline area is the inside inline area. */
- node = inlineArea1.areaNodeChildAt(1);
- Assert.assertTrue(node instanceof InlineArea);
- final InlineArea inlineArea2 = (InlineArea) node;
- Assert.assertEquals(1, inlineArea2.qtyAreaNodeChildren());
-
- /* The first and only child of the inside inline area is a text area. */
- node = inlineArea2.areaNodeChildAt(0);
- Assert.assertTrue(node instanceof TextArea);
- final TextArea textArea3 = (TextArea) node;
- final String textArea3Text = textArea3.getText().toString();
- Assert.assertEquals("Lighter(2), ", textArea3Text);
-
- /* The third child of the outside inline area is another text area. */
- node = inlineArea1.areaNodeChildAt(2);
- Assert.assertTrue(node instanceof TextArea);
- final TextArea textArea4 = (TextArea) node;
- Assert.assertEquals("Bolder(2), ", textArea4.getText().toString());
-
- /* The th...
[truncated message content] |
|
From: <vic...@us...> - 2022-12-03 18:45:46
|
Revision: 12770
http://sourceforge.net/p/foray/code/12770
Author: victormote
Date: 2022-12-03 18:45:44 +0000 (Sat, 03 Dec 2022)
Log Message:
-----------
Liberate some ignored tests, now that the input files are again readable.
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/fo/TestFont.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 2022-12-03 18:20:05 UTC (rev 12769)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2022-12-03 18:45:44 UTC (rev 12770)
@@ -37,7 +37,6 @@
import org.foray.area.PageCollection4a;
import org.foray.area.TextArea;
import org.foray.common.FontContext4a;
-import org.foray.core.ForayException;
import org.axsl.font.FontException;
import org.axsl.font.FontUse;
@@ -66,15 +65,12 @@
/**
* Test of fo/block-001.fo.
- * @throws ForayException For errors creating the FO Tree or Area Tree.
*/
@Test
- @Ignore
- public void testBlock001() throws ForayException {
+ public void testBlock001() {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/block-001.fo", getLineBreakerFactory());
- final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
- areaTree);
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(areaTree);
/* The outer block area. */
AreaNode4a node = firstNormalFlowArea.areaNodeChildAt(0);
@@ -84,8 +80,7 @@
Assert.assertEquals(72000, outerBlockArea.crOriginX());
/* 10 inches from bottom (11 inches high, 1 inch top margin). */
Assert.assertEquals(720000, outerBlockArea.crOriginY());
- /* Page is 8 inches wide, with 2 inches total margin.
- * 6 * 72,000 = 432,000. */
+ /* Page is 8 inches wide, with 2 inches total margin. 6 * 72,000 = 432,000. */
Assert.assertEquals(432000, outerBlockArea.crIpd());
/* The first child of the outer block area is a line-area. */
@@ -92,8 +87,7 @@
node = outerBlockArea.areaNodeChildAt(0);
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. */
+ /* Should have anterior space of one half-leading, which comes from the space-before of this line. */
Assert.assertEquals(1200, lineArea.getAnteriorSpace());
/* Same as parent. */
Assert.assertEquals(72000, lineArea.crOriginX());
@@ -111,8 +105,7 @@
node = outerBlockArea.areaNodeChildAt(1);
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. */
+ /* Should have anterior space of one half-leading, which comes from the space-after of the previous line. */
Assert.assertEquals(1200, insideBlockArea.getAnteriorSpace());
/* Same as parent. */
Assert.assertEquals(72000, insideBlockArea.crOriginX());
@@ -129,8 +122,7 @@
node = outerBlockArea.areaNodeChildAt(2);
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. */
+ /* Should have anterior space of one half-leading, which comes from the space-before of this line. */
Assert.assertEquals(1200, lineArea.getAnteriorSpace());
/* Same as parent. */
Assert.assertEquals(72000, lineArea.crOriginX());
@@ -146,14 +138,12 @@
node = outerBlockArea.areaNodeChildAt(3);
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. */
+ /* 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. */
Assert.assertEquals(2400, lineArea.getAnteriorSpace());
/* Same as parent. */
Assert.assertEquals(72000, lineArea.crOriginX());
- /* Same as the previous line, adjusted for one line and two
- * half-leadings.
+ /* Same as the previous line, adjusted for one line and two half-leadings.
* 704,400 - 12,000 - 1,200 - 1,200 = 690,000. */
Assert.assertEquals(690000, lineArea.crOriginY());
/* Same as parent. */
@@ -164,11 +154,10 @@
/**
* Test of fo/block-002.fo.
- * @throws ForayException For errors creating the FO Tree or Area Tree.
*/
@Test
@Ignore
- public void testBlock002() throws ForayException {
+ public void testBlock002() {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/block-002.fo", getLineBreakerFactory());
final PageCollection4a pageCollection = this.getPageCollection(areaTree,
@@ -243,12 +232,11 @@
/**
* Test of fo/block-003.fo.
* This is a test of simple centering of a text-area on a line.
- * @throws ForayException For errors creating the FO Tree or Area Tree.
* @throws FontException For errors in the font system.
*/
@Test
@Ignore
- public void testBlock003() throws ForayException, FontException {
+ public void testBlock003() throws FontException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/block-003.fo", getLineBreakerFactory());
@@ -307,12 +295,11 @@
* Test of fo/block-004.fo.
* This is a test of centering of a text-area on a line, where the text-area
* has word-spacing = ".3em".
- * @throws ForayException For errors creating the FO Tree or Area Tree.
* @throws FontException For font system errors in obtaining the font.
*/
@Test
@Ignore
- public void testBlock004() throws ForayException, FontException {
+ public void testBlock004() throws FontException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/block-004.fo", getLineBreakerFactory());
final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
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 2022-12-03 18:20:05 UTC (rev 12769)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java 2022-12-03 18:45:44 UTC (rev 12770)
@@ -32,10 +32,8 @@
import org.foray.area.AreaTree4a;
import org.foray.area.NormalBlockArea4a;
import org.foray.area.NormalFlowRa4a;
-import org.foray.core.ForayException;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -45,11 +43,9 @@
/**
* Test of fo/border-style-001.fo.
- * @throws ForayException For errors creating the FO Tree or Area Tree.
*/
@Test
- @Ignore
- public void testBorderStyle001() throws ForayException {
+ public void testBorderStyle001() {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/border-style-001.fo", getLineBreakerFactory());
final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(areaTree);
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 2022-12-03 18:20:05 UTC (rev 12769)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java 2022-12-03 18:45:44 UTC (rev 12770)
@@ -38,7 +38,6 @@
import org.axsl.fotree.FoTreeException;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
import java.util.List;
@@ -53,7 +52,6 @@
* @throws ForayException For errors creating the FO Tree.
*/
@Test
- @Ignore
public void testFontFamily001() throws FoTreeException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
final FoTree4a foTree = reader.buildFoTree("fo/font-family-001.fo");
@@ -83,7 +81,6 @@
* @throws FoTreeException For errors creating the FO Tree.
*/
@Test
- @Ignore
public void testFontSize001() throws FoTreeException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
final FoTree4a foTree = reader.buildFoTree("fo/font-size-001.fo");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-03 18:20:09
|
Revision: 12769
http://sourceforge.net/p/foray/code/12769
Author: victormote
Date: 2022-12-03 18:20:05 +0000 (Sat, 03 Dec 2022)
Log Message:
-----------
Register Base14 font-families, fonts, and font descriptions at construction time.
Modified Paths:
--------------
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2022-12-03 18:17:25 UTC (rev 12768)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2022-12-03 18:20:05 UTC (rev 12769)
@@ -45,6 +45,7 @@
import org.apache.commons.discovery.tools.DiscoverSingleton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.event.Level;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -62,6 +63,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -76,6 +78,12 @@
/** Constant indicating the default percentage to be applied when creating faux small-caps. */
private static final int DEFAULT_SMALL_CAPS_SIZE = 80;
+ /** List of font-family aliases for which a default value is provided as the server is created. If an alias with
+ * one of these names is registered, overwriting the existing default value is treated normally instead of as a
+ * warning. */
+ private static final List<String> PREDEFINED_ALIASES = Collections.unmodifiableList(Arrays.asList(
+ "serif", "sans-serif", "monospace"));
+
/**
* Base URL where general resources are located. System resource
* locations can be passed that are relative to this URL.
@@ -151,6 +159,8 @@
/**
* Constructor.
+ * The Base-14 fonts and aliases for "serif", "sans-serif", and "monospaced" are registered to Base-14-Times,
+ * Base
* @param psServer The PostScript server.
*/
public FontServer4a(final PsServer psServer) {
@@ -157,6 +167,8 @@
this.psServer = psServer;
try {
registerBase14Fonts();
+ registerDefaultAliases();
+ registerBase14Descriptions();
} catch (final FontException e) {
throw new IllegalStateException("Unable to register Base-14 fonts", e);
}
@@ -355,11 +367,6 @@
getLogger().debug("Setting up fonts.");
registerAWTFonts();
readFontConfig(fontConfigFile);
- /* Wait until the font configuration has been processed before creating
- * the default families, descriptions, and aliases, as the user may
- * have customized them. */
- registerBase14Descriptions();
- registerDefaultAliases();
this.setupCompleted = true;
if (this.logger.isDebugEnabled()) {
listSystemFonts();
@@ -745,20 +752,21 @@
* Add an alias to a RegisteredFontFamily.
* @param alias The name of the font family alias (e.g. "sans-serif").
* @param realFamily The name of the real font family to which this alias should be associated (e.g. "Helvetica").
- * @throws FontException If the {@code realFamily} does not exist, or if the alias is already registered to another
- * font-family.
*/
- public void registerFontFamilyAlias(final String alias, final String realFamily) throws FontException {
+ public void registerFontFamilyAlias(final String alias, final String realFamily) {
final RegisteredFontFamily rff = this.fontFamilies.get(realFamily);
if (rff == null) {
- throw new FontException("Font family " + realFamily
- + " not found. Can't register alias: " + alias);
+ this.logger.warn("Font family \"{}\" not found. Can't register alias: \"{}\".", realFamily, alias);
}
if (this.fontFamilyAliases.containsKey(alias)) {
- final RegisteredFontFamily family = this.fontFamilyAliases.get(
- alias);
- throw new FontException("Alias " + alias
- + " already registered to family " + family.getName());
+ Level loggingLevel = Level.WARN;
+ if (PREDEFINED_ALIASES.contains(alias)) {
+ /* Treat this as a normal even instead of something for which a warning needs to be logged. */
+ loggingLevel = Level.DEBUG;
+ }
+ final RegisteredFontFamily family = this.fontFamilyAliases.get(alias);
+ this.logger.atLevel(loggingLevel).log("Alias \"{}\" already registered to family \"{}\".", alias,
+ family.getName());
}
this.fontFamilyAliases.put(alias, rff);
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2022-12-03 18:17:25 UTC (rev 12768)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2022-12-03 18:20:05 UTC (rev 12769)
@@ -277,11 +277,7 @@
|| family.equals("")) {
errorMessage("font-family-alias entry invalid. " + "Igcase red.");
} else {
- try {
- this.fontServer.registerFontFamilyAlias(alias, family);
- } catch (final FontException e) {
- errorMessage(e.getMessage());
- }
+ this.fontServer.registerFontFamilyAlias(alias, family);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-03 18:17:28
|
Revision: 12768
http://sourceforge.net/p/foray/code/12768
Author: victormote
Date: 2022-12-03 18:17:25 +0000 (Sat, 03 Dec 2022)
Log Message:
-----------
Allow static imports.
Modified Paths:
--------------
trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
Modified: trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-12-03 00:13:35 UTC (rev 12767)
+++ trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-12-03 18:17:25 UTC (rev 12768)
@@ -170,11 +170,10 @@
<!-- Avoid magic numbers. -->
<module name="MagicNumber"/>
- <!-- Avoid star, static, redundant and unused imports. -->
+ <!-- Avoid star, redundant and unused imports. -->
<module name="AvoidStarImport">
<property name="severity" value="error"/>
</module>
- <module name="AvoidStaticImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports">
<!--Ignore this for now because it doesn't handle javadoc correctly.-->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-03 00:13:42
|
Revision: 12767
http://sourceforge.net/p/foray/code/12767
Author: victormote
Date: 2022-12-03 00:13:35 +0000 (Sat, 03 Dec 2022)
Log Message:
-----------
Don't look for next node if the current node is the root.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java
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 2022-12-03 00:12:05 UTC (rev 12766)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/AbstractOrderedTreeNode.java 2022-12-03 00:13:35 UTC (rev 12767)
@@ -271,6 +271,9 @@
/* If there are no siblings, then the parent's children are all
* processed, and the parent is the next node. If that happens to be
* null, then we are done, and null is what should be returned. */
+ if (getParent() == null) {
+ return null;
+ }
return getParent().asOrderedNode();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-03 00:12:07
|
Revision: 12766
http://sourceforge.net/p/foray/code/12766
Author: victormote
Date: 2022-12-03 00:12:05 +0000 (Sat, 03 Dec 2022)
Log Message:
-----------
Update some Eclipse-specific config.
Modified Paths:
--------------
trunk/foray/foray-00-master/ide/eclipse/import-organizers/FOray.importorder
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-graphics-basic.launch
Modified: trunk/foray/foray-00-master/ide/eclipse/import-organizers/FOray.importorder
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/import-organizers/FOray.importorder 2022-12-02 21:53:41 UTC (rev 12765)
+++ trunk/foray/foray-00-master/ide/eclipse/import-organizers/FOray.importorder 2022-12-03 00:12:05 UTC (rev 12766)
@@ -1,8 +1,10 @@
#Organize Import Order
-#Thu Mar 28 15:10:21 MDT 2019
-5=javax
-4=java
+#Fri Dec 02 16:53:06 MST 2022
+0=org.foray
+1=org.axsl
+2=org
3=com
-2=org
-1=org.axsl
-0=org.foray
+4=org.junit
+5=org.mockito
+6=java
+7=javax
Modified: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-graphics-basic.launch
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-graphics-basic.launch 2022-12-02 21:53:41 UTC (rev 12765)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-graphics-basic.launch 2022-12-03 00:12:05 UTC (rev 12766)
@@ -16,7 +16,7 @@
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.app.FOray"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-app"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="${build_files}-configuration-file ${foray-config} -fo ${fo-example-path}/basic/graphics.fo -pdf ${foray-test-output-file}/graphics-basic.pdf"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="${build_files}-configuration-file ${foray-config} -fo ${fo-example-path}/basic/graphics.fo -pdf ${foray-test-output-dir}/graphics-basic.pdf"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-app"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
</launchConfiguration>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-02 21:53:44
|
Revision: 12765
http://sourceforge.net/p/foray/code/12765
Author: victormote
Date: 2022-12-02 21:53:41 +0000 (Fri, 02 Dec 2022)
Log Message:
-----------
1. Add xml:lang attribute to root element in test documents. 2. Improve parsing of xml:lang in Lang property class.
Modified Paths:
--------------
trunk/foray/foray-00-master/dist/resource/test/fo/block-001.fo
trunk/foray/foray-00-master/dist/resource/test/fo/block-002.fo
trunk/foray/foray-00-master/dist/resource/test/fo/block-003.fo
trunk/foray/foray-00-master/dist/resource/test/fo/block-004.fo
trunk/foray/foray-00-master/dist/resource/test/fo/border-style-001.fo
trunk/foray/foray-00-master/dist/resource/test/fo/font-family-001.fo
trunk/foray/foray-00-master/dist/resource/test/fo/font-size-001.fo
trunk/foray/foray-00-master/dist/resource/test/fo/graphic-001.fo
trunk/foray/foray-00-master/dist/resource/test/fo/graphic-002.fo
trunk/foray/foray-00-master/dist/resource/test/fo/inline-001.fo
trunk/foray/foray-00-master/dist/resource/test/fo/invalid-xml-003.fo
trunk/foray/foray-00-master/dist/resource/test/fo/metadata-001.fo
trunk/foray/foray-00-master/dist/resource/test/fo/vertical-001.fo
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/prop/Lang.java
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/block-001.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/block-001.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/block-001.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -5,7 +5,7 @@
the three resulting block areas exist and are positioned correctly.
-->
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<!-- layout for the first page -->
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/block-002.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/block-002.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/block-002.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -6,7 +6,7 @@
the content finds its way into the Area Tree.
-->
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<fo:simple-page-master
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/block-003.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/block-003.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/block-003.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -4,7 +4,7 @@
This fo tests basic centering of content on a line.
-->
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<fo:simple-page-master
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/block-004.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/block-004.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/block-004.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -5,7 +5,7 @@
spacing.
-->
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<fo:simple-page-master
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/border-style-001.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/border-style-001.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/border-style-001.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -4,7 +4,7 @@
Background colors are included to ensure that the border and
padding rectangles are computed correctly. -->
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<!-- layout for the first page -->
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/font-family-001.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/font-family-001.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/font-family-001.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<fo:simple-page-master
master-name="simplePM"
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/font-size-001.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/font-size-001.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/font-size-001.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<fo:simple-page-master
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/graphic-001.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/graphic-001.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/graphic-001.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<fo:simple-page-master
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/graphic-002.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/graphic-002.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/graphic-002.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<fo:simple-page-master
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/inline-001.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/inline-001.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/inline-001.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -5,7 +5,7 @@
The purpose of the document is to demonstrate whether nesting of inline areas works properly.
-->
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<!-- layout for the first page -->
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/invalid-xml-003.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/invalid-xml-003.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/invalid-xml-003.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
fegsdfgdsgfsdgf
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<!-- defines page layout -->
<fo:layout-master-set>
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/metadata-001.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/metadata-001.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/metadata-001.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -5,7 +5,8 @@
-->
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
- xmlns:axsl="http://org.axsl/xslfo-extensions/2007">
+ xmlns:axsl="http://org.axsl/xslfo-extensions/2007"
+ xml:lang="eng-US">
<fo:layout-master-set>
<!-- layout for the first page -->
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/vertical-001.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/vertical-001.fo 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/vertical-001.fo 2022-12-02 21:53:41 UTC (rev 12765)
@@ -5,7 +5,7 @@
the three resulting block areas exist and are positioned correctly.
-->
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<!-- layout for the first page -->
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/prop/Lang.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/prop/Lang.java 2022-12-02 20:21:15 UTC (rev 12764)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/prop/Lang.java 2022-12-02 21:53:41 UTC (rev 12765)
@@ -28,6 +28,7 @@
package org.foray.fotree.xml.prop;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
import org.foray.fotree.fo.FoProperty;
@@ -34,17 +35,12 @@
import org.foray.fotree.fo.FoValue;
import org.foray.fotree.fo.prop.PdCountry;
import org.foray.fotree.fo.prop.PdLanguage;
-import org.foray.fotree.value.DtCountry;
-import org.foray.fotree.value.DtLanguage;
+import org.foray.fotree.fo.prop.PdScript;
import org.foray.fotree.value.PropertyCollection;
import org.foray.fotree.value.PropertyValue;
import org.foray.fotree.xml.AbstractXmlProperty;
import org.foray.fotree.xml.XmlProperty;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
/**
* An xml:lang property.
*/
@@ -91,77 +87,94 @@
collection.addItem(new PdLanguage(pv));
return collection;
}
- // There are 2 properties which can be explicitly set
- final byte maxTokens = 2;
- // Tokenize the input & put the tokens into an ArrayList
- final StringTokenizer st = new StringTokenizer(value);
- final List<String> tokenList = new ArrayList<String>(st.countTokens());
- while (st.hasMoreTokens()) {
- tokenList.add(st.nextToken());
+
+ /* XSL-FO Recommendation, Section 7.31.24 indicates the xml:lang attribute should be treated as a shorthand for
+ * the "language" and "country" properties. FOray also allows it to set "script" as that is a legitimate part of
+ * what can be included in that attribute. */
+
+ /* This logic assumes the attribute value is well-formed. */
+ final WritingSystem4a writingSystem = WritingSystem4a.find(value);
+ if (writingSystem.getLanguage() != null) {
+ collection.addItem(new PdLanguage(fobj, propertyFullName, writingSystem.getLanguage().getAlpha3Code()));
}
- if (tokenList.size() < 1 || tokenList.size() > maxTokens) {
- throw unexpectedValue(value, fobj);
+ if (writingSystem.getCountry() != null) {
+ collection.addItem(new PdCountry(fobj, propertyFullName, writingSystem.getCountry().getAlpha3Code()));
}
- // Create an array indicating which property is in each position
- final FoProperty[] positionArray = new FoProperty[tokenList.size()];
- for (int i = 0; i < tokenList.size(); i++) {
- final FoProperty contentType = getContentType(tokenList.get(i));
- if (contentType == null) {
- throw unexpectedValue(value, fobj);
- }
- positionArray[i] = contentType;
+ if (writingSystem.getScript() != null) {
+ collection.addItem(new PdScript(fobj, propertyFullName, writingSystem.getScript().getAlphaCode()));
}
- boolean countryFound = false;
- boolean languageFound = false;
- for (int i = 0; i < positionArray.length; i++) {
- switch (positionArray[i]) {
- case COUNTRY: {
- if (countryFound) {
- throw unexpectedValue(value, fobj);
- }
- collection.addItem(new PdCountry(fobj, propertyFullName,
- tokenList.get(i)));
- countryFound = true;
- break;
- }
- case LANGUAGE: {
- if (languageFound) {
- throw unexpectedValue(value, fobj);
- }
- collection.addItem(new PdLanguage(fobj, propertyFullName,
- tokenList.get(i)));
- languageFound = true;
- break;
- }
- default: {
- break;
- }
- }
- }
+
+// // There are 2 properties which can be explicitly set
+// final byte maxTokens = 2;
+// // Tokenize the input & put the tokens into an ArrayList
+// final StringTokenizer st = new StringTokenizer(value);
+// final List<String> tokenList = new ArrayList<String>(st.countTokens());
+// while (st.hasMoreTokens()) {
+// tokenList.add(st.nextToken());
+// }
+// if (tokenList.size() < 1 || tokenList.size() > maxTokens) {
+// throw unexpectedValue(value, fobj);
+// }
+// // Create an array indicating which property is in each position
+// final FoProperty[] positionArray = new FoProperty[tokenList.size()];
+// for (int i = 0; i < tokenList.size(); i++) {
+// final FoProperty contentType = getContentType(tokenList.get(i));
+// if (contentType == null) {
+// throw unexpectedValue(value, fobj);
+// }
+// positionArray[i] = contentType;
+// }
+// boolean countryFound = false;
+// boolean languageFound = false;
+// for (int i = 0; i < positionArray.length; i++) {
+// switch (positionArray[i]) {
+// case COUNTRY: {
+// if (countryFound) {
+// throw unexpectedValue(value, fobj);
+// }
+// collection.addItem(new PdCountry(fobj, propertyFullName,
+// tokenList.get(i)));
+// countryFound = true;
+// break;
+// }
+// case LANGUAGE: {
+// if (languageFound) {
+// throw unexpectedValue(value, fobj);
+// }
+// collection.addItem(new PdLanguage(fobj, propertyFullName,
+// tokenList.get(i)));
+// languageFound = true;
+// break;
+// }
+// default: {
+// break;
+// }
+// }
+// }
return collection;
}
- /**
- * For the given token, determines which kind of property should be built
- * from it.
- * @param input The String whose content type should be tested.
- * @return One of the following PropertyMaker constants: COUNTRY,
- * LANGUAGE, or -1 for invalid input.
- */
- private FoProperty getContentType(final String input) {
- if (input.equals("inherit")) {
- return null;
- }
- final DtCountry country = DtCountry.makeCountryDT(input);
- if (country != null) {
- return FoProperty.COUNTRY;
- }
- final DtLanguage language = DtLanguage.makeLanguageDT(input);
- if (language != null) {
- return FoProperty.LANGUAGE;
- }
- return null;
- }
+// /**
+// * For the given token, determines which kind of property should be built
+// * from it.
+// * @param input The String whose content type should be tested.
+// * @return One of the following PropertyMaker constants: COUNTRY,
+// * LANGUAGE, or -1 for invalid input.
+// */
+// private FoProperty getContentType(final String input) {
+// if (input.equals("inherit")) {
+// return null;
+// }
+// final DtCountry country = DtCountry.makeCountryDT(input);
+// if (country != null) {
+// return FoProperty.COUNTRY;
+// }
+// final DtLanguage language = DtLanguage.makeLanguageDT(input);
+// if (language != null) {
+// return FoProperty.LANGUAGE;
+// }
+// return null;
+// }
/**
* Return the Country, if any, embedded in this property.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-02 20:21:18
|
Revision: 12764
http://sourceforge.net/p/foray/code/12764
Author: victormote
Date: 2022-12-02 20:21:15 +0000 (Fri, 02 Dec 2022)
Log Message:
-----------
1. Log a warning if an orthography is not found for a given writing system. 2. Fix failing tests by adding xml:lang to root element.
Modified Paths:
--------------
trunk/foray/foray-00-master/dist/resource/test/fo/invalid-ns-001.fo
trunk/foray/foray-00-master/dist/resource/test/fo/invalid-ns-002.fo
trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestInvalidXml.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/invalid-ns-001.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/invalid-ns-001.fo 2022-12-02 19:53:24 UTC (rev 12763)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/invalid-ns-001.fo 2022-12-02 20:21:15 UTC (rev 12764)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<fo:simple-page-master
margin-right="1.5cm"
Modified: trunk/foray/foray-00-master/dist/resource/test/fo/invalid-ns-002.fo
===================================================================
--- trunk/foray/foray-00-master/dist/resource/test/fo/invalid-ns-002.fo 2022-12-02 19:53:24 UTC (rev 12763)
+++ trunk/foray/foray-00-master/dist/resource/test/fo/invalid-ns-002.fo 2022-12-02 20:21:15 UTC (rev 12764)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="eng-US">
<fo:layout-master-set>
<fo:simple-page-master
margin-right="1.5cm"
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestInvalidXml.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestInvalidXml.java 2022-12-02 19:53:24 UTC (rev 12763)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestInvalidXml.java 2022-12-02 20:21:15 UTC (rev 12764)
@@ -31,7 +31,6 @@
import org.axsl.fotree.FoTreeException;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -84,7 +83,6 @@
/**
* Test of fo/invalid-ns-001.fo, which contains an unregistered namespace.
*/
- @Ignore
@Test
public void testNamespace001() {
final FoDocumentReader reader = FoDocumentReader.getInstance();
@@ -99,7 +97,6 @@
/**
* Test of fo/invalid-ns-002.fo, which contains an unregistered namespace inside some foreign xml.
*/
- @Ignore
@Test
public void testNamespace002() {
final FoDocumentReader reader = FoDocumentReader.getInstance();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-12-02 19:53:24 UTC (rev 12763)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-12-02 20:21:15 UTC (rev 12764)
@@ -45,6 +45,9 @@
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.Whitespace;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Text in an FO document that has been tokenized into words.
* This is a thin wrapper around an instance of {@link FoTextTokenFlow} that allows that token flow to live in an FO
@@ -52,6 +55,9 @@
*/
public class FoTextWords4a extends FoText4a implements FoTextWords, KpBranch {
+ /** Logger for this class. */
+ private static final Logger LOGGER = LoggerFactory.getLogger(FoTextWords4a.class);
+
/** The parent of this node. */
private FoObj parent;
@@ -69,6 +75,9 @@
this.parent = parent;
final FoOrthographyServer orthographyServer = getOrthographyServer();
final FoOrthography orthography = orthographyServer.getOrthography(getWritingSystem());
+ if (orthography == null) {
+ LOGGER.warn("Orthography not found for: {}", getWritingSystem());
+ }
this.tokenFlow = orthography.tokenize(content, 0, content.length());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-02 19:53:27
|
Revision: 12763
http://sourceforge.net/p/foray/code/12763
Author: victormote
Date: 2022-12-02 19:53:24 +0000 (Fri, 02 Dec 2022)
Log Message:
-----------
Improvements to test helpers.
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/area/TestVertical.java
trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.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-app/src/test/java/org/foray/app/fo/TestInvalidXml.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 2022-12-02 16:46:01 UTC (rev 12762)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2022-12-02 19:53:24 UTC (rev 12763)
@@ -41,9 +41,11 @@
import org.foray.pioneer.PioneerLayoutStrategy;
import org.axsl.area.AreaTreeException;
+import org.axsl.fotree.FoTreeException;
import org.axsl.linebreak.LineBreakerFactory;
-import java.io.IOException;
+import org.junit.Assert;
+
import java.util.Iterator;
/**
@@ -62,16 +64,15 @@
/**
* Constructor.
- * @throws IOException For errors obtaining the build properties.
- * @throws ForayException For errors initializing the FOray-specific
- * objects.
*/
- private AreaTreeCreator() throws IOException, ForayException {
- final AreaTreeFactory4a areaTreeFactory = ForaySpecific.makeAreaTreeFactory();
- this.areaTreeFactory = areaTreeFactory;
- final LineBreakerFactory lbFactory = ForaySpecific.makeLineBreakerFactory();
- final PioneerFactory layoutFactory = ForaySpecific.makeLayoutFactory(lbFactory);
- this.layoutFactory = layoutFactory;
+ private AreaTreeCreator() {
+ try {
+ this.areaTreeFactory = ForaySpecific.makeAreaTreeFactory();
+ final LineBreakerFactory lbFactory = ForaySpecific.makeLineBreakerFactory();
+ this.layoutFactory = ForaySpecific.makeLayoutFactory(lbFactory);
+ } catch (final ForayException e) {
+ Assert.fail(e.getMessage());
+ }
}
/**
@@ -79,13 +80,9 @@
* @return The singleton instance.
* @throws ForayException For errors creating the singleton instance.
*/
- public static AreaTreeCreator getInstance() throws ForayException {
+ public static AreaTreeCreator getInstance() {
if (AreaTreeCreator.theInstance == null) {
- try {
- AreaTreeCreator.theInstance = new AreaTreeCreator();
- } catch (final IOException e) {
- throw new ForayException(e);
- }
+ AreaTreeCreator.theInstance = new AreaTreeCreator();
}
return AreaTreeCreator.theInstance;
}
@@ -95,11 +92,16 @@
* @param file The file to be converted.
* @param lbFactory The line-breaker factory.
* @return The parsed FO Tree instance.
- * @throws ForayException For errors building the FO Tree.
+ * @throws FoTreeException For errors building the FO Tree.
*/
- public AreaTree4a buildAreaTree(final String file, final LineBreakerFactory lbFactory) throws ForayException {
+ public AreaTree4a buildAreaTree(final String file, final LineBreakerFactory lbFactory) {
final FoDocumentReader foReader = FoDocumentReader.getInstance();
- final FoTree4a foTree = foReader.buildFoTree(file);
+ FoTree4a foTree = null;
+ try {
+ foTree = foReader.buildFoTree(file);
+ } catch (final FoTreeException e) {
+ Assert.fail(e.getMessage());
+ }
final Root4a root = foTree.getRootFo();
final AreaTree4a areaTree = this.areaTreeFactory.makeAreaTree(foTree);
final PioneerLayoutStrategy layout = this.layoutFactory.makeLayout();
@@ -106,14 +108,14 @@
final Iterator<PageSequence4a> iterator = root.getPageSequenceIterator();
while (iterator.hasNext()) {
final PageSequence4a pageSequence = iterator.next();
+ final PageCollection4a collection = areaTree.makePageCollection(pageSequence);
+ if (collection == null) {
+ Assert.fail("No PageCollection created.");
+ }
try {
- final PageCollection4a collection = areaTree.makePageCollection(pageSequence);
- if (collection == null) {
- throw new ForayException("Error creating page collection.");
- }
layout.formatPageSequence(collection);
} catch (final AreaTreeException e) {
- throw new ForayException(e);
+ Assert.fail(e.getMessage());
}
}
return areaTree;
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 2022-12-02 16:46:01 UTC (rev 12762)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java 2022-12-02 19:53:24 UTC (rev 12763)
@@ -37,7 +37,9 @@
import org.foray.area.TextArea;
import org.foray.core.ForayException;
+import org.axsl.area.AreaTreeException;
import org.axsl.font.FontUse;
+import org.axsl.fotree.FoTreeException;
import org.junit.Assert;
import org.junit.Ignore;
@@ -54,7 +56,7 @@
*/
@Test
@Ignore
- public void testVertical001() throws ForayException {
+ public void testVertical001() throws FoTreeException, AreaTreeException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/vertical-001.fo", getLineBreakerFactory());
final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2022-12-02 16:46:01 UTC (rev 12762)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2022-12-02 19:53:24 UTC (rev 12763)
@@ -45,6 +45,7 @@
import org.xml.sax.InputSource;
+import org.junit.Assert;
import org.mockito.Mockito;
import java.io.File;
@@ -52,11 +53,11 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
+import java.net.MalformedURLException;
import java.net.URL;
/**
- * Singleton Helper class for tests that parses an input file and returns an
- * FoTree instance for testing.
+ * Singleton Helper class for tests that parses an input file and returns an {@link FoTree4a} instance for testing.
*/
public final class FoDocumentReader {
@@ -75,21 +76,37 @@
* @throws ForayException For errors initializing the FOray-specific
* objects.
*/
- private FoDocumentReader() throws IOException, ForayException {
+ private FoDocumentReader() {
final String orthographyConfigPath = "../foray-orthography/src/test/resources/orthography-config.xml";
- final URL orthographyFile = new URL("file", null, orthographyConfigPath);
+ URL orthographyFile = null;
+ try {
+ orthographyFile = new URL("file", null, orthographyConfigPath);
+ } catch (final MalformedURLException e) {
+ Assert.fail(e.getMessage());
+ }
final SessionConfig sessionConfig = Mockito.mock(SessionConfig.class);
Mockito.when(sessionConfig.optionOrthographyConfiguration()).thenReturn(orthographyFile);
- this.testDirectory = Environment.getTestDirectory();
+ FontServer fontServer = null;
+ GraphicServer graphicServer = null;
+ FoOrthographyServer hyphenServer = null;
+ try {
+ fontServer = ForaySpecific.makeFontServer(sessionConfig);
+ graphicServer = ForaySpecific.makeGraphicServer();
+ hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
+ } catch (final ForayException e) {
+ Assert.fail(e.getMessage());
+ }
- final FontServer fontServer = ForaySpecific.makeFontServer(sessionConfig);
- final GraphicServer graphicServer = ForaySpecific.makeGraphicServer();
- final FoOrthographyServer hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
final URL[] graphicSearchPath = new URL[1];
- final URL testDirUrl = this.testDirectory.toURI().toURL();
- graphicSearchPath[0] = UrlFactory.createURL(testDirUrl, "fo/");
+ try {
+ this.testDirectory = Environment.getTestDirectory();
+ final URL testDirUrl = this.testDirectory.toURI().toURL();
+ graphicSearchPath[0] = UrlFactory.createURL(testDirUrl, "fo/");
+ } catch (final IOException e) {
+ Assert.fail(e.getMessage());
+ }
final boolean cachingGraphics = false;
this.treeServer = new FoTreeServer4a(fontServer, hyphenServer, graphicServer, graphicSearchPath,
@@ -99,15 +116,10 @@
/**
* Returns the singleton instance.
* @return The singleton instance.
- * @throws ForayException For errors creating the singleton instance.
*/
- public static FoDocumentReader getInstance() throws ForayException {
+ public static FoDocumentReader getInstance() {
if (FoDocumentReader.theInstance == null) {
- try {
- FoDocumentReader.theInstance = new FoDocumentReader();
- } catch (final IOException e) {
- throw new ForayException(e);
- }
+ FoDocumentReader.theInstance = new FoDocumentReader();
}
return FoDocumentReader.theInstance;
}
@@ -118,18 +130,28 @@
* @return The parsed FO Tree instance.
* @throws ForayException For errors building the FO Tree.
*/
- public FoTree4a buildFoTree(final String file) throws ForayException {
- final FoTree4a foTree;
+ public FoTree4a buildFoTree(final String file) throws FoTreeException {
+ File testDirectory = null;
try {
- final Reader reader = new FileReader(file);
- final InputSource inputSource = new InputSource(reader);
- final FoTreeParser4a parser = this.treeServer.makeFoTreeParser();
- parser.parseFoTree(inputSource);
- foTree = parser.getFoTree();
- } catch (FileNotFoundException | FoTreeException e) {
- throw new ForayException(e);
+ testDirectory = Environment.getTestDirectory();
+ } catch (final IOException e) {
+ Assert.fail("Failure retrieving test directory from Environment.");
}
+ final File inputFile = new File(testDirectory, file);
+ Reader reader = null;
+ try {
+ reader = new FileReader(inputFile);
+ } catch (final FileNotFoundException e) {
+ Assert.fail("File not found: " + inputFile.getAbsolutePath());
+ }
+ final InputSource inputSource = new InputSource(reader);
+
+
+ final FoTreeParser4a parser = this.treeServer.makeFoTreeParser();
+ parser.parseFoTree(inputSource);
+ final FoTree4a foTree = parser.getFoTree();
+
final FontServer fontServer = this.treeServer.getFontServer();
final FontConsumer fontConsumer = fontServer.makeFontConsumer(null);
foTree.setFontConsumer(fontConsumer);
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 2022-12-02 16:46:01 UTC (rev 12762)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java 2022-12-02 19:53:24 UTC (rev 12763)
@@ -35,6 +35,7 @@
import org.foray.fotree.fo.obj.Flow4a;
import org.axsl.font.Font;
+import org.axsl.fotree.FoTreeException;
import org.junit.Assert;
import org.junit.Ignore;
@@ -53,10 +54,9 @@
*/
@Test
@Ignore
- public void testFontFamily001() throws ForayException {
+ public void testFontFamily001() throws FoTreeException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
- final FoTree4a foTree = reader.buildFoTree(
- "fo/font-family-001.fo");
+ final FoTree4a foTree = reader.buildFoTree("fo/font-family-001.fo");
final Flow4a flow = this.getFlow(foTree);
FoObj node = flow.formattingObjectChildAt(0);
@@ -80,11 +80,11 @@
/**
* Test of fo/font-size-001.fo.
- * @throws ForayException For errors creating the FO Tree.
+ * @throws FoTreeException For errors creating the FO Tree.
*/
@Test
@Ignore
- public void testFontSize001() throws ForayException {
+ public void testFontSize001() throws FoTreeException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
final FoTree4a foTree = reader.buildFoTree("fo/font-size-001.fo");
final Flow4a flow = this.getFlow(foTree);
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 2022-12-02 16:46:01 UTC (rev 12762)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java 2022-12-02 19:53:24 UTC (rev 12763)
@@ -28,7 +28,6 @@
package org.foray.app.fo;
-import org.foray.core.ForayException;
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.fo.obj.Block4a;
@@ -36,6 +35,8 @@
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.foray.fotree.svg.obj.InstreamSvgElement;
+import org.axsl.fotree.FoTreeException;
+
import org.junit.Assert;
/**
@@ -46,12 +47,11 @@
/**
* Test of fo/graphic-001.fo.
* This file contains an fo:instream-foreign-object with a simple SVG in it.
- * @throws ForayException For errors creating the FO Tree.
+ * @throws FoTreeException For errors creating the FO Tree.
*/
- public void testGraphic001() throws ForayException {
+ public void testGraphic001() throws FoTreeException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
- final FoTree4a foTree = reader.buildFoTree(
- "fo/graphic-001.fo");
+ final FoTree4a foTree = reader.buildFoTree("fo/graphic-001.fo");
final Flow4a flow = this.getFlow(foTree);
/* The second child should be a block ... */
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestInvalidXml.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestInvalidXml.java 2022-12-02 16:46:01 UTC (rev 12762)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestInvalidXml.java 2022-12-02 19:53:24 UTC (rev 12763)
@@ -28,25 +28,27 @@
package org.foray.app.fo;
-import org.foray.core.ForayException;
+import org.axsl.fotree.FoTreeException;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
/**
* Tests for parsing invalid XML in FO input.
*/
-public class TestInvalidXml extends TestCase {
+public class TestInvalidXml {
/**
* Test of fo/invalid-xml-001.fo.
- * @throws ForayException For errors creating the FO Tree.
*/
- public void testXml001() throws ForayException {
+ @Test
+ public void testXml001() {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
reader.buildFoTree("fo/invalid-xml-001.fo");
- fail("Expected ForayException indicating invalid XML content.");
- } catch (final ForayException e) {
+ Assert.fail("Expected ForayException indicating invalid XML content.");
+ } catch (final FoTreeException e) {
/* Do nothing. This is the expected case. */
}
}
@@ -53,14 +55,14 @@
/**
* Test of fo/invalid-xml-002.fo.
- * @throws ForayException For errors creating the FO Tree.
*/
- public void testXml002() throws ForayException {
+ @Test
+ public void testXml002() {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
reader.buildFoTree("fo/invalid-xml-002.fo");
- fail("Expected ForayException indicating invalid XML content.");
- } catch (final ForayException e) {
+ Assert.fail("Expected ForayException indicating invalid XML content.");
+ } catch (final FoTreeException e) {
/* Do nothing. This is the expected case. */
}
}
@@ -67,14 +69,14 @@
/**
* Test of fo/invalid-xml-003.fo.
- * @throws ForayException For errors creating the FO Tree.
*/
- public void testXml003() throws ForayException {
+ @Test
+ public void testXml003() {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
reader.buildFoTree("fo/invalid-xml-003.fo");
- fail("Expected ForayException indicating invalid XML content.");
- } catch (final ForayException e) {
+ Assert.fail("Expected ForayException indicating invalid XML content.");
+ } catch (final FoTreeException e) {
/* Do nothing. This is the expected case. */
}
}
@@ -81,31 +83,30 @@
/**
* Test of fo/invalid-ns-001.fo, which contains an unregistered namespace.
- * @throws ForayException For errors creating the FO Tree.
*/
- public void testNamespace001() throws ForayException {
+ @Ignore
+ @Test
+ public void testNamespace001() {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
reader.buildFoTree("fo/invalid-ns-001.fo");
- fail("Expected ForayException indicating an unregistered "
- + "namespace.");
- } catch (final ForayException e) {
+ Assert.fail("Expected ForayException indicating an unregistered namespace.");
+ } catch (final FoTreeException e) {
/* Do nothing. This is the expected case. */
}
}
/**
- * Test of fo/invalid-ns-002.fo, which contains an unregistered namespace
- * inside some foreign xml.
- * @throws ForayException For errors creating the FO Tree.
+ * Test of fo/invalid-ns-002.fo, which contains an unregistered namespace inside some foreign xml.
*/
- public void testNamespace002() throws ForayException {
+ @Ignore
+ @Test
+ public void testNamespace002() {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
reader.buildFoTree("fo/invalid-ns-002.fo");
- fail("Expected ForayException indicating an unregistered "
- + "namespace.");
- } catch (final ForayException e) {
+ Assert.fail("Expected ForayException indicating an unregistered namespace.");
+ } catch (final FoTreeException e) {
/* Do nothing. This is the expected case. */
}
}
@@ -112,15 +113,14 @@
/**
* Test of fo/invalid-fo-001.fo, which has no root element.
- * @throws ForayException For errors creating the FO Tree.
*/
- public void testFo001() throws ForayException {
+ @Test
+ public void testFo001() {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
reader.buildFoTree("fo/invalid-fo-001.fo");
- fail("Expected ForayException indicating that the root element "
- + "is missing.");
- } catch (final ForayException e) {
+ Assert.fail("Expected ForayException indicating that the root element is missing.");
+ } catch (final FoTreeException e) {
/* Do nothing. This is the expected case. */
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-02 16:46:07
|
Revision: 12762
http://sourceforge.net/p/foray/code/12762
Author: victormote
Date: 2022-12-02 16:46:01 +0000 (Fri, 02 Dec 2022)
Log Message:
-----------
Fix location of test input files.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/Environment.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/Environment.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/Environment.java 2022-12-02 00:42:50 UTC (rev 12761)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/Environment.java 2022-12-02 16:46:01 UTC (rev 12762)
@@ -119,7 +119,7 @@
*/
public static File getTestDirectory() throws IOException {
final File sandbox = Environment.getSandbox();
- return new File(sandbox, "foray-all/resource/test/");
+ return new File(sandbox, "foray-00-master/dist/resource/test/");
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-02 00:42:52
|
Revision: 12761
http://sourceforge.net/p/foray/code/12761
Author: victormote
Date: 2022-12-02 00:42:50 +0000 (Fri, 02 Dec 2022)
Log Message:
-----------
Move DTD and Schema parsing to the abstract superclass, for reuse.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java 2022-12-02 00:25:06 UTC (rev 12760)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java 2022-12-02 00:42:50 UTC (rev 12761)
@@ -28,7 +28,6 @@
package org.foray.xml;
-import org.foray.xml.dtd.Dtd;
import org.foray.xml.dtd.DtdElement;
import org.foray.xml.dtd.ElementStack;
@@ -39,7 +38,6 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
@@ -57,13 +55,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.net.URL;
import java.util.ArrayList;
import java.util.List;
-import javax.xml.XMLConstants;
-import javax.xml.transform.stream.StreamSource;
-
/**
* Command-line application that reads an XML file and writes a pretty-printed
* version of it.
@@ -92,12 +86,6 @@
/** The name of the root element of this document. */
private String rootElement;
- /** The Dtd for this document, which can be null. */
- private Dtd dtd = new Dtd();
-
- /** The XML Schema for this document, which can be null. */
- private XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
-
/** The element stack. */
private ElementStack elementStack = new ElementStack();
@@ -230,7 +218,7 @@
throws SAXException {
flushCharacters();
ensureTopElementWritten(false);
- checkSchema(attributes);
+ parseSchemaLocation(attributes);
@@ -241,7 +229,7 @@
this.lastStartedElement = qName;
/* Must copy the attributes as they are reset on each callback. */
this.lastStartedAttributes = new AttributesImpl(attributes);
- final DtdElement element = this.dtd.getElement(qName);
+ final DtdElement element = getDtd().getElement(qName);
this.elementStack.push(element);
this.topElementWritten = false;
}
@@ -548,12 +536,6 @@
this.inEntity = false;
}
- @Override
- public void elementDecl(final String name, final String model) {
- final DtdElement dtdElement = new DtdElement(name, model);
- this.dtd.addElement(dtdElement);
- }
-
/**
* Use this method if the content may contain \n characters that need to be
* converted to the output line-ending.
@@ -1101,28 +1083,6 @@
this.indentBlocksInsideMixedContent = indent;
}
- /**
- * Checks a set of attributes to see whether they contain a reference to a schema that needs to be parsed.
- * @param attributes The attributes being tested.
- * @throws IOException For problems opening, reading, or closing the schema file.
- */
- private void checkSchema(final Attributes attributes) throws SAXException {
- for (int index = 0; index < attributes.getLength(); index ++) {
- if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI.equals(attributes.getURI(index))
- && "schemaLocation".equals(attributes.getLocalName(index))) {
- final String schemaUrlString = attributes.getValue(index);
- InputStream is = null;
- try {
- final URL schemaUrl = new URL(schemaUrlString);
- is = schemaUrl.openStream();
- } catch (final IOException e) {
- throw new SAXException(e);
- }
- this.schemaCollection.read(new StreamSource(is));
- }
- }
- }
-
@Override
public void reset() {
throw new UnsupportedOperationException();
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java 2022-12-02 00:25:06 UTC (rev 12760)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java 2022-12-02 00:42:50 UTC (rev 12761)
@@ -29,7 +29,10 @@
package org.foray.xml;
import org.foray.common.primitive.StringUtils;
+import org.foray.xml.dtd.Dtd;
+import org.foray.xml.dtd.DtdElement;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;
@@ -46,10 +49,14 @@
import org.xml.sax.helpers.XMLReaderFactory;
import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+
/**
* <p>Abstract superclass for SAX parsers.</p>
*
@@ -71,6 +78,12 @@
/** Constant used to initialize string builders. */
private static final int MAX_EXPECTED_TEXT_LENGTH = 4096;
+ /** The Dtd for this document, which can be null. */
+ private Dtd dtd = new Dtd();
+
+ /** The XML Schema for this document, which can be null. */
+ private XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
+
/* Register the URLStreamHandler for classpath: URLs.
* This has to be done only once, hence a static statement. */
static {
@@ -388,7 +401,43 @@
// no op
}
- @Override
+ @Override
+ public void elementDecl(final String name, final String model) {
+ final DtdElement dtdElement = new DtdElement(name, model);
+ this.dtd.addElement(dtdElement);
+ }
+
+ /**
+ * Returns the parsed DTD.
+ * @return The parsed DTD.
+ */
+ public Dtd getDtd() {
+ return this.dtd;
+ }
+
+ /**
+ * Checks a set of attributes to see whether they contain a reference to a schema that needs to be parsed.
+ * @param attributes The attributes being tested.
+ * @throws SAXException For problems opening, reading, or closing the schema file.
+ */
+ protected void parseSchemaLocation(final Attributes attributes) throws SAXException {
+ for (int index = 0; index < attributes.getLength(); index ++) {
+ if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI.equals(attributes.getURI(index))
+ && "schemaLocation".equals(attributes.getLocalName(index))) {
+ final String schemaUrlString = attributes.getValue(index);
+ InputStream is = null;
+ try {
+ final URL schemaUrl = new URL(schemaUrlString);
+ is = schemaUrl.openStream();
+ } catch (final IOException e) {
+ throw new SAXException(e);
+ }
+ this.schemaCollection.read(new StreamSource(is));
+ }
+ }
+ }
+
+ @Override
public void error(final SAXParseException ex) {
this.logger.error(ex.getMessage());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-02 00:25:08
|
Revision: 12760
http://sourceforge.net/p/foray/code/12760
Author: victormote
Date: 2022-12-02 00:25:06 +0000 (Fri, 02 Dec 2022)
Log Message:
-----------
Remove no-longer-needed thrown exception.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/Options.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionaryResource.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/PatternParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/PatternSerializer.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/Options.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/Options.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/Options.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -38,8 +38,6 @@
import java.io.IOException;
import java.net.URL;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* Loads configuration files and additional setting of commandline options.
*/
@@ -119,7 +117,7 @@
final ForayConfigParser reader = new ForayConfigParser(userConfigUrl, this.sessionConfig,
this.renderConfig);
reader.parse(userConfigUrl);
- } catch (IOException | ParserConfigurationException | SAXException e) {
+ } catch (IOException | SAXException e) {
throw new ForayException("Could not load user configuration:\n"
+ " " + userConfigUrl.toExternalForm() + "\n"
+ " Error: " + e.getMessage() + "\n"
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForayConfigParser.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -42,8 +42,6 @@
import java.io.IOException;
import java.net.URL;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* SAX2 Handler which retrieves the configuration information and stores them
* in Configuration.
@@ -112,7 +110,7 @@
}
@Override
- public Object parse(final InputSource inputSource) throws IOException, ParserConfigurationException, SAXException {
+ public Object parse(final InputSource inputSource) throws IOException, SAXException {
final EntityResolver resolver = ForayEntityResolver.getInstance();
final XMLReader parser = createSax2Parser(true, true, true, resolver, false);
parser.parse(inputSource);
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontServer4a.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -67,8 +67,6 @@
import java.util.Map;
import java.util.Map.Entry;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* An implementation of the aXSL {@link FontServer} interface.
* It is designed to be a singleton, but is not required to be so.
@@ -678,7 +676,7 @@
new FontConfigParser(this);
try {
parser.parse(source);
- } catch (IOException | ParserConfigurationException | SAXException e) {
+ } catch (IOException | SAXException e) {
throw new FontException(e);
}
if (this.hasFatalConfigurationError) {
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/config/FontConfigParser.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -58,8 +58,6 @@
import java.util.Stack;
import java.util.StringTokenizer;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* SAX2 Handler which retrieves the font configuration information and stores it in a {@link FontServer4a} instance.
* Normally this class doesn't need to be accessed directly.
@@ -200,7 +198,7 @@
}
@Override
- public Object parse(final InputSource inputSource) throws IOException, ParserConfigurationException, SAXException {
+ public Object parse(final InputSource inputSource) throws IOException, SAXException {
final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getInstance(), false);
parser.parse(inputSource);
return null;
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 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -54,8 +54,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* SAX Handler that builds the formatting object tree.
*/
@@ -136,7 +134,7 @@
public void parseFoTree(final InputSource inputSource) throws FoTreeException {
try {
parse(inputSource);
- } catch (IOException | ParserConfigurationException | SAXException e) {
+ } catch (IOException | SAXException e) {
throw new FoTreeException(e);
}
}
@@ -147,8 +145,7 @@
}
@Override
- public FoTree4a parse(final InputSource inputSource)
- throws IOException, ParserConfigurationException, SAXException {
+ public FoTree4a parse(final InputSource inputSource) throws IOException, SAXException {
XMLReader parser = this.parser;
if (parser == null) {
parser = createSax2Parser(false, true, true, null, false);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionaryResource.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionaryResource.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionaryResource.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -44,8 +44,6 @@
import java.util.List;
import java.util.regex.Pattern;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* Configuration information for a dictionary resource.
*/
@@ -150,9 +148,6 @@
} catch (final SAXException e) {
logger.error("SAXException", e);
return null;
- } catch (final ParserConfigurationException e) {
- logger.error("ParserConfigurationException", e);
- return null;
} finally {
if (inputStream != null) {
try {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -39,8 +39,6 @@
import java.io.IOException;
import java.net.URL;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* Configuration information for a hyphenation patterns resource.
*/
@@ -78,7 +76,7 @@
PatternTree patternTree = null;
try {
patternTree = patternParser.parse(inputSource);
- } catch (SAXException | ParserConfigurationException | IOException e) {
+ } catch (SAXException | IOException e) {
logger.info("Error parsing: " + this.unparsedPatternsLocation.getLocationDescription(), e);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -61,8 +61,6 @@
import java.util.Map;
import java.util.regex.Pattern;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* This class is the main entry point to the hyphenation package.
*/
@@ -111,7 +109,7 @@
final OrthographyParser parser = new OrthographyParser(this);
try {
parser.parse(inputSource);
- } catch (IOException | SAXException | ParserConfigurationException e) {
+ } catch (IOException | SAXException e) {
throw new OrthographyException(e);
}
}
@@ -264,7 +262,7 @@
final NatLangParser parser = new NatLangParser();
try {
nl = parser.parse(nlFile);
- } catch (IOException | ParserConfigurationException | SAXException e) {
+ } catch (IOException | SAXException e) {
throw new OrthographyException(e);
}
return nl;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -61,8 +61,6 @@
import java.util.Map;
import java.util.Set;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* Parses an axsl-dictionary XML document into a SegmentDictionary.
* @see DictionaryParserText for a parser for similar data in simple text format.
@@ -143,11 +141,9 @@
* @param inputSource The input source to parse.
* @return The parsed dictionaries.
* @throws IOException For IO errors during parsing.
- * @throws ParserConfigurationException For errors during parser configuration.
* @throws SAXException For errors found by the SAX parser.
*/
- public List<SegmentDictionary> parse(final InputSource inputSource)
- throws IOException, SAXException, ParserConfigurationException {
+ public List<SegmentDictionary> parse(final InputSource inputSource) throws IOException, SAXException {
debugMessage("Begin dictionary word list parsing: " + inputSource.getSystemId());
final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getInstance(), false);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -40,8 +40,6 @@
import java.io.IOException;
import java.util.StringTokenizer;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* A SAX document handler to read and parse natural-language descriptions
* from an XML file.
@@ -55,8 +53,7 @@
private NaturalLanguage nl;
@Override
- public NaturalLanguage parse(final InputSource inputSource)
- throws IOException, SAXException, ParserConfigurationException {
+ public NaturalLanguage parse(final InputSource inputSource) throws IOException, SAXException {
final XMLReader parser = createSax2Parser(false, true, true, ForayEntityResolver.getInstance(), false);
parser.parse(inputSource);
return this.nl;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/OrthographyParser.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -68,8 +68,6 @@
import java.util.Stack;
import java.util.regex.Pattern;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* SAX2 Handler which retrieves the orthography configuration information and stores it in a {@link OrthographyServer4a}
* instance.
@@ -157,8 +155,7 @@
}
@Override
- public Orthography4a parse(final InputSource inputSource)
- throws IOException, SAXException, ParserConfigurationException {
+ public Orthography4a parse(final InputSource inputSource) throws IOException, SAXException {
final XMLReader parser = createSax2Parser(true, true, true, ForayEntityResolver.getInstance(), false);
parser.parse(inputSource);
return this.currentOrthographyConfig;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/PatternParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/PatternParser.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/PatternParser.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -46,8 +46,6 @@
import java.io.IOException;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* A SAX document handler to read and parse hyphenation patterns from an XML file.
*/
@@ -82,8 +80,7 @@
}
@Override
- public PatternTree parse(final InputSource inputSource)
- throws SAXException, ParserConfigurationException, IOException {
+ public PatternTree parse(final InputSource inputSource) throws SAXException, IOException {
this.patternTree = new PatternTree(PatternTree.Source.PARSED);
final XMLReader parser = createSax2Parser(false, false, false, null, false);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/PatternSerializer.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/PatternSerializer.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/PatternSerializer.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -52,8 +52,6 @@
import java.io.ObjectOutputStream;
import java.net.URL;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* Parse and serialize hyphenation patterns so that they can be packaged for runtime use without the need to parse them
* then.
@@ -129,7 +127,7 @@
final InputSource inputSource = new InputSource(url.toExternalForm());
final PatternParser patternParser = new PatternParser();
hTree = patternParser.parse(inputSource);
- } catch (SAXException | ParserConfigurationException | IOException e) {
+ } catch (SAXException | IOException e) {
getLogger().error("Error parsing " + infile + ": " + e.getMessage());
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -74,7 +74,6 @@
import java.util.Stack;
import javax.xml.XMLConstants;
-import javax.xml.parsers.ParserConfigurationException;
/**
* <p>Parses a generic XML document, looking for spelling errors.
@@ -197,12 +196,10 @@
* This can be null.
* @throws OrthographyException For errors during configuration of the hyphenation server.
* @throws IOException For input/output errors during parsing.
- * @throws ParserConfigurationException For errors configuring the parser.
* @throws SAXException For errors found by the SAX parser.
*/
- public SpellChecker(final PrintStream output, final URL orthographyConfigPath,
- final List<URL> adhocDictionaryPaths)
- throws OrthographyException, IOException, SAXException, ParserConfigurationException {
+ public SpellChecker(final PrintStream output, final URL orthographyConfigPath, final List<URL> adhocDictionaryPaths)
+ throws OrthographyException, IOException, SAXException {
this.output = output;
final OrthographyServerConfig serverConfig = new OrthographyServerConfig();
@@ -221,7 +218,7 @@
}
@Override
- public Object parse(final InputSource inputSource) throws IOException, ParserConfigurationException, SAXException {
+ public Object parse(final InputSource inputSource) throws IOException, SAXException {
/* Skip validation. That should be handled upstream of this process. */
final XMLReader parser = createSax2Parser(false, true, true, null, false);
parser.parse(inputSource);
@@ -519,7 +516,7 @@
final SpellChecker checker = new SpellChecker(output, orthographyConfigPath, dictionaries);
checker.parse(inputSource);
- } catch (final OrthographyException | IOException | SAXException | ParserConfigurationException e) {
+ } catch (final OrthographyException | IOException | SAXException e) {
logger.error("Error configuring or running: " + input, e);
/* CheckStyle: Allow System.exit() in main method. */
System.exit(SpellChecker.STATUS_PARSING_ERROR);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -55,8 +55,6 @@
import java.net.MalformedURLException;
import java.net.URL;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* Command-line application that reads an XML file and checks its content
* against a predefined set of characters that are legitimate in a given
@@ -120,7 +118,7 @@
}
@Override
- public Object parse(final InputSource input) throws IOException, SAXException, ParserConfigurationException {
+ public Object parse(final InputSource input) throws IOException, SAXException {
final XMLReader parser = createSax2Parser(true, true, true, this.entityResolver, true);
parser.parse(input);
return null;
@@ -258,7 +256,7 @@
final ValidateChars validator = new ValidateChars(server, catalog, iso639);
try {
validator.parse(inputSource);
- } catch (final IOException | ParserConfigurationException | SAXException e) {
+ } catch (final IOException | SAXException e) {
logger.error(e.getMessage(), e);
/* CheckStyle: Allow System.exit() in main method. */
System.exit(ValidateChars.STATUS_PARSING_ERROR);
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -62,7 +62,6 @@
import java.util.List;
import javax.xml.XMLConstants;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.stream.StreamSource;
/**
@@ -196,7 +195,7 @@
}
@Override
- public Object parse(final InputSource inputSource) throws IOException, ParserConfigurationException, SAXException {
+ public Object parse(final InputSource inputSource) throws IOException, SAXException {
final EntityResolver entityResolver = SaxUtils.getEntityResolver(catalogs);
final XMLReader parser = createSax2Parser(true, true, true, entityResolver, true);
parser.parse(inputSource);
@@ -1211,7 +1210,7 @@
final ForayPretty processor = new ForayPretty(outputStream, catalog);
try {
processor.parse(inputSource);
- } catch (final IOException | ParserConfigurationException | SAXException e) {
+ } catch (final IOException | SAXException e) {
logger.error("Error parsing " + input, e);
/* CheckStyle: Allow System.exit() in main method. */
System.exit(ForayPretty.STATUS_PARSING_ERROR);
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java 2022-12-01 23:59:45 UTC (rev 12759)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java 2022-12-02 00:25:06 UTC (rev 12760)
@@ -50,8 +50,6 @@
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
-import javax.xml.parsers.ParserConfigurationException;
-
/**
* <p>Abstract superclass for SAX parsers.</p>
*
@@ -97,10 +95,9 @@
* @param inputSource The input document.
* @return The object created by the parsing process.
* @throws IOException For IO errors during parsing.
- * @throws ParserConfigurationException For errors during parser configuration.
* @throws SAXException For errors found by the SAX parser.
*/
- public abstract T parse(InputSource inputSource) throws IOException, ParserConfigurationException, SAXException;
+ public abstract T parse(InputSource inputSource) throws IOException, SAXException;
/**
* Converts a URL to an InputSource and parses it.
@@ -107,10 +104,9 @@
* @param input The URL whose content is to be parsed.
* @return The object created by the parsing process.
* @throws IOException For IO errors during parsing.
- * @throws ParserConfigurationException For errors during parser configuration.
* @throws SAXException For errors found by the SAX parser.
*/
- public T parse(final URL input) throws IOException, ParserConfigurationException, SAXException {
+ public T parse(final URL input) throws IOException, SAXException {
final InputSource inputSource = new InputSource(input.toExternalForm());
return parse(inputSource);
}
@@ -198,11 +194,10 @@
* the character entities instead.
* @return The newly-created SAX2 parser.
* @throws SAXException For errors creating the parser.
- * @throws ParserConfigurationException For errors configuring the parser.
*/
public XMLReader createSax2Parser(final boolean validate, final boolean namespaceAware,
final boolean namespacePrefixes, final EntityResolver entityResolver, final boolean notifyCharRefs)
- throws SAXException, ParserConfigurationException {
+ throws SAXException {
final XMLReader xmlReader = XMLReaderFactory.createXMLReader();
this.logger.info("Using SAX2 Parser {}", xmlReader.getClass().getName());
xmlReader.setEntityResolver(entityResolver);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-01 23:59:47
|
Revision: 12759
http://sourceforge.net/p/foray/code/12759
Author: victormote
Date: 2022-12-01 23:59:45 +0000 (Thu, 01 Dec 2022)
Log Message:
-----------
Improvements to basic SAX parsing.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java 2022-12-01 04:48:41 UTC (rev 12758)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java 2022-12-01 23:59:45 UTC (rev 12759)
@@ -32,6 +32,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.event.Level;
import org.xml.sax.Attributes;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -42,6 +43,7 @@
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.ext.DefaultHandler2;
+import org.xml.sax.helpers.XMLReaderFactory;
import java.io.IOException;
import java.lang.reflect.Constructor;
@@ -49,7 +51,6 @@
import java.net.URL;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
/**
* <p>Abstract superclass for SAX parsers.</p>
@@ -125,9 +126,7 @@
*/
public static String getParserClassName() {
try {
- return SAXParserFactory.newInstance().newSAXParser().getXMLReader().getClass().getName();
- } catch (final ParserConfigurationException e) {
- return null;
+ return org.xml.sax.helpers.XMLReaderFactory.createXMLReader().getClass().getName();
} catch (final SAXException e) {
return null;
}
@@ -181,7 +180,11 @@
}
/**
- * Creates a SAX2 parser.
+ * Creates a standard SAX2 parser, suitable for general XML parsing.
+ * This method is intended for subclass convenience, and makes quite a few assumptions about what is "suitable for
+ * general XML parsing," generally erring toward thoroughness instead of speed.
+ * Subclasses that wish to override features of the parser created by this method can do so easily by setting those
+ * features on the returned parser after it is created.
* @param validate Indicates whether the parser should validate the document as it parses.
* @param namespaceAware Indicates whether the parser should be namespace-aware.
* @param namespacePrefixes Indicates wehther the parser should process namespace prefixes.
@@ -200,52 +203,97 @@
public XMLReader createSax2Parser(final boolean validate, final boolean namespaceAware,
final boolean namespacePrefixes, final EntityResolver entityResolver, final boolean notifyCharRefs)
throws SAXException, ParserConfigurationException {
- final SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance();
- spf.setNamespaceAware(namespaceAware);
- final XMLReader xmlReader = spf.newSAXParser().getXMLReader();
- xmlReader.setFeature(SaxStdFeatures.NAMESPACE_PREFIXES, namespacePrefixes);
+ final XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+ this.logger.info("Using SAX2 Parser {}", xmlReader.getClass().getName());
xmlReader.setEntityResolver(entityResolver);
+ xmlReader.setContentHandler(this);
+ xmlReader.setErrorHandler(this);
+
+ /* Standard SAX features and properties. */
+
+ setFeature(xmlReader, SaxStdFeatures.NAMESPACES, namespacePrefixes, Level.ERROR);
+ setFeature(xmlReader, SaxStdFeatures.NAMESPACE_PREFIXES, namespacePrefixes, Level.ERROR);
/* Turn on validation if it is available. */
if (validate) {
- try {
- xmlReader.setFeature(SaxStdFeatures.VALIDATION, true);
- } catch (final SAXNotRecognizedException e) {
- this.logger.warn("Parser does not recognize validation.");
- } catch (final SAXNotSupportedException e) {
- this.logger.warn("Parser does not support validation.");
- }
+ setFeature(xmlReader, SaxStdFeatures.VALIDATION, true, Level.WARN);
}
-
/* Bind the LexicalHandler to the XMLReader if possible. */
- try {
- xmlReader.setProperty(SaxStdProperties.LEXICAL_HANDLER, this);
- } catch (final SAXNotSupportedException e1) {
- this.logger.error("Parser does not support LexicalHandler.");
- }
-
+ setProperty(xmlReader, SaxStdProperties.LEXICAL_HANDLER, this, Level.ERROR);
/* Bind the DeclHandler to the XMLReader if possible. */
- try {
- xmlReader.setProperty(SaxStdProperties.DECLARATION_HANDLER, this);
- } catch (final SAXNotSupportedException e) {
- this.logger.error("Parser does not support Declaration Handler.");
- }
+ setProperty(xmlReader, SaxStdProperties.DECLARATION_HANDLER, this, Level.ERROR);
+
+ /* Xerces-specific features. These features have a higher likelihood of NOT being supported by all parsers. */
+
if (notifyCharRefs) {
- /* Let any exceptions thrown here bubble up. If this feature has been requested, it is a fatal error if it
- * is not available. Note that this is a feature defined by Apache Xerces, NOT a standard SAX feature.
- * See https://xerces.apache.org/xerces2-j/features.html. */
- xmlReader.setFeature("http://apache.org/xml/features/scanner/notify-char-refs", true);
+ /* If requested, it is a fatal error if it is not available.*/
+ setFeature(xmlReader, XercesFeatures.SCANNER_NOTIFY_CHAR_REFS, true, null);
}
- xmlReader.setContentHandler(this);
- xmlReader.setErrorHandler(this);
+ setFeature(xmlReader, XercesFeatures.VALIDATION_SCHEMA, true, Level.WARN);
+ setFeature(xmlReader, XercesFeatures.VALIDATION_SCHEMA_FULL_CHECKING, true, Level.WARN);
+ setFeature(xmlReader, XercesFeatures.HONOUR_ALL_SCHEMALOCATIONS, true, Level.WARN);
- this.logger.debug("{}: Using {} as SAX2 Parser", this.getClass().getName(), xmlReader.getClass().getName());
+
return xmlReader;
}
/**
+ * Convenience method used to set parser features, handling exceptions with appropriate log messages.
+ * @param xmlReader The reader to which the feature should be set.
+ * @param feature The name of the feature.
+ * @param value The value of the feature.
+ * @param loggingLevel The logging level to which any exceptions should be logged. A logging level of null implies
+ * that the exception rethrown instead of logged.
+ */
+ private void setFeature(final XMLReader xmlReader, final String feature, final boolean value,
+ final org.slf4j.event.Level loggingLevel) throws SAXException {
+ try {
+ xmlReader.setFeature(SaxStdFeatures.NAMESPACE_PREFIXES, value);
+ } catch (final SAXNotRecognizedException e) {
+ if (loggingLevel == null) {
+ throw e;
+ } else {
+ this.logger.atLevel(loggingLevel).log("SAX2 parser does not recognize feature: " + feature);
+ }
+ } catch (final SAXNotSupportedException e) {
+ if (loggingLevel == null) {
+ throw e;
+ } else {
+ this.logger.atLevel(loggingLevel).log("SAX2 parser does not support feature: " + feature);
+ }
+ }
+ }
+
+ /**
+ * Convenience method used to set parser properties, handling exceptions with appropriate log messages.
+ * @param xmlReader The reader to which the property should be set.
+ * @param property The name of the property.
+ * @param value The value of the property.
+ * @param loggingLevel The logging level to which any exceptions should be logged. A logging level of null implies
+ * that the exception rethrown instead of logged.
+ */
+ private void setProperty(final XMLReader xmlReader, final String property, final Object value,
+ final org.slf4j.event.Level loggingLevel) throws SAXException {
+ try {
+ xmlReader.setProperty(property, value);
+ } catch (final SAXNotRecognizedException e) {
+ if (loggingLevel == null) {
+ throw e;
+ } else {
+ this.logger.atLevel(loggingLevel).log("SAX2 parser does not recognize property: " + property);
+ }
+ } catch (final SAXNotSupportedException e) {
+ if (loggingLevel == null) {
+ throw e;
+ } else {
+ this.logger.atLevel(loggingLevel).log("SAX2 parser does not support property: " + property);
+ }
+ }
+ }
+
+ /**
* Instantiates an instance of a specified class using reflection, and ensures that it is a subtype of a given type.
* @param className The name of the class that should be instantiated.
* @param expectedType The expected superclass for {@code className}.
@@ -336,6 +384,16 @@
}
@Override
+ public void startPrefixMapping(final String prefix, final String uri) throws SAXException {
+ // no op
+ }
+
+ @Override
+ public void endPrefixMapping(final String prefix) throws SAXException {
+ // no op
+ }
+
+ @Override
public void error(final SAXParseException ex) {
this.logger.error(ex.getMessage());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-01 04:48:44
|
Revision: 12758
http://sourceforge.net/p/foray/code/12758
Author: victormote
Date: 2022-12-01 04:48:41 +0000 (Thu, 01 Dec 2022)
Log Message:
-----------
Add constants for more parser features.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdFeatures.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/XercesFeatures.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdFeatures.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdFeatures.java 2022-11-30 23:11:38 UTC (rev 12757)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdFeatures.java 2022-12-01 04:48:41 UTC (rev 12758)
@@ -38,7 +38,19 @@
/* TODO: Only currently-used features are included in this enumeration. Add remaining features as needed. */
+ /** SAX feature "external-general-entities". */
+ public static final String EXTERNAL_GENERAL_ENTITIES = "http://xml.org/sax/features/external-general-entities";
+ /** SAX feature "external-parameter-entities". */
+ public static final String EXTERNAL_PARAMETER_ENTITIES = "http://xml.org/sax/features/external-parameter-entities";
+
+ /** SAX feature "is-standalone". */
+ public static final String IS_STANDALONE = "http://xml.org/sax/features/is-standalone";
+
+ /** SAX feature "lexical-handler/parameter-entities". */
+ public static final String LEXICAL_HANDLER_PARAMETER_ENTITIES =
+ "http://xml.org/sax/features/lexical-handler/parameter-entities";
+
/** SAX feature "namespaces". A value of "true" indicates namespace URIs and unprefixed local names for element and
* attribute names will be available. */
public static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
@@ -47,10 +59,32 @@
* attributes (including xmlns* attributes) will be available. Read/write, default false. */
public static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
+ /** SAX feature "resolve-dtd-uris". */
+ public static final String RESOLVE_DTD_URIS = "http://xml.org/sax/features/resolve-dtd-uris";
+
+ /** SAX feature "string-interning". */
+ public static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning";
+
+ /** SAX feature "unicode-normalization-checking". */
+ public static final String UNICODE_NORMALIZATION_CHECKING =
+ "http://xml.org/sax/features/unicode-normalization-checking";
+
+ /** SAX feature "use-attributes2". */
+ public static final String USE_ATTRIBUTES2 = "http://xml.org/sax/features/use-attributes2";
+
+ /** SAX feature "use-locator2". */
+ public static final String USE_LOCATOR2 = "http://xml.org/sax/features/use-locator2";
+
+ /** SAX feature "use-entity-resolver2". */
+ public static final String USE_ENTITY_RESOLVER2 = "http://xml.org/sax/features/use-entity-resolver2";
+
/** SAX feature "validation". Controls whether the parser is reporting all validity errors; if true, all external
* entities will be read. Read/write, default unspecified. */
public static final String VALIDATION = "http://xml.org/sax/features/validation";
+ /** SAX feature "xmlns-uris". */
+ public static final String XMLNS_URIS = "http://xml.org/sax/features/xmlns-uris";
+
/** SAX feature "xml-1.1". Returns "true" if the parser supports both XML 1.1 and XML 1.0. Returns "false" if the
* parser supports only XML 1.0. Read-only. */
public static final String XML_1_1 = "http://xml.org/sax/features/xml-1.1";
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/XercesFeatures.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/XercesFeatures.java 2022-11-30 23:11:38 UTC (rev 12757)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/XercesFeatures.java 2022-12-01 04:48:41 UTC (rev 12758)
@@ -31,11 +31,125 @@
/**
* Constants for Xerces parser features.
* These features are used to configure/report on an {@link javax.xml.parsers.SAXParserFactory}.
+ * Note that these features are specific to the Xerces parser, and will (almost certainly) be ignored by other parsers.
* @see <a href="https://xerces.apache.org/xerces2-j/features.html">Parser Features</a>
*/
public final class XercesFeatures {
+ /** Xerces feature "validation/dynamic". */
+ public static final String VALIDATION_DYNAMIC = "http://apache.org/xml/features/validation/dynamic";
+ /** Xerces feature "validation/schema". */
+ public static final String VALIDATION_SCHEMA = "http://apache.org/xml/features/validation/schema";
+
+ /** Xerces feature "validation/schema-full-checking". */
+ public static final String VALIDATION_SCHEMA_FULL_CHECKING =
+ "http://apache.org/xml/features/validation/schema-full-checking";
+
+ /** Xerces feature "validation/schema/normalized-value". */
+ public static final String VALIDATION_SCHEMA_NORMALIZED_VALUE =
+ "http://apache.org/xml/features/validation/schema/normalized-value";
+
+ /** Xerces feature "schema/element-default". */
+ public static final String SCHEMA_ELEMENT_DEFAULT =
+ "http://apache.org/xml/features/validation/schema/element-default";
+
+ /** Xerces feature "validation/schema/augment-psvi". */
+ public static final String VALIDATION_SCHEMA_AUGMENT_PSVI =
+ "http://apache.org/xml/features/validation/schema/augment-psvi";
+
+ /** Xerces feature "validation/schema/ignore-xsi-type-until-elemdecl". */
+ public static final String VALIDATION_SCHEMA_IGNORE_XSI_TYPE_UNTIL_ELEMDECL =
+ "http://apache.org/xml/features/validation/schema/ignore-xsi-type-until-elemdecl";
+
+ /** Xerces feature "generate-synthetic-annotations". */
+ public static final String GENERATE_SYNTHETIC_ANNOTATIONS =
+ "http://apache.org/xml/features/generate-synthetic-annotations";
+
+ /** Xerces feature "validate-annotations". */
+ public static final String VALIDATE_ANNOTATIONS = "http://apache.org/xml/features/validate-annotations";
+
+ /** Xerces feature "honour-all-schemaLocations". */
+ public static final String HONOUR_ALL_SCHEMALOCATIONS = "http://apache.org/xml/features/honour-all-schemaLocations";
+
+ /** Xerces feature "external-general-entities". */
+ public static final String EXTERNAL_GENERAL_ENTITIES = "http://xml.org/sax/features/external-general-entities";
+
+ /** Xerces feature "external-parameter-entities". */
+ public static final String EXTERNAL_PARAMETER_ENTITIES = "http://xml.org/sax/features/external-parameter-entities";
+
+ /** Xerces feature "validation/balance-syntax-trees". */
+ public static final String VALIDATION_BALANCE_SYNTAX_TREES =
+ "http://apache.org/xml/features/validation/balance-syntax-trees";
+
+ /** Xerces feature "validation/id-idref-checking". */
+ public static final String VALIDATION_ID_IDREF_CHECKING =
+ "http://apache.org/xml/features/validation/id-idref-checking";
+
+ /** Xerces feature "validation/identity-constraint-checking". */
+ public static final String VALIDATION_IDENTITY_CONSTRAINT_CHECKING =
+ "http://apache.org/xml/features/validation/identity-constraint-checking";
+
+ /** Xerces feature "validation/cta-full-xpath-checking". */
+ public static final String VALIDATION_CTA_FULL_XPATH_CHECKING =
+ "http://apache.org/xml/features/validation/cta-full-xpath-checking";
+
+ /** Xerces feature "validation/assert-comments-and-pi-checking". */
+ public static final String VALIDATION_ASSERT_COMMENTS_AND_PI_CHECKING =
+ "http://apache.org/xml/features/validation/assert-comments-and-pi-checking";
+
+ /** Xerces feature "validation/unparsed-entity-checking". */
+ public static final String VALIDATION_UNPARSED_ENTITY_CHECKING =
+ "http://apache.org/xml/features/validation/unparsed-entity-checking";
+
+ /** Xerces feature "validation/warn-on-duplicate-attdef". */
+ public static final String VALIDATION_WARN_ON_DUPLICATE_ATTDEF =
+ "http://apache.org/xml/features/validation/warn-on-duplicate-attdef";
+
+ /** Xerces feature "validation/warn-on-undeclared-elemdef". */
+ public static final String VALIDATION_WARN_ON_UNDECLARED_ELEMDEF =
+ "http://apache.org/xml/features/validation/warn-on-undeclared-elemdef";
+
+ /** Xerces feature "warn-on-duplicate-entitydef". */
+ public static final String WARN_ON_DUPLICATE_ENTITYDEF =
+ "http://apache.org/xml/features/warn-on-duplicate-entitydef";
+
+ /** Xerces feature "allow-java-encodings". */
+ public static final String ALLOW_JAVA_ENCODINGS = "http://apache.org/xml/features/allow-java-encodings";
+
+ /** Xerces feature "continue-after-fatal-error". */
+ public static final String CONTINUE_AFTER_FATAL_ERROR = "http://apache.org/xml/features/continue-after-fatal-error";
+
+ /** Xerces feature "nonvalidating/load-dtd-grammar". */
+ public static final String NONVALIDATING_LOAD_DTD_GRAMMAR =
+ "http://apache.org/xml/features/nonvalidating/load-dtd-grammar";
+
+ /** Xerces feature "nonvalidating/load-external-dtd". */
+ public static final String NONVALIDATING_LOAD_EXTERNAL_DTD =
+ "http://apache.org/xml/features/nonvalidating/load-external-dtd";
+
+ /** Xerces feature "scanner/notify-char-refs". */
+ public static final String SCANNER_NOTIFY_CHAR_REFS = "http://apache.org/xml/features/scanner/notify-char-refs";
+
+ /** Xerces feature "scanner/notify-builtin-refs". */
+ public static final String SCANNER_NOTIFY_BUILTIN_REFS =
+ "http://apache.org/xml/features/scanner/notify-builtin-refs";
+
+ /** Xerces feature "disallow-doctype-decl". */
+ public static final String DISALLOW_DOCTYPE_DECL = "http://apache.org/xml/features/disallow-doctype-decl";
+
+ /** Xerces feature "standard-uri-conformant". */
+ public static final String STANDARD_URI_CONFORMANT = "http://apache.org/xml/features/standard-uri-conformant";
+
+ /** Xerces feature "xinclude". */
+ public static final String XINCLUDE = "http://apache.org/xml/features/xinclude";
+
+ /** Xerces feature "xinclude/fixup-base-uris". */
+ public static final String XINCLUDE_FIXUP_BASE_URIS = "http://apache.org/xml/features/xinclude/fixup-base-uris";
+
+ /** Xerces feature "xinclude/fixup-language". */
+ public static final String XINCLUDE_FIXUP_LANGUAGE = "http://apache.org/xml/features/xinclude/fixup-language";
+
/**
* Private constructor. This is a utility class and should never be instantiated.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-11-30 23:11:40
|
Revision: 12757
http://sourceforge.net/p/foray/code/12757
Author: victormote
Date: 2022-11-30 23:11:38 +0000 (Wed, 30 Nov 2022)
Log Message:
-----------
Change SAX-related enums into classes containing constants.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/demo/embed/tools/AbstractObjectReader.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentReader.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdFeatures.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdProperties.java
Added Paths:
-----------
trunk/foray/foray-xml/src/main/java/org/foray/xml/XercesFeatures.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/demo/embed/tools/AbstractObjectReader.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/demo/embed/tools/AbstractObjectReader.java 2022-11-30 21:09:53 UTC (rev 12756)
+++ trunk/foray/foray-app/src/main/java/org/foray/demo/embed/tools/AbstractObjectReader.java 2022-11-30 23:11:38 UTC (rev 12757)
@@ -65,8 +65,8 @@
* Constructor for the AbstractObjectReader object.
*/
public AbstractObjectReader() {
- setFeature(SaxStdFeatures.NAMESPACES.getUri(), false);
- setFeature(SaxStdFeatures.NAMESPACE_PREFIXES.getUri(), false);
+ setFeature(SaxStdFeatures.NAMESPACES, false);
+ setFeature(SaxStdFeatures.NAMESPACE_PREFIXES, false);
}
/* ============ XMLReader interface ============ */
@@ -129,7 +129,7 @@
* @return boolean true if enabled
*/
protected boolean isNamespaces() {
- return getFeature(SaxStdFeatures.NAMESPACES.getUri());
+ return getFeature(SaxStdFeatures.NAMESPACES);
}
/**
@@ -137,7 +137,7 @@
* @return boolean true if enabled
*/
protected boolean isNamespacePrefixes() {
- return getFeature(SaxStdFeatures.NAMESPACE_PREFIXES.getUri());
+ return getFeature(SaxStdFeatures.NAMESPACE_PREFIXES);
}
@Override
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentReader.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentReader.java 2022-11-30 21:09:53 UTC (rev 12756)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/DocumentReader.java 2022-11-30 23:11:38 UTC (rev 12757)
@@ -76,9 +76,9 @@
@Override
public boolean getFeature(final String name)
throws SAXNotRecognizedException, SAXNotSupportedException {
- if (SaxStdFeatures.NAMESPACES.getUri().equals(name)) {
+ if (SaxStdFeatures.NAMESPACES.equals(name)) {
return this.namespaces;
- } else if (SaxStdFeatures.NAMESPACE_PREFIXES.getUri().equals(name)) {
+ } else if (SaxStdFeatures.NAMESPACE_PREFIXES.equals(name)) {
return this.namespacePrefixes;
} else {
throw new SAXNotRecognizedException("Feature '" + name
@@ -90,9 +90,9 @@
@Override
public void setFeature(final String name, final boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException {
- if (SaxStdFeatures.NAMESPACES.getUri().equals(name)) {
+ if (SaxStdFeatures.NAMESPACES.equals(name)) {
this.namespaces = value;
- } else if (SaxStdFeatures.NAMESPACE_PREFIXES.getUri().equals(name)) {
+ } else if (SaxStdFeatures.NAMESPACE_PREFIXES.equals(name)) {
this.namespacePrefixes = value;
} else {
throw new SAXNotRecognizedException("Feature '" + name
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java 2022-11-30 21:09:53 UTC (rev 12756)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxParser.java 2022-11-30 23:11:38 UTC (rev 12757)
@@ -203,13 +203,13 @@
final SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance();
spf.setNamespaceAware(namespaceAware);
final XMLReader xmlReader = spf.newSAXParser().getXMLReader();
- xmlReader.setFeature(SaxStdFeatures.NAMESPACE_PREFIXES.getUri(), namespacePrefixes);
+ xmlReader.setFeature(SaxStdFeatures.NAMESPACE_PREFIXES, namespacePrefixes);
xmlReader.setEntityResolver(entityResolver);
/* Turn on validation if it is available. */
if (validate) {
try {
- xmlReader.setFeature(SaxStdFeatures.VALIDATION.getUri(), true);
+ xmlReader.setFeature(SaxStdFeatures.VALIDATION, true);
} catch (final SAXNotRecognizedException e) {
this.logger.warn("Parser does not recognize validation.");
} catch (final SAXNotSupportedException e) {
@@ -219,7 +219,7 @@
/* Bind the LexicalHandler to the XMLReader if possible. */
try {
- xmlReader.setProperty(SaxStdProperties.LEXICAL_HANDLER.getUri(), this);
+ xmlReader.setProperty(SaxStdProperties.LEXICAL_HANDLER, this);
} catch (final SAXNotSupportedException e1) {
this.logger.error("Parser does not support LexicalHandler.");
}
@@ -226,7 +226,7 @@
/* Bind the DeclHandler to the XMLReader if possible. */
try {
- xmlReader.setProperty(SaxStdProperties.DECLARATION_HANDLER.getUri(), this);
+ xmlReader.setProperty(SaxStdProperties.DECLARATION_HANDLER, this);
} catch (final SAXNotSupportedException e) {
this.logger.error("Parser does not support Declaration Handler.");
}
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdFeatures.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdFeatures.java 2022-11-30 21:09:53 UTC (rev 12756)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdFeatures.java 2022-11-30 23:11:38 UTC (rev 12757)
@@ -29,12 +29,12 @@
package org.foray.xml;
/**
- * Enumeration of valid Sax2 Features.
+ * Constants for valid standard Sax2 Features.
* These features are used to configure/report on an {@link javax.xml.parsers.SAXParserFactory}.
* @see <a href="http://www.saxproject.org/apidoc/org/xml/sax/package-summary.html#package_description">org.xml.sax
* package javadocs</a>
*/
-public enum SaxStdFeatures {
+public final class SaxStdFeatures {
/* TODO: Only currently-used features are included in this enumeration. Add remaining features as needed. */
@@ -41,37 +41,23 @@
/** SAX feature "namespaces". A value of "true" indicates namespace URIs and unprefixed local names for element and
* attribute names will be available. */
- NAMESPACES("http://xml.org/sax/features/namespaces"),
+ public static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
/** SAX feature "namespace-prefixes". A value of "true" indicates that XML qualified names (with prefixes) and
* attributes (including xmlns* attributes) will be available. Read/write, default false. */
- NAMESPACE_PREFIXES("http://xml.org/sax/features/namespace-prefixes"),
+ public static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
/** SAX feature "validation". Controls whether the parser is reporting all validity errors; if true, all external
* entities will be read. Read/write, default unspecified. */
- VALIDATION("http://xml.org/sax/features/validation"),
+ public static final String VALIDATION = "http://xml.org/sax/features/validation";
/** SAX feature "xml-1.1". Returns "true" if the parser supports both XML 1.1 and XML 1.0. Returns "false" if the
* parser supports only XML 1.0. Read-only. */
- XML_1_1("http://xml.org/sax/features/xml-1.1");
+ public static final String XML_1_1 = "http://xml.org/sax/features/xml-1.1";
- /** The URI used to identify the feature. */
- private String uri;
-
/**
- * Constructor.
- * @param uri The URI used to identify the feature.
+ * Private constructor. This is a utility class and should never be instantiated.
*/
- SaxStdFeatures(final String uri) {
- this.uri = uri;
- }
+ private SaxStdFeatures() { }
- /**
- * Returns the URI used to identify this feature.
- * @return The URI used to identify this feature.
- */
- public String getUri() {
- return this.uri;
- }
-
}
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdProperties.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdProperties.java 2022-11-30 21:09:53 UTC (rev 12756)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/SaxStdProperties.java 2022-11-30 23:11:38 UTC (rev 12757)
@@ -29,54 +29,40 @@
package org.foray.xml;
/**
- * Enumeration of valid Sax2 Handler and Property IDs.
+ * Constants for valid standard Sax2 Handler and Property IDs.
* These features are used to configure/report on an {@link javax.xml.parsers.SAXParserFactory}.
* @see <a href="http://www.saxproject.org/apidoc/org/xml/sax/package-summary.html#package_description">org.xml.sax
* package javadocs</a>
*/
-public enum SaxStdProperties {
+public final class SaxStdProperties {
/** SAX property "declaration-handler". Used to see most DTD declarations except those treated as lexical ("document
* element name is ...") or which are mandatory for all SAX parsers (DTDHandler). The Object must implement
* org.xml.sax.ext.DeclHandler. */
- DECLARATION_HANDLER("http://xml.org/sax/properties/declaration-handler"),
+ public static final String DECLARATION_HANDLER = "http://xml.org/sax/properties/declaration-handler";
/** SAX property "document-xml-version". May be examined only during a parse, after the startDocument() callback has
* been completed; read-only. This property is a literal string describing the actual XML version of the document,
* such as "1.0" or "1.1". */
- DOCUMENT_XML_VERSION("http://xml.org/sax/properties/document-xml-version"),
+ public static final String DOCUMENT_XML_VERSION = "http://xml.org/sax/properties/document-xml-version";
/** SAX property "dom-node". For "DOM Walker" style parsers, which ignore their parser.parse() parameters, this is
* used to specify the DOM (sub)tree being walked by the parser. The Object must implement the org.w3c.dom.Node
* interface. */
- DOM_NODE("http://xml.org/sax/properties/dom-node"),
+ public static final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
/** SAX property "lexical-handler". Used to see some syntax events that are essential in some applications:
* comments, CDATA delimiters, selected general entity inclusions, and the start and end of the DTD (and declaration
* of document element name). The Object must implement org.xml.sax.ext.LexicalHandler. */
- LEXICAL_HANDLER("http://xml.org/sax/properties/lexical-handler"),
+ public static final String LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler";
/** SAX property "xml-string". Readable only during a parser callback, this exposes a TBS chunk of characters
* responsible for the current event. */
- XML_STRING("http://xml.org/sax/properties/xml-string");
+ public static final String XML_STRING = "http://xml.org/sax/properties/xml-string";
- /** The URI used to identify the property. */
- private String uri;
-
/**
- * Constructor.
- * @param uri The URI used to identify the property.
+ * Constructor. This is a utility class and should never be instantiated.
*/
- SaxStdProperties(final String uri) {
- this.uri = uri;
- }
+ private SaxStdProperties() { }
- /**
- * Returns the URI used to identify this property.
- * @return The URI used to identify this property.
- */
- public String getUri() {
- return this.uri;
- }
-
}
Added: trunk/foray/foray-xml/src/main/java/org/foray/xml/XercesFeatures.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/XercesFeatures.java (rev 0)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/XercesFeatures.java 2022-11-30 23:11:38 UTC (rev 12757)
@@ -0,0 +1,44 @@
+/*
+ * 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.xml;
+
+/**
+ * Constants for Xerces parser features.
+ * These features are used to configure/report on an {@link javax.xml.parsers.SAXParserFactory}.
+ * @see <a href="https://xerces.apache.org/xerces2-j/features.html">Parser Features</a>
+ */
+public final class XercesFeatures {
+
+
+ /**
+ * Private constructor. This is a utility class and should never be instantiated.
+ */
+ private XercesFeatures() { }
+
+}
Property changes on: trunk/foray/foray-xml/src/main/java/org/foray/xml/XercesFeatures.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...> - 2022-11-30 21:09:56
|
Revision: 12756
http://sourceforge.net/p/foray/code/12756
Author: victormote
Date: 2022-11-30 21:09:53 +0000 (Wed, 30 Nov 2022)
Log Message:
-----------
1. Add launch config for pretty-print. 2. Rename others launch configs for project clarity.
Added Paths:
-----------
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-fonts-basic.launch
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-graphics-basic.launch
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/orthography-DictionarySerializer.launch
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/orthography-PatternSerializer.launch
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/xml-ForayPretty.launch
Removed Paths:
-------------
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/DictionarySerializer.launch
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/PatternSerializer.launch
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/fonts-basic.launch
trunk/foray/foray-00-master/ide/eclipse/launch-configurations/graphics-basic.launch
Deleted: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/DictionarySerializer.launch
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2022-11-30 04:54:35 UTC (rev 12755)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2022-11-30 21:09:53 UTC (rev 12756)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
- <listEntry value="/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySerializer.java"/>
- </listAttribute>
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
- <listEntry value="1"/>
- </listAttribute>
- <booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
- <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
- <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-orthography" path="1" type="4"/> "/>
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-orthography"/> </runtimeClasspathEntry> "/>
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
- </listAttribute>
- <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
- <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.orthography.util.DictionarySerializer"/>
- <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-orthography"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/src/main/data/dictionaries --output ${project_loc}/src/main/resources/resources/org/foray/dictionaries --pattern "eng-Latn-ZZZ.dict.txt""/>
- <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-orthography"/>
-</launchConfiguration>
Deleted: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/PatternSerializer.launch
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/PatternSerializer.launch 2022-11-30 04:54:35 UTC (rev 12755)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/PatternSerializer.launch 2022-11-30 21:09:53 UTC (rev 12756)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
- <listEntry value="/foray-orthography/src/main/java/org/foray/orthography/util/PatternSerializer.java"/>
- </listAttribute>
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
- <listEntry value="1"/>
- </listAttribute>
- <booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
- <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
- <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/" javaProject="foray-orthography" path="1" type="4"/> "/>
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-orthography"/> </runtimeClasspathEntry> "/>
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
- </listAttribute>
- <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
- <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.orthography.util.PatternSerializer"/>
- <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-orthography"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/../foray-orthography/src/main/data/hyph-patterns --output ${project_loc}/../foray-orthography/src/main/resources/resources/org/foray/orthography/patterns --pattern ".*\.xml""/>
- <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-orthography"/>
-</launchConfiguration>
Copied: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-fonts-basic.launch (from rev 12743, trunk/foray/foray-00-master/ide/eclipse/launch-configurations/fonts-basic.launch)
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-fonts-basic.launch (rev 0)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-fonts-basic.launch 2022-11-30 21:09:53 UTC (rev 12756)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/foray-app/src/main/java/org/foray/app/FOray.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
+ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" path="1" type="4"/> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-app"/> </runtimeClasspathEntry> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
+ </listAttribute>
+ <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.app.FOray"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-app"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-configuration-file ${foray-config} -fo ${fo-example-path}/basic/fonts.fo -pdf ${foray-test-output-file}/fonts-basic.pdf"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-app"/>
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+</launchConfiguration>
Copied: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-graphics-basic.launch (from rev 12743, trunk/foray/foray-00-master/ide/eclipse/launch-configurations/graphics-basic.launch)
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-graphics-basic.launch (rev 0)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/app-graphics-basic.launch 2022-11-30 21:09:53 UTC (rev 12756)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/foray-app/src/main/java/org/foray/app/FOray.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
+ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" path="1" type="4"/> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-app"/> </runtimeClasspathEntry> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
+ </listAttribute>
+ <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.app.FOray"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-app"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="${build_files}-configuration-file ${foray-config} -fo ${fo-example-path}/basic/graphics.fo -pdf ${foray-test-output-file}/graphics-basic.pdf"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-app"/>
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+</launchConfiguration>
Deleted: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/fonts-basic.launch
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/fonts-basic.launch 2022-11-30 04:54:35 UTC (rev 12755)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/fonts-basic.launch 2022-11-30 21:09:53 UTC (rev 12756)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
- <listEntry value="/foray-app/src/main/java/org/foray/app/FOray.java"/>
- </listAttribute>
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
- <listEntry value="1"/>
- </listAttribute>
- <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
- <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" path="1" type="4"/> "/>
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-app"/> </runtimeClasspathEntry> "/>
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
- </listAttribute>
- <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
- <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
- <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.app.FOray"/>
- <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-app"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-configuration-file ${foray-config} -fo ${fo-example-path}/basic/fonts.fo -pdf ${foray-test-output-file}/fonts-basic.pdf"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-app"/>
- <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
-</launchConfiguration>
Deleted: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/graphics-basic.launch
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/graphics-basic.launch 2022-11-30 04:54:35 UTC (rev 12755)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/graphics-basic.launch 2022-11-30 21:09:53 UTC (rev 12756)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
- <listEntry value="/foray-app/src/main/java/org/foray/app/FOray.java"/>
- </listAttribute>
- <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
- <listEntry value="1"/>
- </listAttribute>
- <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
- <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" path="1" type="4"/> "/>
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-app"/> </runtimeClasspathEntry> "/>
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
- </listAttribute>
- <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
- <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
- <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.app.FOray"/>
- <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-app"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="${build_files}-configuration-file ${foray-config} -fo ${fo-example-path}/basic/graphics.fo -pdf ${foray-test-output-file}/graphics-basic.pdf"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-app"/>
- <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
-</launchConfiguration>
Copied: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/orthography-DictionarySerializer.launch (from rev 12720, trunk/foray/foray-00-master/ide/eclipse/launch-configurations/DictionarySerializer.launch)
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/orthography-DictionarySerializer.launch (rev 0)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/orthography-DictionarySerializer.launch 2022-11-30 21:09:53 UTC (rev 12756)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySerializer.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
+ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-orthography" path="1" type="4"/> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-orthography"/> </runtimeClasspathEntry> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.orthography.util.DictionarySerializer"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-orthography"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/src/main/data/dictionaries --output ${project_loc}/src/main/resources/resources/org/foray/dictionaries --pattern "eng-Latn-ZZZ.dict.txt""/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-orthography"/>
+</launchConfiguration>
Copied: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/orthography-PatternSerializer.launch (from rev 12743, trunk/foray/foray-00-master/ide/eclipse/launch-configurations/PatternSerializer.launch)
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/orthography-PatternSerializer.launch (rev 0)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/orthography-PatternSerializer.launch 2022-11-30 21:09:53 UTC (rev 12756)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/foray-orthography/src/main/java/org/foray/orthography/util/PatternSerializer.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
+ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/" javaProject="foray-orthography" path="1" type="4"/> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-orthography"/> </runtimeClasspathEntry> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.orthography.util.PatternSerializer"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-orthography"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/../foray-orthography/src/main/data/hyph-patterns --output ${project_loc}/../foray-orthography/src/main/resources/resources/org/foray/orthography/patterns --pattern ".*\.xml""/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-orthography"/>
+</launchConfiguration>
Added: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/xml-ForayPretty.launch
===================================================================
--- trunk/foray/foray-00-master/ide/eclipse/launch-configurations/xml-ForayPretty.launch (rev 0)
+++ trunk/foray/foray-00-master/ide/eclipse/launch-configurations/xml-ForayPretty.launch 2022-11-30 21:09:53 UTC (rev 12756)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/foray-xml/src/main/java/org/foray/xml/ForayPretty.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
+ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/" javaProject="foray-xml" path="1" type="4"/> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-xml"/> </runtimeClasspathEntry> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.xml.ForayPretty"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-xml"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${foray-test-input-dir}/pretty-print-input.xml --output ${foray-test-output-dir}/pretty-print-output.xml --catalog ${foray-catalog-file}"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-xml"/>
+</launchConfiguration>
Property changes on: trunk/foray/foray-00-master/ide/eclipse/launch-configurations/xml-ForayPretty.launch
___________________________________________________________________
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...> - 2022-11-30 04:54:37
|
Revision: 12755
http://sourceforge.net/p/foray/code/12755
Author: victormote
Date: 2022-11-30 04:54:35 +0000 (Wed, 30 Nov 2022)
Log Message:
-----------
Move XmlUtils class from common to xml.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayXdiff.java
Added Paths:
-----------
trunk/foray/foray-xml/src/main/java/org/foray/xml/XmlUtils.java
Removed Paths:
-------------
trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java 2022-11-30 04:37:29 UTC (rev 12754)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java 2022-11-30 04:54:35 UTC (rev 12755)
@@ -1,110 +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.common.primitive;
-
-/**
- * Utility class containing constants and methods useful in parsing or building XML.
- * @see javax.xml.XMLConstants
- */
-public final class XmlUtils {
-
- /**
- * This class should never be instantiated.
- */
- private XmlUtils() { }
-
- /**
- * Converts all whitespace characters to spaces, then compresses all sequences of spaces to one space.
- * @param input The String that should be converted.
- * @return The converted String.
- * @see #normalizeWhitespace(StringBuilder)
- */
- public static String normalizeWhitespace(final String input) {
- final StringBuilder buffer = new StringBuilder(input);
- final int changes = normalizeWhitespace(buffer);
- if (changes < 1) {
- return input;
- }
- return buffer.toString();
- }
-
- /**
- * Converts all whitespace characters to spaces, then compresses all sequences of spaces to one space.
- * @param buffer The StringBuffer that should be converted.
- * @return The number of changes made to buffer.
- * @see #normalizeWhitespace(String)
- */
- public static int normalizeWhitespace(final StringBuilder buffer) {
- int changes = 0;
- for (int i = 0; i < buffer.length(); i++) {
- final char c = buffer.charAt(i);
- if (c != ' '
- && XmlCharacterUtils.isXMLWhitespace(c)) {
- buffer.setCharAt(i, ' ');
- changes ++;
- }
- }
-
- /* The StringBuilder "replace" and "deleteCharAt" methods do array
- * copies for each change, so we need something more efficient here. */
-
- /* Count the number of spaces to be removed. */
- int spacesToRemove = 0;
- for (int i = 0; i < buffer.length() - 1; i++) {
- if (buffer.charAt(i) == ' '
- && buffer.charAt(i + 1) == ' ') {
- spacesToRemove ++;
- }
- }
-
- /* If none to remove, we are done. */
- if (spacesToRemove == 0) {
- return changes;
- }
-
- final char[] returnArray = new char[buffer.length() - spacesToRemove];
- /* Copy the buffer characters to the new array. */
- /* Copy the first char in all cases. */
- returnArray[0] = buffer.charAt(0);
- int returnIndex = 1;
- /* For all other characters, only copy them if the current char is not a
- * space OR the previous char was not a space. */
- for (int i = 1; i < buffer.length(); i++) {
- if (buffer.charAt(i) != ' '
- || buffer.charAt(i - 1) != ' ') {
- returnArray[returnIndex] = buffer.charAt(i);
- returnIndex ++;
- }
- }
- buffer.setLength(0);
- buffer.append(returnArray);
- return changes + spacesToRemove;
- }
-
-}
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java 2022-11-30 04:37:29 UTC (rev 12754)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPretty.java 2022-11-30 04:54:35 UTC (rev 12755)
@@ -28,7 +28,6 @@
package org.foray.xml;
-import org.foray.common.primitive.XmlUtils;
import org.foray.xml.dtd.Dtd;
import org.foray.xml.dtd.DtdElement;
import org.foray.xml.dtd.ElementStack;
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayXdiff.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayXdiff.java 2022-11-30 04:37:29 UTC (rev 12754)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayXdiff.java 2022-11-30 04:54:35 UTC (rev 12755)
@@ -29,7 +29,6 @@
package org.foray.xml;
import org.foray.common.primitive.StringUtils;
-import org.foray.common.primitive.XmlUtils;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Copied: trunk/foray/foray-xml/src/main/java/org/foray/xml/XmlUtils.java (from rev 12754, trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java)
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/XmlUtils.java (rev 0)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/XmlUtils.java 2022-11-30 04:54:35 UTC (rev 12755)
@@ -0,0 +1,112 @@
+/*
+ * 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.xml;
+
+import org.foray.common.primitive.XmlCharacterUtils;
+
+/**
+ * Utility class containing constants and methods useful in parsing or building XML.
+ * @see javax.xml.XMLConstants
+ */
+public final class XmlUtils {
+
+ /**
+ * This class should never be instantiated.
+ */
+ private XmlUtils() { }
+
+ /**
+ * Converts all whitespace characters to spaces, then compresses all sequences of spaces to one space.
+ * @param input The String that should be converted.
+ * @return The converted String.
+ * @see #normalizeWhitespace(StringBuilder)
+ */
+ public static String normalizeWhitespace(final String input) {
+ final StringBuilder buffer = new StringBuilder(input);
+ final int changes = normalizeWhitespace(buffer);
+ if (changes < 1) {
+ return input;
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Converts all whitespace characters to spaces, then compresses all sequences of spaces to one space.
+ * @param buffer The StringBuffer that should be converted.
+ * @return The number of changes made to buffer.
+ * @see #normalizeWhitespace(String)
+ */
+ public static int normalizeWhitespace(final StringBuilder buffer) {
+ int changes = 0;
+ for (int i = 0; i < buffer.length(); i++) {
+ final char c = buffer.charAt(i);
+ if (c != ' '
+ && XmlCharacterUtils.isXMLWhitespace(c)) {
+ buffer.setCharAt(i, ' ');
+ changes ++;
+ }
+ }
+
+ /* The StringBuilder "replace" and "deleteCharAt" methods do array
+ * copies for each change, so we need something more efficient here. */
+
+ /* Count the number of spaces to be removed. */
+ int spacesToRemove = 0;
+ for (int i = 0; i < buffer.length() - 1; i++) {
+ if (buffer.charAt(i) == ' '
+ && buffer.charAt(i + 1) == ' ') {
+ spacesToRemove ++;
+ }
+ }
+
+ /* If none to remove, we are done. */
+ if (spacesToRemove == 0) {
+ return changes;
+ }
+
+ final char[] returnArray = new char[buffer.length() - spacesToRemove];
+ /* Copy the buffer characters to the new array. */
+ /* Copy the first char in all cases. */
+ returnArray[0] = buffer.charAt(0);
+ int returnIndex = 1;
+ /* For all other characters, only copy them if the current char is not a
+ * space OR the previous char was not a space. */
+ for (int i = 1; i < buffer.length(); i++) {
+ if (buffer.charAt(i) != ' '
+ || buffer.charAt(i - 1) != ' ') {
+ returnArray[returnIndex] = buffer.charAt(i);
+ returnIndex ++;
+ }
+ }
+ buffer.setLength(0);
+ buffer.append(returnArray);
+ return changes + spacesToRemove;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-11-30 04:37:32
|
Revision: 12754
http://sourceforge.net/p/foray/code/12754
Author: victormote
Date: 2022-11-30 04:37:29 +0000 (Wed, 30 Nov 2022)
Log Message:
-----------
Move more XML-related constants to aXSL.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java
trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgUtilities.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java 2022-11-30 04:07:46 UTC (rev 12753)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java 2022-11-30 04:37:29 UTC (rev 12754)
@@ -34,12 +34,6 @@
*/
public final class XmlUtils {
- /** The namespace URI for XLink, whose typical prefix is "xlink:". */
- public static final String XLINK_NS_URI = "http://www.w3.org/1999/xlink";
-
- /** The namespace URI for Extensible Stylesheet Language Transform (XSL-T), whose typical prefix is "xsl:". */
- public static final String XSLT_NS_URI = "http://www.w3.org/1999/XSL/Transform";
-
/**
* This class should never be instantiated.
*/
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgUtilities.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgUtilities.java 2022-11-30 04:07:46 UTC (rev 12753)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgUtilities.java 2022-11-30 04:37:29 UTC (rev 12754)
@@ -28,9 +28,8 @@
package org.foray.render.svg;
-import org.foray.common.primitive.XmlUtils;
-
import org.axsl.graphic.SvgGraphic;
+import org.axsl.utility.xml.XmlConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -221,7 +220,7 @@
public static Element createImage(final Document doc,
final String ref, final float width, final float height) {
final Element border = doc.createElementNS(SvgGraphic.SVG_NS_URI, "image");
- border.setAttributeNS(XmlUtils.XLINK_NS_URI, "xlink:href", ref);
+ border.setAttributeNS(XmlConstants.XLINK_NS_URI, "xlink:href", ref);
border.setAttributeNS(null, "width", "" + width);
border.setAttributeNS(null, "height", "" + height);
return border;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-11-30 04:07:51
|
Revision: 12753
http://sourceforge.net/p/foray/code/12753
Author: victormote
Date: 2022-11-30 04:07:46 +0000 (Wed, 30 Nov 2022)
Log Message:
-----------
Move Foray namespace definition.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java 2022-11-30 03:59:48 UTC (rev 12752)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java 2022-11-30 04:07:46 UTC (rev 12753)
@@ -40,9 +40,6 @@
/** The namespace URI for Extensible Stylesheet Language Transform (XSL-T), whose typical prefix is "xsl:". */
public static final String XSLT_NS_URI = "http://www.w3.org/1999/XSL/Transform";
- /** The namespace URI for FOray extensions to XSL-FO, whose typical prefix is "foray:". */
- public static final String FORAY_NS_URI = "http://org.foray/fo-extensions/2004";
-
/**
* This class should never be instantiated.
*/
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 2022-11-30 03:59:48 UTC (rev 12752)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-11-30 04:07:46 UTC (rev 12753)
@@ -52,6 +52,9 @@
*/
public class FoTree4a implements FoTree {
+ /** The namespace URI for FOray extensions to XSL-FO, whose typical prefix is "foray:". */
+ public static final String FORAY_NS_URI = "http://org.foray/fo-extensions/2004";
+
/** The parent server. */
private FoTreeServer4a treeServer;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java 2022-11-30 03:59:48 UTC (rev 12752)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java 2022-11-30 04:07:46 UTC (rev 12753)
@@ -28,7 +28,6 @@
package org.foray.fotree.foray;
-import org.foray.common.primitive.XmlUtils;
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
@@ -57,7 +56,7 @@
@Override
public String getNamespaceURI() {
- return XmlUtils.FORAY_NS_URI;
+ return FoTree4a.FORAY_NS_URI;
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-11-30 03:59:51
|
Revision: 12752
http://sourceforge.net/p/foray/code/12752
Author: victormote
Date: 2022-11-30 03:59:48 +0000 (Wed, 30 Nov 2022)
Log Message:
-----------
Move globally-significant constants to aXSL.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathNamespace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/math/MathMlDocument4a.java
trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgUtilities.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/primitive/XmlUtils.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -40,19 +40,6 @@
/** The namespace URI for Extensible Stylesheet Language Transform (XSL-T), whose typical prefix is "xsl:". */
public static final String XSLT_NS_URI = "http://www.w3.org/1999/XSL/Transform";
- /** The namespace URI for Extensible Stylesheet Language Formatting Objects (XSL-FO), whose typical prefix is
- * "fo:". */
- public static final String XSLFO_NS_URI = "http://www.w3.org/1999/XSL/Format";
-
- /** The namespace URI for Scalable Vector Graphics (SVG), whose typical prefix is "svg:". */
- public static final String SVG_NS_URI = "http://www.w3.org/2000/svg";
-
- /** The namespace URI for Math Markup Language (MathML), whose typical prefix is "mathml:". */
- public static final String MATHML_NS_URI = "http://www.w3.org/1998/Math/MathML";
-
- /** The namespace URI for aXSL extensions to XSL-FO, whose typical prefix is "axsl:". */
- public static final String AXSL_NS_URI = "http://org.axsl/xslfo-extensions/2007";
-
/** The namespace URI for FOray extensions to XSL-FO, whose typical prefix is "foray:". */
public static final String FORAY_NS_URI = "http://org.foray/fo-extensions/2004";
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 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -29,7 +29,6 @@
package org.foray.fotree;
import org.foray.common.primitive.StringUtils;
-import org.foray.common.primitive.XmlUtils;
import org.foray.fotree.fo.obj.BookmarkTitle4a;
import org.foray.fotree.fo.obj.FoTextCharacters4a;
import org.foray.fotree.fo.obj.FoTextWords4a;
@@ -37,6 +36,7 @@
import org.foray.fotree.fo.obj.Root4a;
import org.foray.xml.SaxParser;
+import org.axsl.fotree.FoTree;
import org.axsl.fotree.FoTreeEvent;
import org.axsl.fotree.FoTreeException;
import org.axsl.fotree.FoTreeListener;
@@ -360,7 +360,7 @@
}
if (fobj.getName().equals("root")) {
final FoTreeException fote = new FoTreeException("Root element is missing the namespace declaration: "
- + XmlUtils.XSLFO_NS_URI);
+ + FoTree.XSLFO_NS_URI);
fote.setContextMessage(fobj.getContextMessage());
throw new SAXException(fote);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -28,7 +28,6 @@
package org.foray.fotree.axsl;
-import org.foray.common.primitive.XmlUtils;
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
@@ -37,6 +36,7 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
+import org.axsl.fotree.FoTree;
import org.axsl.fotree.FoTreeException;
import org.xml.sax.Attributes;
@@ -56,7 +56,7 @@
@Override
public String getNamespaceURI() {
- return XmlUtils.AXSL_NS_URI;
+ return FoTree.AXSL_NS_URI;
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -28,7 +28,6 @@
package org.foray.fotree.fo;
-import org.foray.common.primitive.XmlUtils;
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
@@ -37,6 +36,7 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
+import org.axsl.fotree.FoTree;
import org.axsl.fotree.FoTreeException;
import org.xml.sax.Attributes;
@@ -56,7 +56,7 @@
@Override
public String getNamespaceURI() {
- return XmlUtils.XSLFO_NS_URI;
+ return FoTree.XSLFO_NS_URI;
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathNamespace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathNamespace.java 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathNamespace.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -28,7 +28,6 @@
package org.foray.fotree.math;
-import org.foray.common.primitive.XmlUtils;
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
@@ -39,6 +38,7 @@
import org.foray.fotree.PropertyListUnparsed;
import org.axsl.fotree.FoTreeException;
+import org.axsl.graphic.MathGraphic;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
@@ -58,7 +58,7 @@
@Override
public String getNamespaceURI() {
- return XmlUtils.MATHML_NS_URI;
+ return MathGraphic.MATHML_NS_URI;
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -28,7 +28,6 @@
package org.foray.fotree.svg;
-import org.foray.common.primitive.XmlUtils;
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
@@ -39,6 +38,7 @@
import org.foray.fotree.PropertyListUnparsed;
import org.axsl.fotree.FoTreeException;
+import org.axsl.graphic.SvgGraphic;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
@@ -57,7 +57,7 @@
@Override
public String getNamespaceURI() {
- return XmlUtils.SVG_NS_URI;
+ return SvgGraphic.SVG_NS_URI;
}
@Override
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/GraphicServer4a.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -29,7 +29,6 @@
package org.foray.graphic;
import org.foray.common.MathMlUtil;
-import org.foray.common.primitive.XmlUtils;
import org.foray.common.url.UrlUtil;
import org.foray.graphic.factory.BmpFactory;
import org.foray.graphic.factory.EpsFactory;
@@ -302,10 +301,8 @@
@Override
public SVGDocument makeSvgDocument() throws GraphicException {
- final DOMImplementation impl =
- SVGDOMImplementation.getDOMImplementation();
- final String svgNS = XmlUtils.SVG_NS_URI;
- final Document dom = impl.createDocument(svgNS, "svg", null);
+ final DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
+ final Document dom = impl.createDocument(SvgGraphic.SVG_NS_URI, "svg", null);
return (SVGDocument) dom;
}
@@ -392,26 +389,20 @@
}
/**
- * Converts a generic DOM Document instance that contains a MathML document
- * into an {@link SVGDocument}.
- * @param dom A generic DOM Document instance that contains a MathML
- * document.
- * @return The SVGDocument containing an SVG representation of the MathML
- * document.
+ * Converts a generic DOM Document instance that contains a MathML document into an {@link SVGDocument}.
+ * @param dom A generic DOM Document instance that contains a MathML document.
+ * @return The SVGDocument containing an SVG representation of the MathML document.
* @throws GraphicException For errors during conversion.
*/
- public SVGDocument domToSvgDom(final Document dom)
- throws GraphicException {
+ public SVGDocument domToSvgDom(final Document dom) throws GraphicException {
/* Do some basic validation of the DOM document. */
final Element rootElement = dom.getDocumentElement();
- if (! XmlUtils.MATHML_NS_URI.equals(rootElement.getNamespaceURI())) {
- throw new GraphicException("Document is not in the MathML "
- + "namespace");
+ if (! MathGraphic.MATHML_NS_URI.equals(rootElement.getNamespaceURI())) {
+ throw new GraphicException("Document is not in the MathML namespace");
}
final String rootElementName = rootElement.getLocalName();
if (! MathMlUtil.MATHML_ROOT_ELEMENT_NAME.equals(rootElementName)) {
- throw new GraphicException("Expected root element <math> for "
- + "MathML document, but was: " + rootElementName);
+ throw new GraphicException("Expected root element <math> for MathML document, but was: " + rootElementName);
}
final Converter converter = Converter.getInstance();
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/math/MathMlDocument4a.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/math/MathMlDocument4a.java 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/math/MathMlDocument4a.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -29,8 +29,9 @@
package org.foray.graphic.math;
import org.foray.common.MathMlUtil;
-import org.foray.common.primitive.XmlUtils;
+import org.axsl.graphic.MathGraphic;
+
import org.apache.batik.dom.GenericDocument;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.DocumentType;
@@ -81,7 +82,7 @@
this.referrer = referrer;
this.domain = domain;
this.uri = uri;
- final Element root = this.createElementNS(XmlUtils.MATHML_NS_URI, MathMlUtil.MATHML_ROOT_ELEMENT_NAME);
+ final Element root = this.createElementNS(MathGraphic.MATHML_NS_URI, MathMlUtil.MATHML_ROOT_ELEMENT_NAME);
this.appendChild(root);
}
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgRenderer.java 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgRenderer.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -30,7 +30,6 @@
import org.foray.common.FontSelectionConstraints4a;
import org.foray.common.WellKnownConstants;
-import org.foray.common.primitive.XmlUtils;
import org.foray.render.Renderer4a;
import org.axsl.font.FontSelectionConstraints;
@@ -286,8 +285,7 @@
this.currentPageG.setAttributeNS(null, "transform", "translate(0,"
+ (this.totalHeight - this.pageHeight) + ")");
- final Element lastPageLink = this.svgDocument.createElementNS(
- XmlUtils.SVG_NS_URI, "a");
+ final Element lastPageLink = this.svgDocument.createElementNS(SvgGraphic.SVG_NS_URI, "a");
if (this.lastLink != null) {
lastPageLink.setAttributeNS(null, "xlink:href",
"#svgView(viewBox(0, " + (this.totalHeight - this.pageHeight
@@ -306,8 +304,7 @@
rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden");
lastPageLink.appendChild(rect);
- this.lastLink = this.svgDocument.createElementNS(
- XmlUtils.SVG_NS_URI, "a");
+ this.lastLink = this.svgDocument.createElementNS(SvgGraphic.SVG_NS_URI, "a");
rect = SvgUtilities.createRect(this.svgDocument, this.pageWidth / 2, 0,
this.pageWidth / 2, this.pageHeight);
rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden");
@@ -561,8 +558,7 @@
return;
}
final SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
- final Element view = this.svgDocument.createElementNS(
- XmlUtils.SVG_NS_URI, "svg");
+ final Element view = this.svgDocument.createElementNS(SvgGraphic.SVG_NS_URI, "svg");
final Node newsvg = this.svgDocument.importNode(svg, true);
//view.setAttributeNS(null, "viewBox", "0 0 ");
view.setAttributeNS(null, "x", "" + x);
@@ -570,7 +566,7 @@
// this fixes a problem where the xmlns is repeated sometimes
final Element ele = (Element) newsvg;
- ele.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLConstants.XMLNS_ATTRIBUTE, XmlUtils.SVG_NS_URI);
+ ele.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLConstants.XMLNS_ATTRIBUTE, SvgGraphic.SVG_NS_URI);
if (ele.hasAttributeNS(null, XMLConstants.XMLNS_ATTRIBUTE)) {
ele.removeAttributeNS(null, XMLConstants.XMLNS_ATTRIBUTE);
}
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgUtilities.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgUtilities.java 2022-11-30 03:25:10 UTC (rev 12751)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/svg/SvgUtilities.java 2022-11-30 03:59:48 UTC (rev 12752)
@@ -30,6 +30,8 @@
import org.foray.common.primitive.XmlUtils;
+import org.axsl.graphic.SvgGraphic;
+
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
@@ -106,8 +108,7 @@
*/
public static Element createLine(final Document doc, final float x,
final float y, final float x2, final float y2) {
- final Element ellipse = doc.createElementNS(XmlUtils.SVG_NS_URI,
- "line");
+ final Element ellipse = doc.createElementNS(SvgGraphic.SVG_NS_URI, "line");
ellipse.setAttributeNS(null, "x1", "" + x);
ellipse.setAttributeNS(null, "x2", "" + x2);
ellipse.setAttributeNS(null, "y1", "" + y);
@@ -126,8 +127,7 @@
*/
public static Element createEllipse(final Document doc,
final float cx, final float cy, final float rx, final float ry) {
- final Element ellipse = doc.createElementNS(XmlUtils.SVG_NS_URI,
- "ellipse");
+ final Element ellipse = doc.createElementNS(SvgGraphic.SVG_NS_URI, "ellipse");
ellipse.setAttributeNS(null, "cx", "" + cx);
ellipse.setAttributeNS(null, "rx", "" + rx);
ellipse.setAttributeNS(null, "cy", "" + cy);
@@ -143,8 +143,7 @@
*/
public static Element createPath(final Document doc,
final String str) {
- final Element path = doc.createElementNS(XmlUtils.SVG_NS_URI,
- "path");
+ final Element path = doc.createElementNS(SvgGraphic.SVG_NS_URI, "path");
path.setAttributeNS(null, "d", str);
return path;
}
@@ -159,8 +158,7 @@
*/
public static Element createText(final Document doc, final float x,
final float y, final String str) {
- final Element textGraph = doc.createElementNS(XmlUtils.SVG_NS_URI,
- "text");
+ final Element textGraph = doc.createElementNS(SvgGraphic.SVG_NS_URI, "text");
textGraph.setAttributeNS(null, "x", "" + x);
textGraph.setAttributeNS(null, "y", "" + y);
final Text text = doc.createTextNode(str);
@@ -179,8 +177,7 @@
*/
public static Element createRect(final Document doc, final float x,
final float y, final float width, final float height) {
- final Element border = doc.createElementNS(XmlUtils.SVG_NS_URI,
- "rect");
+ final Element border = doc.createElementNS(SvgGraphic.SVG_NS_URI, "rect");
border.setAttributeNS(null, "x", "" + x);
border.setAttributeNS(null, "y", "" + y);
border.setAttributeNS(null, "width", "" + width);
@@ -194,8 +191,7 @@
* @return The DOM Element representing the group in SVG.
*/
public static Element createG(final Document doc) {
- final Element border = doc.createElementNS(XmlUtils.SVG_NS_URI,
- "g");
+ final Element border = doc.createElementNS(SvgGraphic.SVG_NS_URI, "g");
return border;
}
@@ -208,8 +204,7 @@
*/
public static Element createClip(final Document doc, final Element els,
final String id) {
- final Element border = doc.createElementNS(XmlUtils.SVG_NS_URI,
- "clipPath");
+ final Element border = doc.createElementNS(SvgGraphic.SVG_NS_URI, "clipPath");
border.setAttributeNS(null, "id", id);
border.appendChild(els);
return border;
@@ -225,7 +220,7 @@
*/
public static Element createImage(final Document doc,
final String ref, final float width, final float height) {
- final Element border = doc.createElementNS(XmlUtils.SVG_NS_URI, "image");
+ final Element border = doc.createElementNS(SvgGraphic.SVG_NS_URI, "image");
border.setAttributeNS(XmlUtils.XLINK_NS_URI, "xlink:href", ref);
border.setAttributeNS(null, "width", "" + width);
border.setAttributeNS(null, "height", "" + height);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|