Thread: [FOray-commit] SF.net SVN: foray:[10746] trunk/foray (Page 2)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2009-04-24 02:21:45
|
Revision: 10746
http://foray.svn.sourceforge.net/foray/?rev=10746&view=rev
Author: victormote
Date: 2009-04-24 02:21:44 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Use new aXSL package to reduce dependencies on FOrayMIF.
Modified Paths:
--------------
trunk/foray/foray-app/.classpath
trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
trunk/foray/foray-mif/.classpath
trunk/foray/foray-mif/src/java/org/foray/mif/MifBook.java
trunk/foray/foray-mif/src/java/org/foray/mif/MifDocument.java
trunk/foray/foray-output/.classpath
trunk/foray/foray-output/scripts/build.xml
trunk/foray/foray-output/src/java/org/foray/output/MIFConverter.java
Modified: trunk/foray/foray-app/.classpath
===================================================================
--- trunk/foray/foray-app/.classpath 2009-04-23 23:09:34 UTC (rev 10745)
+++ trunk/foray/foray-app/.classpath 2009-04-24 02:21:44 UTC (rev 10746)
@@ -38,5 +38,7 @@
<classpathentry kind="lib" path="/FOray Lib-Build/ant/ant.jar" sourcepath="/FOray Lib-Build/ant/ant-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit-4.4.jar" sourcepath="/FOray Lib-Build/junit/junit-4.4-src.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.4.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.4-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/axslMif"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/FOrayMIF"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2009-04-23 23:09:34 UTC (rev 10745)
+++ trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2009-04-24 02:21:44 UTC (rev 10746)
@@ -40,6 +40,7 @@
import org.foray.render.xml.XMLRenderer;
import org.axsl.graphic.GraphicServer;
+import org.axsl.mif.MifBook;
import org.axsl.output.OutputTarget;
import org.axsl.pdf.PdfDocument;
@@ -111,7 +112,8 @@
break;
}
case MIF: {
- renderer = new MIFConverter(logger, outputOptions);
+ final MifBook mifBook = new org.foray.mif.MifBook(logger);
+ renderer = new MIFConverter(mifBook, logger, outputOptions);
break;
}
case XML: {
Modified: trunk/foray/foray-mif/.classpath
===================================================================
--- trunk/foray/foray-mif/.classpath 2009-04-23 23:09:34 UTC (rev 10745)
+++ trunk/foray/foray-mif/.classpath 2009-04-24 02:21:44 UTC (rev 10746)
@@ -6,5 +6,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/FOrayCommon"/>
<classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslOutput"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/axslMif"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifBook.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifBook.java 2009-04-23 23:09:34 UTC (rev 10745)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifBook.java 2009-04-24 02:21:44 UTC (rev 10746)
@@ -43,7 +43,7 @@
*
* @author Seshadri G
*/
-public class MifBook {
+public class MifBook implements org.axsl.mif.MifBook {
/** Constant for the end-of-line String, used in building mif output. */
public static final String EOL = "\n";
@@ -127,7 +127,7 @@
}
/**
- * Add a page to this book.
+ * {@inheritDoc}
*/
public void createPage() {
this.bookComponent.getPages().add(new MifPage(this));
@@ -145,9 +145,7 @@
}
/**
- * Writes the content of this book to a given output stream.
- * @param stream The stream to which the content should be written.
- * @throws OutputException For I/O errors during writing.
+ * {@inheritDoc}
*/
public void output(final OutputStream stream) throws OutputException {
// Output the contents of bookComponent
@@ -159,9 +157,7 @@
}
/**
- * Sets the dimensions of this document.
- * @param height The height, in millipoints (??), of this document.
- * @param width The width, in millipoints (??), of this document.
+ * {@inheritDoc}
*/
public void setDocumentHeightWidth(final int height, final int width) {
if (this.bookComponent.getDocument() == null) {
@@ -216,9 +212,7 @@
}
/**
- * Creates a new paragraph and sets its properties.
- * @param startIndent The start-indent value of the new paragraph.
- * @param endIndent The end-indent value of the new paragraph.
+ * {@inheritDoc}
*/
public void setBlockProp(final int startIndent, final int endIndent) {
this.curFlow.startPara(); // Start a para
@@ -258,7 +252,7 @@
}
/**
- * Create a new table.
+ * {@inheritDoc}
*/
public void createTable() {
// First create a table with an ID, then add it to the textflow
@@ -286,9 +280,7 @@
}
/**
- * Sets the current component of the current table, either body, header, or
- * footer.
- * @param current The description of the current component.
+ * {@inheritDoc}
*/
public void setCurrent(final String current) {
// Start the table body or header or footer
@@ -297,7 +289,7 @@
}
/**
- * Start a new row in the current table.
+ * {@inheritDoc}
*/
public void startRow() {
final MifTbl table = this.bookComponent.curTable();
@@ -305,9 +297,7 @@
}
/**
- * Start a new cell in the current row of the current table.
- * @param rowSpan The number of rows spanned by the new cell.
- * @param colSpan The number of columns spanned by the new cell.
+ * {@inheritDoc}
*/
public void startCell(final int rowSpan, final int colSpan) {
final MifTbl table = this.bookComponent.curTable();
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifDocument.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifDocument.java 2009-04-23 23:09:34 UTC (rev 10745)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifDocument.java 2009-04-24 02:21:44 UTC (rev 10746)
@@ -33,7 +33,7 @@
/**
* A MIF Document.
*/
-public class MifDocument extends MifToken {
+public class MifDocument extends MifToken implements org.axsl.mif.MifDocument {
/** The height of pages in this document, in points (??). */
private int height;
Modified: trunk/foray/foray-output/.classpath
===================================================================
--- trunk/foray/foray-output/.classpath 2009-04-23 23:09:34 UTC (rev 10745)
+++ trunk/foray/foray-output/.classpath 2009-04-24 02:21:44 UTC (rev 10746)
@@ -7,8 +7,8 @@
<classpathentry kind="src" path="/axslFont"/>
<classpathentry kind="src" path="/axslFoTree"/>
<classpathentry kind="src" path="/axslCommon"/>
- <classpathentry combineaccessrules="false" kind="src" path="/FOrayMIF"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslOutput"/>
<classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/axslMif"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-output/scripts/build.xml
===================================================================
--- trunk/foray/foray-output/scripts/build.xml 2009-04-23 23:09:34 UTC (rev 10745)
+++ trunk/foray/foray-output/scripts/build.xml 2009-04-24 02:21:44 UTC (rev 10746)
@@ -28,9 +28,6 @@
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
</fileset>
- <fileset dir="${foray.sandbox}/foray-mif/build/ant">
- <include name="*.jar"/>
- </fileset>
</path>
</target>
Modified: trunk/foray/foray-output/src/java/org/foray/output/MIFConverter.java
===================================================================
--- trunk/foray/foray-output/src/java/org/foray/output/MIFConverter.java 2009-04-23 23:09:34 UTC (rev 10745)
+++ trunk/foray/foray-output/src/java/org/foray/output/MIFConverter.java 2009-04-24 02:21:44 UTC (rev 10746)
@@ -28,8 +28,6 @@
package org.foray.output;
-import org.foray.mif.MifBook;
-
import org.axsl.fo.FoContext;
import org.axsl.fo.fo.Block;
import org.axsl.fo.fo.Table;
@@ -38,6 +36,7 @@
import org.axsl.fo.fo.TableColumn;
import org.axsl.fo.fo.TableRow;
import org.axsl.font.FontConsumer;
+import org.axsl.mif.MifBook;
import org.axsl.output.OutputException;
import org.apache.commons.logging.Log;
@@ -69,11 +68,13 @@
/**
* Create the MIF renderer.
+ * @param mifBook The MIF book to be rendered.
* @param logger The logger.
* @param outputConfig The output configuration.
*/
- public MIFConverter(final Log logger, final OutputConfig outputConfig) {
+ public MIFConverter(final MifBook mifBook, final Log logger, final OutputConfig outputConfig) {
super(logger, outputConfig);
+ this.mifDoc = mifBook;
}
/**
@@ -242,7 +243,6 @@
* {@inheritDoc}
*/
public void startOutput() throws OutputException {
- this.mifDoc = new MifBook(getLogger());
getLogger().info("rendering areas to MIF");
this.mifDoc.setDocumentHeightWidth(this.pageHeight, this.pageWidth);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 10:38:39
|
Revision: 10748
http://foray.svn.sourceforge.net/foray/?rev=10748&view=rev
Author: victormote
Date: 2009-04-24 10:38:31 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Move BoundingBox4a utility class to Common.
Modified Paths:
--------------
trunk/foray/foray-common/.classpath
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormSvg.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PdfXFormMath.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/ps/BoundingBox4a.java
Removed Paths:
-------------
trunk/foray/foray-ps/src/java/org/foray/ps/BoundingBox4a.java
Modified: trunk/foray/foray-common/.classpath
===================================================================
--- trunk/foray/foray-common/.classpath 2009-04-24 09:40:56 UTC (rev 10747)
+++ trunk/foray/foray-common/.classpath 2009-04-24 10:38:31 UTC (rev 10748)
@@ -7,5 +7,6 @@
<classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit-4.4.jar" sourcepath="/FOray Lib-Build/junit/junit-4.4-src.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.4.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.4-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/axslPs"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Copied: trunk/foray/foray-common/src/java/org/foray/common/ps/BoundingBox4a.java (from rev 10669, trunk/foray/foray-ps/src/java/org/foray/ps/BoundingBox4a.java)
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/ps/BoundingBox4a.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/ps/BoundingBox4a.java 2009-04-24 10:38:31 UTC (rev 10748)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2006 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.ps;
+
+import org.axsl.ps.BoundingBox;
+
+/**
+ * A PostScript bounding box.
+ */
+public final class BoundingBox4a implements BoundingBox {
+
+ /** Private constructor. This class is currently strictly a utility class
+ * and should not be instantiated. */
+ private BoundingBox4a() { }
+
+ /**
+ * Computes the width of an int bounding box.
+ * @param boundingBoxArray An array describing a regular PostScript bounding
+ * box.
+ * @return The width of the bounding box.
+ */
+ public static float width(final float[] boundingBoxArray) {
+ return boundingBoxArray[BBOX_UPPER_RIGHT_X_INDEX]
+ - boundingBoxArray[BBOX_LOWER_LEFT_X_INDEX];
+
+ }
+
+ /**
+ * Computes the height of an int bounding box.
+ * @param boundingBoxArray An array describing a regular PostScript bounding
+ * box.
+ * @return The height of the bounding box.
+ */
+ public static float height(final float[] boundingBoxArray) {
+ return boundingBoxArray[BBOX_UPPER_RIGHT_Y_INDEX]
+ - boundingBoxArray[BBOX_LOWER_LEFT_Y_INDEX];
+ }
+
+}
Property changes on: trunk/foray/foray-common/src/java/org/foray/common/ps/BoundingBox4a.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2009-04-24 09:40:56 UTC (rev 10747)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2009-04-24 10:38:31 UTC (rev 10748)
@@ -28,7 +28,7 @@
package org.foray.pdf.object;
-import org.foray.ps.BoundingBox4a;
+import org.foray.common.ps.BoundingBox4a;
import org.foray.ps.PsException;
import org.foray.ps.PsInputFile;
import org.foray.ps.PsInterpreter;
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormSvg.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormSvg.java 2009-04-24 09:40:56 UTC (rev 10747)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormSvg.java 2009-04-24 10:38:31 UTC (rev 10748)
@@ -29,7 +29,7 @@
package org.foray.pdf.object;
import org.foray.common.Mime;
-import org.foray.ps.BoundingBox4a;
+import org.foray.common.ps.BoundingBox4a;
import org.axsl.font.FontConsumer;
import org.axsl.graphic.GraphicException;
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PdfXFormMath.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PdfXFormMath.java 2009-04-24 09:40:56 UTC (rev 10747)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PdfXFormMath.java 2009-04-24 10:38:31 UTC (rev 10748)
@@ -29,7 +29,7 @@
package org.foray.pdf.object;
import org.foray.common.Mime;
-import org.foray.ps.BoundingBox4a;
+import org.foray.common.ps.BoundingBox4a;
import org.axsl.font.FontConsumer;
import org.axsl.graphic.GraphicException;
Deleted: trunk/foray/foray-ps/src/java/org/foray/ps/BoundingBox4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/BoundingBox4a.java 2009-04-24 09:40:56 UTC (rev 10747)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/BoundingBox4a.java 2009-04-24 10:38:31 UTC (rev 10748)
@@ -1,65 +0,0 @@
-/*
- * Copyright 2006 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.ps;
-
-import org.axsl.ps.BoundingBox;
-
-/**
- * A PostScript bounding box.
- */
-public final class BoundingBox4a implements BoundingBox {
-
- /** Private constructor. This class is currently strictly a utility class
- * and should not be instantiated. */
- private BoundingBox4a() { }
-
- /**
- * Computes the width of an int bounding box.
- * @param boundingBoxArray An array describing a regular PostScript bounding
- * box.
- * @return The width of the bounding box.
- */
- public static float width(final float[] boundingBoxArray) {
- return boundingBoxArray[BBOX_UPPER_RIGHT_X_INDEX]
- - boundingBoxArray[BBOX_LOWER_LEFT_X_INDEX];
-
- }
-
- /**
- * Computes the height of an int bounding box.
- * @param boundingBoxArray An array describing a regular PostScript bounding
- * box.
- * @return The height of the bounding box.
- */
- public static float height(final float[] boundingBoxArray) {
- return boundingBoxArray[BBOX_UPPER_RIGHT_Y_INDEX]
- - boundingBoxArray[BBOX_LOWER_LEFT_Y_INDEX];
- }
-
-}
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-24 09:40:56 UTC (rev 10747)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-24 10:38:31 UTC (rev 10748)
@@ -38,8 +38,8 @@
import org.foray.common.Mime;
import org.foray.common.StringUtil;
import org.foray.common.WKConstants;
+import org.foray.common.ps.BoundingBox4a;
import org.foray.output.OutputConfig;
-import org.foray.ps.BoundingBox4a;
import org.foray.ps.filter.Ascii85EncodeFilter;
import org.foray.ps.filter.FlateEncodeFilter;
import org.foray.ps.filter.RunLengthEncodeFilter;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 11:32:28
|
Revision: 10750
http://foray.svn.sourceforge.net/foray/?rev=10750&view=rev
Author: victormote
Date: 2009-04-24 11:32:25 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Conform to new axsl requirements for EpsGraphic.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/java/org/foray/graphic/EPSGraphic.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormSvg.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PdfXFormMath.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/EPSGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/EPSGraphic.java 2009-04-24 11:04:22 UTC (rev 10749)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/EPSGraphic.java 2009-04-24 11:32:25 UTC (rev 10750)
@@ -30,6 +30,7 @@
import org.foray.common.RandomReader;
import org.foray.common.WKConstants;
+import org.foray.common.ps.BoundingBox4a;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
@@ -79,7 +80,7 @@
private String docName;
/** Array containing the bounding box. */
- private float[] bbox = new float[] {0, 0, 0, 0};
+ private BoundingBox bbox;
/** Indicates whether this EPS is in ASCII format (true) or in binary format
* (false). */
@@ -213,12 +214,12 @@
}
readBBox(fileStart);
if (this.bbox != null) {
- final float xUR = this.bbox[BoundingBox.BBOX_UPPER_RIGHT_X_INDEX];
- final float xLL = this.bbox[BoundingBox.BBOX_LOWER_LEFT_X_INDEX];
+ final float xUR = this.bbox.upperRightX();
+ final float xLL = this.bbox.lowerLeftX();
final float pixelWidth = xUR - xLL;
this.pixelWidth = Math.round(pixelWidth);
- final float yUR = this.bbox[BoundingBox.BBOX_UPPER_RIGHT_Y_INDEX];
- final float yLL = this.bbox[BoundingBox.BBOX_LOWER_LEFT_Y_INDEX];
+ final float yUR = this.bbox.upperRightY();
+ final float yLL = this.bbox.lowerLeftY();
final float pixelHeight = yUR - yLL;
this.pixelHeight = Math.round(pixelHeight);
} else {
@@ -277,23 +278,23 @@
}
// i now holds the index of the *start* of bbxName + 1. Skip past it.
index += bbxName.length - 1;
- for (int i = 0; i < this.bbox.length; i++) {
- index += readBBoxString(fileStart, i, index);
+ final float[] bboxArray = new float[BoundingBox.BBOX_ENTRIES];
+ for (int i = 0; i < BoundingBox.BBOX_ENTRIES; i++) {
+ index += readBBoxString(fileStart, i, index, bboxArray);
}
+ this.bbox = new BoundingBox4a(bboxArray);
}
/**
* Read the string describing a bounding box component.
- * @param fileStart The first bytes of the file, which should contain the
- * bounding box information.
- * @param bboxIndex 0-based index inicating which bounding box component is
- * being parsed.
- * @param inputIdx The starting index into <code>fileStart</code> at which
- * this method should start reading.
+ * @param fileStart The first bytes of the file, which should contain the bounding box information.
+ * @param bboxIndex 0-based index inicating which bounding box component is being parsed.
+ * @param inputIdx The starting index into <code>fileStart</code> at which this method should start reading.
+ * @param bboxArray The array that is being built, which contains the bounding box elements.
* @return The value of the bounding box component parsed.
*/
private int readBBoxString(final byte[] fileStart, final int bboxIndex,
- final int inputIdx) {
+ final int inputIdx, final float[] bboxArray) {
int idx = inputIdx;
while (idx < fileStart.length && (fileStart[idx] == ' ')) {
idx++;
@@ -306,7 +307,7 @@
final byte[] num = new byte[nidx - idx];
System.arraycopy(fileStart, idx, num, 0, nidx - idx);
final String ns = new String(num);
- this.bbox[bboxIndex] = Float.parseFloat(ns);
+ bboxArray[bboxIndex] = Float.parseFloat(ns);
return 1 + nidx - idx;
}
@@ -334,7 +335,7 @@
/**
* {@inheritDoc}
*/
- public float[] getBoundingBox() {
+ public BoundingBox getBoundingBox() {
return this.bbox;
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java 2009-04-24 11:04:22 UTC (rev 10749)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java 2009-04-24 11:32:25 UTC (rev 10750)
@@ -85,11 +85,11 @@
* {@inheritDoc}
*/
protected String specialXObjectDictEntries() {
- final float[] boundingBox = this.getBoundingBox();
- final float llx = boundingBox[BoundingBox.BBOX_LOWER_LEFT_X_INDEX];
- final float lly = boundingBox[BoundingBox.BBOX_LOWER_LEFT_Y_INDEX];
- final float urx = boundingBox[BoundingBox.BBOX_UPPER_RIGHT_X_INDEX];
- final float ury = boundingBox[BoundingBox.BBOX_UPPER_RIGHT_Y_INDEX];
+ final BoundingBox boundingBox = this.getBoundingBox();
+ final float llx = boundingBox.lowerLeftX();
+ final float lly = boundingBox.lowerLeftY();
+ final float urx = boundingBox.upperRightX();
+ final float ury = boundingBox.upperRightY();
final StringBuilder buffer = new StringBuilder();
buffer.append("/FormType 1" + EOL);
buffer.append("/BBox [");
@@ -117,7 +117,7 @@
* Returns the bounding box dimensions, in form space, for this graphic.
* @return The bounding box for this graphic.
*/
- protected abstract float[] getBoundingBox();
+ protected abstract BoundingBox getBoundingBox();
/**
* Returns any special entries that should be added to the XForm dictionary.
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2009-04-24 11:04:22 UTC (rev 10749)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2009-04-24 11:32:25 UTC (rev 10750)
@@ -28,7 +28,6 @@
package org.foray.pdf.object;
-import org.foray.common.ps.BoundingBox4a;
import org.foray.ps.PsException;
import org.foray.ps.PsInputFile;
import org.foray.ps.PsInterpreter;
@@ -93,7 +92,7 @@
public float getHorizontalScaling(
final Rectangle2D.Float contentRectangle) {
final EpsGraphic eps = this.getGraphic();
- final float graphicWidth = BoundingBox4a.width(eps.getBoundingBox());
+ final float graphicWidth = eps.getBoundingBox().width();
return contentRectangle.width / graphicWidth;
}
@@ -102,8 +101,7 @@
*/
public float getVerticalScaling(final Rectangle2D.Float contentRectangle) {
final EpsGraphic eps = this.getGraphic();
- final float graphicHeight = BoundingBox4a.height(
- eps.getBoundingBox());
+ final float graphicHeight = eps.getBoundingBox().height();
return contentRectangle.height / graphicHeight;
}
@@ -117,7 +115,7 @@
/**
* {@inheritDoc}
*/
- protected float[] getBoundingBox() {
+ protected BoundingBox getBoundingBox() {
return this.graphic.getBoundingBox();
}
@@ -132,9 +130,9 @@
* {@inheritDoc}
*/
protected AffineTransform getUserSpaceTransform() {
- final float[] boundingBox = this.getBoundingBox();
- final float llx = boundingBox[BoundingBox.BBOX_LOWER_LEFT_X_INDEX];
- final float lly = boundingBox[BoundingBox.BBOX_LOWER_LEFT_Y_INDEX];
+ final BoundingBox boundingBox = this.getBoundingBox();
+ final float llx = boundingBox.lowerLeftX();
+ final float lly = boundingBox.lowerLeftY();
float xTranslate = 0;
if (llx < 0) {
/* If the bounding box of the graphic is negative, adjust it up to
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormSvg.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormSvg.java 2009-04-24 11:04:22 UTC (rev 10749)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormSvg.java 2009-04-24 11:32:25 UTC (rev 10750)
@@ -95,9 +95,8 @@
/**
* {@inheritDoc}
*/
- public float getHorizontalScaling(
- final Rectangle2D.Float contentRectangle) {
- final float graphicWidth = BoundingBox4a.width(getBoundingBox());
+ public float getHorizontalScaling(final Rectangle2D.Float contentRectangle) {
+ final float graphicWidth = getBoundingBox().width();
return contentRectangle.width / graphicWidth;
}
@@ -105,7 +104,7 @@
* {@inheritDoc}
*/
public float getVerticalScaling(final Rectangle2D.Float contentRectangle) {
- final float graphicHeight = BoundingBox4a.height(getBoundingBox());
+ final float graphicHeight = getBoundingBox().height();
return contentRectangle.height / graphicHeight;
}
@@ -119,7 +118,7 @@
/**
* {@inheritDoc}
*/
- protected float[] getBoundingBox() {
+ protected BoundingBox getBoundingBox() {
final float[] box = new float[BoundingBox.BBOX_ENTRIES];
box[BoundingBox.BBOX_LOWER_LEFT_X_INDEX] = 0;
box[BoundingBox.BBOX_LOWER_LEFT_Y_INDEX] = 0;
@@ -132,7 +131,7 @@
this.getLogger().error("Error getting SVG dimensions in "
+ this.getClass().getName());
}
- return box;
+ return new BoundingBox4a(box);
}
/**
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java 2009-04-24 11:04:22 UTC (rev 10749)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java 2009-04-24 11:32:25 UTC (rev 10750)
@@ -28,9 +28,12 @@
package org.foray.pdf.object;
+import org.foray.common.ps.BoundingBox4a;
+
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicException;
import org.axsl.pdf.PdfException;
+import org.axsl.ps.BoundingBox;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
@@ -111,9 +114,9 @@
/**
* {@inheritDoc}
*/
- protected float[] getBoundingBox() {
+ protected BoundingBox getBoundingBox() {
/* TODO: Implement this. */
- return new float[] {0, 0, 0, 0};
+ return new BoundingBox4a(0, 0, 0, 0);
}
/**
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PdfXFormMath.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PdfXFormMath.java 2009-04-24 11:04:22 UTC (rev 10749)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PdfXFormMath.java 2009-04-24 11:32:25 UTC (rev 10750)
@@ -95,9 +95,8 @@
/**
* {@inheritDoc}
*/
- public float getHorizontalScaling(
- final Rectangle2D.Float contentRectangle) {
- final float graphicWidth = BoundingBox4a.width(getBoundingBox());
+ public float getHorizontalScaling(final Rectangle2D.Float contentRectangle) {
+ final float graphicWidth = getBoundingBox().width();
return contentRectangle.width / graphicWidth;
}
@@ -105,7 +104,7 @@
* {@inheritDoc}
*/
public float getVerticalScaling(final Rectangle2D.Float contentRectangle) {
- final float graphicHeight = BoundingBox4a.height(getBoundingBox());
+ final float graphicHeight = getBoundingBox().height();
return contentRectangle.height / graphicHeight;
}
@@ -119,7 +118,7 @@
/**
* {@inheritDoc}
*/
- protected float[] getBoundingBox() {
+ protected BoundingBox getBoundingBox() {
final float[] box = new float[BoundingBox.BBOX_ENTRIES];
box[BoundingBox.BBOX_LOWER_LEFT_X_INDEX] = 0;
box[BoundingBox.BBOX_LOWER_LEFT_Y_INDEX] = 0;
@@ -132,7 +131,7 @@
this.getLogger().error("Error getting SVG dimensions in "
+ this.getClass().getName());
}
- return box;
+ return new BoundingBox4a(box);
}
/**
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-24 11:04:22 UTC (rev 10749)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-24 11:32:25 UTC (rev 10750)
@@ -38,7 +38,6 @@
import org.foray.common.Mime;
import org.foray.common.StringUtil;
import org.foray.common.WKConstants;
-import org.foray.common.ps.BoundingBox4a;
import org.foray.output.OutputConfig;
import org.foray.ps.filter.Ascii85EncodeFilter;
import org.foray.ps.filter.FlateEncodeFilter;
@@ -68,6 +67,7 @@
import org.axsl.graphic.output.GraphicOutputContext;
import org.axsl.graphic.output.GraphicPs;
import org.axsl.output.OutputException;
+import org.axsl.ps.BoundingBox;
import org.axsl.ps.Encoding;
import org.axsl.ps.EncodingVector;
@@ -677,9 +677,9 @@
*/
public byte[] epsToPostScript(final EpsGraphic image, final int x,
final int y, final int w, final int h) throws GraphicException {
- final float[] bbox = image.getBoundingBox();
- final float bboxw = BoundingBox4a.width(bbox);
- final float bboxh = BoundingBox4a.height(bbox);
+ final BoundingBox bbox = image.getBoundingBox();
+ final float bboxw = bbox.width();
+ final float bboxh = bbox.height();
StringBuilder buffer = new StringBuilder();
buffer.append("%%BeginDocument: " + image.getName());
@@ -688,8 +688,8 @@
buffer.append(x + " " + (y - h) + " translate");
buffer.append("0.0 rotate");
buffer.append((long) (w / bboxw) + " " + (long) (h / bboxh) + " scale");
- buffer.append(-bbox[0] + " " + (-bbox[1]) + " translate");
- buffer.append(bbox[0] + " " + bbox[1] + " " + bboxw + " " + bboxh
+ buffer.append(-bbox.lowerLeftX() + " " + (-bbox.lowerLeftY()) + " translate");
+ buffer.append(bbox.lowerLeftX() + " " + bbox.lowerLeftY() + " " + bboxw + " " + bboxh
+ " rectclip");
buffer.append("newpath");
final String string1 = buffer.toString();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 14:04:05
|
Revision: 10753
http://foray.svn.sourceforge.net/foray/?rev=10753&view=rev
Author: victormote
Date: 2009-04-24 13:57:38 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Rename mis-named method.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2009-04-24 13:55:33 UTC (rev 10752)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2009-04-24 13:57:38 UTC (rev 10753)
@@ -144,7 +144,7 @@
return;
}
if (filterType.equals("flate")) {
- addFilter(FlateEncodeFilter.makeFlateDecodeFilter(null, false));
+ addFilter(FlateEncodeFilter.makeFlateEncodeFilter(null, false));
} else if (filterType.equals("ascii-85")) {
addFilter(new Ascii85EncodeFilter(null, false));
} else if (filterType.equals("ascii-hex")) {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-24 13:55:33 UTC (rev 10752)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-24 13:57:38 UTC (rev 10753)
@@ -111,7 +111,7 @@
}
case FLATE:
{
- return FlateEncodeFilter.makeFlateDecodeFilter(outputStream, false);
+ return FlateEncodeFilter.makeFlateEncodeFilter(outputStream, false);
}
case RUN_LENGTH:
{
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2009-04-24 13:55:33 UTC (rev 10752)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2009-04-24 13:57:38 UTC (rev 10753)
@@ -61,7 +61,7 @@
* explanation of this parameter.
* @return The new FlateEncodeFilter instance.
*/
- public static FlateEncodeFilter makeFlateDecodeFilter(
+ public static FlateEncodeFilter makeFlateEncodeFilter(
final OutputStream outputStream, final boolean isApplied) {
DeflaterOutputStream deflaterOutputStream = null;
if (outputStream != null) {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2009-04-24 13:55:33 UTC (rev 10752)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2009-04-24 13:57:38 UTC (rev 10753)
@@ -189,7 +189,7 @@
*/
public PSEncodeFilter makeEncodeFilter(final OutputStream outputStream,
final boolean isApplied) {
- return FlateEncodeFilter.makeFlateDecodeFilter(outputStream,
+ return FlateEncodeFilter.makeFlateEncodeFilter(outputStream,
isApplied);
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-24 13:55:33 UTC (rev 10752)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-24 13:57:38 UTC (rev 10753)
@@ -816,7 +816,7 @@
//nop
} else {
if (this.psLevel >= PSRenderer.POSTSCRIPT_LEVEL_3) {
- out = FlateEncodeFilter.makeFlateDecodeFilter(out, false);
+ out = FlateEncodeFilter.makeFlateEncodeFilter(out, false);
} else {
out = new RunLengthEncodeFilter(out, false);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 16:20:08
|
Revision: 10754
http://foray.svn.sourceforge.net/foray/?rev=10754&view=rev
Author: victormote
Date: 2009-04-24 16:20:06 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Use new aXSL PS package to remove FOrayRender dependency on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-app/.classpath
trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
trunk/foray/foray-render/.classpath
trunk/foray/foray-render/scripts/build.xml
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
Modified: trunk/foray/foray-app/.classpath
===================================================================
--- trunk/foray/foray-app/.classpath 2009-04-24 13:57:38 UTC (rev 10753)
+++ trunk/foray/foray-app/.classpath 2009-04-24 16:20:06 UTC (rev 10754)
@@ -40,5 +40,6 @@
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.4.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.4-sources.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslMif"/>
<classpathentry combineaccessrules="false" kind="src" path="/FOrayMIF"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/axslPs"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2009-04-24 13:57:38 UTC (rev 10753)
+++ trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2009-04-24 16:20:06 UTC (rev 10754)
@@ -31,6 +31,7 @@
import org.foray.core.FOrayException;
import org.foray.output.MIFConverter;
import org.foray.output.OutputConfig;
+import org.foray.ps.PsServer4a;
import org.foray.render.awt.AWTRenderer;
import org.foray.render.pcl.PCLRenderer;
import org.foray.render.pdf.PDFRenderer;
@@ -43,6 +44,7 @@
import org.axsl.mif.MifBook;
import org.axsl.output.OutputTarget;
import org.axsl.pdf.PdfDocument;
+import org.axsl.ps.PsServer;
import org.apache.commons.logging.Log;
@@ -104,7 +106,8 @@
break;
}
case PS: {
- renderer = new PSRenderer(logger, outputOptions);
+ final PsServer psServer = new PsServer4a();
+ renderer = new PSRenderer(logger, outputOptions, psServer);
break;
}
case TXT: {
Modified: trunk/foray/foray-render/.classpath
===================================================================
--- trunk/foray/foray-render/.classpath 2009-04-24 13:57:38 UTC (rev 10753)
+++ trunk/foray/foray-render/.classpath 2009-04-24 16:20:06 UTC (rev 10754)
@@ -12,7 +12,6 @@
<classpathentry kind="src" path="/axslCommon"/>
<classpathentry kind="src" path="/axslText"/>
<classpathentry kind="src" path="/axslPdf"/>
- <classpathentry combineaccessrules="false" kind="src" path="/FOrayPS"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslOutput"/>
<classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib/svg-1.1.jar" sourcepath="/FOray Lib-Build/svg/svg-1.1-src.zip"/>
Modified: trunk/foray/foray-render/scripts/build.xml
===================================================================
--- trunk/foray/foray-render/scripts/build.xml 2009-04-24 13:57:38 UTC (rev 10753)
+++ trunk/foray/foray-render/scripts/build.xml 2009-04-24 16:20:06 UTC (rev 10754)
@@ -45,9 +45,6 @@
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
</fileset>
- <fileset dir="${foray.sandbox}/foray-ps/build/ant">
- <include name="*.jar"/>
- </fileset>
<fileset dir="${foray.sandbox}/foray-output/build/ant">
<include name="*.jar"/>
</fileset>
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-24 13:57:38 UTC (rev 10753)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2009-04-24 16:20:06 UTC (rev 10754)
@@ -39,9 +39,6 @@
import org.foray.common.StringUtil;
import org.foray.common.WKConstants;
import org.foray.output.OutputConfig;
-import org.foray.ps.filter.Ascii85EncodeFilter;
-import org.foray.ps.filter.FlateEncodeFilter;
-import org.foray.ps.filter.RunLengthEncodeFilter;
import org.foray.render.PrintRenderer;
import org.axsl.common.Gradient;
@@ -70,6 +67,8 @@
import org.axsl.ps.BoundingBox;
import org.axsl.ps.Encoding;
import org.axsl.ps.EncodingVector;
+import org.axsl.ps.PsFilterType;
+import org.axsl.ps.PsServer;
import org.apache.commons.logging.Log;
@@ -176,13 +175,18 @@
*/
private Map<FontUse, PSFont> fontMap = new HashMap<FontUse, PSFont>();
+ /** The PostScript server. */
+ private PsServer psServer;
+
/**
* Constructor.
* @param logger The logger.
* @param renderConfig The configuration for this renderer.
+ * @param psServer The PostScript server to be used for this render process.
*/
- public PSRenderer(final Log logger, final OutputConfig renderConfig) {
+ public PSRenderer(final Log logger, final OutputConfig renderConfig, final PsServer psServer) {
super(logger, renderConfig);
+ this.psServer = psServer;
}
/**
@@ -811,14 +815,14 @@
*/
// imgmap[0] = 1;
OutputStream out = this.out;
- out = new Ascii85EncodeFilter(out, false);
+ out = this.psServer.makeEncodeFilter(PsFilterType.ASCII_85, out);
if (img.getGraphicType() == Graphic.Type.JPEG) {
//nop
} else {
if (this.psLevel >= PSRenderer.POSTSCRIPT_LEVEL_3) {
- out = FlateEncodeFilter.makeFlateEncodeFilter(out, false);
+ out = this.psServer.makeEncodeFilter(PsFilterType.FLATE, out);
} else {
- out = new RunLengthEncodeFilter(out, false);
+ out = this.psServer.makeEncodeFilter(PsFilterType.RUN_LENGTH, out);
}
}
out.write(imgmap);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 17:54:43
|
Revision: 10756
http://foray.svn.sourceforge.net/foray/?rev=10756&view=rev
Author: victormote
Date: 2009-04-24 17:54:32 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Give a PDFDocument access to the PostScript services.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
Modified: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2009-04-24 16:46:59 UTC (rev 10755)
+++ trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2009-04-24 17:54:32 UTC (rev 10756)
@@ -128,8 +128,8 @@
break;
}
default: {
- final PdfDocument document = new org.foray.pdf.object.PDFDocument(
- outputStream, logger);
+ final PsServer psServer = new PsServer4a();
+ final PdfDocument document = new org.foray.pdf.object.PDFDocument(outputStream, logger, psServer);
renderer = new PDFRenderer(logger, outputOptions, document);
break;
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2009-04-24 16:46:59 UTC (rev 10755)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2009-04-24 17:54:32 UTC (rev 10756)
@@ -48,6 +48,7 @@
import org.axsl.pdf.PdfPageLabelStyle;
import org.axsl.pdf.PdfVersion;
import org.axsl.ps.Encoding;
+import org.axsl.ps.PsServer;
import org.apache.commons.logging.Log;
@@ -201,6 +202,9 @@
/** The output stream to which this document should be written. */
private OutputStream outputStream;
+ /** The PostScript server. */
+ private PsServer psServer;
+
/**
* Constructor which creates an empty PDF document.
* The constructor creates a /Root and /Pages object to track the document
@@ -211,10 +215,12 @@
* @param outputStream The output stream to which this document should be
* written.
* @param logger The logger to which user messages should be written.
+ * @param psServer The PostScript server.
*/
- public PDFDocument(final OutputStream outputStream, final Log logger) {
+ public PDFDocument(final OutputStream outputStream, final Log logger, final PsServer psServer) {
this.outputStream = outputStream;
this.logger = logger;
+ this.psServer = psServer;
// Create the Root object
this.root = new PDFRoot(this);
@@ -897,4 +903,12 @@
return theColorVector;
}
+ /**
+ * Returns the PostScript server.
+ * @return The PostScript server.
+ */
+ public PsServer getPsServer() {
+ return this.psServer;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 20:08:13
|
Revision: 10757
http://foray.svn.sourceforge.net/foray/?rev=10757&view=rev
Author: victormote
Date: 2009-04-24 20:08:04 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Steps toward reducing FOrayPDF's dependence on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2009-04-24 17:54:32 UTC (rev 10756)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2009-04-24 20:08:04 UTC (rev 10757)
@@ -28,12 +28,11 @@
package org.foray.pdf.object;
-import org.foray.ps.filter.Ascii85EncodeFilter;
-import org.foray.ps.filter.AsciiHexEncodeFilter;
-import org.foray.ps.filter.FlateEncodeFilter;
import org.foray.ps.filter.PSEncodeFilter;
import org.axsl.pdf.PdfException;
+import org.axsl.ps.PsEncodeFilter;
+import org.axsl.ps.PsFilterType;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -57,7 +56,7 @@
/** The LIFO (last-in, first-out) list of filters that should be applied to
* this stream. */
- private List<PSEncodeFilter> filters = new ArrayList<PSEncodeFilter>();
+ private List<PsEncodeFilter> filters = new ArrayList<PsEncodeFilter>();
/** The furthest upstream output stream, that is, the stream to which this
* should write when it has content to be written. */
@@ -136,23 +135,33 @@
* filter to be applied should be added first.
* @param filterType The type of filter to add, one of "flate", "ascii-85",
* or "ascii-hex".
+ * @return The newly-created filter.
* @throws PdfException For errors while adding the filter.
*/
- public void addFilter(final String filterType) throws PdfException {
+ public PsEncodeFilter addFilter(final String filterType) throws PdfException {
if (filterType == null
|| "".equals(filterType)) {
- return;
+ return null;
}
+ if (this.filtersLocked) {
+ throw new PdfException("Cannot add filters to PDFStream after "
+ + "content has been written to the stream.");
+ }
+ PsFilterType psFilterType = null;
if (filterType.equals("flate")) {
- addFilter(FlateEncodeFilter.makeFlateEncodeFilter(null, false));
+ psFilterType = PsFilterType.FLATE;
} else if (filterType.equals("ascii-85")) {
- addFilter(new Ascii85EncodeFilter(null, false));
+ psFilterType = PsFilterType.ASCII_85;
} else if (filterType.equals("ascii-hex")) {
- addFilter(new AsciiHexEncodeFilter(null, false));
+ psFilterType = PsFilterType.ASCII_HEX;
} else {
- throw new PdfException("Unsupported filter type in "
- + "pdf-filters: " + filterType);
+ throw new PdfException("Unsupported filter type in pdf-filters: " + filterType);
}
+ final PsEncodeFilter encodeFilter = this.getPDFDocument().getPsServer().makeEncodeFilter(psFilterType,
+ this.out);
+ this.out = encodeFilter;
+ this.filters.add(encodeFilter);
+ return encodeFilter;
}
/**
@@ -309,7 +318,7 @@
/* Mark the filters as applied. */
for (int i = 0; i < this.filters.size(); i++) {
- final PSEncodeFilter filter = this.filters.get(i);
+ final PsEncodeFilter filter = this.filters.get(i);
// place the names in our local List in reverse order
names.add(0, filter.getDecodeName());
parms.add(0, filter.getDecodeParms());
@@ -383,4 +392,13 @@
return this.out;
}
+ /**
+ * Sets the output stream.
+ * @param outputStream The new output stream.
+ */
+ protected void setOutputStream(final OutputStream outputStream) {
+ /* TODO: Exposing this is pretty ugly. Find another way. */
+ this.out = outputStream;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-24 17:54:32 UTC (rev 10756)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-24 20:08:04 UTC (rev 10757)
@@ -38,6 +38,7 @@
import org.foray.ps.filter.DctEncodeFilter;
import org.foray.ps.filter.FlateDecodeFilter;
import org.foray.ps.filter.FlateEncodeFilter;
+import org.foray.ps.filter.PSEncodeFilter;
import org.foray.ps.filter.RunLengthDecodeFilter;
import org.foray.ps.filter.RunLengthEncodeFilter;
@@ -91,7 +92,7 @@
/**
* {@inheritDoc}
*/
- public OutputStream makeEncodeFilter(final PsFilterType filterType, final OutputStream outputStream) {
+ public PSEncodeFilter makeEncodeFilter(final PsFilterType filterType, final OutputStream outputStream) {
switch (filterType) {
case ASCII_85:
{
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java 2009-04-24 17:54:32 UTC (rev 10756)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java 2009-04-24 20:08:04 UTC (rev 10757)
@@ -28,14 +28,15 @@
package org.foray.ps.filter;
+import org.axsl.ps.PsEncodeFilter;
+
import java.io.ByteArrayOutputStream;
-import java.io.FilterOutputStream;
import java.io.OutputStream;
/**
* A PostScript filter object.
*/
-public abstract class PSEncodeFilter extends FilterOutputStream {
+public abstract class PSEncodeFilter extends PsEncodeFilter {
/** Tracks whether this filter has already been applied to the data. */
private boolean applied = false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 21:10:09
|
Revision: 10760
http://foray.svn.sourceforge.net/foray/?rev=10760&view=rev
Author: victormote
Date: 2009-04-24 21:10:05 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Move PsInput interface from FOray to aXSL.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsFileReal.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInputFile.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsStringInput.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java
Removed Paths:
-------------
trunk/foray/foray-ps/src/java/org/foray/ps/PsInput.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-24 20:56:18 UTC (rev 10759)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-24 21:10:05 UTC (rev 10760)
@@ -31,7 +31,6 @@
import org.foray.common.WKConstants;
import org.foray.ps.PsDictionary;
import org.foray.ps.PsException;
-import org.foray.ps.PsInput;
import org.foray.ps.PsInterpreter;
import org.foray.ps.PsObject;
import org.foray.ps.filter.PSFilter;
@@ -39,6 +38,8 @@
import org.foray.ps.type1.PsFontInfoDictionary;
import org.foray.ps.type1.PsPrivateDictionary;
+import org.axsl.ps.PsInput;
+
import org.apache.commons.logging.Log;
import java.io.IOException;
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsFileReal.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsFileReal.java 2009-04-24 20:56:18 UTC (rev 10759)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsFileReal.java 2009-04-24 21:10:05 UTC (rev 10760)
@@ -28,6 +28,8 @@
package org.foray.ps;
+import org.axsl.ps.PsInput;
+
import java.io.File;
import java.io.IOException;
Deleted: trunk/foray/foray-ps/src/java/org/foray/ps/PsInput.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInput.java 2009-04-24 20:56:18 UTC (rev 10759)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInput.java 2009-04-24 21:10:05 UTC (rev 10760)
@@ -1,56 +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.ps;
-
-import java.io.IOException;
-
-/**
- * Interface for objects that wish to be used as input to the PostScript
- * interpreter. This interface is needed because a variety of file types may be
- * used as input to a PostScript interpreter. For example, Type 1 font files
- * are frequently packaged in operating-system-specific wrapper files that must
- * be unwrapped (and sometimes decoded) before they can be consumed by the
- * PostScript interpreter. This interface allows other classes to do that work
- * and pass the results through to the interpreter.
- *
- * Please note that the implementing class is responsible for any buffering of
- * the data for i/o efficiency purposes.
- */
-public interface PsInput {
-
- /**
- * Returns the next byte array chunk in the input so that it can be
- * consumed by the PostScript interpreter.
- * @return The next byte array that should be consumed by the interpreter,
- * or null if there is no more input.
- * @throws IOException For I/O Errors.
- */
- byte[] providePostScriptInput() throws IOException;
-
-}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsInputFile.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInputFile.java 2009-04-24 20:56:18 UTC (rev 10759)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInputFile.java 2009-04-24 21:10:05 UTC (rev 10760)
@@ -30,6 +30,8 @@
import org.foray.common.WKConstants;
+import org.axsl.ps.PsInput;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java 2009-04-24 20:56:18 UTC (rev 10759)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java 2009-04-24 21:10:05 UTC (rev 10760)
@@ -32,6 +32,8 @@
import org.foray.ps.encode.EncodingVector;
import org.foray.ps.readonly.ReadOnlySystemDict;
+import org.axsl.ps.PsInput;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsStringInput.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsStringInput.java 2009-04-24 20:56:18 UTC (rev 10759)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsStringInput.java 2009-04-24 21:10:05 UTC (rev 10760)
@@ -28,6 +28,8 @@
package org.foray.ps;
+import org.axsl.ps.PsInput;
+
/**
* A {@link PsInput} implementation that simply wraps a String.
*/
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java 2009-04-24 20:56:18 UTC (rev 10759)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java 2009-04-24 21:10:05 UTC (rev 10760)
@@ -28,6 +28,8 @@
package org.foray.ps;
+import org.axsl.ps.PsInput;
+
import java.math.BigDecimal;
import junit.framework.TestCase;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 21:21:49
|
Revision: 10761
http://foray.svn.sourceforge.net/foray/?rev=10761&view=rev
Author: victormote
Date: 2009-04-24 21:21:41 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Push more of the PostScript API to aXSL.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2009-04-24 21:10:05 UTC (rev 10760)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2009-04-24 21:21:41 UTC (rev 10761)
@@ -29,13 +29,13 @@
package org.foray.pdf.object;
import org.foray.ps.PsException;
-import org.foray.ps.PsInputFile;
import org.foray.ps.PsInterpreter;
import org.foray.ps.pdf.PDFSystemDict;
import org.axsl.graphic.EpsGraphic;
import org.axsl.graphic.GraphicException;
import org.axsl.ps.BoundingBox;
+import org.axsl.ps.PsInput;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
@@ -67,9 +67,9 @@
*/
protected byte[] getPdfContent() throws GraphicException {
final File file = new File(getGraphic().getUrl().getFile());
- PsInputFile psInput = null;
+ PsInput psInput = null;
try {
- psInput = new PsInputFile(file);
+ psInput = this.getPDFDocument().getPsServer().makePsInput(file);
} catch (final IOException e) {
throw new GraphicException("Cannot open EPS file.");
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-24 21:10:05 UTC (rev 10760)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-24 21:21:41 UTC (rev 10761)
@@ -43,8 +43,11 @@
import org.foray.ps.filter.RunLengthEncodeFilter;
import org.axsl.ps.PsFilterType;
+import org.axsl.ps.PsInput;
import org.axsl.ps.PsServer;
+import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -125,4 +128,11 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
+ public PsInput makePsInput(final File inputFile) throws IOException {
+ return new PsInputFile(inputFile);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 21:44:44
|
Revision: 10763
http://foray.svn.sourceforge.net/foray/?rev=10763&view=rev
Author: victormote
Date: 2009-04-24 21:44:41 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
1. Conform to new aXSL requirements for method allowing decode parameters to be set.
2. Set decode parameters previously excluded.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2009-04-24 21:35:46 UTC (rev 10762)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2009-04-24 21:44:41 UTC (rev 10763)
@@ -182,7 +182,7 @@
case CCITT_GROUP_4:
filter = psServer.makeEncodeFilter(PsFilterType.CCITT_FAX, outputStream);
filter.setInactive();
-// filter.setDecodeParms("<< /K -1 /Columns " + graphic.pixelWidth() + " >>");
+ filter.setDecodeParms("<< /K -1 /Columns " + graphic.pixelWidth() + " >>");
return filter;
case JPEG:
filter = psServer.makeEncodeFilter(PsFilterType.DCT, outputStream);
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2009-04-24 21:35:46 UTC (rev 10762)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2009-04-24 21:44:41 UTC (rev 10763)
@@ -251,4 +251,11 @@
super.flush();
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setDecodeParms(final String decodeParms) {
+ /* Ignore. */
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2009-04-24 21:35:46 UTC (rev 10762)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2009-04-24 21:44:41 UTC (rev 10763)
@@ -190,4 +190,11 @@
super.flush();
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setDecodeParms(final String decodeParms) {
+ /* Ignore. */
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java 2009-04-24 21:35:46 UTC (rev 10762)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java 2009-04-24 21:44:41 UTC (rev 10763)
@@ -89,4 +89,11 @@
/* TODO: Implement this. */
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setDecodeParms(final String decodeParms) {
+ /* Ignore. */
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2009-04-24 21:35:46 UTC (rev 10762)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2009-04-24 21:44:41 UTC (rev 10763)
@@ -118,4 +118,11 @@
this.getDeflaterOutputStream().finish();
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setDecodeParms(final String decodeParms) {
+ /* Ignore. */
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java 2009-04-24 21:35:46 UTC (rev 10762)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java 2009-04-24 21:44:41 UTC (rev 10763)
@@ -227,4 +227,11 @@
super.flush();
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setDecodeParms(final String decodeParms) {
+ /* Ignore. */
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-24 23:51:38
|
Revision: 10766
http://foray.svn.sourceforge.net/foray/?rev=10766&view=rev
Author: victormote
Date: 2009-04-24 23:51:24 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Push more of the PostScript API to aXSL.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/pdf/PDFSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/readonly/ReadOnlySystemDict.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2009-04-24 22:37:49 UTC (rev 10765)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXFormEps.java 2009-04-24 23:51:24 UTC (rev 10766)
@@ -28,14 +28,15 @@
package org.foray.pdf.object;
-import org.foray.ps.PsException;
-import org.foray.ps.PsInterpreter;
-import org.foray.ps.pdf.PDFSystemDict;
-
import org.axsl.graphic.EpsGraphic;
import org.axsl.graphic.GraphicException;
import org.axsl.ps.BoundingBox;
+import org.axsl.ps.PsException;
import org.axsl.ps.PsInput;
+import org.axsl.ps.PsInterpreter;
+import org.axsl.ps.PsInterpreterException;
+import org.axsl.ps.PsServer;
+import org.axsl.ps.PsSystemDict;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
@@ -73,16 +74,20 @@
} catch (final IOException e) {
throw new GraphicException("Cannot open EPS file.");
}
- final PDFSystemDict systemDict = new PDFSystemDict();
- PsInterpreter interpreter = null;
+ final PsServer psServer = this.getPDFDocument().getPsServer();
+ PsSystemDict systemDict = null;
try {
- interpreter = new PsInterpreter(psInput, systemDict);
+ systemDict = psServer.getPdfSystemDict();
+ final PsInterpreter interpreter = psServer.makeInterpreter(psInput, systemDict);
interpreter.process();
+ } catch (final PsInterpreterException e1) {
+ getLogger().error(e1.getMessage());
+ throw new GraphicException("Cannot parse EPS file.");
} catch (final PsException e1) {
getLogger().error(e1.getMessage());
throw new GraphicException("Cannot parse EPS file.");
}
- final byte[] pdfBytes = systemDict.getOutputStream().toByteArray();
+ final byte[] pdfBytes = systemDict.getOutput();
return pdfBytes;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java 2009-04-24 22:37:49 UTC (rev 10765)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java 2009-04-24 23:51:24 UTC (rev 10766)
@@ -43,7 +43,7 @@
* This interpreter can be used in wide variety of different processing environments by creating
* approprate subclasses of {@link PsSystemDict}.
*/
-public class PsInterpreter {
+public class PsInterpreter implements org.axsl.ps.PsInterpreter {
/** The PostScript "null" character. */
public static final byte NULL = 0x00;
@@ -298,8 +298,7 @@
}
/**
- * Parses and interprets the input.
- * @throws PsException For any PostScript error.
+ * {@inheritDoc}
*/
public void process() throws PsException {
while (this.executionStack.size() != 0) {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-24 22:37:49 UTC (rev 10765)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-24 23:51:24 UTC (rev 10766)
@@ -45,11 +45,9 @@
import org.foray.ps.pdf.PDFSystemDict;
import org.foray.ps.readonly.ReadOnlySystemDict;
-import org.axsl.ps.PsException;
import org.axsl.ps.PsFilterType;
import org.axsl.ps.PsInput;
import org.axsl.ps.PsServer;
-import org.axsl.ps.PsSystemDict;
import java.awt.Graphics2D;
import java.io.File;
@@ -144,22 +142,38 @@
/**
* {@inheritDoc}
*/
- public PsSystemDict getReadOnlySystemDict() throws PsException {
+ public PsSystemDict getReadOnlySystemDict() throws org.axsl.ps.PsException {
return new ReadOnlySystemDict();
}
/**
* {@inheritDoc}
*/
- public PsSystemDict getPdfSystemDict() throws PsException {
+ public PsSystemDict getPdfSystemDict() throws org.axsl.ps.PsException {
return new PDFSystemDict();
}
/**
* {@inheritDoc}
*/
- public PsSystemDict getJava2dSystemDict(final Graphics2D graphics) throws PsException {
+ public PsSystemDict getJava2dSystemDict(final Graphics2D graphics) throws org.axsl.ps.PsException {
return new Java2DSystemDict(graphics);
}
+ /**
+ * {@inheritDoc}
+ */
+ public PsInterpreter makeInterpreter(final PsInput psInput, final org.axsl.ps.PsSystemDict systemDict)
+ throws org.axsl.ps.PsException {
+ if (! (systemDict instanceof org.foray.ps.PsSystemDict)) {
+ throw new org.axsl.ps.PsException("Unable to use non-FOray PsSystemDict");
+ }
+ final org.foray.ps.PsSystemDict foraySystemDict = (org.foray.ps.PsSystemDict) systemDict;
+ try {
+ return new PsInterpreter(psInput, foraySystemDict);
+ } catch (final PsException e) {
+ throw new org.axsl.ps.PsException(e.getMessage());
+ }
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java 2009-04-24 22:37:49 UTC (rev 10765)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java 2009-04-24 23:51:24 UTC (rev 10766)
@@ -150,4 +150,11 @@
/* TODO: Implement this. */
}
+ /**
+ * {@inheritDoc}
+ */
+ public byte[] getOutput() {
+ return new byte[0];
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/pdf/PDFSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/pdf/PDFSystemDict.java 2009-04-24 22:37:49 UTC (rev 10765)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/pdf/PDFSystemDict.java 2009-04-24 23:51:24 UTC (rev 10766)
@@ -63,6 +63,13 @@
}
/**
+ * {@inheritDoc}
+ */
+ public byte[] getOutput() {
+ return this.stream.toByteArray();
+ }
+
+ /**
* Writes to the output stream.
* @param operator The operator performing the write operation. Used in
* user messages.
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/readonly/ReadOnlySystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/readonly/ReadOnlySystemDict.java 2009-04-24 22:37:49 UTC (rev 10765)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/readonly/ReadOnlySystemDict.java 2009-04-24 23:51:24 UTC (rev 10766)
@@ -100,4 +100,11 @@
public void setrgbcolorDevice(final float red, final float green,
final float blue) { }
+ /**
+ * {@inheritDoc}
+ */
+ public byte[] getOutput() {
+ return new byte[0];
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-25 15:06:39
|
Revision: 10768
http://foray.svn.sourceforge.net/foray/?rev=10768&view=rev
Author: victormote
Date: 2009-04-25 15:06:30 +0000 (Sat, 25 Apr 2009)
Log Message:
-----------
Rename exception class for clarity.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsMatrix.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsObjectComposite.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsOperandStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreterException4a.java
Removed Paths:
-------------
trunk/foray/foray-ps/src/java/org/foray/ps/PsException.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-25 00:00:15 UTC (rev 10767)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-25 15:06:30 UTC (rev 10768)
@@ -30,7 +30,7 @@
import org.foray.common.WKConstants;
import org.foray.ps.PsDictionary;
-import org.foray.ps.PsException;
+import org.foray.ps.PsInterpreterException4a;
import org.foray.ps.PsInterpreter;
import org.foray.ps.PsObject;
import org.foray.ps.filter.PSFilter;
@@ -137,13 +137,13 @@
PsInterpreter interpreter = null;
try {
interpreter = new PsInterpreter(this, null);
- } catch (final PsException e) {
+ } catch (final PsInterpreterException4a e) {
getLogger().error(e.getMessage());
}
startNewSegment();
try {
interpreter.process();
- } catch (final PsException e1) {
+ } catch (final PsInterpreterException4a e1) {
this.getLogger().error(e1.getMessage()
+ "\n " + this.getReader().getDescription().toString());
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2009-04-25 00:00:15 UTC (rev 10767)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2009-04-25 15:06:30 UTC (rev 10768)
@@ -67,10 +67,10 @@
* @param nameObject The PsName instance that should be executed.
* @return True if the operation was found and executed, otherwise, false.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
protected boolean execute(final PsInterpreter interpreter, final PsName nameObject)
- throws PsOperatorException, PsException {
+ throws PsOperatorException, PsInterpreterException4a {
final PsObject value = getItem(nameObject);
// If the item is not in this dictionary, exit
if (value == null) {
@@ -98,10 +98,10 @@
* be executed
* @return True if the operator is found and executed, otherwise, false.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
protected boolean executeOperator(final PsOperator operatorEnum) throws PsOperatorException,
- PsException {
+ PsInterpreterException4a {
return false;
}
@@ -124,13 +124,13 @@
* @param interpreter The parent interpreter.
* @param key The key to the dictionary entry.
* @param value The value of the dictionary entry.
- * @throws PsException A typecheck error if the object is null.
+ * @throws PsInterpreterException4a A typecheck error if the object is null.
*/
public void addItem(final PsInterpreter interpreter, final PsObject key, final PsObject value)
- throws PsException {
+ throws PsInterpreterException4a {
// Per PLRM2, Sec 3.3.9, a key can be any PS object except null.
if (key instanceof PsNull) {
- throw new PsException(interpreter, PsError.TYPECHECK, PsOperator.INVALID);
+ throw new PsInterpreterException4a(interpreter, PsError.TYPECHECK, PsOperator.INVALID);
}
/*
* We are relying here on proper equals() methods, primarily in the
Deleted: trunk/foray/foray-ps/src/java/org/foray/ps/PsException.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsException.java 2009-04-25 00:00:15 UTC (rev 10767)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsException.java 2009-04-25 15:06:30 UTC (rev 10768)
@@ -1,131 +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.ps;
-
-import org.axsl.ps.PsInterpreterException;
-
-/**
- * Handles PostScript Exceptions.
- */
-public class PsException extends PsInterpreterException {
-
- /** Constant needed for serialization. */
- static final long serialVersionUID = 7211537297214545L;
-
- /** The PostScript error code that triggered this Exception. */
- private PsError errorCode;
-
- /** The PostScript operator code that triggered this Exception. */
- private PsOperator offendingOperator;
-
- /** The input line number at which the Exception was noted. */
- private int lineNumber;
-
- /** The input column number at which the Exception was noted. */
- private int columnNumber;
-
- /** An image of the stack as it existed when the Exception was thrown.
- * This image can be useful during debugging. */
- private String operandStackImage;
-
- /**
- * Constructor.
- * @param interpreter The PS interpreter.
- * @param errorCode The PS error code for this exception.
- * @param offendingOperator The PS operator that triggered the request
- * that threw the exception.
- * @param message The user message.
- */
- public PsException(final PsInterpreter interpreter, final PsError errorCode,
- final PsOperator offendingOperator, final String message) {
- super(message);
- if (errorCode == null) {
- throw new NullPointerException("PostScript error code is required.");
- }
- this.lineNumber = interpreter.getCurrentLine();
- this.columnNumber = interpreter.getCurrentColumn();
- this.errorCode = errorCode;
- this.offendingOperator = offendingOperator;
- final StringBuilder buffer = new StringBuilder();
- buffer.append("Operand Stack:\n");
- final PsStack<PsObject> operandStack = interpreter.getOperandStack();
- if (operandStack.size() == 0) {
- buffer.append(" (empty)");
- }
- for (int i = 0; i < operandStack.size(); i++) {
- final PsObject object = operandStack.peek(i);
- buffer.append(" " + object.toString() + "\n");
- }
- this.operandStackImage = buffer.toString();
- }
-
- /**
- * Constructor.
- * @param interpreter The PS interpreter.
- * @param errorCode The PS error code for this exception.
- */
- public PsException(final PsInterpreter interpreter, final PsError errorCode) {
- this(interpreter, errorCode, PsOperator.INVALID, null);
- }
-
- /**
- * Constructor.
- * @param interpreter The PS interpreter.
- * @param errorCode The PS error code for this exception.
- * @param offendingOperator The PS operator that triggered the request
- * that threw the exception.
- */
- public PsException(final PsInterpreter interpreter, final PsError errorCode,
- final PsOperator offendingOperator) {
- this(interpreter, errorCode, offendingOperator, null);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getMessage() {
- final String detailMessage = super.getMessage();
- final StringBuilder sb = new StringBuilder();
- sb.append("PostScript error: ");
- sb.append(this.errorCode.getName());
- sb.append(" (operator: ");
- sb.append(this.offendingOperator.getName());
- sb.append(") ");
- if (detailMessage != null) {
- sb.append(" (");
- sb.append(detailMessage);
- sb.append(")");
- }
- sb.append("\n Line " + this.lineNumber + ", Column "
- + this.columnNumber);
- sb.append("\n" + this.operandStackImage);
- return sb.toString();
- }
-
-}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java 2009-04-25 00:00:15 UTC (rev 10767)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java 2009-04-25 15:06:30 UTC (rev 10768)
@@ -229,9 +229,9 @@
* @param input The PsInput instance that should be used as standard input
* to the interpreter.
* @param systemDict The dictionary that should be used.
- * @throws PsException For invalid parameters.
+ * @throws PsInterpreterException4a For invalid parameters.
*/
- public PsInterpreter(final PsInput input, final PsSystemDict systemDict) throws PsException {
+ public PsInterpreter(final PsInput input, final PsSystemDict systemDict) throws PsInterpreterException4a {
if (input == null) {
throw new NullPointerException("PostScript Error: No standard input.");
}
@@ -300,13 +300,13 @@
/**
* {@inheritDoc}
*/
- public void process() throws PsException {
+ public void process() throws PsInterpreterException4a {
while (this.executionStack.size() != 0) {
final PsObject currentExecution = this.executionStack.peek();
try {
processItem(currentExecution);
} catch (final PsOperatorException e) {
- throw new PsException(this, e.getErrorCode(), e.getOffendingOperator());
+ throw new PsInterpreterException4a(this, e.getErrorCode(), e.getOffendingOperator());
}
}
}
@@ -314,9 +314,9 @@
/**
* Processes the top item on the execution stack.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
- public void processItem() throws PsOperatorException, PsException {
+ public void processItem() throws PsOperatorException, PsInterpreterException4a {
final int executionStackSize = this.executionStack.size();
while (this.executionStack.size() >= executionStackSize) {
final PsObject currentExecution = this.executionStack.peek();
@@ -328,10 +328,10 @@
* Processes a specific item.
* @param currentExecution The item to process.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
private void processItem(final PsObject currentExecution)
- throws PsOperatorException, PsException {
+ throws PsOperatorException, PsInterpreterException4a {
if (currentExecution instanceof PsFile) {
executePSFile((PsFile) currentExecution);
return;
@@ -371,13 +371,13 @@
this.executionStack.pop(PsOperator.INTERPRETER);
final boolean completed = this.getSystemDict().executeOperator(operator);
if (! completed) {
- throw new PsException(this, PsError.UNDEFINED, PsOperator.INTERPRETER,
+ throw new PsInterpreterException4a(this, PsError.UNDEFINED, PsOperator.INTERPRETER,
"Unsupported operator: " + operator.getName());
}
return;
}
/* Anything else is illegal. */
- throw new PsException(this, PsError.UNDEFINED, PsOperator.INTERPRETER,
+ throw new PsInterpreterException4a(this, PsError.UNDEFINED, PsOperator.INTERPRETER,
"Invalid item on execution stack: " + currentExecution.toString());
}
@@ -385,9 +385,9 @@
* Execute a PostScript file.
* @param file The file to execute.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For errors during execution.
+ * @throws PsInterpreterException4a For errors during execution.
*/
- private void executePSFile(final PsFile file) throws PsOperatorException, PsException {
+ private void executePSFile(final PsFile file) throws PsOperatorException, PsInterpreterException4a {
if (! file.isOpen()) {
this.executionStack.pop(PsOperator.INTERPRETER);
return;
@@ -409,10 +409,10 @@
* Execute a PostScript array.
* @param array The array to execute.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For errors during execution.
+ * @throws PsInterpreterException4a For errors during execution.
*/
private void executePSArray(final PsArrayExecuting array) throws PsOperatorException,
- PsException {
+ PsInterpreterException4a {
if (array.qtyUnexecutedItems() < 1) {
this.executionStack.pop(PsOperator.INTERPRETER);
return;
@@ -438,10 +438,10 @@
* Executes an array item.
* @param arrayItem The array item to execute.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
private void executePSArrayItem(final PsObject arrayItem) throws PsOperatorException,
- PsException {
+ PsInterpreterException4a {
if (arrayItem == null) {
this.executionStack.pop(PsOperator.INTERPRETER);
return;
@@ -484,9 +484,9 @@
* See PSLRM2 3.2.2, where such characters are listed as self-delimiting.
* @param inputByte The byte to be tested.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
- private void autoDelimitByte(final byte inputByte) throws PsOperatorException, PsException {
+ private void autoDelimitByte(final byte inputByte) throws PsOperatorException, PsInterpreterException4a {
if (this.inCommentLine) {
return;
}
@@ -529,9 +529,9 @@
* Consume one byte of PostScript input.
* @param inputByte The byte to be consumed.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
- private void consumeByte(final byte inputByte) throws PsOperatorException, PsException {
+ private void consumeByte(final byte inputByte) throws PsOperatorException, PsInterpreterException4a {
/*
* Uncomment the following line to have the input font sent to std out.
* This is useful for debugging filtered or encrypted PostScript input.
@@ -639,9 +639,9 @@
* Consumes a byte in a string.
* @param inputByte The byte to be consumed.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
- private void consumeByteInString(final byte inputByte) throws PsOperatorException, PsException {
+ private void consumeByteInString(final byte inputByte) throws PsOperatorException, PsInterpreterException4a {
switch (inputByte) {
case PsInterpreter.LEFT_PAREN:
this.qtyNestedParentheses ++;
@@ -689,9 +689,9 @@
/**
* Consume the current token.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
- private void consumeToken() throws PsOperatorException, PsException {
+ private void consumeToken() throws PsOperatorException, PsInterpreterException4a {
if (this.tokenBeingBuiltSize < 1) {
return;
}
@@ -725,9 +725,9 @@
* Process a given token.
* @param object The token to be processed.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
- private void processToken(final PsObject object) throws PsOperatorException, PsException {
+ private void processToken(final PsObject object) throws PsOperatorException, PsInterpreterException4a {
if (this.inProcedure) {
this.procedureBeingBuilt.add(object);
return;
@@ -749,9 +749,9 @@
* Process a name token.
* @param nameObject The name token to be processed.
* @throws PsOperatorException For errors executing operators.
- * @throws PsException For any PostScript error.
+ * @throws PsInterpreterException4a For any PostScript error.
*/
- private void processName(final PsName nameObject) throws PsOperatorException, PsException {
+ private void processName(final PsName nameObject) throws PsOperatorException, PsInterpreterException4a {
// If the name is not executable, just push it onto the stack.
if (! nameObject.isExecutable()) {
this.operandStack.push(nameObject);
@@ -766,7 +766,7 @@
doneExecuting = currentDict.execute(this, nameObject);
}
if (! doneExecuting) {
- throw new PsException(this, PsError.UNDEFINED, PsOperator.INTERPRETER,
+ throw new PsInterpreterException4a(this, PsError.UNDEFINED, PsOperator.INTERPRETER,
"PostScript name '" + nameObject.getValue() + "' not found.");
}
}
Copied: trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreterException4a.java (from rev 10764, trunk/foray/foray-ps/src/java/org/foray/ps/PsException.java)
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreterException4a.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreterException4a.java 2009-04-25 15:06:30 UTC (rev 10768)
@@ -0,0 +1,131 @@
+/*
+ * 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.ps;
+
+import org.axsl.ps.PsInterpreterException;
+
+/**
+ * Handles PostScript Exceptions.
+ */
+public class PsInterpreterException4a extends PsInterpreterException {
+
+ /** Constant needed for serialization. */
+ static final long serialVersionUID = 7211537297214545L;
+
+ /** The PostScript error code that triggered this Exception. */
+ private PsError errorCode;
+
+ /** The PostScript operator code that triggered this Exception. */
+ private PsOperator offendingOperator;
+
+ /** The input line number at which the Exception was noted. */
+ private int lineNumber;
+
+ /** The input column number at which the Exception was noted. */
+ private int columnNumber;
+
+ /** An image of the stack as it existed when the Exception was thrown.
+ * This image can be useful during debugging. */
+ private String operandStackImage;
+
+ /**
+ * Constructor.
+ * @param interpreter The PS interpreter.
+ * @param errorCode The PS error code for this exception.
+ * @param offendingOperator The PS operator that triggered the request
+ * that threw the exception.
+ * @param message The user message.
+ */
+ public PsInterpreterException4a(final PsInterpreter interpreter, final PsError errorCode,
+ final PsOperator offendingOperator, final String message) {
+ super(message);
+ if (errorCode == null) {
+ throw new NullPointerException("PostScript error code is required.");
+ }
+ this.lineNumber = interpreter.getCurrentLine();
+ this.columnNumber = interpreter.getCurrentColumn();
+ this.errorCode = errorCode;
+ this.offendingOperator = offendingOperator;
+ final StringBuilder buffer = new StringBuilder();
+ buffer.append("Operand Stack:\n");
+ final PsStack<PsObject> operandStack = interpreter.getOperandStack();
+ if (operandStack.size() == 0) {
+ buffer.append(" (empty)");
+ }
+ for (int i = 0; i < operandStack.size(); i++) {
+ final PsObject object = operandStack.peek(i);
+ buffer.append(" " + object.toString() + "\n");
+ }
+ this.operandStackImage = buffer.toString();
+ }
+
+ /**
+ * Constructor.
+ * @param interpreter The PS interpreter.
+ * @param errorCode The PS error code for this exception.
+ */
+ public PsInterpreterException4a(final PsInterpreter interpreter, final PsError errorCode) {
+ this(interpreter, errorCode, PsOperator.INVALID, null);
+ }
+
+ /**
+ * Constructor.
+ * @param interpreter The PS interpreter.
+ * @param errorCode The PS error code for this exception.
+ * @param offendingOperator The PS operator that triggered the request
+ * that threw the exception.
+ */
+ public PsInterpreterException4a(final PsInterpreter interpreter, final PsError errorCode,
+ final PsOperator offendingOperator) {
+ this(interpreter, errorCode, offendingOperator, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getMessage() {
+ final String detailMessage = super.getMessage();
+ final StringBuilder sb = new StringBuilder();
+ sb.append("PostScript error: ");
+ sb.append(this.errorCode.getName());
+ sb.append(" (operator: ");
+ sb.append(this.offendingOperator.getName());
+ sb.append(") ");
+ if (detailMessage != null) {
+ sb.append(" (");
+ sb.append(detailMessage);
+ sb.append(")");
+ }
+ sb.append("\n Line " + this.lineNumber + ", Column "
+ + this.columnNumber);
+ sb.append("\n" + this.operandStackImage);
+ return sb.toString();
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreterException4a.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsMatrix.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsMatrix.java 2009-04-25 00:00:15 UTC (rev 10767)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsMatrix.java 2009-04-25 15:06:30 UTC (rev 10768)
@@ -135,14 +135,14 @@
* @param matrix1 The first matrix.
* @param matrix2 The second matrix.
* @return The product matrix.
- * @throws PsException If either matrix1 or matrix2 are not exactly 6
+ * @throws PsInterpreterException4a If either matrix1 or matrix2 are not exactly 6
* elements long.
*/
public static PsMatrix concatMatrices(final PsInterpreter interpreter,
final PsMatrix matrix1, final PsMatrix matrix2)
- throws PsException {
+ throws PsInterpreterException4a {
if (matrix1.size() != PsUtil.MATRIX_QTY_ELEMENTS) {
- throw new PsException(interpreter, PsError.RANGECHECK);
+ throw new PsInterpreterException4a(interpreter, PsError.RANGECHECK);
}
// double[] productArray = new double[6];
/* TODO: Complete the matrix multiplication logic. For now, just
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsObjectComposite.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsObjectComposite.java 2009-04-25 00:00:15 UTC (rev 10767)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsObjectComposite.java 2009-04-25 15:06:30 UTC (rev 10768)
@@ -40,11 +40,11 @@
* Sets the access level for this object.
* @param interpreter The parent interpreter.
* @param accessLevel The new access level.
- * @throws PsException If a PostScript typecheck error is thrown because
+ * @throws PsInterpreterException4a If a PostScript typecheck error is thrown because
* the access level cannot be changed on this object.
*/
public void setAccess(final PsInterpreter interpreter, final PsAccess accessLevel)
- throws PsException {
+ throws PsInterpreterException4a {
if (accessLevel == null) {
throw new NullPointerException("Access level cannot be null on PostScript composite "
+ "object");
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsOperandStack.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsOperandStack.java 2009-04-25 00:00:15 UTC (rev 10767)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsOperandStack.java 2009-04-25 15:06:30 UTC (rev 10768)
@@ -71,14 +71,14 @@
* bottom of the stack.
* @param operatorCode The PS operator code requesting the roll.
* This is used in user messages.
- * @throws PsException For PS stackunderflow errors.
+ * @throws PsInterpreterException4a For PS stackunderflow errors.
*/
protected void roll(final int n, final int j, final PsOperator operatorCode)
- throws PsException {
+ throws PsInterpreterException4a {
final List<PsObject> list = this.getList();
if (list.size() < n) {
final PsInterpreter interpreter = this.getInterpreter();
- throw new PsException(interpreter, this.getUnderflowError(),
+ throw new PsInterpreterException4a(interpreter, this.getUnderflowError(),
operatorCode, "attempted to roll " + n
+ " additional operands, stack has only "
+ list.size() + ".");
@@ -138,14 +138,14 @@
* down to, but not including, the first mark object.
* @param operator The PostScript operator requesting the counttomark.
* This is used in user messages.
- * @throws PsException For PS unmatchedmark error.
+ * @throws PsInterpreterException4a For PS unmatchedmark error.
*/
- int countToMark(final PsOperator operator) throws PsException {
+ int countToMark(final PsOperator operator) throws PsInterpreterException4a {
final int markIndex = markIndex();
final List<PsObject> list = this.getList();
if (markIndex < 0) {
final PsInterpreter interpreter = this.getInterpreter();
- throw new PsException(interpreter, PsError.UNMATCHEDMARK, operator);
+ throw new PsInterpreterException4a(interpreter, PsError.UNMATCHEDMARK, operator);
}
return list.size() - 1 - markIndex;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-25 00:00:15 UTC (rev 10767)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-25 15:06:30 UTC (rev 10768)
@@ -171,7 +171,7 @@
final org.foray.ps.PsSystemDict foraySystemDict = (org.foray.ps.PsSystemDict) systemDict;
try {
return new PsInterpreter(psInput, foraySystemDict);
- } catch (final PsException e) {
+ } catch (final PsInterpreterException4a e) {
throw new org.axsl.ps.PsException(e.getMessage());
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java
===================================================================
---...
[truncated message content] |
|
From: <vic...@us...> - 2009-04-25 15:10:35
|
Revision: 10769
http://foray.svn.sourceforge.net/foray/?rev=10769&view=rev
Author: victormote
Date: 2009-04-25 15:10:30 +0000 (Sat, 25 Apr 2009)
Log Message:
-----------
Rename class for clarity.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsExecutionStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsFile.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsStateStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInteger.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreterException4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsMatrix.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsName.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsObjectComposite.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsOperandStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsReal.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsStack.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsSystemDict.java
trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/TestPsSystemDict.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter4a.java
Removed Paths:
-------------
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-25 15:06:30 UTC (rev 10768)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-25 15:10:30 UTC (rev 10769)
@@ -31,7 +31,7 @@
import org.foray.common.WKConstants;
import org.foray.ps.PsDictionary;
import org.foray.ps.PsInterpreterException4a;
-import org.foray.ps.PsInterpreter;
+import org.foray.ps.PsInterpreter4a;
import org.foray.ps.PsObject;
import org.foray.ps.filter.PSFilter;
import org.foray.ps.type1.PsFontDictionary;
@@ -134,9 +134,9 @@
return;
}
parseBasics();
- PsInterpreter interpreter = null;
+ PsInterpreter4a interpreter = null;
try {
- interpreter = new PsInterpreter(this, null);
+ interpreter = new PsInterpreter4a(this, null);
} catch (final PsInterpreterException4a e) {
getLogger().error(e.getMessage());
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2009-04-25 15:06:30 UTC (rev 10768)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionary.java 2009-04-25 15:10:30 UTC (rev 10769)
@@ -69,7 +69,7 @@
* @throws PsOperatorException For errors executing operators.
* @throws PsInterpreterException4a For any PostScript error.
*/
- protected boolean execute(final PsInterpreter interpreter, final PsName nameObject)
+ protected boolean execute(final PsInterpreter4a interpreter, final PsName nameObject)
throws PsOperatorException, PsInterpreterException4a {
final PsObject value = getItem(nameObject);
// If the item is not in this dictionary, exit
@@ -126,7 +126,7 @@
* @param value The value of the dictionary entry.
* @throws PsInterpreterException4a A typecheck error if the object is null.
*/
- public void addItem(final PsInterpreter interpreter, final PsObject key, final PsObject value)
+ public void addItem(final PsInterpreter4a interpreter, final PsObject key, final PsObject value)
throws PsInterpreterException4a {
// Per PLRM2, Sec 3.3.9, a key can be any PS object except null.
if (key instanceof PsNull) {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryStack.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryStack.java 2009-04-25 15:06:30 UTC (rev 10768)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsDictionaryStack.java 2009-04-25 15:10:30 UTC (rev 10769)
@@ -41,7 +41,7 @@
* Constructor.
* @param interpreter The parent interpreter.
*/
- PsDictionaryStack(final PsInterpreter interpreter) {
+ PsDictionaryStack(final PsInterpreter4a interpreter) {
super(interpreter, PsStack.DEFAULT_STACK_SIZE);
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsExecutionStack.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsExecutionStack.java 2009-04-25 15:06:30 UTC (rev 10768)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsExecutionStack.java 2009-04-25 15:10:30 UTC (rev 10769)
@@ -39,7 +39,7 @@
* Constructor.
* @param interpreter The parent interpreter.
*/
- PsExecutionStack(final PsInterpreter interpreter) {
+ PsExecutionStack(final PsInterpreter4a interpreter) {
super(interpreter, PsStack.DEFAULT_STACK_SIZE);
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsFile.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsFile.java 2009-04-25 15:06:30 UTC (rev 10768)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsFile.java 2009-04-25 15:10:30 UTC (rev 10769)
@@ -92,7 +92,7 @@
* @throws IOException For I/O Errors.
* @throws PsOperatorException For PostScript error closing the file.
*/
- protected byte provideInput(final PsInterpreter interpreter) throws IOException,
+ protected byte provideInput(final PsInterpreter4a interpreter) throws IOException,
PsOperatorException {
if (this.chunk == null
|| this.chunk.length == 0
@@ -122,7 +122,7 @@
* @param interpreter The parent interpreter.
* @throws PsOperatorException For error popping the dictionary stack.
*/
- protected void closeFile(final PsInterpreter interpreter) throws PsOperatorException {
+ protected void closeFile(final PsInterpreter4a interpreter) throws PsOperatorException {
this.fileIsOpen = false;
if (this.popDictionaryStack) {
interpreter.getDictionaryStack().pop(PsOperator.INVALID);
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsStateStack.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsStateStack.java 2009-04-25 15:06:30 UTC (rev 10768)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsGraphicsStateStack.java 2009-04-25 15:10:30 UTC (rev 10769)
@@ -37,7 +37,7 @@
* Constructor.
* @param interpreter The parent interpreter.
*/
- PsGraphicsStateStack(final PsInterpreter interpreter) {
+ PsGraphicsStateStack(final PsInterpreter4a interpreter) {
super(interpreter, PsStack.DEFAULT_STACK_SIZE);
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsInteger.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInteger.java 2009-04-25 15:06:30 UTC (rev 10768)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInteger.java 2009-04-25 15:10:30 UTC (rev 10769)
@@ -102,10 +102,10 @@
* a PSInteger instance.
* @return A PSInteger instance, if the input qualifies, otherwise, null.
*/
- public static PsInteger create(final PsInterpreter interpreter,
+ public static PsInteger create(final PsInterpreter4a interpreter,
final byte[] input) {
// First char must be a digit or a sign indicator
- if (!isNumeral(input[0]) && !isMember(PsInterpreter.SIGN_INDICATOR,
+ if (!isNumeral(input[0]) && !isMember(PsInterpreter4a.SIGN_INDICATOR,
input[0])) {
return parseRadixNumber(interpreter, input);
}
@@ -146,7 +146,7 @@
* a PSInteger instance.
* @return A PSInteger instance, if the input qualifies, otherwise, null.
*/
- private static PsInteger parseRadixNumber(final PsInterpreter interpreter,
+ private static PsInteger parseRadixNumber(final PsInterpreter4a interpreter,
final byte[] input) {
// Every char must be a digit, a letter, or a # sign
for (int i = 0; i < input.length; i++) {
Deleted: trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java 2009-04-25 15:06:30 UTC (rev 10768)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter.java 2009-04-25 15:10:30 UTC (rev 10769)
@@ -1,914 +0,0 @@
-/*
- * Copyright 2004-2005 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.ps;
-
-import org.foray.common.WKConstants;
-import org.foray.ps.encode.EncodingVector;
-import org.foray.ps.readonly.ReadOnlySystemDict;
-
-import org.axsl.ps.PsInput;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A generic PostScript interpreter.
- * This interpreter can be used in wide variety of different processing environments by creating
- * approprate subclasses of {@link PsSystemDict}.
- */
-public class PsInterpreter implements org.axsl.ps.PsInterpreter {
-
- /** The PostScript "null" character. */
- public static final byte NULL = 0x00;
-
- /** The PostScript "tab" character. */
- public static final byte TAB = 0x09;
-
- /** The PostScript "line-feed" character. */
- public static final byte LINE_FEED = 0x0a;
-
- /** The PostScript "form-feed" character. */
- public static final byte FORM_FEED = 0x0c;
-
- /** The PostScript "carriage-return" character. */
- public static final byte CARRIAGE_RETURN = 0x0d;
-
- /** The PostScript "space" character. */
- public static final byte SPACE = 0x20;
-
- /** The PostScript "left parentheses" character. */
- public static final byte LEFT_PAREN = 0x28;
-
- /** The PostScript "right parentheses" character. */
- public static final byte RIGHT_PAREN = 0x29;
-
- /** The PostScript "left angle" character. */
- public static final byte LEFT_ANGLE = 0x3c;
-
- /** The PostScript "right angle" character. */
- public static final byte RIGHT_ANGLE = 0x3e;
-
- /** The PostScript "left bracket" character. */
- public static final byte LEFT_BRACKET = 0x5b;
-
- /** The PostScript "right bracket" character. */
- public static final byte RIGHT_BRACKET = 0x5d;
-
- /** The PostScript "left curly" character. */
- public static final byte LEFT_CURLY = 0x7b;
-
- /** The PostScript "right curly" character. */
- public static final byte RIGHT_CURLY = 0x7d;
-
- /** The PostScript "slash" character. */
- public static final byte SLASH = 0x2f;
-
- /** The PostScript "percent" character. */
- public static final byte PERCENT = 0x25;
-
- /** The PostScript "plus" character. */
- public static final byte PLUS_SIGN = 0x2b;
-
- /** The PostScript "minus" character. */
- public static final byte MINUS_SIGN = 0x2d;
-
- /** The PostScript whitespace characters. */
- public static final byte[] WHITESPACE = {
- PsInterpreter.NULL,
- PsInterpreter.TAB,
- PsInterpreter.LINE_FEED,
- PsInterpreter.FORM_FEED,
- PsInterpreter.CARRIAGE_RETURN,
- PsInterpreter.SPACE,
- };
-
- /** The PostScript new-line possibilities. */
- public static final byte[] NEWLINE = {
- PsInterpreter.LINE_FEED,
- PsInterpreter.CARRIAGE_RETURN,
- };
-
- /** The PostScript delimiters. */
- public static final byte[] DELIMITER = {
- PsInterpreter.LEFT_PAREN,
- PsInterpreter.RIGHT_PAREN,
- PsInterpreter.LEFT_ANGLE,
- PsInterpreter.RIGHT_ANGLE,
- PsInterpreter.LEFT_BRACKET,
- PsInterpreter.RIGHT_BRACKET,
- PsInterpreter.LEFT_CURLY,
- PsInterpreter.RIGHT_CURLY,
- PsInterpreter.SLASH,
- PsInterpreter.PERCENT,
- };
-
- /** The PostScript sign indicators. */
- public static final byte[] SIGN_INDICATOR = {
- PsInterpreter.PLUS_SIGN,
- PsInterpreter.MINUS_SIGN,
- };
-
- /** The maximum PostScript array size. */
- public static final int MAX_ARRAY_SIZE = 65535;
-
- /** The PostScript operand stack. operandStack.size() - 1 is the "top" of
- * the stack. */
- private PsOperandStack operandStack = new PsOperandStack(this);
-
- /** The PostScript dictionary stack. */
- private PsDictionaryStack dictionaryStack = new PsDictionaryStack(this);
-
- /** The PostScript execution stack. */
- private PsExecutionStack executionStack = new PsExecutionStack(this);
-
- /** The PostScript graphics state stack. */
- private PsGraphicsStateStack graphicsStateStack = new PsGraphicsStateStack(this);
-
- /** The internal dictionary. */
- private PsDictionary internaldict = null;
-
- /** The current graphics state. */
- private PsGraphicsState currentGraphicsState = new PsGraphicsState();
-
- /**
- * Holds any partially-build token as it is being built. This also serves
- * to maintain state between chunks.
- */
- private byte[] tokenBeingBuilt =
- new byte[WKConstants.MAX_8_BIT_UNSIGNED_VALUES];
-
- /**
- * The portion of tokenBeingBuilt that is actually being used.
- */
- private short tokenBeingBuiltSize = 0;
-
- /** Counter of the number of tokens processes, useful in debugging. */
- private long tokenCount = 0;
-
- /** Reusable buffer for building Strings. */
- private StringBuilder stringBeingBuilt = new StringBuilder();
-
- /** The current nesting level for parentheses.
- * Zero indicates we are not inside parentheses.*/
- private short qtyNestedParentheses = 0;
-
- /**
- * The stack of procedureBeingBuilt items. The bottom of
- * the stack is at index 0, the top is at ....size() - 1. This is needed
- * because procedures can be nested as they are built. The current procedure
- * being built is in procedureBeingBuilt, which is pushed onto this stack
- * if a nested procedure is started.
- */
- private List<List<PsObject>> procedureStack
- = new ArrayList<List<PsObject>>();
-
- /**
- * This is the procedure that is currently being built. If a nested
- * procedure is encountered, procedureBeingBuilt is pushed onto the
- * procedureStack, and a new procedureBeingBuilt is started. It must always
- * be null when no procedure is being built.
- */
- private List<PsObject> procedureBeingBuilt = null;
-
- /** Indicates whether the parser is currently inside a string. */
- private boolean inString = false;
-
- /** Indicates whether the parser is currently inside a comment line. */
- private boolean inCommentLine = false;
-
- /** Indicates whether the parser is currently inside a procedure. */
- private boolean inProcedure = false;
-
- /** The PsFile representing "STDIN", the standard input. */
- private PsFile standardInput;
-
- /** Tracks the current line number being parsed. */
- private int currentLine = 1;
-
- /** Tracks the current column on the current line being parsed. */
- private int currentColumn = 1;
-
- /** The last byte read as per the counter logic. This is adjusted as soon
- * as the counter logic is updated, so it is probably not useful anywhere
- * else. */
- private byte lastByteParsed;
-
- /** See the setpacking and currentpacking operators for details of this
- * state variable. */
- private boolean packingMode;
-
- /**
- * Constructor for a PostScript interpreter.
- * @param input The PsInput instance that should be used as standard input
- * to the interpreter.
- * @param systemDict The dictionary that should be used.
- * @throws PsInterpreterException4a For invalid parameters.
- */
- public PsInterpreter(final PsInput input, final PsSystemDict systemDict) throws PsInterpreterException4a {
- if (input == null) {
- throw new NullPointerException("PostScript Error: No standard input.");
- }
- // Create the standard input file.
- this.standardInput = new PsFileReal(input);
- // Place it on the execution stack.
- this.executionStack.push(this.standardInput);
- // Get the System Dictionary.
- PsSystemDict systemDictToUse = systemDict;
- if (systemDictToUse == null) {
- systemDictToUse = new ReadOnlySystemDict();
- }
- // Register this as the parent of the System Dictionary
- systemDictToUse.setPSInterpreter(this);
- // Add the Standard Encoding to the System Dictionary.
- PsName name = new PsName("StandardEncoding", false, false);
- EncodingVector encoding = EncodingVector.getPredefinedEncoding(
- name.getValue());
- PsArray array = new PsArray(encoding.getGlyphList(),
- false);
- systemDictToUse.addItem(this, name, array);
- // Add the ISO Latin 1 Encoding to the System Dictionary.
- name = new PsName("ISOLatin1Encoding", false, false);
- encoding = EncodingVector.getPredefinedEncoding(name.getValue());
- array = new PsArray(encoding.getGlyphList(), false);
- systemDictToUse.addItem(this, name, array);
- // Add the System Dictionary to the dictionary stack.
- this.dictionaryStack.push(systemDictToUse);
- /*
- * Add "systemdict" as an entry in itself. See PLRM2, Section 8.2,
- * "systemdict" entry. It is not an operator, but is an element in the
- * systemdict dictionary.
- */
- name = new PsName("systemdict", false, false);
- systemDictToUse.addItem(this, name, systemDictToUse);
- // Create a Global Dictionary & push it on the dictionary Stack.
- PsDictionary newDict = new PsDictionary(0);
- this.dictionaryStack.push(newDict);
- /*
- * Add "globaldict" as an entry in systemdict. See PLRM2, Section 8.2,
- * "globaldict" entry. It is not an operator, but is an element in the
- * systemdict dictionary.
- */
- name = new PsName("globaldict", false, false);
- systemDictToUse.addItem(this, name, newDict);
- // Create a User Dictionary & push it on the dictionary Stack.
- newDict = new PsDictionary(0);
- this.dictionaryStack.push(newDict);
- /*
- * Add "userdict" as an entry in systemdict. See PLRM2, Section 8.2,
- * "userdict" entry. It is not an operator, but is an element in the
- * systemdict dictionary.
- */
- name = new PsName("userdict", false, false);
- systemDictToUse.addItem(this, name, newDict);
- /*
- * Create an "internaldict".
- * The need for this is inferred from the internaldict operator
- * documented at PLRM2, Section 8.2, and from examination of Type1
- * files that seem to expect it to exist.
- */
- newDict = new PsDictionary(0);
- this.internaldict = newDict;
- }
-
- /**
- * {@inheritDoc}
- */
- public void process() throws PsInterpreterException4a {
- while (this.executionStack.size() != 0) {
- final PsObject currentExecution = this.executionStack.peek();
- try {
- processItem(currentExecution);
- } catch (final PsOperatorException e) {
- throw new PsInterpreterException4a(this, e.getErrorCode(), e.getOffendingOperator());
- }
- }
- }
-
- /**
- * Processes the top item on the execution stack.
- * @throws PsOperatorException For errors executing operators.
- * @throws PsInterpreterException4a For any PostScript error.
- */
- public void processItem() throws PsOperatorException, PsInterpreterException4a {
- final int executionStackSize = this.executionStack.size();
- while (this.executionStack.size() >= executionStackSize) {
- final PsObject currentExecution = this.executionStack.peek();
- processItem(currentExecution);
- }
- }
-
- /**
- * Processes a specific item.
- * @param currentExecution The item to process.
- * @throws PsOperatorException For errors executing operators.
- * @throws PsInterpreterException4a For any PostScript error.
- */
- private void processItem(final PsObject currentExecution)
- throws PsOperatorException, PsInterpreterException4a {
- if (currentExecution instanceof PsFile) {
- executePSFile((PsFile) currentExecution);
- return;
- }
- if (currentExecution instanceof PsArrayExecuting
- && currentExecution.isExecutable()) {
- executePSArray((PsArrayExecuting) currentExecution);
- return;
- }
- if (currentExecution instanceof PsArray
- && currentExecution.isExecutable()) {
- final PsArrayExecuting executingArray = new PsArrayExecuting((PsArray) currentExecution);
- executePSArray(executingArray);
- return;
- }
- if (currentExecution instanceof PsName) {
- this.executionStack.pop(PsOperator.INTERPRETER);
- processName((PsName) currentExecution);
- return;
- }
- if (currentExecution instanceof PsString) {
- this.executionStack.pop(PsOperator.INTERPRETER);
- final PsString psString = (PsString) currentExecution;
- /* If the name is not executable, ignore it. */
- if (! psString.isExecutable()) {
- /* TODO: Throw an exception here? */
- return;
- }
- /* Otherwise, execute it. */
- final PsStringInput stringInput = new PsStringInput(psString.getValue());
- final PsFileReal inputFile = new PsFileReal(stringInput);
- this.executionStack.push(inputFile);
- return;
- }
- if (currentExecution instanceof PsOperator) {
- final PsOperator operator = (PsOperator) currentExecution;
- this.executionStack.pop(PsOperator.INTERPRETER);
- final boolean completed = this.getSystemDict().executeOperator(operator);
- if (! completed) {
- throw new PsInterpreterException4a(this, PsError.UNDEFINED, PsOperator.INTERPRETER,
- "Unsupported operator: " + operator.getName());
- }
- return;
- }
- /* Anything else is illegal. */
- throw new PsInterpreterException4a(this, PsError.UNDEFINED, PsOperator.INTERPRETER,
- "Invalid item on execution stack: " + currentExecution.toString());
- }
-
- /**
- * Execute a PostScript file.
- * @param file The file to execute.
- * @throws PsOperatorException For errors executing operators.
- * @throws PsInterpreterException4a For errors during execution.
- */
- private void executePSFile(final PsFile file) throws PsOperatorException, PsInterpreterException4a {
- if (! file.isOpen()) {
- this.executionStack.pop(PsOperator.INTERPRETER);
- return;
- }
- byte byteToConsume = 0;
- try {
- byteToConsume = file.provideInput(this);
- } catch (final IOException e) {
- file.closeFile(this);
- return;
- }
- adjustCounters(byteToConsume);
- autoDelimitByte(byteToConsume);
- consumeByte(byteToConsume);
- return;
- }
-
- /**
- * Execute a PostScript array.
- * @param array The array to execute.
- * @throws PsOperatorException For errors executing operators.
- * @throws PsInterpreterException4a For errors during execution.
- */
- private void executePSArray(final PsArrayExecuting array) throws PsOperatorException,
- PsInterpreterException4a {
- if (array.qtyUnexecutedItems() < 1) {
- this.executionStack.pop(PsOperator.INTERPRETER);
- return;
- }
- PsObject object = null;
- /*
- * See PSLRM2 Section 3.5.5, bullet 1, where the procedure below
- * is outlined. When the last item in the array is reached,
- * pop the array from the execution stack and place the last item
- * from the array on the execution stack.
- */
- if (array.qtyUnexecutedItems() == 1) {
- object = array.getNextProcedureItem();
- this.executionStack.pop(PsOperator.INTERPRETER);
- } else {
- object = array.getNextProcedureItem();
- }
- executePSArrayItem(object);
- return;
- }
-
- /**
- * Executes an array item.
- * @param arrayItem The array item to execute.
- * @throws PsOperatorException For errors executing operators.
- * @throws PsInterpreterException4a For any PostScript error.
- */
- private void executePSArrayItem(final PsObject arrayItem) throws PsOperatorException,
- PsInterpreterException4a {
- if (arrayItem == null) {
- this.executionStack.pop(PsOperator.INTERPRETER);
- return;
- }
- if (arrayItem instanceof PsArray) {
- this.operandStack.push(arrayItem);
- return;
- }
- processToken(arrayItem);
- }
-
- /**
- * Adjusts the line and column counters.
- * @param inputByte The input byte to be tested.
- */
- private void adjustCounters(final byte inputByte) {
- switch (inputByte) {
- case PsInterpreter.CARRIAGE_RETURN: {
- this.currentLine ++;
- this.currentColumn = 1;
- break;
- }
- case PsInterpreter.LINE_FEED: {
- if (this.lastByteParsed != PsInterpreter.CARRIAGE_RETURN) {
- this.currentLine ++;
- this.currentColumn = 1;
- }
- break;
- }
- default: {
- this.currentColumn ++;
- }
- }
- this.lastByteParsed = inputByte;
- }
-
- /**
- * Provides a pre-consumption pass at the byte to allow any open tokens
- * to be processed normally when a self-delimiting character is found.
- * See PSLRM2 3.2.2, where such characters are listed as self-delimiting.
- * @param inputByte The byte to be tested.
- * @throws PsOperatorException For errors executing operators.
- * @throws PsInterpreterException4a For any PostScript error.
- */
- private void autoDelimitByte(final byte inputByte) throws PsOperatorException, PsInterpreterException4a {
- if (this.inCommentLine) {
- return;
- }
- if (this.inString) {
- return;
- }
- switch (inputByte) {
- case PsInterpreter.LEFT_PAREN:
- case PsInterpreter.RIGHT_PAREN: // RIGHT_PAREN should never happen
- case PsInterpreter.LEFT_ANGLE:
- case PsInterpreter.RIGHT_ANGLE:
- case PsInterpreter.LEFT_BRACKET:
- case PsInterpreter.RIGHT_BRACKET:
- case PsInterpreter.LEFT_CURLY:
- case PsInterpreter.RIGHT_CURLY:
- case PsInterpreter.SLASH:
- case PsInterpreter.PERCENT:
- final int oldExecutionStackSize = this.executionStack.size();
- consumeToken();
- final int newExecutionStackSize = this.executionStack.size();
- /*
- * If the execution stack size increased as a result of the
- * consumeToken(), we need to
- */
- if (newExecutionStackSize > oldExecutionStackSize) {
- assert newExecutionStackSize == oldExecutionStackSize + 1 :
- "More than 1 item added to Execution Stack.";
- final PsObject currentExecution = this.executionStack.peek();
- // Warning: This is recursive. We are already inside this.
- processItem(currentExecution);
- }
- break;
- default: {
- break;
- }
- }
- }
-
- /**
- * Consume one byte of PostScript input.
- * @param inputByte The byte to be consumed.
- * @throws PsOperatorException For errors executing operators.
- * @throws PsInterpreterException4a For any PostScript error.
- */
- private void consumeByte(final byte inputByte) throws PsOperatorException, PsInterpreterException4a {
- /*
- * Uncomment the following line to have the input font sent to std out.
- * This is useful for debugging filtered or encrypted PostScript input.
- */
-// System.out.print((char) inputByte);
- if (this.inCommentLine) {
- consumeByteInCommentLine(inputByte);
- return;
- }
- if (this.inString) {
- consumeByteInString(inputByte);
- return;
- }
- switch (inputByte) {
- case PsInterpreter.PERCENT:
- this.inCommentLine = true;
- break;...
[truncated message content] |
|
From: <vic...@us...> - 2009-04-25 15:36:01
|
Revision: 10773
http://foray.svn.sourceforge.net/foray/?rev=10773&view=rev
Author: victormote
Date: 2009-04-25 15:36:00 +0000 (Sat, 25 Apr 2009)
Log Message:
-----------
Wrap a PsServer inside the FontServer so that the font system has access to the PS features.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java
trunk/foray/foray-font/src/java/org/foray/font/FontServer4a.java
trunk/foray/foray-font/src/javatest/org/foray/font/TestFontServer4a.java
Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2009-04-25 15:23:18 UTC (rev 10772)
+++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2009-04-25 15:36:00 UTC (rev 10773)
@@ -38,6 +38,7 @@
import org.foray.fotree.FoTreeServer4a;
import org.foray.graphic.GraphicServer4a;
import org.foray.pioneer.PioneerFactory;
+import org.foray.ps.PsServer4a;
import org.foray.speech.SpeechServer4a;
import org.axsl.area.AreaTreeFactory;
@@ -47,6 +48,7 @@
import org.axsl.graphic.GraphicServer;
import org.axsl.hyphen.HyphenationServer;
import org.axsl.layout.LayoutFactory;
+import org.axsl.ps.PsServer;
import org.axsl.speech.SpeechServer;
import org.axsl.text.TextServer;
@@ -134,7 +136,8 @@
public static FontServer makeFontServer(final Log logger,
final SessionConfig configuration) throws FOrayException {
final EntityResolver entityResolver = makeEntityResolver(configuration);
- final FontServer4a forayFontServer = new FontServer4a(logger);
+ final PsServer psServer = FOraySpecific.makePsServer();
+ final FontServer4a forayFontServer = new FontServer4a(logger, psServer);
forayFontServer.setBaseFontURL(
configuration.optionFontBaseDirectory());
forayFontServer.setBaseURL(configuration.optionBaseDirectory());
@@ -258,6 +261,14 @@
}
/**
+ * Make a standard PsServer instance for use in FOray.
+ * @return The newly-created PsServer instance.
+ */
+ public static PsServer makePsServer() {
+ return new PsServer4a();
+ }
+
+ /**
* Create a standard entity resolver for use with FOray.
* @param configuration The session configuration.
* @return The newly-created entity resolver, or null if no XML catalog
Modified: trunk/foray/foray-font/src/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FontServer4a.java 2009-04-25 15:23:18 UTC (rev 10772)
+++ trunk/foray/foray-font/src/java/org/foray/font/FontServer4a.java 2009-04-25 15:36:00 UTC (rev 10773)
@@ -40,6 +40,7 @@
import org.axsl.font.FontServer;
import org.axsl.font.output.FontOutput;
import org.axsl.ps.Encoding;
+import org.axsl.ps.PsServer;
import org.apache.commons.logging.Log;
@@ -155,6 +156,9 @@
private Map<String, FontSelectorFactory> registeredFontSelectorFactories
= new HashMap<String, FontSelectorFactory>();
+ /** The PostScript server. */
+ private PsServer psServer;
+
/**
* Constructor.
* @param logger The Logger to be used for system-level messages. Please
@@ -163,9 +167,11 @@
* system-level messages can be logged to the FontServer logger, and
* messages that are more client-related can be logged to the FontConsumer
* logger.
+ * @param psServer The PostScript server.
*/
- public FontServer4a(final Log logger) {
+ public FontServer4a(final Log logger, final PsServer psServer) {
this.logger = logger;
+ this.psServer = psServer;
try {
registerStandardOutputFactories();
} catch (final FontException e) {
@@ -1260,4 +1266,12 @@
return this.fontFamilies.values();
}
+ /**
+ * Returns the PostScript server.
+ * @return The PostScript server.
+ */
+ public PsServer getPsServer() {
+ return this.psServer;
+ }
+
}
Modified: trunk/foray/foray-font/src/javatest/org/foray/font/TestFontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/javatest/org/foray/font/TestFontServer4a.java 2009-04-25 15:23:18 UTC (rev 10772)
+++ trunk/foray/foray-font/src/javatest/org/foray/font/TestFontServer4a.java 2009-04-25 15:36:00 UTC (rev 10773)
@@ -31,8 +31,10 @@
import org.foray.common.Environment;
import org.foray.common.Logging;
import org.foray.common.url.URLFactory;
+import org.foray.ps.PsServer4a;
import org.axsl.font.FontException;
+import org.axsl.ps.PsServer;
import org.apache.commons.logging.Log;
@@ -58,7 +60,8 @@
public static FontServer4a getServer() throws FontException {
if (TestFontServer4a.fontServer == null) {
final Log logger = Logging.makeDefaultLogger();
- final FontServer4a fontServer = new FontServer4a(logger);
+ final PsServer psServer = new PsServer4a();
+ final FontServer4a fontServer = new FontServer4a(logger, psServer);
fontServer.setup(null, null);
TestFontServer4a.fontServer = fontServer;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-25 16:52:06
|
Revision: 10778
http://foray.svn.sourceforge.net/foray/?rev=10778&view=rev
Author: victormote
Date: 2009-04-25 16:52:02 +0000 (Sat, 25 Apr 2009)
Log Message:
-----------
Rename implementation classes for clarity.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
trunk/foray/foray-font/src/java/org/foray/font/ConsumerFont4a.java
trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java
trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java
trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingStandard.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingWinAnsi.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector4a.java
Removed Paths:
-------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -32,7 +32,7 @@
import org.foray.common.url.URLFactory;
import org.foray.ps.encode.EncodingCustom;
import org.foray.ps.encode.EncodingParser;
-import org.foray.ps.encode.EncodingVector;
+import org.foray.ps.encode.EncodingVector4a;
import org.foray.ps.encode.GlyphList;
import org.foray.ps.encode.GlyphListParser;
@@ -455,9 +455,9 @@
/* Inherit the value from font-family. */
encodingName = this.currentEncoding;
}
- EncodingVector encoding = null;
+ EncodingVector4a encoding = null;
if (encodingName != null) {
- encoding = EncodingVector.getPredefinedEncoding(encodingName);
+ encoding = EncodingVector4a.getPredefinedEncoding(encodingName);
}
final String[] simulateStretch
= new String[RegisteredFontDesc.QTY_SIMULATED_STRETCH];
@@ -719,7 +719,7 @@
logError("Attribute \"name\" required for element \"encoding\".");
return;
}
- EncodingVector encoding = EncodingVector.getPredefinedEncoding(name);
+ EncodingVector4a encoding = EncodingVector4a.getPredefinedEncoding(name);
if (encoding != null) {
logError("Encoding already defined: " + name);
return;
@@ -772,7 +772,7 @@
encoding = new EncodingCustom(name, parser.getGlyphListsToCheck(),
parser.getCodePoints(),
parser.getCodePointIndexes());
- EncodingVector.registerEncoding(name, encoding);
+ EncodingVector4a.registerEncoding(name, encoding);
}
/**
@@ -952,7 +952,7 @@
private final class FontFamilyMember {
/** The encoding for this instance. */
- private final EncodingVector encoding;
+ private final EncodingVector4a encoding;
/** The style for this instance. */
private final String style;
@@ -994,7 +994,7 @@
* @param simulateStretch he "simulate-stretch" value for this instance.
*/
private FontFamilyMember(
- final EncodingVector encoding,
+ final EncodingVector4a encoding,
final String style,
final String weight,
final String variant,
Modified: trunk/foray/foray-font/src/java/org/foray/font/ConsumerFont4a.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/ConsumerFont4a.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-font/src/java/org/foray/font/ConsumerFont4a.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -30,7 +30,7 @@
import org.foray.ps.encode.EncodingStandard;
import org.foray.ps.encode.EncodingSymbol;
-import org.foray.ps.encode.EncodingVector;
+import org.foray.ps.encode.EncodingVector4a;
import org.foray.ps.encode.EncodingZapfDingbats;
import org.axsl.ps.Encoding;
@@ -275,7 +275,7 @@
private Encoding getBestEncoding(final int codePoint) {
Encoding trialEncoding = null;
final Encoding internalEncoding = this.font.getInternalEncoding();
- if (! (internalEncoding instanceof EncodingVector)) {
+ if (! (internalEncoding instanceof EncodingVector4a)) {
/* CMap encodings should be able to handle any character in the
* font's character set. */
return internalEncoding;
@@ -287,18 +287,18 @@
}
if (internalEncoding instanceof EncodingStandard) {
/* Try WinAnsiEncoding. */
- trialEncoding = EncodingVector.getPredefinedEncoding(
+ trialEncoding = EncodingVector4a.getPredefinedEncoding(
"WinAnsiEncoding");
if (trialEncoding.canEncode(codePoint)) {
return trialEncoding;
}
/* Try the Central European encoding. */
- trialEncoding = EncodingVector.getPredefinedEncoding("CEEncoding");
+ trialEncoding = EncodingVector4a.getPredefinedEncoding("CEEncoding");
if (trialEncoding.canEncode(codePoint)) {
return trialEncoding;
}
/* Try the FOray catch-all encoding. */
- trialEncoding = EncodingVector.getPredefinedEncoding(
+ trialEncoding = EncodingVector4a.getPredefinedEncoding(
"FOrayLatinExtraEncoding");
if (trialEncoding.canEncode(codePoint)) {
return trialEncoding;
Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -36,7 +36,7 @@
import org.foray.font.format.Type1File;
import org.foray.font.format.Type1PFAFile;
import org.foray.font.format.Type1PFBFile;
-import org.foray.ps.encode.EncodingVector;
+import org.foray.ps.encode.EncodingVector4a;
import org.axsl.font.Font;
import org.axsl.font.FontException;
@@ -135,14 +135,14 @@
/* If not already set, set the Encoding. */
if (this.getInternalEncoding() == null) {
final String encodingName = this.metricsFile.getEncoding();
- EncodingVector encoding = null;
+ EncodingVector4a encoding = null;
if (encodingName.equals("StandardEncoding")
|| encodingName.equals("AdobeStandardEncoding")) {
- encoding = EncodingVector.getPredefinedEncoding(
+ encoding = EncodingVector4a.getPredefinedEncoding(
"WinAnsiEncoding");
}
if (getRegisteredFont().getConfiguredFontName().equals("Symbol")) {
- encoding = EncodingVector.getPredefinedEncoding("Symbol");
+ encoding = EncodingVector4a.getPredefinedEncoding("Symbol");
}
this.setInternalEncoding(encoding);
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -32,7 +32,7 @@
import org.foray.font.charset.CharSet;
import org.foray.font.output.FontPdf4a;
import org.foray.ps.encode.EncodingCustom;
-import org.foray.ps.encode.EncodingVector;
+import org.foray.ps.encode.EncodingVector4a;
import org.foray.ps.encode.GlyphList;
import org.axsl.font.Font;
@@ -640,7 +640,7 @@
* first character is at index 5, an index that is not included in the
* EncodingScheme listed, "AdobeStandardEncoding".</p>
*/
- private EncodingVector internalEncoding;
+ private EncodingVector4a internalEncoding;
/** The characters set used by this font. */
private CharSet charSet;
@@ -1616,7 +1616,7 @@
* encoding instance, using standard encodings if possible.
* @return The internal encoding for this font.
*/
- protected EncodingVector findInternalEncoding() {
+ protected EncodingVector4a findInternalEncoding() {
// Truncate the arrays to the right size.
if (this.internalCodePointCount < MetricsFileAFM.MAX_CODE_POINTS) {
char[] newArray = new char[this.internalCodePointCount];
@@ -1629,29 +1629,29 @@
this.internalCodePointIndexes = newArray;
}
// Make the arrays suitable for use in Encoding by sorting them
- EncodingVector.sortCodePoints(this.internalCodePoints,
+ EncodingVector4a.sortCodePoints(this.internalCodePoints,
this.internalCodePointIndexes);
/* Create a tentative EncodingVector instance. */
- final EncodingVector newEncoding = new EncodingCustom("internal-"
+ final EncodingVector4a newEncoding = new EncodingCustom("internal-"
+ this.getPostscriptName(), null, this.internalCodePoints,
this.internalCodePointIndexes);
/* Is this a predefined encoding? */
- EncodingVector predefinedEncoding = null;
+ EncodingVector4a predefinedEncoding = null;
if (this.getPostscriptName().equals("ZapfDingbats")) {
- predefinedEncoding = EncodingVector.getPredefinedEncoding(
+ predefinedEncoding = EncodingVector4a.getPredefinedEncoding(
"ZapfDingbatsEncoding");
if (newEncoding.isSubsetOf(predefinedEncoding)) {
return predefinedEncoding;
}
}
if (this.getPostscriptName().equals("Symbol")) {
- predefinedEncoding = EncodingVector.getPredefinedEncoding(
+ predefinedEncoding = EncodingVector4a.getPredefinedEncoding(
"SymbolEncoding");
if (newEncoding.isSubsetOf(predefinedEncoding)) {
return predefinedEncoding;
}
}
- predefinedEncoding = EncodingVector.getPredefinedEncoding(
+ predefinedEncoding = EncodingVector4a.getPredefinedEncoding(
this.encodingScheme);
if (newEncoding.isSubsetOf(predefinedEncoding)) {
return predefinedEncoding;
@@ -1662,7 +1662,7 @@
/**
* {@inheritDoc}
*/
- public EncodingVector getInternalEncoding() {
+ public EncodingVector4a getInternalEncoding() {
return this.internalEncoding;
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -32,7 +32,7 @@
import org.foray.common.WKConstants;
import org.foray.font.charset.CharSet;
import org.foray.font.output.FontPdf4a;
-import org.foray.ps.encode.EncodingVector;
+import org.foray.ps.encode.EncodingVector4a;
import org.axsl.ps.BoundingBox;
@@ -297,7 +297,7 @@
* @throws IOException For I/O Error.
*/
private void loadKernPairs() throws IOException {
- final EncodingVector encoding = this.getInternalEncoding();
+ final EncodingVector4a encoding = this.getInternalEncoding();
final int qtyPairs = getReader().readUnsignedShortLoHi();
if (this.getKerning() == null) {
@@ -383,7 +383,7 @@
* @throws IOException For I/O Error.
*/
private void loadExtentTable() throws IOException {
- final EncodingVector internalEncoding = this.getInternalEncoding();
+ final EncodingVector4a internalEncoding = this.getInternalEncoding();
if (internalEncoding == null) {
return;
}
@@ -450,10 +450,10 @@
/**
* {@inheritDoc}
*/
- public EncodingVector getInternalEncoding() {
+ public EncodingVector4a getInternalEncoding() {
switch (this.getCharSetID()) {
case 0:
- return EncodingVector.getPredefinedEncoding("WinAnsiEncoding");
+ return EncodingVector4a.getPredefinedEncoding("WinAnsiEncoding");
default:
return null;
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -29,7 +29,7 @@
package org.foray.font.format;
import org.foray.common.RandomReader;
-import org.foray.ps.encode.EncodingVector;
+import org.foray.ps.encode.EncodingVector4a;
import java.io.IOException;
@@ -208,8 +208,8 @@
* @return The PostScript name for <code>glyphIndex</code>.
*/
public String getPostScriptName(final char glyphIndex) {
- final EncodingVector macOrdering = EncodingVector.getPredefinedEncoding(
- EncodingVector.STANDARD_MACINTOSH_ORDERING);
+ final EncodingVector4a macOrdering = EncodingVector4a.getPredefinedEncoding(
+ EncodingVector4a.STANDARD_MACINTOSH_ORDERING);
int codePoint;
switch (this.postFormat) {
case TTFTablePOST.PS_FORMAT_1:
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter4a.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter4a.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -29,7 +29,7 @@
package org.foray.ps;
import org.foray.common.WKConstants;
-import org.foray.ps.encode.EncodingVector;
+import org.foray.ps.encode.EncodingVector4a;
import org.foray.ps.readonly.ReadOnlySystemDict;
import org.axsl.ps.PsInput;
@@ -248,14 +248,14 @@
systemDictToUse.setPSInterpreter(this);
// Add the Standard Encoding to the System Dictionary.
PsName name = new PsName("StandardEncoding", false, false);
- EncodingVector encoding = EncodingVector.getPredefinedEncoding(
+ EncodingVector4a encoding = EncodingVector4a.getPredefinedEncoding(
name.getValue());
PsArray array = new PsArray(encoding.getGlyphList(),
false);
systemDictToUse.addItem(this, name, array);
// Add the ISO Latin 1 Encoding to the System Dictionary.
name = new PsName("ISOLatin1Encoding", false, false);
- encoding = EncodingVector.getPredefinedEncoding(name.getValue());
+ encoding = EncodingVector4a.getPredefinedEncoding(name.getValue());
array = new PsArray(encoding.getGlyphList(), false);
systemDictToUse.addItem(this, name, array);
// Add the System Dictionary to the dictionary stack.
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -181,7 +181,7 @@
* {@inheritDoc}
*/
public EncodingVector getPredefinedEncoding(final String name) {
- return org.foray.ps.encode.EncodingVector.getPredefinedEncoding(name);
+ return org.foray.ps.encode.EncodingVector4a.getPredefinedEncoding(name);
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -31,7 +31,7 @@
/**
* Abstract superclass for all CMap Tables.
*/
-public abstract class CMap extends Encoding {
+public abstract class CMap extends Encoding4a {
/** Constant needed for serialization. */
private static final long serialVersionUID = -6516855352094857929L;
Deleted: trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -1,79 +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.ps.encode;
-
-import java.io.Serializable;
-
-/**
- * <p>Abstract superclass for all classes that manage the process of mapping
- * character codes to array indexes.
- * Such mapping is usually used for indexes into glyph description arrays in
- * fonts.</p>
- *
- * <p>Note that this definition of <em>Encoding </em>is a superset of the
- * PostScript and PDF concept of the same name.
- * That concept is encapsulated in the class {@link EncodingVector}, and is
- * usually used to address arrays containing no more than 256 elements, that is,
- * arrays addressable by a single byte index.
- * The concept of <em>Encoding </em> as used in this class also encompasses
- * other schemes for mapping character codes to array indexes, such as CMAP
- * tables found in TrueType fonts.</p>
- */
-public abstract class Encoding implements org.axsl.ps.Encoding, Serializable {
-
- /** Constant needed for serialization. */
- private static final long serialVersionUID = -745565802070157893L;
-
- /**
- * {@inheritDoc}
- */
- public abstract String asPostScript(org.axsl.ps.Encoding baseEncoding);
-
- /**
- * {@inheritDoc}
- */
- public boolean isPredefinedPs() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isPredefinedPdf() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean canEncode(final int codePoint) {
- return this.encodeCharacter(codePoint) != 0;
- }
-
-}
Copied: trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding4a.java (from rev 10669, trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java)
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding4a.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding4a.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -0,0 +1,79 @@
+/*
+ * 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.ps.encode;
+
+import java.io.Serializable;
+
+/**
+ * <p>Abstract superclass for all classes that manage the process of mapping
+ * character codes to array indexes.
+ * Such mapping is usually used for indexes into glyph description arrays in
+ * fonts.</p>
+ *
+ * <p>Note that this definition of <em>Encoding </em>is a superset of the
+ * PostScript and PDF concept of the same name.
+ * That concept is encapsulated in the class {@link EncodingVector4a}, and is
+ * usually used to address arrays containing no more than 256 elements, that is,
+ * arrays addressable by a single byte index.
+ * The concept of <em>Encoding </em> as used in this class also encompasses
+ * other schemes for mapping character codes to array indexes, such as CMAP
+ * tables found in TrueType fonts.</p>
+ */
+public abstract class Encoding4a implements org.axsl.ps.Encoding, Serializable {
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -745565802070157893L;
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract String asPostScript(org.axsl.ps.Encoding baseEncoding);
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isPredefinedPs() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isPredefinedPdf() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canEncode(final int codePoint) {
+ return this.encodeCharacter(codePoint) != 0;
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding4a.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -46,7 +46,7 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingCE extends EncodingVector implements Serializable {
+public final class EncodingCE extends EncodingVector4a implements Serializable {
/** Constant needed for serialization. */
public static final long serialVersionUID = 233004851494403242L;
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -32,7 +32,7 @@
* An encoding that is not one of the predefined encodings, usually parsed from
* a Type 1 Font.
*/
-public class EncodingCustom extends EncodingVector {
+public class EncodingCustom extends EncodingVector4a {
/** Constant needed for serialization. */
public static final long serialVersionUID = 215757843764870865L;
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -45,7 +45,7 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingExpert extends EncodingVector
+public final class EncodingExpert extends EncodingVector4a
implements Serializable {
/** Constant needed for serialization. */
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -45,7 +45,7 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingExpertSubset extends EncodingVector
+public final class EncodingExpertSubset extends EncodingVector4a
implements Serializable {
/** Constant needed for serialization. */
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -51,7 +51,7 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingFOrayLatinExtra extends EncodingVector
+public final class EncodingFOrayLatinExtra extends EncodingVector4a
implements Serializable {
/** Constant needed for serialization. */
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -44,7 +44,7 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingISOLatin1 extends EncodingVector
+public final class EncodingISOLatin1 extends EncodingVector4a
implements Serializable {
/** Constant needed for serialization. */
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -45,7 +45,7 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingMacExpert extends EncodingVector
+public final class EncodingMacExpert extends EncodingVector4a
implements Serializable {
/** Constant needed for serialization. */
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -45,7 +45,7 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingMacRoman extends EncodingVector
+public final class EncodingMacRoman extends EncodingVector4a
implements Serializable {
/** Constant needed for serialization. */
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java 2009-04-25 16:39:22 UTC (rev 10777)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java 2009-04-25 16:52:02 UTC (rev 10778)
@@ -51,7 +51,7 @@
* <p>Note that the glyphs named ".null" and "nonmarkingreturn" do not map
* to Unicode code points.</p>
*/
-public final class EncodingMacStandard extends EncodingVector
+public final class EncodingMacStandard extends EncodingVector4a
implements Serializable {
/** Constant needed for serialization. */
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java
====================================...
[truncated message content] |
|
From: <vic...@us...> - 2009-04-25 23:21:12
|
Revision: 10779
http://foray.svn.sourceforge.net/foray/?rev=10779&view=rev
Author: victormote
Date: 2009-04-25 23:20:57 +0000 (Sat, 25 Apr 2009)
Log Message:
-----------
1. Add Apache Commons Discovery to library.
2. Use it to create a zero-parameters constructor for FontServer4a.
Modified Paths:
--------------
trunk/foray/foray-font/.classpath
trunk/foray/foray-font/src/java/org/foray/font/FontServer4a.java
Added Paths:
-----------
trunk/foray/lib/commons-discovery-0.4.jar
trunk/foray/lib/commons-discovery-0.4.license.txt
trunk/foray/lib-build/commons-discovery/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/LICENSE.txt
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/NOTICE.txt
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/RELEASE-NOTES.txt
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/build.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/checkstyle.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/lib/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/lib/README.txt
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/maven.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/project.properties
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/project.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/conf/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/conf/MANIFEST.MF
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/conf/README.txt
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/DiscoveryException.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/Resource.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/ResourceClass.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/ResourceClassDiscover.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/ResourceClassIterator.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/ResourceDiscover.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/ResourceIterator.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/ResourceNameDiscover.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/ResourceNameIterator.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/ant/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/ant/ServiceDiscoveryTask.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/jdk/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/jdk/JDKHooks.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/jdk/PsuedoSystemClassLoader.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/log/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/log/DiscoveryLogFactory.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/log/SimpleLog.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/package.html
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/DiscoverResources.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/ResourceDiscoverImpl.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/classes/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.jav100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/classes/ResourceClassDiscov100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/DiscoverMappedNames.j100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInAltern100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInDictio100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInFile.j100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInManage100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/DiscoverNamesInSystem100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/DiscoverServiceNames.100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/NameDiscoverers.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/resource/names/ResourceNameDiscoverI100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/ClassUtils.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/DefaultClassHolder.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/DiscoverClass.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/DiscoverSingleton.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/EnvironmentCache.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/PropertiesHolder.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/ResourceUtils.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/SPInterface.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/java/org/apache/commons/discovery/tools/Service.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/media/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/media/logo.xcf
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/META-INF/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/META-INF/services/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/META-INF/services/org.apache.commons.discovery.test.TestInterface100644
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/test/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/test/TestAll.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/test/TestImpl1_1.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/test/TestImpl1_2.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/test/TestImpl2_1.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/test/TestImpl2_2.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/test/TestInterface.properties
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/test/TestInterface1.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/org/apache/commons/discovery/test/TestInterface2.java
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/test/testResource
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/testAlt1/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/testAlt1/testResource
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/testAlt2/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/src/testAlt2/testResource
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/adc-guidelines.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/best-practices.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/building.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/cvs-usage.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/images/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/images/logo.png
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/index.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/issue-tracking.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/navigation.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/proposal.xml
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/style/
trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/xdocs/style/project.css
Modified: trunk/foray/foray-font/.classpath
===================================================================
--- trunk/foray/foray-font/.classpath 2009-04-25 16:52:02 UTC (rev 10778)
+++ trunk/foray/foray-font/.classpath 2009-04-25 23:20:57 UTC (rev 10779)
@@ -15,5 +15,6 @@
<classpathentry kind="lib" path="/FOray Lib-Build/ant/ant.jar"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit-4.4.jar" sourcepath="/FOray Lib-Build/junit/junit-4.4-src.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.4.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.4-sources.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-discovery-0.4.jar" sourcepath="/FOray Lib-Build/commons-discovery"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-font/src/java/org/foray/font/FontServer4a.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FontServer4a.java 2009-04-25 16:52:02 UTC (rev 10778)
+++ trunk/foray/foray-font/src/java/org/foray/font/FontServer4a.java 2009-04-25 23:20:57 UTC (rev 10779)
@@ -29,6 +29,7 @@
package org.foray.font;
import org.foray.common.Environment;
+import org.foray.common.FOrayLogger;
import org.foray.font.format.FontFileReader;
import org.foray.font.format.MetricsFileReader;
import org.foray.font.output.FontOutputFactory4a;
@@ -41,6 +42,7 @@
import org.axsl.ps.Encoding;
import org.axsl.ps.PsServer;
+import org.apache.commons.discovery.tools.DiscoverSingleton;
import org.apache.commons.logging.Log;
import org.xml.sax.EntityResolver;
@@ -171,6 +173,24 @@
public FontServer4a(final Log logger, final PsServer psServer) {
this.logger = logger;
this.psServer = psServer;
+ init();
+ }
+
+ /**
+ * Zero-argument constructor used for resource discovery purposes.
+ */
+ public FontServer4a() {
+ this.logger = new FOrayLogger("FontServer4a");
+ /* Use the FOrayPS implementation as a default. */
+ final PsServer psServer = (PsServer) DiscoverSingleton.find(PsServer.class, "org.foray.ps.PsServer4a");
+ this.psServer = psServer;
+ init();
+ }
+
+ /**
+ * Initialization that should be used by all constructors.
+ */
+ private void init() {
try {
registerStandardOutputFactories();
} catch (final FontException e) {
Added: trunk/foray/lib/commons-discovery-0.4.jar
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib/commons-discovery-0.4.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/foray/lib/commons-discovery-0.4.license.txt
===================================================================
--- trunk/foray/lib/commons-discovery-0.4.license.txt (rev 0)
+++ trunk/foray/lib/commons-discovery-0.4.license.txt 2009-04-25 23:20:57 UTC (rev 10779)
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
Property changes on: trunk/foray/lib/commons-discovery-0.4.license.txt
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
Added: trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/LICENSE.txt
===================================================================
--- trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/LICENSE.txt (rev 0)
+++ trunk/foray/lib-build/commons-discovery/commons-discovery-0.4-src/LICENSE.txt 2009-04-25 23:20:57 UTC (rev 10779)
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative W...
[truncated message content] |
|
From: <vic...@us...> - 2009-04-27 14:55:25
|
Revision: 10786
http://foray.svn.sourceforge.net/foray/?rev=10786&view=rev
Author: victormote
Date: 2009-04-27 14:55:07 +0000 (Mon, 27 Apr 2009)
Log Message:
-----------
Use new aXSL interface to reduce a dependency on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-26 17:45:24 UTC (rev 10785)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-27 14:55:07 UTC (rev 10786)
@@ -31,14 +31,14 @@
import org.foray.common.WKConstants;
import org.foray.ps.PsDictionary;
import org.foray.ps.PsInterpreter4a;
-import org.foray.ps.PsInterpreterException4a;
import org.foray.ps.PsObject;
import org.foray.ps.type1.PsFontDictionary;
import org.foray.ps.type1.PsFontInfoDictionary;
-import org.foray.ps.type1.PsPrivateDictionary;
import org.axsl.ps.PsFilterType;
import org.axsl.ps.PsInput;
+import org.axsl.ps.PsInterpreterException;
+import org.axsl.ps.Type1PrivateDictionary;
import org.apache.commons.logging.Log;
@@ -137,13 +137,13 @@
PsInterpreter4a interpreter = null;
try {
interpreter = new PsInterpreter4a(this, null);
- } catch (final PsInterpreterException4a e) {
+ } catch (final PsInterpreterException e) {
getLogger().error(e.getMessage());
}
startNewSegment();
try {
interpreter.process();
- } catch (final PsInterpreterException4a e1) {
+ } catch (final PsInterpreterException e1) {
this.getLogger().error(e1.getMessage()
+ "\n " + this.getReader().getDescription().toString());
}
@@ -178,7 +178,7 @@
* Returns the private dictionary portion of the font file.
* @return The private dictionary portion of the font file.
*/
- private PsPrivateDictionary getPrivateDictionary() {
+ private Type1PrivateDictionary getPrivateDictionary() {
if (this.fontDictionary == null) {
return null;
}
@@ -334,11 +334,11 @@
* @return The stemV value.
*/
public int getStemV() {
- final PsPrivateDictionary privateDict = this.getPrivateDictionary();
+ final Type1PrivateDictionary privateDict = this.getPrivateDictionary();
if (privateDict == null) {
return 0;
}
- return privateDict.getStdVW().intValue();
+ return privateDict.getStdVw().intValue();
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java 2009-04-26 17:45:24 UTC (rev 10785)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java 2009-04-27 14:55:07 UTC (rev 10786)
@@ -34,12 +34,14 @@
import org.foray.ps.PsNumber;
import org.foray.ps.PsObject;
+import org.axsl.ps.Type1PrivateDictionary;
+
import java.math.BigDecimal;
/**
* A Type 1 font "Private" dictionary.
*/
-public class PsPrivateDictionary extends PsDictionaryWrapper {
+public class PsPrivateDictionary extends PsDictionaryWrapper implements Type1PrivateDictionary {
/** Key to the "StdVW" entry. */
public static final String STD_VW_KEY = "StdVW";
@@ -56,7 +58,7 @@
* Returns the StdVW value from the font file.
* @return The StdVW value, or null if it does not exist.
*/
- public BigDecimal getStdVW() {
+ public BigDecimal getStdVw() {
final PsObject object = getWrappedDictionary().getItem(PsPrivateDictionary.STD_VW_KEY);
if (object == null || ! (object instanceof PsArray)) {
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-27 15:08:17
|
Revision: 10787
http://foray.svn.sourceforge.net/foray/?rev=10787&view=rev
Author: victormote
Date: 2009-04-27 15:08:04 +0000 (Mon, 27 Apr 2009)
Log Message:
-----------
Use new aXSL interface to reduce a dependency on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontInfoDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-27 14:55:07 UTC (rev 10786)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-27 15:08:04 UTC (rev 10787)
@@ -33,11 +33,11 @@
import org.foray.ps.PsInterpreter4a;
import org.foray.ps.PsObject;
import org.foray.ps.type1.PsFontDictionary;
-import org.foray.ps.type1.PsFontInfoDictionary;
import org.axsl.ps.PsFilterType;
import org.axsl.ps.PsInput;
import org.axsl.ps.PsInterpreterException;
+import org.axsl.ps.Type1FontInfoDictionary;
import org.axsl.ps.Type1PrivateDictionary;
import org.apache.commons.logging.Log;
@@ -385,7 +385,7 @@
* @return The PostScript name of this font.
*/
public String getFamilyName() {
- final PsFontInfoDictionary fontInfo = getFontDictionary().getFontInfoDictionary();
+ final Type1FontInfoDictionary fontInfo = getFontDictionary().getFontInfoDictionary();
if (fontInfo == null) {
return null;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontInfoDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontInfoDictionary.java 2009-04-27 14:55:07 UTC (rev 10786)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontInfoDictionary.java 2009-04-27 15:08:04 UTC (rev 10787)
@@ -31,13 +31,15 @@
import org.foray.ps.PsDictionary;
import org.foray.ps.PsDictionaryWrapper;
+import org.axsl.ps.Type1FontInfoDictionary;
+
import java.math.BigDecimal;
/**
* Wrapper around a {@link PsDictionary} instance providing some convenience methods for Type 1
* fonts.
*/
-public class PsFontInfoDictionary extends PsDictionaryWrapper {
+public class PsFontInfoDictionary extends PsDictionaryWrapper implements Type1FontInfoDictionary {
/** Key to the "version" entry. */
public static final String VERSION_KEY = "version";
@@ -75,72 +77,63 @@
}
/**
- * Returns the /version for this font dictionary.
- * @return The /version.
+ * {@inheritDoc}
*/
public String getVersion() {
return this.getWrappedDictionary().getString(PsFontInfoDictionary.VERSION_KEY);
}
/**
- * Returns the /Notice for this font dictionary.
- * @return The /Notice.
+ * {@inheritDoc}
*/
public String getNotice() {
return this.getWrappedDictionary().getString(PsFontInfoDictionary.NOTICE_KEY);
}
/**
- * Returns the /FullName for this font dictionary.
- * @return The /FullName.
+ * {@inheritDoc}
*/
public String getFullName() {
return this.getWrappedDictionary().getString(PsFontInfoDictionary.FULL_NAME_KEY);
}
/**
- * Returns the /FamilyName for this font dictionary.
- * @return The /FamilyName.
+ * {@inheritDoc}
*/
public String getFamilyName() {
return this.getWrappedDictionary().getString(PsFontInfoDictionary.FAMILY_NAME_KEY);
}
/**
- * Returns the /Weight for this font dictionary.
- * @return The /Weight.
+ * {@inheritDoc}
*/
public String getWeight() {
return this.getWrappedDictionary().getString(PsFontInfoDictionary.WEIGHT_KEY);
}
/**
- * Returns the /ItalicAngle for this font dictionary.
- * @return The /ItalicAngle.
+ * {@inheritDoc}
*/
public BigDecimal getItalicAngle() {
return this.getWrappedDictionary().getNumber(PsFontInfoDictionary.ITALIC_ANGLE_KEY);
}
/**
- * Returns the /isFixedPitch for this font dictionary.
- * @return The /isFixedPitch.
+ * {@inheritDoc}
*/
public boolean isFixedPitch() {
return this.getWrappedDictionary().getBoolean(PsFontInfoDictionary.IS_FIXED_PITCH_KEY);
}
/**
- * Returns the /UnderlinePosition for this font dictionary.
- * @return The /UnderlinePosition.
+ * {@inheritDoc}
*/
public BigDecimal getUnderlinePosition() {
return this.getWrappedDictionary().getNumber(PsFontInfoDictionary.UNDERLINE_POSITION_KEY);
}
/**
- * Returns the /UnderlineThickness for this font dictionary.
- * @return The /UnderlineThickness.
+ * {@inheritDoc}
*/
public BigDecimal getUnderlineThickness() {
return this.getWrappedDictionary().getNumber(PsFontInfoDictionary.UNDERLINE_THICKNESS_KEY);
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java 2009-04-27 14:55:07 UTC (rev 10786)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsPrivateDictionary.java 2009-04-27 15:08:04 UTC (rev 10787)
@@ -55,8 +55,7 @@
}
/**
- * Returns the StdVW value from the font file.
- * @return The StdVW value, or null if it does not exist.
+ * {@inheritDoc}
*/
public BigDecimal getStdVw() {
final PsObject object = getWrappedDictionary().getItem(PsPrivateDictionary.STD_VW_KEY);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-27 15:50:09
|
Revision: 10788
http://foray.svn.sourceforge.net/foray/?rev=10788&view=rev
Author: victormote
Date: 2009-04-27 15:50:00 +0000 (Mon, 27 Apr 2009)
Log Message:
-----------
Use new aXSL interfaces to reduce a dependency on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java
trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-27 15:08:04 UTC (rev 10787)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-27 15:50:00 UTC (rev 10788)
@@ -37,6 +37,7 @@
import org.axsl.ps.PsFilterType;
import org.axsl.ps.PsInput;
import org.axsl.ps.PsInterpreterException;
+import org.axsl.ps.Type1FontDictionary;
import org.axsl.ps.Type1FontInfoDictionary;
import org.axsl.ps.Type1PrivateDictionary;
@@ -90,7 +91,7 @@
private long chunkEndOffset;
/** The PostScipt font dictionary parsed from this file. */
- private PsFontDictionary fontDictionary = null;
+ private Type1FontDictionary fontDictionary = null;
/** The font bounding box parsed from this file. */
private int[] fontBBox = null;
@@ -169,7 +170,7 @@
* Caches the FontDictionary in an instance variable for easier access.
* @return The font dictionary for the font file.
*/
- PsFontDictionary getFontDictionary() {
+ Type1FontDictionary getFontDictionary() {
parseDetail();
return this.fontDictionary;
}
@@ -320,7 +321,7 @@
public int[] getFontBBox() {
if (this.fontBBox == null) {
parseDetail();
- this.fontBBox = getFontDictionary().getFontBBox();
+ this.fontBBox = getFontDictionary().getFontBbox();
if (this.fontBBox == null) {
this.getLogger().error("Unable to parse Font BBox:\n"
+ " " + this.getReader().getDescription().toString());
Modified: trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java
===================================================================
--- trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java 2009-04-27 15:08:04 UTC (rev 10787)
+++ trunk/foray/foray-font/src/javatest/org/foray/font/format/TestType1PfbFile.java 2009-04-27 15:50:00 UTC (rev 10788)
@@ -30,12 +30,12 @@
import org.foray.common.Logging;
import org.foray.font.TestFontServer4a;
-import org.foray.ps.type1.PsCharStringsDictionary;
-import org.foray.ps.type1.PsFontDictionary;
-import org.foray.ps.type1.PsFontInfoDictionary;
-import org.foray.ps.type1.PsPrivateDictionary;
import org.axsl.font.FontException;
+import org.axsl.ps.Type1CharStringsDictionary;
+import org.axsl.ps.Type1FontDictionary;
+import org.axsl.ps.Type1FontInfoDictionary;
+import org.axsl.ps.Type1PrivateDictionary;
import org.apache.commons.logging.Log;
@@ -63,18 +63,18 @@
assertNotNull(reader);
final Type1PFBFile pfbFile = new Type1PFBFile(reader);
assertNotNull(pfbFile);
- final PsFontDictionary fontDict = pfbFile.getFontDictionary();
+ final Type1FontDictionary fontDict = pfbFile.getFontDictionary();
assertNotNull(fontDict);
/* Test values below obtained from the AFM file. */
- final PsFontInfoDictionary fontInfoDict = fontDict.getFontInfoDictionary();
+ final Type1FontInfoDictionary fontInfoDict = fontDict.getFontInfoDictionary();
assertNotNull(fontInfoDict);
final String fontName = fontDict.getFontName();
assertEquals("CMR10", fontName);
- final int[] fontBBox = fontDict.getFontBBox();
+ final int[] fontBBox = fontDict.getFontBbox();
assertEquals(4, fontBBox.length);
/* Following test fails. The AFM file shows -40, but the font file returns -251. */
// assertEquals(-40, fontBBox[0]);
@@ -82,10 +82,10 @@
assertEquals(1009, fontBBox[2]);
assertEquals(969, fontBBox[3]);
- final PsPrivateDictionary privateDict = fontDict.getPrivateDictionary();
+ final Type1PrivateDictionary privateDict = fontDict.getPrivateDictionary();
assertNotNull(privateDict);
- final PsCharStringsDictionary charStringsDict = fontDict.getCharStringsDictionary();
+ final Type1CharStringsDictionary charStringsDict = fontDict.getCharStringsDictionary();
assertNotNull(charStringsDict);
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java 2009-04-27 15:08:04 UTC (rev 10787)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsCharStringsDictionary.java 2009-04-27 15:50:00 UTC (rev 10788)
@@ -34,12 +34,14 @@
import org.foray.ps.PsNumber;
import org.foray.ps.PsObject;
+import org.axsl.ps.Type1CharStringsDictionary;
+
import java.math.BigDecimal;
/**
* A Type 1 font "CharStrings" dictionary.
*/
-public class PsCharStringsDictionary extends PsDictionaryWrapper {
+public class PsCharStringsDictionary extends PsDictionaryWrapper implements Type1CharStringsDictionary {
/** Key to the "StdVW" entry. */
public static final String STD_VW_KEY = "StdVW";
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java 2009-04-27 15:08:04 UTC (rev 10787)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/type1/PsFontDictionary.java 2009-04-27 15:50:00 UTC (rev 10788)
@@ -35,12 +35,13 @@
import org.foray.ps.PsObject;
import org.axsl.ps.BoundingBox;
+import org.axsl.ps.Type1FontDictionary;
/**
* Wrapper around a {@link PsDictionary} instance providing some convenience methods for Type 1
* fonts.
*/
-public class PsFontDictionary extends PsDictionaryWrapper {
+public class PsFontDictionary extends PsDictionaryWrapper implements Type1FontDictionary {
/** Key to the "FontInfo" entry. */
public static final String FONT_INFO_KEY = "FontInfo";
@@ -69,8 +70,7 @@
}
/**
- * Returns the FontInfo dictionary.
- * @return The FontInfo dictionary, or null if it does not exist.
+ * {@inheritDoc}
*/
public PsFontInfoDictionary getFontInfoDictionary() {
final PsObject psObject = getWrappedDictionary().getItem(PsFontDictionary.FONT_INFO_KEY);
@@ -84,18 +84,16 @@
}
/**
- * Returns the /FontName for this font dictionary.
- * @return The /FontName.
+ * {@inheritDoc}
*/
public String getFontName() {
return this.getWrappedDictionary().getName(PsFontDictionary.FONT_NAME_KEY);
}
/**
- * Parses and returns the font bounding box.
- * @return The font bbox.
+ * {@inheritDoc}
*/
- public int[] getFontBBox() {
+ public int[] getFontBbox() {
final Object object = this.getWrappedDictionary().getItem(PsFontDictionary.FONT_BBOX_KEY);
if (! (object instanceof PsArray)) {
return null;
@@ -119,8 +117,7 @@
}
/**
- * Returns the Private dictionary.
- * @return The Private dictionary, or null if it does not exist.
+ * {@inheritDoc}
*/
public PsPrivateDictionary getPrivateDictionary() {
final PsObject psObject = getWrappedDictionary().getItem(PsFontDictionary.PRIVATE_KEY);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-27 16:25:06
|
Revision: 10789
http://foray.svn.sourceforge.net/foray/?rev=10789&view=rev
Author: victormote
Date: 2009-04-27 16:24:56 +0000 (Mon, 27 Apr 2009)
Log Message:
-----------
Use new aXSL interfaces to reduce a dependency on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter4a.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/PsFontDirectory4a.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-27 15:50:00 UTC (rev 10788)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2009-04-27 16:24:56 UTC (rev 10789)
@@ -29,12 +29,10 @@
package org.foray.font.format;
import org.foray.common.WKConstants;
-import org.foray.ps.PsDictionary;
import org.foray.ps.PsInterpreter4a;
-import org.foray.ps.PsObject;
-import org.foray.ps.type1.PsFontDictionary;
import org.axsl.ps.PsFilterType;
+import org.axsl.ps.PsFontDirectory;
import org.axsl.ps.PsInput;
import org.axsl.ps.PsInterpreterException;
import org.axsl.ps.Type1FontDictionary;
@@ -44,8 +42,7 @@
import org.apache.commons.logging.Log;
import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
+import java.util.List;
/**
* Abstract superclass for the various Postscript Type 1 font file formats.
@@ -149,17 +146,12 @@
+ "\n " + this.getReader().getDescription().toString());
}
- final PsDictionary fontDirectory = interpreter.getFontDirectory();
+ final PsFontDirectory fontDirectory = interpreter.getFontDirectory();
if (fontDirectory != null) {
- final Map<PsObject, PsObject> fontMap = fontDirectory.getMap();
- final Iterator<PsObject> iter = fontMap.keySet().iterator();
+ final List<? extends Type1FontDictionary> fonts = fontDirectory.getFonts();
// There should only be one font in the font directory
- if (iter.hasNext()) {
- final PsObject psObject = fontMap.get(iter.next());
- if (psObject instanceof PsDictionary) {
- final PsDictionary dictionary = (PsDictionary) psObject;
- this.fontDictionary = new PsFontDictionary(dictionary);
- }
+ if (fonts.size() > 0) {
+ this.fontDictionary = fonts.get(0);
}
}
Added: trunk/foray/foray-ps/src/java/org/foray/ps/PsFontDirectory4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsFontDirectory4a.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsFontDirectory4a.java 2009-04-27 16:24:56 UTC (rev 10789)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2009 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.ps;
+
+import org.foray.ps.type1.PsFontDictionary;
+
+import org.axsl.ps.PsFontDirectory;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A /FontDirectory dictionary.
+ */
+public class PsFontDirectory4a extends PsDictionaryWrapper implements PsFontDirectory {
+
+ /**
+ * Constructor.
+ * @param dictionary The wrapped dictionary instance.
+ */
+ public PsFontDirectory4a(final PsDictionary dictionary) {
+ super(dictionary);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<PsFontDictionary> getFonts() {
+ final List<PsFontDictionary> returnList = new ArrayList<PsFontDictionary>();
+ final Map<PsObject, PsObject> fontMap = getWrappedDictionary().getMap();
+ final Iterator<PsObject> iter = fontMap.keySet().iterator();
+ if (iter.hasNext()) {
+ final PsObject psObject = fontMap.get(iter.next());
+ if (psObject instanceof PsDictionary) {
+ final PsDictionary dictionary = (PsDictionary) psObject;
+ final PsFontDictionary fontDictionary = new PsFontDictionary(dictionary);
+ returnList.add(fontDictionary);
+ }
+ }
+ return returnList;
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/PsFontDirectory4a.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter4a.java 2009-04-27 15:50:00 UTC (rev 10788)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsInterpreter4a.java 2009-04-27 16:24:56 UTC (rev 10789)
@@ -815,12 +815,13 @@
* Returns the font dictionary.
* @return The font dictionary.
*/
- public PsDictionary getFontDirectory() {
+ public PsFontDirectory4a getFontDirectory() {
final PsDictionary systemDict = getSystemDict();
if (systemDict == null) {
return null;
}
- return (PsDictionary) systemDict.getItem("FontDirectory");
+ final PsDictionary dictionary = (PsDictionary) systemDict.getItem("FontDirectory");
+ return new PsFontDirectory4a(dictionary);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-27 17:58:14
|
Revision: 10792
http://foray.svn.sourceforge.net/foray/?rev=10792&view=rev
Author: victormote
Date: 2009-04-27 17:58:11 +0000 (Mon, 27 Apr 2009)
Log Message:
-----------
1. Conform to new aXSL requirements for PsEncodeFilter.
2. Use new aXSL method to eliminate a dependency of FOrayFont on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java 2009-04-27 17:26:57 UTC (rev 10791)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java 2009-04-27 17:58:11 UTC (rev 10792)
@@ -28,10 +28,11 @@
package org.foray.font.format;
-import org.foray.ps.filter.AsciiHexEncodeFilter;
-
+import org.axsl.ps.PsEncodeFilter;
import org.axsl.ps.PsFilterType;
+import org.axsl.ps.PsServer;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
/**
@@ -154,18 +155,21 @@
/**
* {@inheritDoc}
*/
- protected byte[] getEncryptedSegment(final PsFilterType outputFormat)
- throws IOException {
+ protected byte[] getEncryptedSegment(final PsFilterType outputFormat) throws IOException {
this.getReader().seek(this.getSegmentOffset(1));
final byte[] unEncoded = new byte[this.getSegmentSize(1)];
this.getReader().readFully(unEncoded, 0, this.getSegmentSize(1));
if (outputFormat == null) {
return unEncoded;
}
+ final PsServer psServer = this.getReader().getFontServer().getPsServer();
switch (outputFormat) {
case ASCII_HEX: {
- return AsciiHexEncodeFilter.encodeArray(unEncoded, 0,
- unEncoded.length, Type1PFBFile.DEFAULT_LINE_LENGTH);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final PsEncodeFilter filter = psServer.makeEncodeFilter(outputFormat, baos);
+ filter.setLineLength(Type1PFBFile.DEFAULT_LINE_LENGTH);
+ filter.write(unEncoded, 0, unEncoded.length);
+ return baos.toByteArray();
}
default: {
return null;
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2009-04-27 17:26:57 UTC (rev 10791)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2009-04-27 17:58:11 UTC (rev 10792)
@@ -258,4 +258,11 @@
/* Ignore. */
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setLineLength(final int lineLength) {
+ /* Ignore. */
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2009-04-27 17:26:57 UTC (rev 10791)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2009-04-27 17:58:11 UTC (rev 10792)
@@ -51,6 +51,10 @@
/** The unwritten input bytes. */
private ByteArrayOutputStream unprocessedBytes;
+ /** The length of the output line that should be written.
+ * Any value less than one implies an unlimited line length. */
+ private int lineLength = -1;
+
/**
* Constructor.
* @param outputStream The underlying output stream to which the encoded
@@ -117,7 +121,7 @@
* Whitespace characters may be added to the output, so it may be somewhat
* larger.
*/
- public static byte[] encodeArray(final byte[] input, final int start,
+ private static byte[] encodeArray(final byte[] input, final int start,
final int size, final int lineBreak) {
if (input == null || input.length < 1) {
return null;
@@ -181,8 +185,7 @@
*/
public void flush() throws IOException {
final byte[] data = this.unprocessedBytes.toByteArray();
- final byte[] tentative = AsciiHexEncodeFilter.encodeArray(data, 0,
- data.length, -1);
+ final byte[] tentative = AsciiHexEncodeFilter.encodeArray(data, 0, data.length, this.lineLength);
final byte[] returnArray = new byte[tentative.length + 1];
System.arraycopy(tentative, 0, returnArray, 0, tentative.length);
returnArray[returnArray.length - 1] = AsciiHexEncodeFilter.END_OF_DATA;
@@ -197,4 +200,11 @@
/* Ignore. */
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setLineLength(final int lineLength) {
+ this.lineLength = lineLength;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java 2009-04-27 17:26:57 UTC (rev 10791)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java 2009-04-27 17:58:11 UTC (rev 10792)
@@ -100,4 +100,11 @@
/* TODO: Implement this. */
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setLineLength(final int lineLength) {
+ /* Ignore. */
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java 2009-04-27 17:26:57 UTC (rev 10791)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java 2009-04-27 17:58:11 UTC (rev 10792)
@@ -96,4 +96,11 @@
/* Ignore. */
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setLineLength(final int lineLength) {
+ /* Ignore. */
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2009-04-27 17:26:57 UTC (rev 10791)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2009-04-27 17:58:11 UTC (rev 10792)
@@ -125,4 +125,11 @@
/* Ignore. */
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setLineLength(final int lineLength) {
+ /* Ignore. */
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java 2009-04-27 17:26:57 UTC (rev 10791)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java 2009-04-27 17:58:11 UTC (rev 10792)
@@ -234,4 +234,11 @@
/* Ignore. */
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setLineLength(final int lineLength) {
+ /* Ignore. */
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 00:23:01
|
Revision: 10793
http://foray.svn.sourceforge.net/foray/?rev=10793&view=rev
Author: victormote
Date: 2009-04-29 00:22:59 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
1. Conform to new aXSL requirements for PsServer.
2. Use new aXSL enum of predefined encoding vectors to eliminate a dependency on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector4a.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java 2009-04-27 17:58:11 UTC (rev 10792)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java 2009-04-29 00:22:59 UTC (rev 10793)
@@ -29,8 +29,11 @@
package org.foray.font.format;
import org.foray.common.RandomReader;
-import org.foray.ps.encode.EncodingVector4a;
+import org.axsl.ps.Encoding;
+import org.axsl.ps.EncodingVector;
+import org.axsl.ps.PsServer;
+
import java.io.IOException;
/**
@@ -204,20 +207,19 @@
/**
* Returns the parsed PostScript name for a given glyph index.
+ * @param psServer The PostScript server.
* @param glyphIndex The glyph index whose PostScript name is sought.
* @return The PostScript name for <code>glyphIndex</code>.
*/
- public String getPostScriptName(final char glyphIndex) {
- final EncodingVector4a macOrdering = EncodingVector4a.getPredefinedEncoding(
- EncodingVector4a.STANDARD_MACINTOSH_ORDERING);
- int codePoint;
+ public String getPostScriptName(final PsServer psServer, final char glyphIndex) {
+ final EncodingVector macOrdering = psServer.getPredefinedEncoding(
+ EncodingVector.Predefined.STANDARD_MACINTOSH_ORDERING);
+ final int codePoint = macOrdering.decodeCharacter(glyphIndex);
switch (this.postFormat) {
case TTFTablePOST.PS_FORMAT_1:
- codePoint = macOrdering.decodeCharacter(glyphIndex);
return macOrdering.mapCodePointToGlyphName(codePoint);
case TTFTablePOST.PS_FORMAT_2:
- if (glyphIndex < macOrdering.size()) {
- codePoint = macOrdering.decodeCharacter(glyphIndex);
+ if (codePoint != Encoding.INVALID_UNICODE_CHAR) {
return macOrdering.mapCodePointToGlyphName(codePoint);
}
if (this.glyphNameIndex == null
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-27 17:58:11 UTC (rev 10792)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-29 00:22:59 UTC (rev 10793)
@@ -184,4 +184,11 @@
return org.foray.ps.encode.EncodingVector4a.getPredefinedEncoding(name);
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector getPredefinedEncoding(final EncodingVector.Predefined predefinedVector) {
+ return org.foray.ps.encode.EncodingVector4a.getPredefinedEncoding(predefinedVector);
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java 2009-04-27 17:58:11 UTC (rev 10792)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java 2009-04-29 00:22:59 UTC (rev 10793)
@@ -28,6 +28,9 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
+import java.io.ObjectStreamException;
import java.io.Serializable;
@@ -1117,9 +1120,8 @@
* {@link #getInstance()}.
*/
private EncodingMacStandard() {
- super(STANDARD_MACINTOSH_ORDERING, GlyphList.standardSourceGlyphLists(),
- EncodingMacStandard.CODE_POINTS,
- EncodingMacStandard.CODE_POINT_INDEXES);
+ super(EncodingVector.Predefined.STANDARD_MACINTOSH_ORDERING.getName(), GlyphList.standardSourceGlyphLists(),
+ EncodingMacStandard.CODE_POINTS, EncodingMacStandard.CODE_POINT_INDEXES);
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector4a.java 2009-04-27 17:58:11 UTC (rev 10792)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector4a.java 2009-04-29 00:22:59 UTC (rev 10793)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -83,16 +85,11 @@
* the first array.
* Methods are provided to encode and decode characters.</p>
*/
-public abstract class EncodingVector4a extends Encoding4a
- implements org.axsl.ps.EncodingVector, Serializable {
+public abstract class EncodingVector4a extends Encoding4a implements EncodingVector, Serializable {
/** The name of the undefined glyph. */
public static final String NOTDEF = ".notdef";
- /** The name of the "Standard Macintosh Ordering" encoding. */
- public static final String STANDARD_MACINTOSH_ORDERING
- = "MacStandardEncoding";
-
/** Constant needed for serialization. */
private static final long serialVersionUID = 6967489975814026068L;
@@ -150,56 +147,95 @@
}
/**
- * This is a factory method that either finds or creates one of the
- * predefined encodings.
+ * This is a factory method that either finds or creates one of the predefined encodings.
* @param name The name of the predefined encoding to be returned.
- * @return The predefined encoding if it can be found or created, or null
- * otherwise.
+ * @return The predefined encoding if it can be found or created, or null otherwise.
*/
public static EncodingVector4a getPredefinedEncoding(final String name) {
- // If already instantiated, return it.
+ /* If already instantiated, return it. */
EncodingVector4a encoding = EncodingVector4a.predefinedEncodings.get(name);
if (encoding != null) {
return encoding;
}
- // Otherwise, try to instantiate it.
- if (name.equals("AdobeStandardEncoding")
- || name.equals("StandardEncoding")) {
+ /* Otherwise, try to instantiate it. */
+ final EncodingVector.Predefined predefined = EncodingVector.Predefined.findByName(name);
+ encoding = getPredefinedEncoding(predefined);
+
+ if (name.equals("FOrayLatinExtraEncoding")) {
+ encoding = EncodingFOrayLatinExtra.getInstance();
+ } else if (name.equals("InternalEncoding")) {
+ /* The statement below is a bit redundant, but is included to
+ * document the fact that "InternalEncoding" is reserved to
+ * indicate that the Font's internal encoding should be used. */
+ encoding = null;
+ }
+ if (encoding == null) {
+ return null;
+ }
+ EncodingVector4a.predefinedEncodings.put(name, encoding);
+ return encoding;
+ }
+
+ /**
+ * This is a factory method that either finds or creates one of the predefined encodings.
+ * @param predefined The enumerated predefined encoding to be returned.
+ * @return The predefined encoding if it can be found or created, or null otherwise.
+ */
+ public static EncodingVector4a getPredefinedEncoding(final EncodingVector.Predefined predefined) {
+ if (predefined == null) {
+ return null;
+ }
+ EncodingVector4a encoding = null;
+ switch (predefined) {
+ case STANDARD: {
encoding = EncodingStandard.getInstance();
- } else if (name.equals("ISOLatin1Encoding")) {
+ break;
+ }
+ case ISO_LATIN_1: {
encoding = EncodingISOLatin1.getInstance();
- } else if (name.equals("WinAnsiEncoding")) {
+ break;
+ }
+ case WIN_ANSI: {
encoding = EncodingWinAnsi.getInstance();
- } else if (name.equals("SymbolEncoding")) {
+ break;
+ }
+ case SYMBOL: {
encoding = EncodingSymbol.getInstance();
- } else if (name.equals("ZapfDingbatsEncoding")) {
+ break;
+ }
+ case ZAPF_DINGBATS: {
encoding = EncodingZapfDingbats.getInstance();
- } else if (name.equals("CEEncoding")) {
+ break;
+ }
+ case CE: {
encoding = EncodingCE.getInstance();
- } else if (name.equals("MacRomanEncoding")) {
+ break;
+ }
+ case MAC_ROMAN: {
encoding = EncodingMacRoman.getInstance();
- } else if (name.equals("PDFDocEncoding")) {
+ break;
+ }
+ case PDF_DOC: {
encoding = EncodingPDFDoc.getInstance();
- } else if (name.equals("MacExpertEncoding")) {
+ break;
+ }
+ case MAC_EXPERT: {
encoding = EncodingMacExpert.getInstance();
- } else if (name.equals("ExpertEncoding")) {
+ break;
+ }
+ case EXPERT: {
encoding = EncodingExpert.getInstance();
- } else if (name.equals("ExpertSubsetEncoding")) {
+ break;
+ }
+ case EXPERT_SUBSET: {
encoding = EncodingExpertSubset.getInstance();
- } else if (name.equals(EncodingVector4a.STANDARD_MACINTOSH_ORDERING)) {
+ break;
+ }
+ case STANDARD_MACINTOSH_ORDERING: {
encoding = EncodingMacStandard.getInstance();
- } else if (name.equals("FOrayLatinExtraEncoding")) {
- encoding = EncodingFOrayLatinExtra.getInstance();
- } else if (name.equals("InternalEncoding")) {
- /* The statement below is a bit redundant, but is included to
- * document the fact that "InternalEncoding" is reserved to
- * indicate that the Font's internal encoding should be used. */
- encoding = null;
+ break;
}
- if (encoding == null) {
- return null;
}
- EncodingVector4a.predefinedEncodings.put(name, encoding);
return encoding;
}
@@ -375,11 +411,7 @@
}
/**
- * Finds the glyph name that corresponds to a given Unicode code point.
- * @param codePoint The Unicode code point for which the glyph name is
- * desired.
- * @return The glyph name, or null if none is found in this encoding's
- * glyph lists.
+ * {@inheritDoc}
*/
public String mapCodePointToGlyphName(final int codePoint) {
if (this.sourceGlyphLists == null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 01:08:27
|
Revision: 10795
http://foray.svn.sourceforge.net/foray/?rev=10795&view=rev
Author: victormote
Date: 2009-04-29 01:08:24 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
1. Conform to new aXSL CMap requirements.
2. Use new aXSL CMap capabilities to eliminate some dependencies on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java
trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2009-04-29 00:27:40 UTC (rev 10794)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2009-04-29 01:08:24 UTC (rev 10795)
@@ -31,9 +31,9 @@
import org.foray.common.Bit;
import org.foray.common.WKConstants;
import org.foray.font.output.FontPdf4a;
-import org.foray.ps.encode.CMap;
import org.axsl.font.Font;
+import org.axsl.ps.Cmap;
import org.apache.commons.logging.Log;
@@ -450,7 +450,7 @@
* Returns the "To Unicode" CMap for this font.
* @return The "To Unicode" CMap for this font, or null if there is none.
*/
- public CMap getUnicodeCMap() {
+ public Cmap getUnicodeCMap() {
return this.cmapTable.getUnicodeCMap();
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java 2009-04-29 00:27:40 UTC (rev 10794)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java 2009-04-29 01:08:24 UTC (rev 10795)
@@ -28,10 +28,13 @@
package org.foray.font.format;
-import org.foray.ps.encode.CMap;
import org.foray.ps.encode.CMap04;
import org.foray.ps.encode.CMap12;
+import org.axsl.ps.Cmap;
+import org.axsl.ps.Cmap04;
+import org.axsl.ps.Cmap12;
+
import java.io.IOException;
/**
@@ -67,7 +70,7 @@
protected static final int ENCODING_UCS_4 = 10;
/** The CMap instance that was parsed from this table. */
- private CMap unicodeCMap;
+ private Cmap unicodeCMap;
/**
* Constructor.
@@ -142,7 +145,7 @@
* @return The parsed CMap instance.
* @throws IOException For I/O Error.
*/
- private CMap parseCMap(final long offsetToParse) throws IOException {
+ private Cmap parseCMap(final long offsetToParse) throws IOException {
int tableOffset = ttfFont().getTTFDirTabEntry(getTableTag())
.getOffset();
tableOffset += offsetToParse;
@@ -176,7 +179,7 @@
* @return The parsed CMap format 4 table.
* @throws IOException For I/O Error.
*/
- private CMap04 parseCMap04() throws IOException {
+ private Cmap04 parseCMap04() throws IOException {
/* Format and Length have already been read. */
/* Skip version */
getReader().skipBytes(USHORT_BYTES);
@@ -217,7 +220,7 @@
// Parse the table entries and build a CMap4 from them.
final String encodingName = "internal-"
+ this.ttfFont().getPostscriptName();
- final CMap04 cmap04 = new CMap04(encodingName, segCountX2 / 2);
+ final Cmap04 cmap04 = new CMap04(encodingName, segCountX2 / 2);
for (int i = 0; i < startCount.length; i++) {
if (rangeOffset[i] == 0) {
cmap04.addEntry(startCount[i],
@@ -256,7 +259,7 @@
* <a href="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6cmap.html">
* The Apple doc for the cmap table</a>
*/
- private CMap12 parseCMap12() throws IOException {
+ private Cmap12 parseCMap12() throws IOException {
/* Format and Length have already been read. */
/* Skip language. */
getReader().skipBytes(ULONG_BYTES);
@@ -264,7 +267,7 @@
final String encodingName = "internal-"
+ this.ttfFont().getPostscriptName();
- final CMap12 cmap12 = new CMap12(encodingName, nGroups);
+ final Cmap12 cmap12 = new CMap12(encodingName, nGroups);
for (int i = 0; i < nGroups; i++) {
final int startCharCode = (int) getReader().readUnsignedInt();
@@ -286,7 +289,7 @@
* Returns the Unicode CMap instance parsed from this table.
* @return The Unicode CMap instance parsed from this table.
*/
- public CMap getUnicodeCMap() {
+ public Cmap getUnicodeCMap() {
return this.unicodeCMap;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-29 00:27:40 UTC (rev 10794)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-29 01:08:24 UTC (rev 10795)
@@ -28,6 +28,8 @@
package org.foray.ps;
+import org.foray.ps.encode.CMap04;
+import org.foray.ps.encode.CMap12;
import org.foray.ps.filter.Ascii85DecodeFilter;
import org.foray.ps.filter.Ascii85EncodeFilter;
import org.foray.ps.filter.AsciiHexDecodeFilter;
@@ -45,6 +47,8 @@
import org.foray.ps.pdf.PDFSystemDict;
import org.foray.ps.readonly.ReadOnlySystemDict;
+import org.axsl.ps.Cmap04;
+import org.axsl.ps.Cmap12;
import org.axsl.ps.EncodingVector;
import org.axsl.ps.PsFilterType;
import org.axsl.ps.PsInput;
@@ -191,4 +195,18 @@
return org.foray.ps.encode.EncodingVector4a.getPredefinedEncoding(predefinedVector);
}
+ /**
+ * {@inheritDoc}
+ */
+ public Cmap04 makeCmap04(final String name, final int expectedEntries) {
+ return new CMap04(name, expectedEntries);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Cmap12 makeCmap12(final String name, final int expectedEntries) {
+ return new CMap12(name, expectedEntries);
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2009-04-29 00:27:40 UTC (rev 10794)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2009-04-29 01:08:24 UTC (rev 10795)
@@ -28,10 +28,12 @@
package org.foray.ps.encode;
+import org.axsl.ps.Cmap;
+
/**
* Abstract superclass for all CMap Tables.
*/
-public abstract class CMap extends Encoding4a {
+public abstract class CMap extends Encoding4a implements Cmap {
/** Constant needed for serialization. */
private static final long serialVersionUID = -6516855352094857929L;
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java 2009-04-29 00:27:40 UTC (rev 10794)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java 2009-04-29 01:08:24 UTC (rev 10795)
@@ -28,12 +28,14 @@
package org.foray.ps.encode;
+import org.axsl.ps.Cmap04;
+
/**
* Class containing a set of 16-bit Unicode ranges that sequentially map to the
* same-sized range of glyph indexes. The contents are analogous to a Format 4
* TrueType Font cmap table (from which this class derives its name).
*/
-public class CMap04 extends CMap {
+public class CMap04 extends CMap implements Cmap04 {
/** Constant needed for serialization. */
public static final long serialVersionUID = 985957847129472354L;
@@ -80,11 +82,7 @@
}
/**
- * Add a new entry to this map, converting the input values to an entry.
- * @param unicodeStart The starting Unicode code point for this map.
- * @param unicodeEnd The ending Unicode code point for this map.
- * @param glyphStartIndex The starting glyph index for this map.
- * This index is the encoded value for <code>unicodeStart</code>.
+ * {@inheritDoc}
*/
public void addEntry(final char unicodeStart, final char unicodeEnd,
final char glyphStartIndex) {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java 2009-04-29 00:27:40 UTC (rev 10794)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java 2009-04-29 01:08:24 UTC (rev 10795)
@@ -28,12 +28,14 @@
package org.foray.ps.encode;
+import org.axsl.ps.Cmap12;
+
/**
* Class containing a set of 32-bit Unicode ranges that sequentially map to the
* same-sized range of glyph indexes. The contents are analogous to a Format 12
* TrueType Font cmap table (from which this class derives its name).
*/
-public class CMap12 extends CMap {
+public class CMap12 extends CMap implements Cmap12 {
/** Constant needed for serialization. */
public static final long serialVersionUID = -606154911100219394L;
@@ -80,11 +82,7 @@
}
/**
- * Add a new entry to this map, converting the input values to an entry.
- * @param unicodeStart The starting Unicode code point for this map.
- * @param unicodeEnd The ending Unicode code point for this map.
- * @param glyphStartIndex The starting glyph index for this map.
- * This index is the encoded value for <code>unicodeStart</code>.
+ * {@inheritDoc}
*/
public void addEntry(final int unicodeStart, final int unicodeEnd,
final int glyphStartIndex) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 15:04:53
|
Revision: 10796
http://foray.svn.sourceforge.net/foray/?rev=10796&view=rev
Author: victormote
Date: 2009-04-29 15:04:36 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Move the CharSet classes from FOrayFont to FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/Font4a.java
trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java
trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java
trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java
trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java
trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java
trunk/foray/foray-font/src/java/org/foray/font/output/FontOutput4a.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSet.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetExtendedRoman.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetWindowsANSI.java
Removed Paths:
-------------
trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java
trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetExtendedRoman.java
trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java
trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetWindowsANSI.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/Font4a.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/Font4a.java 2009-04-29 01:08:24 UTC (rev 10795)
+++ trunk/foray/foray-font/src/java/org/foray/font/Font4a.java 2009-04-29 15:04:36 UTC (rev 10796)
@@ -28,8 +28,8 @@
package org.foray.font;
import org.foray.common.WKConstants;
-import org.foray.font.charset.CharSet;
import org.foray.font.format.Kerning;
+import org.foray.ps.encode.CharSet;
import org.axsl.font.Font;
Modified: trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2009-04-29 01:08:24 UTC (rev 10795)
+++ trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java 2009-04-29 15:04:36 UTC (rev 10796)
@@ -29,10 +29,10 @@
package org.foray.font;
import org.foray.common.WKConstants;
-import org.foray.font.charset.CharSet;
import org.foray.font.format.FontFileReader;
import org.foray.font.format.Kerning;
import org.foray.font.format.Panose;
+import org.foray.ps.encode.CharSet;
import org.axsl.font.Font;
import org.axsl.ps.Encoding;
Modified: trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2009-04-29 01:08:24 UTC (rev 10795)
+++ trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java 2009-04-29 15:04:36 UTC (rev 10796)
@@ -30,9 +30,9 @@
import org.foray.common.Environment;
import org.foray.common.WKConstants;
-import org.foray.font.charset.CharSet;
import org.foray.font.format.FontFileReader;
import org.foray.font.format.Kerning;
+import org.foray.ps.encode.CharSet;
import org.axsl.font.FontException;
Deleted: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java 2009-04-29 01:08:24 UTC (rev 10795)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java 2009-04-29 15:04:36 UTC (rev 10796)
@@ -1,285 +0,0 @@
-/*
- * Copyright 2005 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.font.charset;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * <p>Instances of CharSet are collections of related characters.
- * Fonts are frequently designed to cover a specific collection of characters.
- * For example, 12 of the Base-14 fonts cover the ExtendedRoman collection.</p>
- *
- * <p>The main purpose of the class is to efficiently map a Unicode code point
- * to an array index that can be used in other classes to store information
- * about that code point.
- * For example, as an AFM file is parsed, width metric information is
- * accumulated about each glyph in the font.
- * The font Encoding is not a suitable concept to use as an index for such
- * information, because it is limited to 256 characters and most Encodings use
- * less than that.
- * A font may contain more than 256 glyphs.
- * For example, the ExtendedRoman character set contains 315 glyphs.
- * By separating CharSet from Encoding, we can record all of the information
- * about a font without caring how it will be encoded as it is used.</p>
- */
-public class CharSet implements Serializable {
-
- /** Constant needed for serialization. */
- public static final long serialVersionUID = -194139196582956914L;
-
- /**
- * A map of all registered CharSet instances.
- * The key to the map is a String containing the name of the charset.
- * The value is the CharSet instance.
- */
- private static Map<String, CharSet> registeredCharSets
- = new HashMap<String, CharSet>();
-
- /** The name of this character set. */
- private transient String name;
-
- /** The 16-bit Unicode codepoints. */
- private transient char[] characterSet16;
-
- /** The 32-bit Unicode codepoints. These are conceptually appended to the
- * end of {@link #characterSet16} as if they were all in one array. */
- private transient int[] characterSet32;
-
- /**
- * Constructor suitable for character sets that contain only 16-bit
- * characters. If there are any 32-bit code points in the character set,
- * use {@link #CharSet(String, int[])} instead.
- * @param name The name of this character set.
- * @param characterSet The array containing the code points in this
- * character set.
- */
- public CharSet(final String name, final char[] characterSet) {
- this.name = name;
- if (characterSet == null) {
- return;
- }
- /* Make sure the input array is sorted. */
- Arrays.sort(characterSet);
- this.characterSet16 = characterSet;
- }
-
- /**
- * General constructor suitable for character sets containing 16-bit
- * codePoints, 32-bit code points, or both.
- * If all code points in the character set are 16-bit (less than or equal to
- * 0xFFFF), then {@link #CharSet(String, char[])} may also be used.
- * @param name The name of this character set.
- * @param characterSet The array containing the code points in this
- * character set.
- */
- public CharSet(final String name, final int[] characterSet) {
- this.name = name;
- if (characterSet == null) {
- return;
- }
-
- /* Make sure the input array is sorted. */
- Arrays.sort(characterSet);
-
- /* Find the index to the first code point > 0xFFFF. */
- int first32bitIndex = Integer.MAX_VALUE;
- for (int i = characterSet.length - 1; i > -1 && first32bitIndex < 0;
- i--) {
- if (characterSet[i] <= Character.MAX_VALUE) {
- /* We are down to the 16-bit items, so we are done. */
- break;
- }
- /* We are still in the 32-bit items, so this one is now the first
- * known 32-bit item. */
- first32bitIndex = i;
- }
-
- /* Split the input array into 2 arrays, one for 16-bit items, one for
- * 32-bit items. */
- if (first32bitIndex == Integer.MAX_VALUE) {
- /* There are no 32-bit values. */
- this.characterSet32 = null;
- this.characterSet16 = new char[characterSet.length];
- for (int i = 0; i < characterSet.length; i++) {
- this.characterSet16[i] = (char) characterSet[i];
- }
- } else {
- final int num16bits = first32bitIndex;
- final int num32bits = characterSet.length - num16bits;
- this.characterSet16 = new char[num16bits];
- for (int i = 0; i < first32bitIndex; i++) {
- this.characterSet16[i] = (char) characterSet[i];
- }
- this.characterSet32 = new int[num32bits];
- for (int i = first32bitIndex; i < characterSet.length; i++) {
- this.characterSet32[i - first32bitIndex] = characterSet[i];
- }
- }
- }
-
- /**
- * Returns the name of this character set.
- * @return The name of this character set.
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * Returns the array index for a character in this character set.
- * @param codePoint The character whose index should be found.
- * @return The index for codePoint, or -1 if codePoint is not in the
- * character set.
- */
- public int getCharSetIndex(final int codePoint) {
- int index = -1;
- if (this.characterSet16 != null) {
- index = Arrays.binarySearch(this.characterSet16, (char) codePoint);
- }
- if (index > -1) {
- return index;
- }
- if (this.characterSet32 != null) {
- index = Arrays.binarySearch(this.characterSet32, codePoint);
- if (index > -1
- && this.characterSet16 != null) {
- index += this.characterSet16.length;
- }
- }
- if (index < 0) {
- index = -1;
- }
- return index;
- }
-
- /**
- * This is a factory method that either finds or creates the known
- * predefined CharSet instances.
- * @param name The name of the predefined charset to be returned.
- * @return The CharSet instance for <code>name</code>, or null if
- * <code>name</code> does not describe a predefined character set.
- */
- public static CharSet getRegisteredCharSet(final String name) {
- // If already instantiated, return it.
- CharSet charSet = CharSet.registeredCharSets.get(name);
- if (charSet != null) {
- return charSet;
- }
- // Otherwise, try to instantiate it.
- if (name.equals("WindowsANSI")) {
- charSet = CharSetWindowsANSI.getInstance();
- } else if (name.equals("ExtendedRoman")) {
- charSet = CharSetExtendedRoman.getInstance();
- }
- if (charSet == null) {
- return null;
- }
- CharSet.registeredCharSets.put(name, charSet);
- return charSet;
- }
-
- /**
- * Returns the size, in characters, of this character set.
- * @return The size of this character set.
- */
- public int size() {
- int size = 0;
- if (this.characterSet16 != null) {
- size += this.characterSet16.length;
- }
- if (this.characterSet32 != null) {
- size += this.characterSet32.length;
- }
- return size;
- }
-
- /**
- * Indicates whether the data in this character set is static, that is,
- * tied entirely to the class itself and not built dynamically.
- * This is used primarily to determine whether the instance should actually
- * be serialized.
- * Static subclasses should override this method.
- * @return True iff all data in this glyph list is static and does not
- * need to be serialized.
- */
- public boolean isStatic() {
- return false;
- }
-
- /**
- * Serialize this {@link CharSet} instance.
- * @param stream The output stream to which the serialized data is written.
- * @throws IOException For I/O errors.
- * @serialData
- * <ol>
- * <li>The name of the character set (String).</li>
- * <li>The The 16-bit Unicode codepoints (char[]).</li>
- * <li>The The 32-bit Unicode codepoints (int[]).</li>
- * </ol>
- */
- private void writeObject(final ObjectOutputStream stream)
- throws IOException {
- if (this.isStatic()) {
- /* The static instances do not need to be serialized as they are
- * derived entirely from static data. */
- return;
- }
- stream.defaultWriteObject();
- stream.writeObject(this.name);
- stream.writeObject(this.characterSet16);
- stream.writeObject(this.characterSet32);
- }
-
- /**
- * Deserialize this {@link CharSet} instance.
- * @param stream The input stream from which the serialized data is read.
- * @throws IOException For I/O errors reading the input.
- * @throws ClassNotFoundException For classes in the input that cannot be
- * found.
- */
- private void readObject(final ObjectInputStream stream)
- throws IOException, ClassNotFoundException {
- if (this.isStatic()) {
- /* The static instances do not need to be serialized as they are
- * derived entirely from static data. */
- return;
- }
- stream.defaultReadObject();
- this.name = (String) stream.readObject();
- this.characterSet16 = (char[]) stream.readObject();
- this.characterSet32 = (int[]) stream.readObject();
- }
-
-}
Deleted: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetExtendedRoman.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetExtendedRoman.java 2009-04-29 01:08:24 UTC (rev 10795)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetExtendedRoman.java 2009-04-29 15:04:36 UTC (rev 10796)
@@ -1,407 +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.font.charset;
-
-/**
- * Class containing hard-coded values that represent the ExtendedRoman
- * character set.
- * We cannot find an official list for this character set.
- * It is inferred from the AFM files for the Base-14 fonts.
- *
- * <p>The hard-coded values in this class were derived by running
- * {@link CharSetParser#main(String[])}.
- * The input file was created by extracting all of the glyph names from the
- * "C" entries in the following AFM file:
- * foray/foray-font/resource/base-14/Helvetica.afm</p>
- */
-public final class CharSetExtendedRoman extends CharSet {
-
- /** Constant needed for serialization. */
- public static final long serialVersionUID = -78856854976712859L;
-
- /** The array of characters in this character set. This array is sorted
- * so that it can be used in binary searches. */
- private static final char[] CHARACTER_SET = {
- 0x0020, // [0] space
- 0x0021, // [1] exclam
- 0x0022, // [2] quotedbl
- 0x0023, // [3] numbersign
- 0x0024, // [4] dollar
- 0x0025, // [5] percent
- 0x0026, // [6] ampersand
- 0x0027, // [7] quotesingle
- 0x0028, // [8] parenleft
- 0x0029, // [9] parenright
- 0x002a, // [10] asterisk
- 0x002b, // [11] plus
- 0x002c, // [12] comma
- 0x002d, // [13] hyphen
- 0x002e, // [14] period
- 0x002f, // [15] slash
- 0x0030, // [16] zero
- 0x0031, // [17] one
- 0x0032, // [18] two
- 0x0033, // [19] three
- 0x0034, // [20] four
- 0x0035, // [21] five
- 0x0036, // [22] six
- 0x0037, // [23] seven
- 0x0038, // [24] eight
- 0x0039, // [25] nine
- 0x003a, // [26] colon
- 0x003b, // [27] semicolon
- 0x003c, // [28] less
- 0x003d, // [29] equal
- 0x003e, // [30] greater
- 0x003f, // [31] question
- 0x0040, // [32] at
- 0x0041, // [33] A
- 0x0042, // [34] B
- 0x0043, // [35] C
- 0x0044, // [36] D
- 0x0045, // [37] E
- 0x0046, // [38] F
- 0x0047, // [39] G
- 0x0048, // [40] H
- 0x0049, // [41] I
- 0x004a, // [42] J
- 0x004b, // [43] K
- 0x004c, // [44] L
- 0x004d, // [45] M
- 0x004e, // [46] N
- 0x004f, // [47] O
- 0x0050, // [48] P
- 0x0051, // [49] Q
- 0x0052, // [50] R
- 0x0053, // [51] S
- 0x0054, // [52] T
- 0x0055, // [53] U
- 0x0056, // [54] V
- 0x0057, // [55] W
- 0x0058, // [56] X
- 0x0059, // [57] Y
- 0x005a, // [58] Z
- 0x005b, // [59] bracketleft
- 0x005c, // [60] backslash
- 0x005d, // [61] bracketright
- 0x005e, // [62] asciicircum
- 0x005f, // [63] underscore
- 0x0060, // [64] grave
- 0x0061, // [65] a
- 0x0062, // [66] b
- 0x0063, // [67] c
- 0x0064, // [68] d
- 0x0065, // [69] e
- 0x0066, // [70] f
- 0x0067, // [71] g
- 0x0068, // [72] h
- 0x0069, // [73] i
- 0x006a, // [74] j
- 0x006b, // [75] k
- 0x006c, // [76] l
- 0x006d, // [77] m
- 0x006e, // [78] n
- 0x006f, // [79] o
- 0x0070, // [80] p
- 0x0071, // [81] q
- 0x0072, // [82] r
- 0x0073, // [83] s
- 0x0074, // [84] t
- 0x0075, // [85] u
- 0x0076, // [86] v
- 0x0077, // [87] w
- 0x0078, // [88] x
- 0x0079, // [89] y
- 0x007a, // [90] z
- 0x007b, // [91] braceleft
- 0x007c, // [92] bar
- 0x007d, // [93] braceright
- 0x007e, // [94] asciitilde
- 0x00a1, // [95] exclamdown
- 0x00a2, // [96] cent
- 0x00a3, // [97] sterling
- 0x00a4, // [98] currency
- 0x00a5, // [99] yen
- 0x00a6, // [100] brokenbar
- 0x00a7, // [101] section
- 0x00a8, // [102] dieresis
- 0x00a9, // [103] copyright
- 0x00aa, // [104] ordfeminine
- 0x00ab, // [105] guillemotleft
- 0x00ac, // [106] logicalnot
- 0x00ae, // [107] registered
- 0x00af, // [108] macron
- 0x00b0, // [109] degree
- 0x00b1, // [110] plusminus
- 0x00b2, // [111] twosuperior
- 0x00b3, // [112] threesuperior
- 0x00b4, // [113] acute
- 0x00b5, // [114] mu
- 0x00b6, // [115] paragraph
- 0x00b7, // [116] periodcentered
- 0x00b8, // [117] cedilla
- 0x00b9, // [118] onesuperior
- 0x00ba, // [119] ordmasculine
- 0x00bb, // [120] guillemotright
- 0x00bc, // [121] onequarter
- 0x00bd, // [122] onehalf
- 0x00be, // [123] threequarters
- 0x00bf, // [124] questiondown
- 0x00c0, // [125] Agrave
- 0x00c1, // [126] Aacute
- 0x00c2, // [127] Acircumflex
- 0x00c3, // [128] Atilde
- 0x00c4, // [129] Adieresis
- 0x00c5, // [130] Aring
- 0x00c6, // [131] AE
- 0x00c7, // [132] Ccedilla
- 0x00c8, // [133] Egrave
- 0x00c9, // [134] Eacute
- 0x00ca, // [135] Ecircumflex
- 0x00cb, // [136] Edieresis
- 0x00cc, // [137] Igrave
- 0x00cd, // [138] Iacute
- 0x00ce, // [139] Icircumflex
- 0x00cf, // [140] Idieresis
- 0x00d0, // [141] Eth
- 0x00d1, // [142] Ntilde
- 0x00d2, // [143] Ograve
- 0x00d3, // [144] Oacute
- 0x00d4, // [145] Ocircumflex
- 0x00d5, // [146] Otilde
- 0x00d6, // [147] Odieresis
- 0x00d7, // [148] multiply
- 0x00d8, // [149] Oslash
- 0x00d9, // [150] Ugrave
- 0x00da, // [151] Uacute
- 0x00db, // [152] Ucircumflex
- 0x00dc, // [153] Udieresis
- 0x00dd, // [154] Yacute
- 0x00de, // [155] Thorn
- 0x00df, // [156] germandbls
- 0x00e0, // [157] agrave
- 0x00e1, // [158] aacute
- 0x00e2, // [159] acircumflex
- 0x00e3, // [160] atilde
- 0x00e4, // [161] adieresis
- 0x00e5, // [162] aring
- 0x00e6, // [163] ae
- 0x00e7, // [164] ccedilla
- 0x00e8, // [165] egrave
- 0x00e9, // [166] eacute
- 0x00ea, // [167] ecircumflex
- 0x00eb, // [168] edieresis
- 0x00ec, // [169] igrave
- 0x00ed, // [170] iacute
- 0x00ee, // [171] icircumflex
- 0x00ef, // [172] idieresis
- 0x00f0, // [173] eth
- 0x00f1, // [174] ntilde
- 0x00f2, // [175] ograve
- 0x00f3, // [176] oacute
- 0x00f4, // [177] ocircumflex
- 0x00f5, // [178] otilde
- 0x00f6, // [179] odieresis
- 0x00f7, // [180] divide
- 0x00f8, // [181] oslash
- 0x00f9, // [182] ugrave
- 0x00fa, // [183] uacute
- 0x00fb, // [184] ucircumflex
- 0x00fc, // [185] udieresis
- 0x00fd, // [186] yacute
- 0x00fe, // [187] thorn
- 0x00ff, // [188] ydieresis
- 0x0100, // [189] Amacron
- 0x0101, // [190] amacron
- 0x0102, // [191] Abreve
- 0x0103, // [192] abreve
- 0x0104, // [193] Aogonek
- 0x0105, // [194] aogonek
- 0x0106, // [195] Cacute
- 0x0107, // [196] cacute
- 0x010c, // [197] Ccaron
- 0x010d, // [198] ccaron
- 0x010e, // [199] Dcaron
- 0x010f, // [200] dcaron
- 0x0110, // [201] Dcroat
- 0x0111, // [202] dcroat
- 0x0112, // [203] Emacron
- 0x0113, // [204] emacron
- 0x0116, // [205] Edotaccent
- 0x0117, // [206] edotaccent
- 0x0118, // [207] Eogonek
- 0x0119, // [208] eogonek
- 0x011a, // [209] Ecaron
- 0x011b, // [210] ecaron
- 0x011e, // [211] Gbreve
- 0x011f, // [212] gbreve
- 0x0122, // [213] Gcommaaccent
- 0x0123, // [214] gcommaaccent
- 0x012a, // [215] Imacron
- 0x012b, // [216] imacron
- 0x012e, // [217] Iogonek
- 0x012f, // [218] iogonek
- 0x0130, // [219] Idotaccent
- 0x0131, // [220] dotlessi
- 0x0136, // [221] Kcommaaccent
- 0x0137, // [222] kcommaaccent
- 0x0139, // [223] Lacute
- 0x013a, // [224] lacute
- 0x013b, // [225] Lcommaaccent
- 0x013c, // [226] lcommaaccent
- 0x013d, // [227] Lcaron
- 0x013e, // [228] lcaron
- 0x0141, // [229] Lslash
- 0x0142, // [230] lslash
- 0x0143, // [231] Nacute
- 0x0144, // [232] nacute
- 0x0145, // [233] Ncommaaccent
- 0x0146, // [234] ncommaaccent
- 0x0147, // [235] Ncaron
- 0x0148, // [236] ncaron
- 0x014c, // [237] Omacron
- 0x014d, // [238] omacron
- 0x0150, // [239] Ohungarumlaut
- 0x0151, // [240] ohungarumlaut
- 0x0152, // [241] OE
- 0x0153, // [242] oe
- 0x0154, // [243] Racute
- 0x0155, // [244] racute
- 0x0156, // [245] Rcommaaccent
- 0x0157, // [246] rcommaaccent
- 0x0158, // [247] Rcaron
- 0x0159, // [248] rcaron
- 0x015a, // [249] Sacute
- 0x015b, // [250] sacute
- 0x015e, // [251] Scedilla
- 0x015f, // [252] scedilla
- 0x0160, // [253] Scaron
- 0x0161, // [254] scaron
- 0x0162, // [255] Tcommaaccent
- 0x0163, // [256] tcommaaccent
- 0x0164, // [257] Tcaron
- 0x0165, // [258] tcaron
- 0x016a, // [259] Umacron
- 0x016b, // [260] umacron
- 0x016e, // [261] Uring
- 0x016f, // [262] uring
- 0x0170, // [263] Uhungarumlaut
- 0x0171, // [264] uhungarumlaut
- 0x0172, // [265] Uogonek
- 0x0173, // [266] uogonek
- 0x0178, // [267] Ydieresis
- 0x0179, // [268] Zacute
- 0x017a, // [269] zacute
- 0x017b, // [270] Zdotaccent
- 0x017c, // [271] zdotaccent
- 0x017d, // [272] Zcaron
- 0x017e, // [273] zcaron
- 0x0192, // [274] florin
- 0x0218, // [275] Scommaaccent
- 0x0219, // [276] scommaaccent
- 0x02c6, // [277] circumflex
- 0x02c7, // [278] caron
- 0x02d8, // [279] breve
- 0x02d9, // [280] dotaccent
- 0x02da, // [281] ring
- 0x02db, // [282] ogonek
- 0x02dc, // [283] tilde
- 0x02dd, // [284] hungarumlaut
- 0x2013, // [285] endash
- 0x2014, // [286] emdash
- 0x2018, // [287] quoteleft
- 0x2019, // [288] quoteright
- 0x201a, // [289] quotesinglbase
- 0x201c, // [290] quotedblleft
- 0x201d, // [291] quotedblright
- 0x201e, // [292] quotedblbase
- 0x2020, // [293] dagger
- 0x2021, // [294] daggerdbl
- 0x2022, // [295] bullet
- 0x2026, // [296] ellipsis
- 0x2030, // [297] perthousand
- 0x2039, // [298] guilsinglleft
- 0x203a, // [299] guilsinglright
- 0x2044, // [300] fraction
- 0x20ac, // [301] Euro
- 0x2122, // [302] trademark
- 0x2202, // [303] partialdiff
- 0x2206, // [304] Delta
- 0x2211, // [305] summation
- 0x2212, // [306] minus
- 0x221a, // [307] radical
- 0x2260, // [308] notequal
- 0x2264, // [309] lessequal
- 0x2265, // [310] greaterequal
- 0x25ca, // [311] lozenge
- 0xf6c3, // [312] commaaccent
- 0xfb01, // [313] fi
- 0xfb02 // [314] fl
- };
-
- /** The singleton instance. */
- private static CharSetExtendedRoman theInstance;
-
- /**
- * Constructor.
- */
- private CharSetExtendedRoman() {
- super("ExtendedRoman", CharSetExtendedRoman.CHARACTER_SET);
- }
-
- /**
- * Returns the singleton instance of this class.
- * @return The singleton isntance of this class.
- */
- public static CharSetExtendedRoman getInstance() {
- if (CharSetExtendedRoman.theInstance == null) {
- CharSetExtendedRoman.theInstance = new CharSetExtendedRoman();
- }
- return CharSetExtendedRoman.theInstance;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isStatic() {
- return true;
- }
-
- /**
- * Method ensuring that the singleton nature of this class is not broken by
- * deserialization.
- * @return The singleton instance, ignoring any object stream input.
- * @throws ObjectStreamException
- */
- private Object readResolve() {
- return CharSetExtendedRoman.getInstance();
- }
-
-}
Deleted: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java 2009-04-29 01:08:24 UTC (rev 10795)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java 2009-04-29 15:04:36 UTC (rev 10796)
@@ -1,319 +0,0 @@
-/*
- * Copyright 2005 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.font.charset;
-
-import org.foray.common.Logging;...
[truncated message content] |
|
From: <vic...@us...> - 2009-04-29 16:05:50
|
Revision: 10797
http://foray.svn.sourceforge.net/foray/?rev=10797&view=rev
Author: victormote
Date: 2009-04-29 16:05:47 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Rebuild the font resources library jar to reflect recent changes in location of CharSet classes.
Modified Paths:
--------------
trunk/foray/foray-font/.classpath
Added Paths:
-----------
trunk/foray/lib/foray-font-0.4-rsrc.jar
Removed Paths:
-------------
trunk/foray/lib/foray-font-0.3-rsrc.jar
Modified: trunk/foray/foray-font/.classpath
===================================================================
--- trunk/foray/foray-font/.classpath 2009-04-29 15:04:36 UTC (rev 10796)
+++ trunk/foray/foray-font/.classpath 2009-04-29 16:05:47 UTC (rev 10797)
@@ -9,12 +9,12 @@
<classpathentry kind="src" path="/axslPs"/>
<classpathentry kind="src" path="/axslCommon"/>
<classpathentry combineaccessrules="false" kind="src" path="/FOrayPretty"/>
- <classpathentry kind="lib" path="/FOray Lib/foray-font-0.3-rsrc.jar"/>
<classpathentry kind="lib" path="/FOray Lib/xercesImpl-2.7.1.jar" sourcepath="/FOray Lib-Build/xerces/Xerces-J-src.2.7.1.zip"/>
<classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib-Build/ant/ant.jar"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit-4.4.jar" sourcepath="/FOray Lib-Build/junit/junit-4.4-src.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.4.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.4-sources.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-discovery-0.4.jar" sourcepath="/FOray Lib-Build/commons-discovery"/>
+ <classpathentry kind="lib" path="/FOray Lib/foray-font-0.4-rsrc.jar"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Deleted: trunk/foray/lib/foray-font-0.3-rsrc.jar
===================================================================
(Binary files differ)
Added: trunk/foray/lib/foray-font-0.4-rsrc.jar
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib/foray-font-0.4-rsrc.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|