foray-commit Mailing List for FOray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
(13) |
3
(24) |
4
(9) |
5
(18) |
6
(7) |
7
(17) |
|
8
(2) |
9
(13) |
10
(8) |
11
(2) |
12
(9) |
13
(10) |
14
(4) |
|
15
|
16
|
17
(5) |
18
(23) |
19
(20) |
20
(7) |
21
(1) |
|
22
(6) |
23
(12) |
24
(5) |
25
(2) |
26
(6) |
27
(4) |
28
(8) |
|
29
|
30
(12) |
|
|
|
|
|
|
From: <vic...@us...> - 2007-04-30 23:39:20
|
Revision: 9303
http://svn.sourceforge.net/foray/?rev=9303&view=rev
Author: victormote
Date: 2007-04-30 16:39:20 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Make use of the serialized afm files switchable (they are not being read correctly).
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2007-04-30 23:36:18 UTC (rev 9302)
+++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2007-04-30 23:39:20 UTC (rev 9303)
@@ -406,41 +406,75 @@
this.registerFontFamily("Base14-ZapfDingbats");
/* Register the fonts. */
- registerBase14Font("Base14-Courier", "Courier.afm");
- registerBase14Font("Base14-Courier-Oblique", "Courier-Oblique.afm");
- registerBase14Font("Base14-Courier-Bold", "Courier-Bold.afm");
+ registerBase14Font("Base14-Courier", "Courier");
+ registerBase14Font("Base14-Courier-Oblique", "Courier-Oblique");
+ registerBase14Font("Base14-Courier-Bold", "Courier-Bold");
registerBase14Font("Base14-Courier-BoldOblique",
- "Courier-BoldOblique.afm");
- registerBase14Font("Base14-Helvetica", "Helvetica.afm");
- registerBase14Font("Base14-Helvetica-Oblique", "Helvetica-Oblique.afm");
- registerBase14Font("Base14-Helvetica-Bold", "Helvetica-Bold.afm");
+ "Courier-BoldOblique");
+ registerBase14Font("Base14-Helvetica", "Helvetica");
+ registerBase14Font("Base14-Helvetica-Oblique",
+ "Helvetica-Oblique");
+ registerBase14Font("Base14-Helvetica-Bold", "Helvetica-Bold");
registerBase14Font("Base14-Helvetica-BoldOblique",
- "Helvetica-BoldOblique.afm");
- registerBase14Font("Base14-Times", "Times-Roman.afm");
- registerBase14Font("Base14-Times-Italic", "Times-Italic.afm");
- registerBase14Font("Base14-Times-Bold", "Times-Bold.afm");
- registerBase14Font("Base14-Times-BoldItalic", "Times-BoldItalic.afm");
- registerBase14Font("Base14-Symbol", "Symbol.afm");
- registerBase14Font("Base14-ZapfDingbats", "ZapfDingbats.afm");
+ "Helvetica-BoldOblique");
+ registerBase14Font("Base14-Times", "Times-Roman");
+ registerBase14Font("Base14-Times-Italic", "Times-Italic");
+ registerBase14Font("Base14-Times-Bold", "Times-Bold");
+ registerBase14Font("Base14-Times-BoldItalic", "Times-BoldItalic");
+ registerBase14Font("Base14-Symbol", "Symbol");
+ registerBase14Font("Base14-ZapfDingbats", "ZapfDingbats");
}
/**
- * Registeres one base-14 font.
+ * Registers one base-14 font.
* @param fontName The name of the font to register.
* @param fileName The name of the file from which metrics should be
* obtained.
*/
private void registerBase14Font(final String fontName,
final String fileName) {
+ final boolean useSerialized = false;
+ String extension = null;
+ if (useSerialized) {
+ extension = "jbso";
+ } else {
+ extension = "afm";
+ }
final String resourceName = "org/foray/font/resource/base-14/"
- + fileName;
+ + fileName + "." + extension;
final ClassLoader loader = ClassLoader.getSystemClassLoader();
final URL metricURL = loader.getResource(resourceName);
+
+ if (metricURL == null) {
+ if (useSerialized) {
+ this.getLogger().warn("Serialized Base-14 font metrics not "
+ + "found: " + resourceName);
+ } else {
+ this.getLogger().warn("Base-14 font metrics not "
+ + "found: " + resourceName);
+ }
+ return;
+ }
+ RegisteredFont rf = null;
try {
- registerFont(fontName, null, metricURL, null, "none", null);
+ if (useSerialized) {
+ rf = new RegisteredFont(this, fontName,
+ null, null, null, "none", null);
+ } else {
+ final MetricsFileReader metricFileReader
+ = new MetricsFileReader(this.getLogger(), metricURL);
+ rf = new RegisteredFont(this, fontName,
+ null, metricFileReader, null, "none", null);
+ }
+
} catch (final FontException e) {
this.logger.warn(e);
+ } catch (final IOException e) {
+ this.logger.warn(e);
}
+ if (useSerialized) {
+ rf.setSerializedMetricsFile(metricURL);
+ }
}
/**
@@ -1035,8 +1069,9 @@
throw new FontException(e);
}
}
- new RegisteredFont(this, fontID, fontFileReader, metricsFileReader,
- collectionID, embed, systemName);
+ new RegisteredFont(this, fontID,
+ fontFileReader, metricsFileReader, collectionID, embed,
+ systemName);
}
/**
@@ -1068,8 +1103,9 @@
throw new FontException(e);
}
}
- new RegisteredFont(this, fontID, fontFileReader, metricsFileReader,
- collectionID, embed, systemName);
+ new RegisteredFont(this, fontID,
+ fontFileReader, metricsFileReader, collectionID, embed,
+ systemName);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 23:36:32
|
Revision: 9302
http://svn.sourceforge.net/foray/?rev=9302&view=rev
Author: victormote
Date: 2007-04-30 16:36:18 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Fix bug preventing the font instance from being created.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2007-04-30 23:35:47 UTC (rev 9301)
+++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2007-04-30 23:36:18 UTC (rev 9302)
@@ -167,7 +167,7 @@
throw new FontException("Unknown Metric Format: "
+ reader.getDescription());
}
- if (this.metricsFile.getInternalEncoding() == null) {
+ if (metricsFile.getInternalEncoding() == null) {
throw new FontException("Unusable Internal Encoding: "
+ reader.getDescription());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 23:35:47
|
Revision: 9301
http://svn.sourceforge.net/foray/?rev=9301&view=rev
Author: victormote
Date: 2007-04-30 16:35:47 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Avoid instantiating the non-preferred manifestation of the font if it is not needed.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2007-04-30 23:17:54 UTC (rev 9300)
+++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2007-04-30 23:35:47 UTC (rev 9301)
@@ -371,25 +371,29 @@
protected FOrayFont whichUse(final RegisteredFontDesc rfd,
final int codePoint) {
final RegisteredFont rf = rfd.getRegisteredFont();
- final FreeStandingFont fsf = eligibleFreeStandingFont(rfd, codePoint);
- final SystemFont sf = eligibleSystemFont(rf, codePoint);
- /* Consumer uses and prefers FreeStandingFont and it is available. */
- if (fsf != null
- && preferFreeStandingFonts()) {
- return fsf;
+
+ /* Avoid instantiating the non-preferred manifestation if it won't be
+ * used anyway. */
+ FreeStandingFont fsf = null;
+ SystemFont sf = null;
+
+ if (preferFreeStandingFonts()) {
+ /* Consumer prefers FreeStandingFont. */
+ fsf = eligibleFreeStandingFont(rfd, codePoint);
+ if (fsf != null) {
+ /* It is available. */
+ return fsf;
+ }
+ return eligibleSystemFont(rf, codePoint);
+ } else {
+ /* Consumer prefers SystemFont. */
+ sf = eligibleSystemFont(rf, codePoint);
+ if (sf != null) {
+ /* It is available. */
+ return sf;
+ }
+ return eligibleFreeStandingFont(rfd, codePoint);
}
- /* Consumer uses and prefers SystemFont and it is available. */
- if (sf != null
- && ! preferFreeStandingFonts()) {
- return sf;
- }
- /* The RegistedFontDesc cannot even be selected if it can't satisfy the
- * "isUsing" methods, so all we care about is whether there is an
- * instance to return or not. */
- if (fsf != null) {
- return fsf;
- }
- return sf;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 23:17:52
|
Revision: 9300
http://svn.sourceforge.net/foray/?rev=9300&view=rev
Author: victormote
Date: 2007-04-30 16:17:54 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Upgrade the classpath to include the new serialized afm files.
Modified Paths:
--------------
trunk/foray/foray-font/.classpath
Modified: trunk/foray/foray-font/.classpath
===================================================================
--- trunk/foray/foray-font/.classpath 2007-04-30 23:16:43 UTC (rev 9299)
+++ trunk/foray/foray-font/.classpath 2007-04-30 23:17:54 UTC (rev 9300)
@@ -13,5 +13,6 @@
<classpathentry kind="var" path="FORAY_LIB_ROOT/commons-io-1.2.jar"/>
<classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
<classpathentry kind="var" path="FORAY_LIB_ROOT/foray-font-0.2-rsrc.jar"/>
+ <classpathentry kind="var" path="FORAY_LIB_ROOT/foray-font-0.3-rsrc.jar"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 23:16:43
|
Revision: 9299
http://svn.sourceforge.net/foray/?rev=9299&view=rev
Author: victormote
Date: 2007-04-30 16:16:43 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Add logic to deserialize a serialized metrics file if necessary.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2007-04-30 23:15:33 UTC (rev 9298)
+++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2007-04-30 23:16:43 UTC (rev 9299)
@@ -43,6 +43,9 @@
import org.axsl.fontR.FontException;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.net.URL;
/**
* Class representing FreeStanding Type 1 fonts.
@@ -104,17 +107,7 @@
* @throws FontException For errors during font parsing.
*/
public void parseFont() throws FontException {
- final MetricsFileReader reader = this.getRegisteredFont()
- .getMetricsFileReader();
- this.metricsFile = reader.metricsFileFactory();
- if (this.metricsFile == null) {
- throw new FontException("Unknown Metric Format: "
- + reader.getDescription());
- }
- if (this.metricsFile.getInternalEncoding() == null) {
- throw new FontException("Unusable Internal Encoding: "
- + reader.getDescription());
- }
+ this.metricsFile = this.getMetricsFile();
this.setFontComplexity(Font.Complexity.SIMPLE);
this.setPostscriptName(this.metricsFile.getPostscriptName());
this.setFontName(this.metricsFile.getFontName());
@@ -158,6 +151,57 @@
}
/**
+ * Finds the metrics file for this font.
+ * @return The metrics file for this font.
+ * @throws FontException For errors reading or parsing the metrics file.
+ */
+ private MetricsFile getMetricsFile() throws FontException {
+ MetricsFile metricsFile = null;
+ final URL serializedMetricsFile = this.getRegisteredFont()
+ .getSerializedMetricsFile();
+ if (serializedMetricsFile == null) {
+ final MetricsFileReader reader = this.getRegisteredFont()
+ .getMetricsFileReader();
+ metricsFile = reader.metricsFileFactory();
+ if (metricsFile == null) {
+ throw new FontException("Unknown Metric Format: "
+ + reader.getDescription());
+ }
+ if (this.metricsFile.getInternalEncoding() == null) {
+ throw new FontException("Unusable Internal Encoding: "
+ + reader.getDescription());
+ }
+ return metricsFile;
+ } else {
+ try {
+ metricsFile = deserializeMetricsFile();
+ } catch (final IOException e) {
+ throw new FontException(e);
+ } catch (final ClassNotFoundException e) {
+ throw new FontException(e);
+ }
+ }
+ return metricsFile;
+ }
+
+ /**
+ * Deserializes a serialized metrics file.
+ * @return The deserialized metrics file.
+ * @throws IOException For I/O errors.
+ * @throws ClassNotFoundException If the serialization class is not found.
+ */
+ private MetricsFile deserializeMetricsFile() throws IOException,
+ ClassNotFoundException {
+ final URL serializedMetricsFile = this.getRegisteredFont()
+ .getSerializedMetricsFile();
+
+ final InputStream is = serializedMetricsFile.openStream();
+ final ObjectInputStream ois = new ObjectInputStream(is);
+ final MetricsFile metricsFile = (MetricsFile) ois.readObject();
+ return metricsFile;
+ }
+
+ /**
* {@inheritDoc}
*/
public int[] getFontBBox() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 23:16:32
|
Revision: 9298
http://svn.sourceforge.net/foray/?rev=9298&view=rev
Author: victormote
Date: 2007-04-30 16:15:33 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Add field for serialized metrics file.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2007-04-30 20:03:21 UTC (rev 9297)
+++ trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java 2007-04-30 23:15:33 UTC (rev 9298)
@@ -37,6 +37,8 @@
import org.apache.commons.logging.Log;
+import java.net.URL;
+
/**
* <p>Class representing a font that has been registered for use with FOray.
* RegisteredFont is not really a Font, as it is not part of the Font hierarcy
@@ -103,9 +105,13 @@
* {@link FOrayFont#FORMAT_TRUETYPE}. */
private Font.Format fontFormat = Font.Format.UNKNOWN;
- /** URL to the font metrics file, if any. */
- private MetricsFileReader metricsFile = null;
+ /** The MetricsFileReader used for parsing the metrics file, if any. */
+ private MetricsFileReader metricsFileReader = null;
+ /** The serialized metrics file. This will be null if the font is not a
+ * Type 1 font, or if its metrics file is not serialized. */
+ private URL serializedMetricsFile;
+
/**
* Set to true if the configuration file has requested that this font be
* embedded.
@@ -161,7 +167,7 @@
this.configuredFontName = fontName;
this.fontFileReader = fontFileReader;
this.ttcName = ttcName;
- this.metricsFile = metricsFileURL;
+ this.metricsFileReader = metricsFileURL;
if (embedding == null) {
this.embedding = false;
this.subsetting = false;
@@ -291,7 +297,7 @@
* @return The metrics file reader.
*/
protected MetricsFileReader getMetricsFileReader() {
- return this.metricsFile;
+ return this.metricsFileReader;
}
/**
@@ -361,9 +367,12 @@
if (this.fontFileReader != null) {
return true;
}
- if (this.metricsFile != null) {
+ if (this.metricsFileReader != null) {
return true;
}
+ if (this.serializedMetricsFile != null) {
+ return true;
+ }
return false;
}
@@ -394,4 +403,21 @@
return null;
}
+ /**
+ * Returns the serialized metrics file.
+ * @return The serialized metrics file, or null if the there is no metrics
+ * file or if the metrics file is not serialized.
+ */
+ protected URL getSerializedMetricsFile() {
+ return this.serializedMetricsFile;
+ }
+
+ /**
+ * Sets the serialized metrics file.
+ * @param serializedMetricsFile The new serialized metrics file.
+ */
+ protected void setSerializedMetricsFile(final URL serializedMetricsFile) {
+ this.serializedMetricsFile = serializedMetricsFile;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 20:03:22
|
Revision: 9297
http://svn.sourceforge.net/foray/?rev=9297&view=rev
Author: victormote
Date: 2007-04-30 13:03:21 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Make Kerning serializable.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java 2007-04-30 19:53:57 UTC (rev 9296)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java 2007-04-30 20:03:21 UTC (rev 9297)
@@ -28,6 +28,8 @@
package org.foray.font.format;
+import java.io.Serializable;
+
/**
* Manages the storage and retrieval of kerning information for a font.
* Use {@link #addKerningEntry(int, int, short)} to add kerning pairs.
@@ -35,7 +37,7 @@
* Kerning information cannot be retrieved until the instance is locked. Once
* it is locked, no more kerning entries can be added to it.
*/
-public class Kerning {
+public class Kerning implements Serializable {
/*
* This class maintins 2 sets of three parallel arrays. One set is used
* for kerning pairs where both code points are less than or equal to
@@ -54,6 +56,9 @@
* memory consumption is minimized.
*/
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 509780044800725684L;
+
/** Constant indicating the number of new entries that should be added to
* the arrays when they have to be resized. */
private static final byte ARRAY_SIZE_INCREMENT = 10;
@@ -78,12 +83,14 @@
* kerning pairs. */
private short[] kernAmount16;
- /** Stores the index to the last kerning entry that was added. */
+ /** Stores the index to the last kerning entry that was added. Note that
+ * this index is used only as the kerning pairs are added. Separate indexes
+ * are used for the 16- and 32-bit entries when they are split up during
+ * the locking process. */
private int lastIndex = -1;
- /* TODO: It looks like we should have a separate lastIndex for 32-bit
- * pairs. */
- /** Only the method {@link #lock()} should set this variable. */
+ /** Indicates whether this instance has been locked.
+ * Only the method {@link #lock()} should set this variable. */
private boolean isLocked = false;
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 19:53:58
|
Revision: 9296
http://svn.sourceforge.net/foray/?rev=9296&view=rev
Author: victormote
Date: 2007-04-30 12:53:57 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Push data down from abstract superclass to the subclasses, primarily to make serialization more straightforward, but also to clean it up and to move the normalization to the abstract methods instead of the data.
Modified Paths:
--------------
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
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java 2007-04-30 17:49:24 UTC (rev 9295)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java 2007-04-30 19:53:57 UTC (rev 9296)
@@ -28,13 +28,9 @@
package org.foray.font.format;
-import org.foray.common.Bit;
import org.foray.font.charset.CharSet;
-import org.foray.font.output.FOrayFontPDF;
import org.foray.ps.encode.EncodingVector;
-import org.axsl.psR.BoundingBox;
-
import java.io.IOException;
/**
@@ -67,80 +63,21 @@
/** Constant used to estimate the lower-left X value of the bbox for
* fixed-width fonts. */
- private static final int EST_BBOX_LL_X_FIXED = -20;
+ protected static final int EST_BBOX_LL_X_FIXED = -20;
/** Constant used to estimate the lower-left X value of the bbox for
* proportional fonts. */
- private static final int EST_BBOX_LL_X_PROPORTIONAL = -100;
+ protected static final int EST_BBOX_LL_X_PROPORTIONAL = -100;
/** Constant used to estimate the lower-left Y value of the bbox. */
- private static final int EST_BBOX_LL_Y_ADJUST = 5;
+ protected static final int EST_BBOX_LL_Y_ADJUST = 5;
/** Constant used to estimate the upper-right X value of the bbox. */
- private static final int EST_BBOX_UR_X_ADJUST = 10;
+ protected static final int EST_BBOX_UR_X_ADJUST = 10;
/** Constant used to estimate the upper-right Y value of the bbox. */
- private static final int EST_BBOX_UR_Y_ADJUST = 5;
+ protected static final int EST_BBOX_UR_Y_ADJUST = 5;
- /** The parsed font name. */
- private String fontName;
-
- /** The parsed postscript name. */
- private String postscriptName;
-
- /** The parsed font-family name. */
- private String fontFamilyName;
-
- /** The parsed italic value. Contains a 1 if the font is italic, otherwise a
- * 0. */
- private short dfItalic;
-
- /** The parsed font weight. */
- private int dfWeight;
-
- /** The parsed character set identifier. */
- private int dfCharSet;
-
- /** The parsed pitch and family identifier. */
- private int dfPitchAndFamily;
-
- /** The parsed average glyph width. */
- private int dfAvgWidth;
-
- /** The parsed maximum glyph width. */
- private int dfMaxWidth;
-
- /** The parsed minimum glyph width. */
- private int dfMinWidth;
-
- /** The parsed bounding box. */
- private int[] fontBBox = new int[BoundingBox.BBOX_ENTRIES];
-
- /** The parsed cap height. */
- private int etmCapHeight;
-
- /** The parsed x height. */
- private int etmXHeight;
-
- /** The parsed lowercase ascent. */
- private int etmLowerCaseAscent;
-
- /** The parsed uppercase descent.
- * Note that PFM stores this value as a positive amount, AFM stores it as a
- * negative. The setter methods adjust accordingly. */
- private int etmLowerCaseDescent;
-
- /** The parsed italic angle.
- * Used for italic or oblique fonts to indicate the angle of the glyphs,
- * expressed in degrees counterclockwise from upright. */
- private float etmSlant;
-
- /** The parsed extent table. */
- private short[] extentTable;
-
- /** The parsed kerning table. */
- private Kerning kerning;
-
/**
* Constructor. Parses the passed file and returns it as an object.
*/
@@ -157,60 +94,27 @@
* Returns the name of the font.
* @return The name of this font.
*/
- public String getFontName() {
- return this.fontName;
- }
+ public abstract String getFontName();
/**
- * Sets the font name for this font.
- * @param fontName The name of this font.
- */
- protected void setFontName(final String fontName) {
- this.fontName = fontName;
- }
-
- /**
* Returns the name of the font's font-family.
* @return The name of the font's font-family.
*/
- public String getFontFamilyName() {
- return this.fontFamilyName;
- }
+ public abstract String getFontFamilyName();
/**
- * Sets the font-family name for this font.
- * @param fontFamilyName The new font-family name.
- */
- protected void setFontFamilyName(final String fontFamilyName) {
- this.fontFamilyName = fontFamilyName;
- }
-
- /**
* Return the kerning table.
* @return The kerning information parsed from this file.
*/
- public Kerning getKerning() {
- return this.kerning;
- }
+ public abstract Kerning getKerning();
/**
* Returns the Postscript name of the font.
- *
* @return The Postscript name.
*/
- public String getPostscriptName() {
- return this.postscriptName;
- }
+ public abstract String getPostscriptName();
/**
- * Sets the PostScript name for this font.
- * @param postscriptName The new PostScript name for this font.
- */
- protected void setPostscriptName(final String postscriptName) {
- this.postscriptName = postscriptName;
- }
-
- /**
* Returns the name of the font's encoding vector, e.g. "StandardEncoding".
* @return The name of the font's encoding vector.
*/
@@ -218,31 +122,22 @@
/**
* Returns the CapHeight parameter for the font (height of uppercase H).
- *
* @return The CapHeight parameter.
*/
- public int getCapHeight() {
- return this.etmCapHeight;
- }
+ public abstract int getCapHeight();
/**
* Returns the XHeight parameter for the font (height of lowercase x).
- *
* @return The CapHeight parameter.
*/
- public int getXHeight() {
- return this.etmXHeight;
- }
+ public abstract int getXHeight();
/**
* Returns the LowerCaseAscent parameter for the font (height of
* lowercase d).
- *
* @return The LowerCaseAscent parameter.
*/
- public int getLowerCaseAscent() {
- return this.etmLowerCaseAscent;
- }
+ public abstract int getLowerCaseAscent();
/**
* Returns the LowerCaseDescent parameter for the font (distance below the
@@ -250,9 +145,7 @@
* number.
* @return The LowerCaseDescent parameter.
*/
- public int getLowerCaseDescent() {
- return this.etmLowerCaseDescent;
- }
+ public abstract int getLowerCaseDescent();
/**
@@ -264,64 +157,24 @@
/**
* Returns the bounding box for the font.
- * Note: this value is just an approximation,
- * it does not really exist in the PFM file.
- *
+ * Note: this value is just an approximation, it does not really exist in
+ * the PFM file.
* @return The calculated Font BBox.
*/
- public int[] getFontBBox() {
- final int[] bbox = new int[BoundingBox.BBOX_ENTRIES];
+ public abstract int[] getFontBBox();
- // Just guessing....
- if (!getIsProportional() && (this.dfAvgWidth == this.dfMaxWidth)) {
- bbox[BoundingBox.BBOX_LOWER_LEFT_X_INDEX] = EST_BBOX_LL_X_FIXED;
- } else {
- bbox[BoundingBox.BBOX_LOWER_LEFT_X_INDEX] =
- EST_BBOX_LL_X_PROPORTIONAL;
- }
- bbox[BoundingBox.BBOX_LOWER_LEFT_Y_INDEX] = -(getLowerCaseDescent()
- + EST_BBOX_LL_Y_ADJUST);
- bbox[BoundingBox.BBOX_UPPER_RIGHT_X_INDEX] = this.dfMaxWidth
- + EST_BBOX_UR_X_ADJUST;
- bbox[BoundingBox.BBOX_UPPER_RIGHT_Y_INDEX] = getLowerCaseAscent()
- + EST_BBOX_UR_Y_ADJUST;
- return bbox;
- }
-
/**
* Returns the characteristics flags for the font as
* needed for a PDF font descriptor (See PDF specs).
- *
* @return The characteristics flags.
*/
- public int getFlags() {
- int flags = 0x00;
- if (!getIsProportional()) {
- flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_FIXED_PITCH - 1);
- }
- if (isSerif()) {
- flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_SERIF - 1);
- }
- if (isPDFSymbolic()) {
- flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_SYMBOLIC - 1);
- }
- if (isScript()) {
- flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_SCRIPT - 1);
- }
- if (! isPDFSymbolic()) {
- flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_NONSYMBOLIC - 1);
- }
- if (this.dfItalic != 0) {
- flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_ITALIC - 1);
- }
- return flags;
- }
+ public abstract int getFlags();
/**
* Indicates whether this font is considered to be a symbolic font by PDF.
* @return True iff this font is considered to be a symbolic font by PDF.
*/
- private boolean isPDFSymbolic() {
+ protected boolean isPDFSymbolic() {
if (getEncoding().equals("AdobeStandardEncoding")) {
return false;
}
@@ -332,19 +185,13 @@
* Indicates whether this font is a serif font.
* @return True iff this font has serifs.
*/
- private boolean isSerif() {
- return (this.dfPitchAndFamily & PITCH_FAMILY_ROMAN_MASK)
- == PITCH_FAMILY_ROMAN_MASK;
- }
+ public abstract boolean isSerif();
/**
* Indicates whether this font is a script font.
* @return True iff this font is a script font.
*/
- private boolean isScript() {
- return (this.dfPitchAndFamily & PITCH_FAMILY_SCRIPT_MASK)
- == PITCH_FAMILY_SCRIPT_MASK;
- }
+ public abstract boolean isScript();
/**
* Returns the width of the dominant vertical stems of the font.
@@ -360,21 +207,16 @@
/**
* Returns the italic angle of the font.
- *
* @return The italic angle, expressed in degrees counterclockwise from
* upright.
*/
- public float getItalicAngle() {
- return this.etmSlant;
- }
+ public abstract float getItalicAngle();
/**
* Returns the character widths for this font.
* @return The character widths for this font.
*/
- public short[] getCharWidths() {
- return this.extentTable;
- }
+ public abstract short[] getCharWidths();
/**
* Returns the character set for this font.
@@ -395,184 +237,45 @@
public abstract String getUniqueID();
/**
- * Set the etm Slant.
- * @param etmSlant The etmSlant to set.
- */
- protected void setEtmSlant(final float etmSlant) {
- this.etmSlant = etmSlant;
- }
-
- /**
* Get the italic value.
* @return The italic value.
*/
- public short getItalic() {
- return this.dfItalic;
- }
+ public abstract short getItalic();
/**
- * Set the italic value.
- * @param italic The new italic value.
- */
- protected void setItalic(final short italic) {
- this.dfItalic = italic;
- }
-
- /**
* Returns the weight of this font.
* @return The weight of this font.
*/
- protected int getWeight() {
- return this.dfWeight;
- }
+ protected abstract int getWeight();
/**
- * Sets the weight of this font.
- * @param weight The weight to set.
- */
- protected void setWeight(final int weight) {
- this.dfWeight = weight;
- }
-
- /**
* Returns the character set for this font.
* @return The character set for this font.
*/
- public int getCharSetID() {
- return this.dfCharSet;
- }
+ public abstract int getCharSetID();
/**
- * Set the character set for this font.
- * @param charSet The dfCharSet to set.
- */
- protected void setCharSet(final int charSet) {
- this.dfCharSet = charSet;
- }
-
- /**
- * Sets the average width.
- * @param avgWidth The average width to set.
- */
- protected void setAvgWidth(final int avgWidth) {
- this.dfAvgWidth = avgWidth;
- }
-
- /**
* Returns the max width.
* @return The max width.
*/
- protected int getMaxWidth() {
- return this.dfMaxWidth;
- }
+ protected abstract int getMaxWidth();
/**
- * Set the max width.
- * @param maxWidth The max width to set.
- */
- protected void setMaxWidth(final int maxWidth) {
- this.dfMaxWidth = maxWidth;
- }
-
- /**
* Returns the min width.
* @return The min width.
*/
- protected int getMinWidth() {
- return this.dfMinWidth;
- }
+ protected abstract int getMinWidth();
/**
- * Set the min width.
- * @param minWidth The min width to set.
- */
- protected void setMinWidth(final int minWidth) {
- this.dfMinWidth = minWidth;
- }
-
- /**
* Returns the pitch and family.
* @return The pitch and family.
*/
- protected int getPitchAndFamily() {
- return this.dfPitchAndFamily;
- }
+ protected abstract int getPitchAndFamily();
/**
- * Set the pitch and family.
- * @param pitchAndFamily The pitch and family to set.
- */
- protected void setPitchAndFamily(final int pitchAndFamily) {
- this.dfPitchAndFamily = pitchAndFamily;
- }
-
- /**
- * Set the bounding box.
- * @param index The fontBBox index to set.
- * @param value The value to set.
- */
- protected void setFontBBox(final int index, final int value) {
- if (index < 0
- || index >= BoundingBox.BBOX_ENTRIES) {
- return;
- }
- this.fontBBox[index] = value;
- }
-
- /**
- * Sets the cap height.
- * @param capHeight The cap height to set.
- */
- protected void setCapHeight(final int capHeight) {
- this.etmCapHeight = capHeight;
- }
-
- /**
- * Sets the lowercase ascent.
- * @param lowerCaseAscent The lowercase ascent to set.
- */
- protected void setLowerCaseAscent(final int lowerCaseAscent) {
- this.etmLowerCaseAscent = lowerCaseAscent;
- }
-
- /**
- * Sets the lowercase descent.
- * @param lowerCaseDescent The lowercase descent to set.
- */
- protected void setLowerCaseDescent(final int lowerCaseDescent) {
- this.etmLowerCaseDescent = lowerCaseDescent;
- }
-
- /**
- * Sets the x-height.
- * @param xHeight The x-height to set.
- */
- protected void setXHeight(final int xHeight) {
- this.etmXHeight = xHeight;
- }
-
- /**
- * Sets the kerning.
- * @param kerning The kerning to set.
- */
- protected void setKerning(final Kerning kerning) {
- this.kerning = kerning;
- }
-
- /**
- * Set the extent table.
- * @param extentTable The extent table to set.
- */
- protected void setExtentTable(final short[] extentTable) {
- this.extentTable = extentTable;
- }
-
- /**
* Returns the extent table.
* @return The extent table.
*/
- protected short[] getExtentTable() {
- return this.extentTable;
- }
+ protected abstract short[] getExtentTable();
}
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 2007-04-30 17:49:24 UTC (rev 9295)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2007-04-30 19:53:57 UTC (rev 9296)
@@ -28,7 +28,9 @@
package org.foray.font.format;
+import org.foray.common.Bit;
import org.foray.font.charset.CharSet;
+import org.foray.font.output.FOrayFontPDF;
import org.foray.ps.encode.EncodingVector;
import org.foray.ps.encode.GlyphList;
@@ -539,6 +541,65 @@
* MetricsFile class. These are the ones that are specific to AFM files.)
*----------------------------------------------------------------------------*/
+ /** The parsed font name. */
+ private String fontName;
+
+ /** The parsed postscript name. */
+ private String postscriptName;
+
+ /** The parsed font-family name. */
+ private String fontFamilyName;
+
+ /** The parsed italic value. Contains a 1 if the font is italic, otherwise a
+ * 0. */
+ private short dfItalic;
+
+ /** The parsed font weight. */
+ private int dfWeight;
+
+ /** The parsed character set identifier. */
+ private int dfCharSet;
+
+ /** The parsed pitch and family identifier. */
+ private int dfPitchAndFamily;
+
+ /** The parsed average glyph width. */
+ private int dfAvgWidth;
+
+ /** The parsed maximum glyph width. */
+ private int dfMaxWidth;
+
+ /** The parsed minimum glyph width. */
+ private int dfMinWidth;
+
+ /** The parsed bounding box. */
+ private int[] fontBBox = new int[BoundingBox.BBOX_ENTRIES];
+
+ /** The parsed cap height. */
+ private int etmCapHeight;
+
+ /** The parsed x height. */
+ private int etmXHeight;
+
+ /** The parsed lowercase ascent. */
+ private int etmLowerCaseAscent;
+
+ /** The parsed uppercase descent.
+ * Note that PFM stores this value as a positive amount, AFM stores it as a
+ * negative. The setter methods adjust accordingly. */
+ private int etmLowerCaseDescent;
+
+ /** The parsed italic angle.
+ * Used for italic or oblique fonts to indicate the angle of the glyphs,
+ * expressed in degrees counterclockwise from upright. */
+ private float etmSlant;
+
+ /** The parsed extent table. */
+ private short[] extentTable;
+
+ /** The parsed kerning table. */
+ private Kerning kerning;
+
/** The EncodingScheme string parsed from the AFM file. */
private String encodingScheme;
@@ -1000,7 +1061,7 @@
* Process a "FontName" keyword.
*/
private void fontName() {
- this.setPostscriptName(getString());
+ this.postscriptName = getString();
this.doneWithLine = true;
}
@@ -1008,7 +1069,7 @@
* Process a "FullName" keyword.
*/
private void fullName() {
- this.setFontName(getString());
+ this.fontName = getString();
this.doneWithLine = true;
}
@@ -1016,7 +1077,7 @@
* Process a "FamilyName" keyword.
*/
private void familyName() {
- this.setFontFamilyName(getString());
+ this.fontFamilyName = getString();
this.doneWithLine = true;
}
@@ -1029,15 +1090,15 @@
}
final String weightString = this.currentTokenizer.nextToken();
if (weightString.equals("Light")) {
- this.setWeight(Font.Weight.LIGHT.getNumericWeight());
+ this.dfWeight = Font.Weight.LIGHT.getNumericWeight();
} else if (weightString.equals("Medium")) {
- this.setWeight(Font.Weight.NORMAL.getNumericWeight());
+ this.dfWeight = Font.Weight.NORMAL.getNumericWeight();
} else if (weightString.equals("Regular")) {
- this.setWeight(Font.Weight.NORMAL.getNumericWeight());
+ this.dfWeight = Font.Weight.NORMAL.getNumericWeight();
} else if (weightString.equals("Bold")) {
- this.setWeight(Font.Weight.BOLD.getNumericWeight());
+ this.dfWeight = Font.Weight.BOLD.getNumericWeight();
} else {
- this.setWeight(0);
+ this.dfWeight = 0;
}
this.doneWithLine = true;
}
@@ -1058,7 +1119,7 @@
this.codePoints = new int[this.qtyCharMetricsExpected];
}
final short[] extentTable = new short[this.qtyCharMetricsExpected];
- this.setExtentTable(extentTable);
+ this.extentTable = extentTable;
// 256 is the maximum size needed. The actual encoding may be less.
this.internalCodePoints = new char[MAX_CODE_POINTS];
this.internalCodePointIndexes = new char[MAX_CODE_POINTS];
@@ -1121,7 +1182,7 @@
* Process a "ItalicAngle" keyword.
*/
private void italicAngle() {
- this.setEtmSlant(getFloat());
+ this.etmSlant = getFloat();
}
/**
@@ -1165,28 +1226,28 @@
* Process a "CapHeight" keyword.
*/
private void capHeight() {
- this.setCapHeight(Math.round(getFloat()));
+ this.etmCapHeight = Math.round(getFloat());
}
/**
* Process a "XHeight" keyword.
*/
private void xHeight() {
- this.setXHeight(Math.round(getFloat()));
+ this.etmXHeight = Math.round(getFloat());
}
/**
* Process a "Ascender" keyword.
*/
private void ascender() {
- this.setLowerCaseAscent(Math.round(getFloat()));
+ this.etmLowerCaseAscent = Math.round(getFloat());
}
/**
* Process a "Descender" keyword.
*/
private void descender() {
- this.setLowerCaseDescent(Math.round(getFloat()));
+ this.etmLowerCaseDescent = Math.round(getFloat());
}
/**
@@ -1247,7 +1308,7 @@
}
this.inKernPairs = true;
this.qtyKernPairsExpected = getInteger();
- this.setKerning(new Kerning(this.qtyKernPairsExpected));
+ this.kerning = new Kerning(this.qtyKernPairsExpected);
}
/**
@@ -1627,4 +1688,200 @@
return this.reader;
}
+ /**
+ * {@inheritDoc}
+ */
+ public String getFontName() {
+ return this.fontName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPostscriptName() {
+ return this.postscriptName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getFontFamilyName() {
+ return this.fontFamilyName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Kerning getKerning() {
+ return this.kerning;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getCapHeight() {
+ return this.etmCapHeight;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getXHeight() {
+ return this.etmXHeight;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getLowerCaseAscent() {
+ return this.etmLowerCaseAscent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getLowerCaseDescent() {
+ return this.etmLowerCaseDescent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int[] getFontBBox() {
+ final int[] bbox = new int[BoundingBox.BBOX_ENTRIES];
+
+ // Just guessing....
+ if (!getIsProportional() && (this.dfAvgWidth == this.dfMaxWidth)) {
+ bbox[BoundingBox.BBOX_LOWER_LEFT_X_INDEX] = EST_BBOX_LL_X_FIXED;
+ } else {
+ bbox[BoundingBox.BBOX_LOWER_LEFT_X_INDEX] =
+ EST_BBOX_LL_X_PROPORTIONAL;
+ }
+ bbox[BoundingBox.BBOX_LOWER_LEFT_Y_INDEX] = -(getLowerCaseDescent()
+ + EST_BBOX_LL_Y_ADJUST);
+ bbox[BoundingBox.BBOX_UPPER_RIGHT_X_INDEX] = this.dfMaxWidth
+ + EST_BBOX_UR_X_ADJUST;
+ bbox[BoundingBox.BBOX_UPPER_RIGHT_Y_INDEX] = getLowerCaseAscent()
+ + EST_BBOX_UR_Y_ADJUST;
+ return bbox;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getFlags() {
+ int flags = 0x00;
+ if (!getIsProportional()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_FIXED_PITCH - 1);
+ }
+ if (isSerif()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_SERIF - 1);
+ }
+ if (isPDFSymbolic()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_SYMBOLIC - 1);
+ }
+ if (isScript()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_SCRIPT - 1);
+ }
+ if (! isPDFSymbolic()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_NONSYMBOLIC - 1);
+ }
+ if (this.dfItalic != 0) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_ITALIC - 1);
+ }
+ return flags;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isSerif() {
+ return (this.dfPitchAndFamily & PITCH_FAMILY_ROMAN_MASK)
+ == PITCH_FAMILY_ROMAN_MASK;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isScript() {
+ return (this.dfPitchAndFamily & PITCH_FAMILY_SCRIPT_MASK)
+ == PITCH_FAMILY_SCRIPT_MASK;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public float getItalicAngle() {
+ return this.etmSlant;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public short[] getCharWidths() {
+ return this.extentTable;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public short getItalic() {
+ return this.dfItalic;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected int getWeight() {
+ return this.dfWeight;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getCharSetID() {
+ return this.dfCharSet;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected int getMaxWidth() {
+ return this.dfMaxWidth;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected int getMinWidth() {
+ return this.dfMinWidth;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected int getPitchAndFamily() {
+ return this.dfPitchAndFamily;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected short[] getExtentTable() {
+ return this.extentTable;
+ }
+
+ /**
+ * Set the bounding box.
+ * @param index The fontBBox index to set.
+ * @param value The value to set.
+ */
+ private void setFontBBox(final int index, final int value) {
+ if (index < 0
+ || index >= BoundingBox.BBOX_ENTRIES) {
+ return;
+ }
+ this.fontBBox[index] = value;
+ }
+
}
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 2007-04-30 17:49:24 UTC (rev 9295)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java 2007-04-30 19:53:57 UTC (rev 9296)
@@ -28,10 +28,14 @@
package org.foray.font.format;
+import org.foray.common.Bit;
import org.foray.common.WKConstants;
import org.foray.font.charset.CharSet;
+import org.foray.font.output.FOrayFontPDF;
import org.foray.ps.encode.EncodingVector;
+import org.axsl.psR.BoundingBox;
+
import org.apache.commons.logging.Log;
import java.io.IOException;
@@ -86,6 +90,62 @@
/** The last character index in this font, as parsed. */
private char dfLastChar = 0;
+ /** The parsed font name. */
+ private String fontName;
+
+ /** The parsed postscript name. */
+ private String postscriptName;
+
+ /** The parsed font-family name. */
+ private String fontFamilyName;
+
+ /** The parsed italic value. Contains a 1 if the font is italic, otherwise a
+ * 0. */
+ private short dfItalic;
+
+ /** The parsed font weight. */
+ private int dfWeight;
+
+ /** The parsed character set identifier. */
+ private int dfCharSet;
+
+ /** The parsed pitch and family identifier. */
+ private int dfPitchAndFamily;
+
+ /** The parsed average glyph width. */
+ private int dfAvgWidth;
+
+ /** The parsed maximum glyph width. */
+ private int dfMaxWidth;
+
+ /** The parsed minimum glyph width. */
+ private int dfMinWidth;
+
+ /** The parsed cap height. */
+ private int etmCapHeight;
+
+ /** The parsed x height. */
+ private int etmXHeight;
+
+ /** The parsed lowercase ascent. */
+ private int etmLowerCaseAscent;
+
+ /** The parsed uppercase descent.
+ * Note that PFM stores this value as a positive amount, AFM stores it as a
+ * negative. The setter methods adjust accordingly. */
+ private int etmLowerCaseDescent;
+
+ /** The parsed italic angle.
+ * Used for italic or oblique fonts to indicate the angle of the glyphs,
+ * expressed in degrees counterclockwise from upright. */
+ private float etmSlant;
+
+ /** The parsed extent table. */
+ private short[] extentTable;
+
+ /** The parsed kerning table. */
+ private Kerning kerning;
+
/**
* Constructor.
* @param reader The reader encapsulating the file.
@@ -145,7 +205,7 @@
/* Skip dfExternalLeading. */
getReader().skipBytes(WKConstants.BYTES_PER_SHORT);
- this.setItalic((short) getReader().readUnsignedByte());
+ this.dfItalic = (short) getReader().readUnsignedByte();
/* Skip dfUnderline. */
getReader().skipBytes(1);
@@ -153,9 +213,9 @@
/* Skip dfStrikeOut. */
getReader().skipBytes(1);
- this.setWeight(getReader().readUnsignedShortLoHi());
+ this.dfWeight = getReader().readUnsignedShortLoHi();
- this.setCharSet(getReader().readUnsignedByte());
+ this.dfCharSet = getReader().readUnsignedByte();
/* Skip dfPixWidth. */
getReader().skipBytes(WKConstants.BYTES_PER_SHORT);
@@ -163,11 +223,11 @@
/* Skip dfPixHeight. */
getReader().skipBytes(WKConstants.BYTES_PER_SHORT);
- this.setPitchAndFamily(getReader().readUnsignedByte());
+ this.dfPitchAndFamily = getReader().readUnsignedByte();
- this.setAvgWidth(getReader().readUnsignedShortLoHi());
+ this.dfAvgWidth = getReader().readUnsignedShortLoHi();
- this.setMaxWidth(getReader().readUnsignedShortLoHi());
+ this.dfMaxWidth = getReader().readUnsignedShortLoHi();
this.dfFirstChar = (char) getReader().readUnsignedByte();
@@ -189,7 +249,7 @@
getReader().seek(faceOffset);
- this.setFontFamilyName(getReader().readNullTerminatedString());
+ this.fontFamilyName = getReader().readNullTerminatedString();
}
/**
@@ -214,7 +274,7 @@
}
getReader().seek(driverInfoOffset);
- this.setPostscriptName(getReader().readNullTerminatedString());
+ this.postscriptName = getReader().readNullTerminatedString();
if (extMetricsOffset != 0) {
getReader().seek(extMetricsOffset);
@@ -235,7 +295,7 @@
final int qtyPairs = getReader().readUnsignedShortLoHi();
if (this.getKerning() == null) {
- this.setKerning(new Kerning(qtyPairs));
+ this.kerning = new Kerning(qtyPairs);
}
for (int i = 0; i < qtyPairs; i++) {
final char glyphIndex1 = (char) getReader().readUnsignedByte();
@@ -272,15 +332,15 @@
getReader().skipBytes(WKConstants.BYTES_PER_SHORT);
/* Skip the etmMasterUnits field. */
getReader().skipBytes(WKConstants.BYTES_PER_SHORT);
- this.setCapHeight(getReader().readUnsignedShortLoHi());
- this.setXHeight(getReader().readUnsignedShortLoHi());
- this.setLowerCaseAscent(getReader().readUnsignedShortLoHi());
+ this.etmCapHeight = getReader().readUnsignedShortLoHi();
+ this.etmXHeight = getReader().readUnsignedShortLoHi();
+ this.etmLowerCaseAscent = getReader().readUnsignedShortLoHi();
/* The lowercase descent value is stored in the pfm file as a positive
* number, but our superclass wants it as a negative amount. */
- this.setLowerCaseDescent(getReader().readUnsignedShortLoHi() * -1);
+ this.etmLowerCaseDescent = getReader().readUnsignedShortLoHi() * -1;
/* PFM file stores the italic angle in 1/10ths of a degree, but
* the variable stores it in degrees. */
- this.setEtmSlant(getReader().readShortLoHi() * ITALIC_ANGLE_FACTOR);
+ this.etmSlant = getReader().readShortLoHi() * ITALIC_ANGLE_FACTOR;
}
/**
@@ -297,7 +357,7 @@
return;
}
final short[] extentTable = new short[charSet.size()];
- this.setMinWidth(this.getMaxWidth());
+ this.dfMinWidth = this.getMaxWidth();
for (int i = this.dfFirstChar; i <= this.dfLastChar; i++) {
final short width = (short) getReader().readUnsignedShortLoHi();
final char encodedIndex = (char) i;
@@ -310,10 +370,10 @@
}
extentTable[charSetIndex] = width;
if (width < this.getMinWidth()) {
- this.setMinWidth(width);
+ this.dfMinWidth = width;
}
}
- this.setExtentTable(extentTable);
+ this.extentTable = extentTable;
}
/**
@@ -430,4 +490,187 @@
return this.reader;
}
+ /**
+ * {@inheritDoc}
+ */
+ public String getFontName() {
+ return this.fontName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPostscriptName() {
+ return this.postscriptName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getFontFamilyName() {
+ return this.fontFamilyName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Kerning getKerning() {
+ return this.kerning;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getCapHeight() {
+ return this.etmCapHeight;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getXHeight() {
+ return this.etmXHeight;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getLowerCaseAscent() {
+ return this.etmLowerCaseAscent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getLowerCaseDescent() {
+ return this.etmLowerCaseDescent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int[] getFontBBox() {
+ final int[] bbox = new int[BoundingBox.BBOX_ENTRIES];
+
+ // Just guessing....
+ if (!getIsProportional() && (this.dfAvgWidth == this.dfMaxWidth)) {
+ bbox[BoundingBox.BBOX_LOWER_LEFT_X_INDEX] = EST_BBOX_LL_X_FIXED;
+ } else {
+ bbox[BoundingBox.BBOX_LOWER_LEFT_X_INDEX] =
+ EST_BBOX_LL_X_PROPORTIONAL;
+ }
+ bbox[BoundingBox.BBOX_LOWER_LEFT_Y_INDEX] = -(getLowerCaseDescent()
+ + EST_BBOX_LL_Y_ADJUST);
+ bbox[BoundingBox.BBOX_UPPER_RIGHT_X_INDEX] = this.dfMaxWidth
+ + EST_BBOX_UR_X_ADJUST;
+ bbox[BoundingBox.BBOX_UPPER_RIGHT_Y_INDEX] = getLowerCaseAscent()
+ + EST_BBOX_UR_Y_ADJUST;
+ return bbox;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getFlags() {
+ int flags = 0x00;
+ if (!getIsProportional()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_FIXED_PITCH - 1);
+ }
+ if (isSerif()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_SERIF - 1);
+ }
+ if (isPDFSymbolic()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_SYMBOLIC - 1);
+ }
+ if (isScript()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_SCRIPT - 1);
+ }
+ if (! isPDFSymbolic()) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_NONSYMBOLIC - 1);
+ }
+ if (this.dfItalic != 0) {
+ flags = Bit.setBit(flags, FOrayFontPDF.FLAG_BIT_ITALIC - 1);
+ }
+ return flags;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isSerif() {
+ return (this.dfPitchAndFamily & PITCH_FAMILY_ROMAN_MASK)
+ == PITCH_FAMILY_ROMAN_MASK;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isScript() {
+ return (this.dfPitchAndFamily & PITCH_FAMILY_SCRIPT_MASK)
+ == PITCH_FAMILY_SCRIPT_MASK;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public float getItalicAngle() {
+ return this.etmSlant;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public short[] getCharWidths() {
+ return this.extentTable;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public short getItalic() {
+ return this.dfItalic;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected int getWeight() {
+ return this.dfWeight;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getCharSetID() {
+ return this.dfCharSet;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected int getMaxWidth() {
+ return this.dfMaxWidth;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected int getMinWidth() {
+ return this.dfMinWidth;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected int getPitchAndFamily() {
+ return this.dfPitchAndFamily;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected short[] getExtentTable() {
+ return this.extentTable;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 17:49:23
|
Revision: 9295
http://svn.sourceforge.net/foray/?rev=9295&view=rev
Author: victormote
Date: 2007-04-30 10:49:24 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Mark more parse-time variables transient.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java
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 2007-04-30 17:35:47 UTC (rev 9294)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2007-04-30 17:49:24 UTC (rev 9295)
@@ -503,6 +503,31 @@
/** The glyph width parsed from the "WX" token. */
private transient short charWidth = Short.MIN_VALUE;
+ /** If we need to build a CharSet for this font, this array is where the
+ * characters are accumulated, then later sorted, and eventually is used
+ * to create the CharSet instance. */
+ private transient int[] codePoints = null;
+
+ /** The next index to be used as {@link #codePoints} is built. */
+ private transient int nextCharArrayIndex = 0;
+
+ /**
+ * <p>Array whose contents are the Unicode code points used in the internal
+ * encoding for this font.
+ * This array is created as the metrics file is parsed, and is then used
+ * later to create {@link #internalEncoding}.</p>
+ */
+ private transient char[] internalCodePoints;
+
+ /**
+ * Array parallel to {@link #internalCodePoints} and containing the
+ * encoded indexes that correspond to the elements therein.
+ */
+ private transient char[] internalCodePointIndexes;
+
+ /** The number of internalCodePoint elements parsed so far. */
+ private transient int internalCodePointCount = 0;
+
/*------------------------------------------------------------------------------
* End items used in the parsing of the file.
*----------------------------------------------------------------------------*/
@@ -537,34 +562,9 @@
*----------------------------------------------------------------------------*/
/** The reader used to parse this file. */
- private MetricsFileReader reader = null;
+ private transient MetricsFileReader reader = null;
- /** If we need to build a CharSet for this font, this array is where the
- * characters are accumulated, then later sorted, and eventually is used
- * to create the CharSet instance. */
- private int[] codePoints = null;
-
- /** The next index to be used as charArray is built. */
- private int nextCharArrayIndex = 0;
-
/**
- * <p>Array whose contents are the Unicode code points used in the internal
- * encoding for this font.
- * This array is created as the metrics file is parsed, and is then used
- * later to create {@link #internalEncoding}.</p>
- */
- private char[] internalCodePoints;
-
- /**
- * Array parallel to {@link #internalCodePoints} and containing the
- * encoded indexes that correspond to the elements therein.
- */
- private char[] internalCodePointIndexes;
-
- /** The number of internalCodePoint elements parsed so far. */
- private int internalCodePointCount = 0;
-
- /**
* <p>This font's internalEncoding, as parsed from its metrics file.
* Note that the encoding encapsulated in internalEncoding may not have
* an exact correlation to the encoding listed in the metrics file.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 17:35:50
|
Revision: 9294
http://svn.sourceforge.net/foray/?rev=9294&view=rev
Author: victormote
Date: 2007-04-30 10:35:47 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Fix javadoc on writeObject @serialData.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java 2007-04-30 17:33:06 UTC (rev 9293)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java 2007-04-30 17:35:47 UTC (rev 9294)
@@ -70,10 +70,10 @@
/** The name of this character set. */
private transient String name;
- /** Holds 16-bit Unicode codepoints. */
+ /** The 16-bit Unicode codepoints. */
private transient char[] characterSet16;
- /** Holds 32-bit Unicode codepoints. These are conceptually appended to the
+ /** 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;
@@ -244,11 +244,9 @@
* @throws IOException For I/O errors.
* @serialData
* <ol>
- * <li>The name of the list (String).</li>
- * <li>The sorted glyph names (String[]).</li>
- * <li>The code points for glyph names (char[][]).</li>
- * <li>The sorted code points (char[]).</li>
- * <li>The glyph names for code points (short[]).</li>
+ * <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)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 17:33:11
|
Revision: 9293
http://svn.sourceforge.net/foray/?rev=9293&view=rev
Author: victormote
Date: 2007-04-30 10:33:06 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
1. Make CharSet serializable.
2. Make the CharSet subclasses true singletons.
Modified 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/CharSetWindowsANSI.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java 2007-04-30 17:12:10 UTC (rev 9292)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java 2007-04-30 17:33:06 UTC (rev 9293)
@@ -28,6 +28,10 @@
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;
@@ -50,8 +54,11 @@
* 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 {
+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.
@@ -61,14 +68,14 @@
= new HashMap<String, CharSet>();
/** The name of this character set. */
- private String name;
+ private transient String name;
/** Holds 16-bit Unicode codepoints. */
- private char[] characterSet16;
+ private transient char[] characterSet16;
/** Holds 32-bit Unicode codepoints. These are conceptually appended to the
* end of {@link #characterSet16} as if they were all in one array. */
- private int[] characterSet32;
+ private transient int[] characterSet32;
/**
* Constructor suitable for character sets that contain only 16-bit
@@ -192,9 +199,9 @@
}
// Otherwise, try to instantiate it.
if (name.equals("WindowsANSI")) {
- charSet = new CharSetWindowsANSI();
+ charSet = CharSetWindowsANSI.getInstance();
} else if (name.equals("ExtendedRoman")) {
- charSet = new CharSetExtendedRoman();
+ charSet = CharSetExtendedRoman.getInstance();
}
if (charSet == null) {
return null;
@@ -218,4 +225,58 @@
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 list (String).</li>
+ * <li>The sorted glyph names (String[]).</li>
+ * <li>The code points for glyph names (char[][]).</li>
+ * <li>The sorted code points (char[]).</li>
+ * <li>The glyph names for code points (short[]).</li>
+ * </ol>
+ */
+ private void writeObject(final ObjectOutputStream stream)
+ throws IOException {
+ stream.defaultWriteObject();
+ if (this.isStatic()) {
+ /* The static instances do not need to be serialized as they are
+ * derived entirely from static data. */
+ return;
+ }
+ 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 {
+ stream.defaultReadObject();
+ this.name = (String) stream.readObject();
+ this.characterSet16 = (char[]) stream.readObject();
+ this.characterSet32 = (int[]) stream.readObject();
+ }
+
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetExtendedRoman.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetExtendedRoman.java 2007-04-30 17:12:10 UTC (rev 9292)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetExtendedRoman.java 2007-04-30 17:33:06 UTC (rev 9293)
@@ -40,11 +40,14 @@
* "C" entries in the following AFM file:
* foray/foray-font/resource/base-14/Helvetica.afm</p>
*/
-public class CharSetExtendedRoman extends CharSet {
+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. */
- public static final char[] CHARACTER_SET = {
+ private static final char[] CHARACTER_SET = {
0x0020, // [0] space
0x0021, // [1] exclam
0x0022, // [2] quotedbl
@@ -362,11 +365,43 @@
0xfb02 // [314] fl
};
+ /** The singleton instance. */
+ private static CharSetExtendedRoman theInstance;
+
/**
* Constructor.
*/
- public CharSetExtendedRoman() {
+ 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();
+ }
+
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetWindowsANSI.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetWindowsANSI.java 2007-04-30 17:12:10 UTC (rev 9292)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetWindowsANSI.java 2007-04-30 17:33:06 UTC (rev 9293)
@@ -35,13 +35,48 @@
* character set, also known as Windows Code Page 1252. Its members are the
* same as for the WinAnsiEncoding.
*/
-public class CharSetWindowsANSI extends CharSet {
+public final class CharSetWindowsANSI extends CharSet {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = -639431722920767103L;
+
+ /** The singleton instance. */
+ private static CharSetWindowsANSI theInstance;
+
/**
* Constructor.
*/
- public CharSetWindowsANSI() {
+ private CharSetWindowsANSI() {
super("WindowsANSI", EncodingWinAnsi.getCodePoints());
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static CharSetWindowsANSI getInstance() {
+ if (CharSetWindowsANSI.theInstance == null) {
+ CharSetWindowsANSI.theInstance = new CharSetWindowsANSI();
+ }
+ return CharSetWindowsANSI.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 CharSetWindowsANSI.getInstance();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-30 17:12:10
|
Revision: 9292
http://svn.sourceforge.net/foray/?rev=9292&view=rev
Author: victormote
Date: 2007-04-30 10:12:10 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
Compile the source code before running the serialization task.
Modified Paths:
--------------
trunk/foray/foray-font/scripts/build.xml
Modified: trunk/foray/foray-font/scripts/build.xml
===================================================================
--- trunk/foray/foray-font/scripts/build.xml 2007-04-28 23:43:18 UTC (rev 9291)
+++ trunk/foray/foray-font/scripts/build.xml 2007-04-30 17:12:10 UTC (rev 9292)
@@ -62,7 +62,7 @@
Parse and serialize the Base-14 AFM files
==============================================================================
-->
- <target name="resources" depends="init"
+ <target name="resources" depends="package"
description="Parse and serialize the Base-14 AFM files">
<delete dir="${resources.build}"/>
<delete file="${font.resource.jar.file}"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-28 23:43:18
|
Revision: 9291
http://svn.sourceforge.net/foray/?rev=9291&view=rev
Author: victormote
Date: 2007-04-28 16:43:18 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Fix bug caused by last commit. The reader was not getting set in the constructor.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java
trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java
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 2007-04-28 23:19:04 UTC (rev 9290)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2007-04-28 23:43:18 UTC (rev 9291)
@@ -583,6 +583,7 @@
*/
public MetricsFileAFM(final MetricsFileReader reader) {
super();
+ this.reader = reader;
try {
load();
} catch (final Exception e) {
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 2007-04-28 23:19:04 UTC (rev 9290)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java 2007-04-28 23:43:18 UTC (rev 9291)
@@ -92,6 +92,7 @@
*/
public MetricsFilePFM(final MetricsFileReader reader) {
super();
+ this.reader = reader;
try {
load();
} catch (final Exception e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-28 23:19:11
|
Revision: 9290
http://svn.sourceforge.net/foray/?rev=9290&view=rev
Author: victormote
Date: 2007-04-28 16:19:04 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Steps toward making MetricsFileAFM serializable, and using that ability in the build.
Modified Paths:
--------------
trunk/foray/foray-font/scripts/build.xml
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
Modified: trunk/foray/foray-font/scripts/build.xml
===================================================================
--- trunk/foray/foray-font/scripts/build.xml 2007-04-28 23:00:54 UTC (rev 9289)
+++ trunk/foray/foray-font/scripts/build.xml 2007-04-28 23:19:04 UTC (rev 9290)
@@ -72,16 +72,12 @@
<pathelement location="${classes.dir}"/>
</path>
- <!-- BEGIN SKIPPED CODE. -->
- <!--
<taskdef name="serializeMetrics"
classname="org.foray.font.SerializeStandardFonts"
classpathref="resources-classpath"/>
<serializeMetrics includes="*.afm"
sourceDir="${base14.source}"
targetDir="${resources.build}" />
- -->
- <!-- END SKIPPED CODE. -->
<!-- Put the compiled font metrics objects in a jar file. -->
<copy todir="${resources.build}">
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java 2007-04-28 23:00:54 UTC (rev 9289)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java 2007-04-28 23:19:04 UTC (rev 9290)
@@ -35,8 +35,6 @@
import org.axsl.psR.BoundingBox;
-import org.apache.commons.logging.Log;
-
import java.io.IOException;
/**
@@ -84,9 +82,6 @@
/** Constant used to estimate the upper-right Y value of the bbox. */
private static final int EST_BBOX_UR_Y_ADJUST = 5;
- /** The reader used to parse this file. */
- private MetricsFileReader reader = null;
-
/** The parsed font name. */
private String fontName;
@@ -148,16 +143,8 @@
/**
* Constructor. Parses the passed file and returns it as an object.
- * @param reader The MetricsFileReader instance that encapsulates the
- * actual metrics file.
*/
- public MetricsFile(final MetricsFileReader reader) {
- this.reader = reader;
- try {
- load();
- } catch (final Exception e) {
- e.printStackTrace();
- }
+ public MetricsFile() {
}
/**
@@ -382,14 +369,6 @@
}
/**
- * Returns the logger.
- * @return The logger.
- */
- public Log getLogger() {
- return this.reader.getLogger();
- }
-
- /**
* Returns the character widths for this font.
* @return The character widths for this font.
*/
@@ -416,14 +395,6 @@
public abstract String getUniqueID();
/**
- * Return the reader used to parse this metrics file.
- * @return The reader used to parse this metrics file.
- */
- public MetricsFileReader getReader() {
- return this.reader;
- }
-
- /**
* Set the etm Slant.
* @param etmSlant The etmSlant to set.
*/
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 2007-04-28 23:00:54 UTC (rev 9289)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2007-04-28 23:19:04 UTC (rev 9290)
@@ -35,15 +35,21 @@
import org.axsl.fontR.Font;
import org.axsl.psR.BoundingBox;
+import org.apache.commons.logging.Log;
+
import java.io.IOException;
+import java.io.Serializable;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* This class represents an AFM file.
*/
-public class MetricsFileAFM extends MetricsFile {
+public class MetricsFileAFM extends MetricsFile implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = -443187764113043557L;
+
/** The maximum number of code points that can be encoded. */
private static final int MAX_CODE_POINTS = 256;
@@ -530,6 +536,9 @@
* End items parsed from the AFM File.
*----------------------------------------------------------------------------*/
+ /** The reader used to parse this file. */
+ private MetricsFileReader reader = null;
+
/** If we need to build a CharSet for this font, this array is where the
* characters are accumulated, then later sorted, and eventually is used
* to create the CharSet instance. */
@@ -573,7 +582,12 @@
* @param reader The reader encapsulating the file.
*/
public MetricsFileAFM(final MetricsFileReader reader) {
- super(reader);
+ super();
+ try {
+ load();
+ } catch (final Exception e) {
+ e.printStackTrace();
+ }
}
/**
@@ -1596,4 +1610,20 @@
return this.uniqueID;
}
+ /**
+ * Returns the logger.
+ * @return The logger.
+ */
+ public Log getLogger() {
+ return this.reader.getLogger();
+ }
+
+ /**
+ * Return the reader used to parse this metrics file.
+ * @return The reader used to parse this metrics file.
+ */
+ public MetricsFileReader getReader() {
+ return this.reader;
+ }
+
}
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 2007-04-28 23:00:54 UTC (rev 9289)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java 2007-04-28 23:19:04 UTC (rev 9290)
@@ -32,6 +32,8 @@
import org.foray.font.charset.CharSet;
import org.foray.ps.encode.EncodingVector;
+import org.apache.commons.logging.Log;
+
import java.io.IOException;
/**
@@ -75,6 +77,9 @@
/** Constant used to estimate the Stem V size for italic fonts. */
private static final double BOGUS_ITALIC_STEM_V_FACTOR = 0.25;
+ /** The reader used to parse this file. */
+ private MetricsFileReader reader = null;
+
/** The first character index in this font, as parsed. */
private char dfFirstChar = 0;
@@ -86,7 +91,12 @@
* @param reader The reader encapsulating the file.
*/
public MetricsFilePFM(final MetricsFileReader reader) {
- super(reader);
+ super();
+ try {
+ load();
+ } catch (final Exception e) {
+ e.printStackTrace();
+ }
}
/**
@@ -403,4 +413,20 @@
return null;
}
+ /**
+ * Returns the logger.
+ * @return The logger.
+ */
+ public Log getLogger() {
+ return this.reader.getLogger();
+ }
+
+ /**
+ * Return the reader used to parse this metrics file.
+ * @return The reader used to parse this metrics file.
+ */
+ public MetricsFileReader getReader() {
+ return this.reader;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-28 23:00:53
|
Revision: 9289
http://svn.sourceforge.net/foray/?rev=9289&view=rev
Author: victormote
Date: 2007-04-28 16:00:54 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Add default serialization for remaining Encoding classes.
Modified Paths:
--------------
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
trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java
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 2007-04-28 22:54:23 UTC (rev 9288)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2007-04-28 23:00:54 UTC (rev 9289)
@@ -33,22 +33,4 @@
*/
public abstract class CMap extends Encoding {
- /** The name of this encoding. */
- private String name;
-
- /**
- * Constructor.
- * @param name The name of the encoding.
- */
- public CMap(final String name) {
- this.name = name;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return this.name;
- }
-
}
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 2007-04-28 22:54:23 UTC (rev 9288)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java 2007-04-28 23:00:54 UTC (rev 9289)
@@ -35,6 +35,12 @@
*/
public class CMap04 extends CMap {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 985957847129472354L;
+
+ /** The name of this encoding. */
+ private String name;
+
/** The array of entries. */
private CMap04Entry[] entries;
@@ -49,11 +55,18 @@
* processing.
*/
public CMap04(final String name, final int expectedEntries) {
- super(name);
+ this.name = name;
this.entries = new CMap04Entry[expectedEntries];
}
/**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
* Add a new entry to this map.
* @param entry The entry to be added.
*/
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 2007-04-28 22:54:23 UTC (rev 9288)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java 2007-04-28 23:00:54 UTC (rev 9289)
@@ -35,6 +35,12 @@
*/
public class CMap12 extends CMap {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = -606154911100219394L;
+
+ /** The name of this encoding. */
+ private String name;
+
/** The array of entries. */
private CMap12Entry[] entries;
@@ -49,11 +55,18 @@
* processing.
*/
public CMap12(final String name, final int expectedEntries) {
- super(name);
+ this.name = name;
this.entries = new CMap12Entry[expectedEntries];
}
/**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
* Add a new entry to this map.
* @param entry The entry to be added.
*/
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2007-04-28 22:54:23 UTC (rev 9288)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2007-04-28 23:00:54 UTC (rev 9289)
@@ -28,6 +28,8 @@
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.
@@ -43,7 +45,7 @@
* 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.psR.Encoding {
+public abstract class Encoding implements org.axsl.psR.Encoding, Serializable {
/**
* {@inheritDoc}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-28 22:57:50
|
Revision: 9288
http://svn.sourceforge.net/foray/?rev=9288&view=rev
Author: victormote
Date: 2007-04-28 15:54:23 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Make dynamic encoding vectors serializable (untested).
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.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/EncodingStandard.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.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
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 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -33,12 +33,22 @@
*/
public abstract class CMap extends Encoding {
+ /** The name of this encoding. */
+ private String name;
+
/**
* Constructor.
* @param name The name of the encoding.
*/
public CMap(final String name) {
- super(name);
+ this.name = name;
}
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return this.name;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -45,18 +45,7 @@
*/
public abstract class Encoding implements org.axsl.psR.Encoding {
- /** The name of this encoding. */
- private String name;
-
/**
- * Constructor.
- * @param name The name of the encoding.
- */
- public Encoding(final String name) {
- this.name = name;
- }
-
- /**
* {@inheritDoc}
*/
public abstract String asPostScript(org.axsl.psR.Encoding baseEncoding);
@@ -64,13 +53,6 @@
/**
* {@inheritDoc}
*/
- public String getName() {
- return this.name;
- }
-
- /**
- * {@inheritDoc}
- */
public boolean isPredefinedPS() {
return false;
}
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 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* <p>Class containing hard-coded values that represent the CE (Central
* European) Encoding Vector documented at PLRM2, Appendix E.5.</p>
@@ -44,8 +46,11 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingCE extends EncodingVector {
+public final class EncodingCE extends EncodingVector implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 233004851494403242L;
+
/*
private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
@@ -950,4 +955,22 @@
return EncodingCE.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 EncodingCE.getInstance();
+ }
+
}
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 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the Expert
* Encoding Vector documented at PostScript Language Reference, 3rd Edition,
@@ -43,8 +45,12 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingExpert extends EncodingVector {
+public final class EncodingExpert extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 646506681417105614L;
+
/* private static final String[] sortedGlyphNames = {
"AEsmall", // #0 glyph: 0xe6 \346
"Aacutesmall", // #1 glyph: 0xe1 \341
@@ -748,4 +754,22 @@
return EncodingExpert.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 EncodingExpert.getInstance();
+ }
+
}
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 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the ExpertSubset
* Encoding Vector documented at PostScript Language Reference, 3rd Edition,
@@ -43,8 +45,12 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingExpertSubset extends EncodingVector {
+public final class EncodingExpertSubset extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 613751704171026729L;
+
/*
private static final String[] sortedGlyphNames = {
"asuperior", // [0] glyph-index: 0x0041 \101
@@ -433,4 +439,22 @@
return EncodingExpertSubset.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 EncodingExpertSubset.getInstance();
+ }
+
}
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 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the FOrayLatinExtra
* Encoding Vector.
@@ -49,8 +51,12 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingFOrayLatinExtra extends EncodingVector {
+public final class EncodingFOrayLatinExtra extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 104918159455810006L;
+
/*
private static final String[] sortedGlyphNames = {
"Amacron", // [0] glyph-index: 0x0021 \041
@@ -283,4 +289,22 @@
return EncodingFOrayLatinExtra.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 EncodingFOrayLatinExtra.getInstance();
+ }
+
}
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 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the ISOLatin1Encoding
* Encoding Vector documented at PLRM2, Appendix E.7.
@@ -42,8 +44,12 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingISOLatin1 extends EncodingVector {
+public final class EncodingISOLatin1 extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = -914396846680222158L;
+
/*
private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
@@ -895,4 +901,22 @@
return true;
}
+ /**
+ * {@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 EncodingISOLatin1.getInstance();
+ }
+
}
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 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,7 +28,9 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the MacExpertEncoding
* Encoding Vector documented at PDF Reference, 5th Edition, Appendix D.2.
@@ -43,8 +45,12 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingMacExpert extends EncodingVector {
+public final class EncodingMacExpert extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = -79549852871454145L;
+
/* private static final String[] sortedGlyphNames = {
"AEsmall", // #0 glyph: 0xbe \276
"Aacutesmall", // #1 glyph: 0x87 \207
@@ -755,4 +761,22 @@
return true;
}
+ /**
+ * {@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 EncodingMacExpert.getInstance();
+ }
+
}
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 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,7 +28,9 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the MacRomanEncoding
* Encoding Vector documented at PDF Reference, 3rd Edition, Appendix D.1.
@@ -43,8 +45,12 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingMacRoman extends EncodingVector {
+public final class EncodingMacRoman extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 993684350470444306L;
+
/* private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
"AE", // #1 glyph: 0xae \256
@@ -923,4 +929,22 @@
return true;
}
+ /**
+ * {@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 EncodingMacRoman.getInstance();
+ }
+
}
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 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,7 +28,9 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the "standard Macintosh
* ordering" described in the TrueType font reference material (TTF Reference).
@@ -49,8 +51,12 @@
* <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 EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 471516609574396260L;
+
/*
private static final String[] sortedGlyphNames = {
".notdef", // [0] glyph-index: 0x0000 \000
@@ -1127,4 +1133,22 @@
return EncodingMacStandard.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 EncodingMacStandard.getInstance();
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,7 +28,9 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the PDFDocEncoding
* Encoding Vector documented at PDF Reference, 3rd Edition, Appendix D.1.
@@ -43,8 +45,12 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingPDFDoc extends EncodingVector {
+public final class EncodingPDFDoc extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 749951479927669211L;
+
/* private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
"AE", // #1 glyph: 0xc6 \306
@@ -1011,4 +1017,22 @@
return EncodingVector.getPredefinedEncoding("WinAnsiEncoding");
}
+ /**
+ * {@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 EncodingPDFDoc.getInstance();
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingStandard.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingStandard.java 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingStandard.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the StandardEncoding
* Encoding Vector documented at PLRM3, Appendix E.5.
@@ -45,8 +47,12 @@
* </ol>
*
*/
-public final class EncodingStandard extends EncodingVector {
+public final class EncodingStandard extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 910770936726091423L;
+
/*
private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
@@ -694,4 +700,22 @@
return true;
}
+ /**
+ * {@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 EncodingStandard.getInstance();
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,7 +28,9 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the Symbol
* Encoding Vector documented at PDF Reference, 5th Edition, Appendix D.3.
@@ -51,8 +53,12 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingSymbol extends EncodingVector {
+public final class EncodingSymbol extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 730497395146140317L;
+
/* private static final String[] sortedGlyphNames = {
"Alpha", // #0 glyph: 0x41 \101
"Beta", // #1 glyph: 0x42 \102
@@ -852,4 +858,22 @@
return EncodingSymbol.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 EncodingSymbol.getInstance();
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,6 +28,10 @@
package org.foray.ps.encode;
+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;
@@ -80,8 +84,11 @@
* Methods are provided to encode and decode characters.</p>
*/
public class EncodingVector extends Encoding
- implements org.axsl.psR.EncodingVector {
+ implements org.axsl.psR.EncodingVector, Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = -401311001482299007L;
+
/** The name of the undefined glyph. */
public static final String NOTDEF = ".notdef";
@@ -97,17 +104,20 @@
private static Map<String, EncodingVector> predefinedEncodings
= new HashMap<String, EncodingVector>();
+ /** The name of this encoding. */
+ private transient String name;
+
/** The GlyphList instances, in order, which were used to create this
* encoding. */
- private GlyphList[] sourceGlyphLists;
+ private transient GlyphList[] sourceGlyphLists;
/** Array of Unicode code points, sorted. Elements in this array are keys
* to elements in {@link #codePointIndexes}. */
- private char[] codePoints;
+ private transient char[] codePoints;
/** Array of encoded indexes for the glyphs that correspond to elements
* in {@link #codePoints}. */
- private char[] codePointIndexes;
+ private transient char[] codePointIndexes;
/**
* Create a new Encoding instance.
@@ -126,13 +136,20 @@
*/
public EncodingVector(final String name, final GlyphList[] sourceGlyphLists,
final char[] codePoints, final char[] codePointIndexes) {
- super(name);
+ this.name = name;
this.sourceGlyphLists = sourceGlyphLists;
this.codePoints = codePoints;
this.codePointIndexes = codePointIndexes;
}
/**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
* 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.
@@ -411,4 +428,60 @@
return true;
}
+ /**
+ * Indicates whether the data in this encoding vector 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.
+ * Non-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 EncodingVector} 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 encoding (String).</li>
+ * <li>The source {@link GlyphList} instances used to build this encoding
+ * (GlyphList[]), in order.</li>
+ * <li>The code points (char[]).</li>
+ * <li>The code point indexes (char[]).</li>
+ * </ol>
+ */
+ private void writeObject(final ObjectOutputStream stream)
+ throws IOException {
+ stream.defaultWriteObject();
+ if (this.isStatic()) {
+ /* The static instances do not need to be serialized as they are
+ * derived entirely from static data. */
+ return;
+ }
+ stream.writeObject(this.name);
+ stream.writeObject(this.sourceGlyphLists);
+ stream.writeObject(this.codePoints);
+ stream.writeObject(this.codePointIndexes);
+ }
+
+ /**
+ * Deserialize this {@link EncodingVector} 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 {
+ stream.defaultReadObject();
+ this.name = (String) stream.readObject();
+ this.sourceGlyphLists = (GlyphList[]) stream.readObject();
+ this.codePoints = (char[]) stream.readObject();
+ this.codePointIndexes = (char[]) stream.readObject();
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingWinAnsi.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingWinAnsi.java 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingWinAnsi.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,7 +28,9 @@
package org.foray.ps.encode;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the WinAnsiEncoding
* Encoding Vector documented at PDF Reference, 3rd Edition, Appendix D.1.
@@ -43,8 +45,12 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public final class EncodingWinAnsi extends EncodingVector {
+public final class EncodingWinAnsi extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 136361072507407243L;
+
/* private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
"AE", // #1 glyph: 0xc6 \306
@@ -971,4 +977,22 @@
return EncodingWinAnsi.CODE_POINTS;
}
+ /**
+ * {@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 EncodingWinAnsi.getInstance();
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -28,7 +28,10 @@
package org.foray.ps.encode;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
/**
* Class containing hard-coded values that represent the ZapfDingbats
* Encoding Vector documented at PDF Reference, 5th Edition, Appendix D.4.
@@ -49,8 +52,12 @@
* <li>glyph-lists: ZapfDingbats</li>
* </ol>
*/
-public final class EncodingZapfDingbats extends EncodingVector {
+public final class EncodingZapfDingbats extends EncodingVector
+ implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 518223961238847383L;
+
/** The array of glyph lists that should be used to map glyph names to
* Unicode code points for this font. */
private static final GlyphList[] GLYPH_LISTS_USED = {
@@ -911,4 +918,22 @@
return EncodingZapfDingbats.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 EncodingZapfDingbats.getInstance();
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2007-04-28 21:58:33 UTC (rev 9287)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2007-04-28 22:54:23 UTC (rev 9288)
@@ -319,7 +319,7 @@
* <li>The glyph names for code points (short[]).</li>
* </ol>
*/
- protected void writeObject(final ObjectOutputStream stream)
+ private void writeObject(final ObjectOutputStream stream)
throws IOException {
stream.defaultWriteObject();
if (this.isStatic()) {
@@ -341,7 +341,7 @@
* @throws ClassNotFoundException For classes in the input that cannot be
* found.
*/
- protected void readObject(final ObjectInputStream stream)
+ private void readObject(final ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.name = (String) stream.readObject();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-28 21:58:32
|
Revision: 9287
http://svn.sourceforge.net/foray/?rev=9287&view=rev
Author: victormote
Date: 2007-04-28 14:58:33 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Make dynamic glyph lists serializable (untested).
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListZapfDingbats.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2007-04-28 20:53:54 UTC (rev 9286)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2007-04-28 21:58:33 UTC (rev 9287)
@@ -28,6 +28,10 @@
package org.foray.ps.encode;
+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;
@@ -41,8 +45,11 @@
* together by a common index. In each set, the "key" array is sorted, which
* allows an efficient binary search.
*/
-public class GlyphList {
+public class GlyphList implements Serializable {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = -271250133295639106L;
+
/** Map of GlyphList instances that have already been registered. The key
* is a String with the GlyphList name, and the value is the GlyphList
* instance. */
@@ -56,7 +63,7 @@
};
/** A unique, descriptive name for this GlyphList. */
- private String name;
+ private transient String name;
/** Array of glyph names, sorted.
* This array is parallel with {@link #codePointsForGlyphNames}.
@@ -65,7 +72,7 @@
* At all times, for {@link #sortedGlyphNames}[n], the corresponding
* Unicode code point(s) can be found in
* {@link #codePointsForGlyphNames}[n]. */
- private String[] sortedGlyphNames = null;
+ private transient String[] sortedGlyphNames = null;
/** Array of Unicode code points.
* This array is parallel with {@link #sortedGlyphNames}.
@@ -74,7 +81,7 @@
* At all times, for {@link #sortedGlyphNames}[n], the corresponding
* Unicode code point(s) can be found in
* {@link #codePointsForGlyphNames}[n]. */
- private char[][] codePointsForGlyphNames = null;
+ private transient char[][] codePointsForGlyphNames = null;
/** Array of Unicode code points, sorted.
* This array is parallel with {@link #glyphNamesForCodePoints}.
@@ -83,7 +90,7 @@
* At all times, for {@link #sortedCodePoints}[n], the corresponding
* index to sortedGlyphNames can be found in
* {@link #glyphNamesForCodePoints}[n]. */
- private char[] sortedCodePoints = null;
+ private transient char[] sortedCodePoints = null;
/** Array of indexes to elements in sortedGlyphNames.
* This array is parallel with {@link #sortedCodePoints}.
@@ -92,7 +99,7 @@
* At all times, for {@link #sortedCodePoints}[n], the corresponding
* index to sortedGlyphNames can be found in
* {@link #glyphNamesForCodePoints}[n]. */
- private short[] glyphNamesForCodePoints = null;
+ private transient short[] glyphNamesForCodePoints = null;
/**
* Constructor.
@@ -286,4 +293,62 @@
return GlyphList.STANDARD_SOURCE_GLYPH_LISTS;
}
+ /**
+ * Indicates whether the data in this glyph list 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 GlyphList} 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 list (String).</li>
+ * <li>The sorted glyph names (String[]).</li>
+ * <li>The code points for glyph names (char[][]).</li>
+ * <li>The sorted code points (char[]).</li>
+ * <li>The glyph names for code points (short[]).</li>
+ * </ol>
+ */
+ protected void writeObject(final ObjectOutputStream stream)
+ throws IOException {
+ stream.defaultWriteObject();
+ if (this.isStatic()) {
+ /* The static instances do not need to be serialized as they are
+ * derived entirely from static data. */
+ return;
+ }
+ stream.writeObject(this.name);
+ stream.writeObject(this.sortedGlyphNames);
+ stream.writeObject(this.codePointsForGlyphNames);
+ stream.writeObject(this.sortedCodePoints);
+ stream.writeObject(this.glyphNamesForCodePoints);
+ }
+
+ /**
+ * Deserialize this {@link GlyphList} 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.
+ */
+ protected void readObject(final ObjectInputStream stream)
+ throws IOException, ClassNotFoundException {
+ stream.defaultReadObject();
+ this.name = (String) stream.readObject();
+ this.sortedGlyphNames = (String[]) stream.readObject();
+ this.codePointsForGlyphNames = (char[][]) stream.readObject();
+ this.sortedCodePoints = (char[]) stream.readObject();
+ this.glyphNamesForCodePoints = (short[]) stream.readObject();
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL.java 2007-04-28 20:53:54 UTC (rev 9286)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL.java 2007-04-28 21:58:33 UTC (rev 9287)
@@ -64,6 +64,9 @@
*/
public final class GlyphListAGL extends GlyphList {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = 94697051968528141L;
+
/** The list of glyph names for this glyph list.
* This array must be sorted alphabatically as it is used in binary
* search). */
@@ -4376,4 +4379,22 @@
return GlyphListAGL.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 GlyphListAGL.getInstance();
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListZapfDingbats.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListZapfDingbats.java 2007-04-28 20:53:54 UTC (rev 9286)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListZapfDingbats.java 2007-04-28 21:58:33 UTC (rev 9287)
@@ -38,6 +38,9 @@
*/
public class GlyphListZapfDingbats extends GlyphList {
+ /** Constant needed for serialization. */
+ public static final long serialVersionUID = -379764538953156385L;
+
/** The list of glyph names for this glyph list.
* This array must be sorted alphabatically as it is used in binary
* search). */
@@ -902,4 +905,22 @@
return GlyphListZapfDingbats.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 GlyphListZapfDingbats.getInstance();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-28 20:53:54
|
Revision: 9286
http://svn.sourceforge.net/foray/?rev=9286&view=rev
Author: victormote
Date: 2007-04-28 13:53:54 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Make all EncodingVector subclasses true singletons, and make their data private.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetWindowsANSI.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.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/EncodingStandard.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.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
Modified: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetWindowsANSI.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetWindowsANSI.java 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetWindowsANSI.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -41,7 +41,7 @@
* Constructor.
*/
public CharSetWindowsANSI() {
- super("WindowsANSI", EncodingWinAnsi.CODE_POINTS);
+ super("WindowsANSI", EncodingWinAnsi.getCodePoints());
}
}
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 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -44,10 +44,10 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingCE extends EncodingVector {
+public final class EncodingCE extends EncodingVector {
/*
- public static final String[] sortedGlyphNames = {
+ private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
"Aacute", // #1 glyph: 0xc1 \301
"Abreve", // #2 glyph: 0xc3 \303
@@ -265,7 +265,7 @@
"zero" // #214 glyph: 0x30 \60
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x41, // #0
0xc1, // #1
0xc3, // #2
@@ -485,7 +485,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x20, // #0 glyph: 0x20 \40
0x21, // #1 glyph: 0x21 \41
0x22, // #2 glyph: 0x22 \42
@@ -706,7 +706,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x20, // #0
0x21, // #1
0x22, // #2
@@ -924,17 +924,30 @@
0x99 // #214
};
+ /** The singleton instance. */
+ private static EncodingCE theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "CEEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingCE() {
+ private EncodingCE() {
super("CEEncoding", GlyphList.standardSourceGlyphLists(),
EncodingCE.CODE_POINTS,
EncodingCE.CODE_POINT_INDEXES);
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingCE getInstance() {
+ if (EncodingCE.theInstance == null) {
+ EncodingCE.theInstance = new EncodingCE();
+ }
+ return EncodingCE.theInstance;
+ }
+
}
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 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -43,9 +43,9 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingExpert extends EncodingVector {
+public final class EncodingExpert extends EncodingVector {
-/* public static final String[] sortedGlyphNames = {
+/* private static final String[] sortedGlyphNames = {
"AEsmall", // #0 glyph: 0xe6 \346
"Aacutesmall", // #1 glyph: 0xe1 \341
"Acircumflexsmall", // #2 glyph: 0xe2 \342
@@ -213,7 +213,7 @@
"zerosuperior" // #164 glyph: 0xc8 \310
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0xe6, // #0
0xe1, // #1
0xe2, // #2
@@ -383,7 +383,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x20, // #0 glyph: 0x20 \40
0x2c, // #1 glyph: 0x2c \54
0x2d, // #2 glyph: 0x2d \55
@@ -554,7 +554,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x20, // #0
0x2c, // #1
0x2d, // #2
@@ -722,17 +722,30 @@
0x5a // #164
};
+ /** The singleton instance. */
+ private static EncodingExpert theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "ExpertEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingExpert() {
+ private EncodingExpert() {
super("ExpertEncoding", GlyphList.standardSourceGlyphLists(),
EncodingExpert.CODE_POINTS,
EncodingExpert.CODE_POINT_INDEXES);
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingExpert getInstance() {
+ if (EncodingExpert.theInstance == null) {
+ EncodingExpert.theInstance = new EncodingExpert();
+ }
+ return EncodingExpert.theInstance;
+ }
+
}
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 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -43,10 +43,10 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingExpertSubset extends EncodingVector {
+public final class EncodingExpertSubset extends EncodingVector {
/*
- public static final String[] sortedGlyphNames = {
+ private static final String[] sortedGlyphNames = {
"asuperior", // [0] glyph-index: 0x0041 \101
"bsuperior", // [1] glyph-index: 0x0042 \102
"centinferior", // [2] glyph-index: 0x00dc \334
@@ -135,7 +135,7 @@
"zerosuperior" // [85] glyph-index: 0x00c8 \310
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x0041, // [0] \101 asuperior
0x0042, // [1] \102 bsuperior
0x00dc, // [2] \334 centinferior
@@ -226,7 +226,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x0020, // [0] glyph: 0x0020 \0040
0x002c, // [1] glyph: 0x002c \0054
0x002d, // [2] glyph: 0x002d \0055
@@ -318,7 +318,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x0020, // [0]
0x002c, // [1]
0x002d, // [2]
@@ -407,17 +407,30 @@
0x005a // [85]
};
+ /** The singleton instance. */
+ private static EncodingExpertSubset theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "ExpertSubsetEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingExpertSubset() {
+ private EncodingExpertSubset() {
super("ExpertSubsetEncoding", GlyphList.standardSourceGlyphLists(),
EncodingExpertSubset.CODE_POINTS,
EncodingExpertSubset.CODE_POINT_INDEXES);
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingExpertSubset getInstance() {
+ if (EncodingExpertSubset.theInstance == null) {
+ EncodingExpertSubset.theInstance = new EncodingExpertSubset();
+ }
+ return EncodingExpertSubset.theInstance;
+ }
+
}
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 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -49,10 +49,10 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingFOrayLatinExtra extends EncodingVector {
+public final class EncodingFOrayLatinExtra extends EncodingVector {
/*
- public static final String[] sortedGlyphNames = {
+ private static final String[] sortedGlyphNames = {
"Amacron", // [0] glyph-index: 0x0021 \041
"Delta", // [1] glyph-index: 0x0022 \042
"Edotaccent", // [2] glyph-index: 0x0023 \043
@@ -102,7 +102,7 @@
"uogonek" // [46] glyph-index: 0x004e \116
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x0021, // [0] \041 Amacron
0x0022, // [1] \042 Delta
0x0023, // [2] \043 Edotaccent
@@ -154,7 +154,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x0020, // [0] glyph: 0x0020 \0040
0x0100, // [1] glyph: 0x0021 \0041
0x0101, // [2] glyph: 0x0032 \0062
@@ -207,7 +207,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x0020, // [0]
0x0021, // [1]
0x0032, // [2]
@@ -257,18 +257,30 @@
0x0038 // [46]
};
+ /** The singleton instance. */
+ private static EncodingFOrayLatinExtra theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass
- * "FOrayLatinExtraEncoding" to
- * {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingFOrayLatinExtra() {
+ private EncodingFOrayLatinExtra() {
super("FOrayLatinExtraEncoding", GlyphList.standardSourceGlyphLists(),
EncodingFOrayLatinExtra.CODE_POINTS,
EncodingFOrayLatinExtra.CODE_POINT_INDEXES);
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingFOrayLatinExtra getInstance() {
+ if (EncodingFOrayLatinExtra.theInstance == null) {
+ EncodingFOrayLatinExtra.theInstance = new EncodingFOrayLatinExtra();
+ }
+ return EncodingFOrayLatinExtra.theInstance;
+ }
+
}
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 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -42,10 +42,10 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingISOLatin1 extends EncodingVector {
+public final class EncodingISOLatin1 extends EncodingVector {
/*
- public static final String[] sortedGlyphNames = {
+ private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
"AE", // #1 glyph: 0xc6 \306
"Aacute", // #2 glyph: 0xc1 \301
@@ -248,7 +248,7 @@
"zero" // #199 glyph: 0x30 \60
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x41, // #0
0xc6, // #1
0xc1, // #2
@@ -453,7 +453,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x20, // #0 glyph: 0x20 \40
0x21, // #1 glyph: 0x21 \41
0x22, // #2 glyph: 0x22 \42
@@ -659,7 +659,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x20, // #0
0x21, // #1
0x22, // #2
@@ -862,20 +862,33 @@
0x2d // #199
};
+ /** The singleton instance. */
+ private static EncodingISOLatin1 theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "ISOLatin1Encoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingISOLatin1() {
+ private EncodingISOLatin1() {
super("ISOLatin1Encoding", GlyphList.standardSourceGlyphLists(),
EncodingISOLatin1.CODE_POINTS,
EncodingISOLatin1.CODE_POINT_INDEXES);
}
/**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingISOLatin1 getInstance() {
+ if (EncodingISOLatin1.theInstance == null) {
+ EncodingISOLatin1.theInstance = new EncodingISOLatin1();
+ }
+ return EncodingISOLatin1.theInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean isPredefinedPS() {
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 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -43,9 +43,9 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingMacExpert extends EncodingVector {
+public final class EncodingMacExpert extends EncodingVector {
-/* public static final String[] sortedGlyphNames = {
+/* private static final String[] sortedGlyphNames = {
"AEsmall", // #0 glyph: 0xbe \276
"Aacutesmall", // #1 glyph: 0x87 \207
"Acircumflexsmall", // #2 glyph: 0x89 \211
@@ -213,7 +213,7 @@
"zerosuperior" // #164 glyph: 0xe2 \342
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0xbe, // #0
0x87, // #1
0x89, // #2
@@ -383,7 +383,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x20, // #0 glyph: 0x20 \40
0x2c, // #1 glyph: 0x2c \54
0x2d, // #2 glyph: 0x2d \55
@@ -554,7 +554,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x20, // #0
0x2c, // #1
0x2d, // #2
@@ -722,20 +722,33 @@
0x5a // #164
};
+ /** The singleton instance. */
+ private static EncodingMacExpert theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "MacExpertEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingMacExpert() {
+ private EncodingMacExpert() {
super("MacExpertEncoding", GlyphList.standardSourceGlyphLists(),
EncodingMacExpert.CODE_POINTS,
EncodingMacExpert.CODE_POINT_INDEXES);
}
/**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingMacExpert getInstance() {
+ if (EncodingMacExpert.theInstance == null) {
+ EncodingMacExpert.theInstance = new EncodingMacExpert();
+ }
+ return EncodingMacExpert.theInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean isPredefinedPDF() {
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 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -43,9 +43,9 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingMacRoman extends EncodingVector {
+public final class EncodingMacRoman extends EncodingVector {
-/* public static final String[] sortedGlyphNames = {
+/* private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
"AE", // #1 glyph: 0xae \256
"Aacute", // #2 glyph: 0xe7 \347
@@ -255,7 +255,7 @@
"zero" // #206 glyph: 0x30 \60
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x41, // #0
0xae, // #1
0xe7, // #2
@@ -467,7 +467,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x20, // #0 glyph: 0x20 \40
0x21, // #1 glyph: 0x21 \41
0x22, // #2 glyph: 0x22 \42
@@ -680,7 +680,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x20, // #0
0x21, // #1
0x22, // #2
@@ -890,20 +890,33 @@
0xdf // #206
};
+ /** The singleton instance. */
+ private static EncodingMacRoman theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "MacRomanEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingMacRoman() {
+ private EncodingMacRoman() {
super("MacRomanEncoding", GlyphList.standardSourceGlyphLists(),
EncodingMacRoman.CODE_POINTS,
EncodingMacRoman.CODE_POINT_INDEXES);
}
/**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingMacRoman getInstance() {
+ if (EncodingMacRoman.theInstance == null) {
+ EncodingMacRoman.theInstance = new EncodingMacRoman();
+ }
+ return EncodingMacRoman.theInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean isPredefinedPDF() {
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 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -49,10 +49,10 @@
* <p>Note that the glyphs named ".null" and "nonmarkingreturn" do not map
* to Unicode code points.</p>
*/
-public class EncodingMacStandard extends EncodingVector {
+public final class EncodingMacStandard extends EncodingVector {
/*
- public static final String[] sortedGlyphNames = {
+ private static final String[] sortedGlyphNames = {
".notdef", // [0] glyph-index: 0x0000 \000
".null", // [1] glyph-index: 0x0001 \001
"A", // [2] glyph-index: 0x0024 \044
@@ -313,7 +313,7 @@
"zero" // [257] glyph-index: 0x0013 \023
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x0000, // [0] \000 .notdef
0x0001, // [1] \001 .null
0x0024, // [2] \044 A
@@ -576,7 +576,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x0000, // [0] glyph: 0x0000 \0000
0x0000, // [1] glyph: 0x0000 \0000
0x0000, // [2] glyph: 0x0000 \0000
@@ -840,7 +840,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x0000, // [0]
0x0000, // [1]
0x0000, // [2]
@@ -1101,17 +1101,30 @@
0x00c1 // [257]
};
+ /** The singleton instance. */
+ private static EncodingMacStandard theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "MacStandardEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- EncodingMacStandard() {
+ private EncodingMacStandard() {
super(STANDARD_MACINTOSH_ORDERING, GlyphList.standardSourceGlyphLists(),
EncodingMacStandard.CODE_POINTS,
EncodingMacStandard.CODE_POINT_INDEXES);
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingMacStandard getInstance() {
+ if (EncodingMacStandard.theInstance == null) {
+ EncodingMacStandard.theInstance = new EncodingMacStandard();
+ }
+ return EncodingMacStandard.theInstance;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -43,9 +43,9 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingPDFDoc extends EncodingVector {
+public final class EncodingPDFDoc extends EncodingVector {
-/* public static final String[] sortedGlyphNames = {
+/* private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
"AE", // #1 glyph: 0xc6 \306
"Aacute", // #2 glyph: 0xc1 \301
@@ -277,7 +277,7 @@
"zero" // #228 glyph: 0x30 \60
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x41, // #0
0xc6, // #1
0xc1, // #2
@@ -511,7 +511,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x20, // #0 glyph: 0x20 \40
0x21, // #1 glyph: 0x21 \41
0x22, // #2 glyph: 0x22 \42
@@ -746,7 +746,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x20, // #0
0x21, // #1
0x22, // #2
@@ -978,20 +978,33 @@
0x94 // #228
};
+ /** The singleton instance. */
+ private static EncodingPDFDoc theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "PDFDocEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingPDFDoc() {
+ private EncodingPDFDoc() {
super("PDFDocEncoding", GlyphList.standardSourceGlyphLists(),
EncodingPDFDoc.CODE_POINTS,
EncodingPDFDoc.CODE_POINT_INDEXES);
}
/**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingPDFDoc getInstance() {
+ if (EncodingPDFDoc.theInstance == null) {
+ EncodingPDFDoc.theInstance = new EncodingPDFDoc();
+ }
+ return EncodingPDFDoc.theInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
public org.axsl.psR.EncodingVector bestBaseEncodingPDF() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingStandard.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingStandard.java 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingStandard.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -45,10 +45,10 @@
* </ol>
*
*/
-public class EncodingStandard extends EncodingVector {
+public final class EncodingStandard extends EncodingVector {
/*
- public static final String[] sortedGlyphNames = {
+ private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
"AE", // #1 glyph: 0xe1 \341
"B", // #2 glyph: 0x42 \102
@@ -200,7 +200,7 @@
"zero" // #148 glyph: 0x30 \60
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x41, // #0
0xe1, // #1
0x42, // #2
@@ -354,7 +354,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x20, // #0 glyph: 0x20 \40
0x21, // #1 glyph: 0x21 \41
0x22, // #2 glyph: 0x22 \42
@@ -509,7 +509,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x20, // #0
0x21, // #1
0x22, // #2
@@ -661,20 +661,33 @@
0xaf // #148
};
+ /** The singleton instance. */
+ private static EncodingStandard theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "StandardEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingStandard() {
+ private EncodingStandard() {
super("StandardEncoding", GlyphList.standardSourceGlyphLists(),
EncodingStandard.CODE_POINTS,
EncodingStandard.CODE_POINT_INDEXES);
}
/**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingStandard getInstance() {
+ if (EncodingStandard.theInstance == null) {
+ EncodingStandard.theInstance = new EncodingStandard();
+ }
+ return EncodingStandard.theInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean isPredefinedPS() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -51,9 +51,9 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingSymbol extends EncodingVector {
+public final class EncodingSymbol extends EncodingVector {
-/* public static final String[] sortedGlyphNames = {
+/* private static final String[] sortedGlyphNames = {
"Alpha", // #0 glyph: 0x41 \101
"Beta", // #1 glyph: 0x42 \102
"Chi", // #2 glyph: 0x43 \103
@@ -245,7 +245,7 @@
"zeta" // #188 glyph: 0x7a \172
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x41, // #0
0x42, // #1
0x43, // #2
@@ -439,7 +439,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x20, // #0 glyph: 0x20 \40
0x21, // #1 glyph: 0x21 \41
0x23, // #2 glyph: 0x23 \43
@@ -634,7 +634,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x20, // #0
0x21, // #1
0x23, // #2
@@ -826,17 +826,30 @@
0xfe // #188
};
+ /** The singleton instance. */
+ private static EncodingSymbol theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "SymbolEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingSymbol() {
+ private EncodingSymbol() {
super("SymbolEncoding", GlyphList.standardSourceGlyphLists(),
EncodingSymbol.CODE_POINTS,
EncodingSymbol.CODE_POINT_INDEXES);
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingSymbol getInstance() {
+ if (EncodingSymbol.theInstance == null) {
+ EncodingSymbol.theInstance = new EncodingSymbol();
+ }
+ return EncodingSymbol.theInstance;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -148,31 +148,31 @@
// Otherwise, try to instantiate it.
if (name.equals("AdobeStandardEncoding")
|| name.equals("StandardEncoding")) {
- encoding = new EncodingStandard();
+ encoding = EncodingStandard.getInstance();
} else if (name.equals("ISOLatin1Encoding")) {
- encoding = new EncodingISOLatin1();
+ encoding = EncodingISOLatin1.getInstance();
} else if (name.equals("WinAnsiEncoding")) {
- encoding = new EncodingWinAnsi();
+ encoding = EncodingWinAnsi.getInstance();
} else if (name.equals("SymbolEncoding")) {
- encoding = new EncodingSymbol();
+ encoding = EncodingSymbol.getInstance();
} else if (name.equals("ZapfDingbatsEncoding")) {
- encoding = new EncodingZapfDingbats();
+ encoding = EncodingZapfDingbats.getInstance();
} else if (name.equals("CEEncoding")) {
- encoding = new EncodingCE();
+ encoding = EncodingCE.getInstance();
} else if (name.equals("MacRomanEncoding")) {
- encoding = new EncodingMacRoman();
+ encoding = EncodingMacRoman.getInstance();
} else if (name.equals("PDFDocEncoding")) {
- encoding = new EncodingPDFDoc();
+ encoding = EncodingPDFDoc.getInstance();
} else if (name.equals("MacExpertEncoding")) {
- encoding = new EncodingMacExpert();
+ encoding = EncodingMacExpert.getInstance();
} else if (name.equals("ExpertEncoding")) {
- encoding = new EncodingExpert();
+ encoding = EncodingExpert.getInstance();
} else if (name.equals("ExpertSubsetEncoding")) {
- encoding = new EncodingExpertSubset();
+ encoding = EncodingExpertSubset.getInstance();
} else if (name.equals(EncodingVector.STANDARD_MACINTOSH_ORDERING)) {
- encoding = new EncodingMacStandard();
+ encoding = EncodingMacStandard.getInstance();
} else if (name.equals("FOrayLatinExtraEncoding")) {
- encoding = new EncodingFOrayLatinExtra();
+ 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
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingWinAnsi.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingWinAnsi.java 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingWinAnsi.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -43,9 +43,9 @@
* <li>glyph-lists: [null]</li>
* </ol>
*/
-public class EncodingWinAnsi extends EncodingVector {
+public final class EncodingWinAnsi extends EncodingVector {
-/* public static final String[] sortedGlyphNames = {
+/* private static final String[] sortedGlyphNames = {
"A", // #0 glyph: 0x41 \101
"AE", // #1 glyph: 0xc6 \306
"Aacute", // #2 glyph: 0xc1 \301
@@ -264,7 +264,7 @@
"zero" // #215 glyph: 0x30 \60
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x41, // #0
0xc6, // #1
0xc1, // #2
@@ -485,7 +485,7 @@
*/
/** The Unicode codepoints encoded in this encoding. */
- public static final char[] CODE_POINTS = {
+ private static final char[] CODE_POINTS = {
0x20, // #0 glyph: 0x20 \40
0x21, // #1 glyph: 0x21 \41
0x22, // #2 glyph: 0x22 \42
@@ -707,7 +707,7 @@
/** The array of encoded indexes that is parallel to {@link #CODE_POINTS}.
* For the codepoint found at {@link #CODE_POINTS}[n], the encoded value
* for that codepoint is found at {@link #CODE_POINT_INDEXES}[n]. */
- public static final char[] CODE_POINT_INDEXES = {
+ private static final char[] CODE_POINT_INDEXES = {
0x20, // #0
0x21, // #1
0x22, // #2
@@ -926,24 +926,49 @@
0x99 // #215
};
+ /** The singleton instance. */
+ private static EncodingWinAnsi theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "WinAnsiEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingWinAnsi() {
+ private EncodingWinAnsi() {
super("WinAnsiEncoding", GlyphList.standardSourceGlyphLists(),
EncodingWinAnsi.CODE_POINTS,
EncodingWinAnsi.CODE_POINT_INDEXES);
}
/**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingWinAnsi getInstance() {
+ if (EncodingWinAnsi.theInstance == null) {
+ EncodingWinAnsi.theInstance = new EncodingWinAnsi();
+ }
+ return EncodingWinAnsi.theInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean isPredefinedPDF() {
return true;
}
+ /**
+ * Method allowing the ANSI character set to use the same char array as
+ * this encoding.
+ * @return The character set used by this encoding.
+ */
+ public static char[] getCodePoints() {
+ /* TODO: Remove this method and instead add a constructor to
+ * org.foray.font.charset.CharSet that takes an Encoding or
+ * EncodingVector as its parameter. */
+ return EncodingWinAnsi.CODE_POINTS;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java 2007-04-28 20:05:13 UTC (rev 9285)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java 2007-04-28 20:53:54 UTC (rev 9286)
@@ -49,7 +49,7 @@
* <li>glyph-lists: ZapfDingbats</li>
* </ol>
*/
-public class EncodingZapfDingbats extends EncodingVector {
+public final class EncodingZapfDingbats extends EncodingVector {
/** The array of glyph lists that should be used to map glyph names to
* Unicode code points for this font. */
@@ -60,7 +60,7 @@
};
/*
- public static final String[] sortedGlyphNames = {
+ private static final String[] sortedGlyphNames = {
"a1", // [0] glyph-index: 0x0021 \041
"a10", // [1] glyph-index: 0x0041 \101
"a100", // [2] glyph-index: 0x007e \176
@@ -265,7 +265,7 @@
"space" // [201] glyph-index: 0x0020 \040
};
- public static final short[] glyphIndexes = {
+ private static final short[] glyphIndexes = {
0x0021, // [0] \041 a1
0x0041, // [1] \101 a10
0x007e, // [2] \176 a100
@@ -885,17 +885,30 @@
0x00fe // [201]
};
+ /** The singleton instance. */
+ private static EncodingZapfDingbats theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link EncodingVector#getPredefinedEncoding(String)}.
- * To get the singleton instance of this class, pass "ZapfDingbatsEncoding"
- * to {@link EncodingVector#getPredefinedEncoding(String)}
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- public EncodingZapfDingbats() {
+ private EncodingZapfDingbats() {
super("ZapfDingbatsEncoding", EncodingZapfDingbats.GLYPH_LISTS_USED,
EncodingZapfDingbats.CODE_POINTS,
EncodingZapfDingbats.CODE_POINT_INDEXES);
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static EncodingZapfDingbats getInstance() {
+ if (EncodingZapfDingbats.theInstance == null) {
+ EncodingZapfDingbats.theInstance = new EncodingZapfDingbats();
+ }
+ return EncodingZapfDingbats.theInstance;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-28 20:05:15
|
Revision: 9285
http://svn.sourceforge.net/foray/?rev=9285&view=rev
Author: victormote
Date: 2007-04-28 13:05:13 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Make predefined glyph list subclasses true singletons.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL2.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL3.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL4.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListZapfDingbats.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2007-04-28 00:19:51 UTC (rev 9284)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2007-04-28 20:05:13 UTC (rev 9285)
@@ -185,7 +185,7 @@
}
// Otherwise, try to instantiate it.
if (name.equals("AGL")) {
- list = new GlyphListAGL();
+ list = GlyphListAGL.getInstance();
} else if (name.equals("ZapfDingbats")) {
list = new GlyphListZapfDingbats();
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL.java 2007-04-28 00:19:51 UTC (rev 9284)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL.java 2007-04-28 20:05:13 UTC (rev 9285)
@@ -62,12 +62,12 @@
* @see GlyphListAGL3
* @see GlyphListAGL4
*/
-public class GlyphListAGL extends GlyphList {
+public final class GlyphListAGL extends GlyphList {
/** The list of glyph names for this glyph list.
* This array must be sorted alphabatically as it is used in binary
* search). */
- public static final String[] GLYPH_NAMES = {
+ static final String[] GLYPH_NAMES = {
"A",
"AE",
"AEacute",
@@ -4351,16 +4351,29 @@
"zukatakana"
};
+ /** The singleton instance. */
+ private static GlyphListAGL theInstance;
+
/**
- * Constructor with package-level visibility.
- * This class should only be instantiated by
- * {@link GlyphList#getGlyphList(String)}.
- * To obtain the singleton instance of this class, pass "AGL" to
- * {@link GlyphList#getGlyphList(String)}.
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
- GlyphListAGL() {
+ private GlyphListAGL() {
super("AGL", GlyphListAGL.GLYPH_NAMES, GlyphListAGL2.CHAR_FOR_GLYPH,
GlyphListAGL3.CHAR_LIST, GlyphListAGL4.GLYPH_NAME_INDEX);
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static GlyphListAGL getInstance() {
+ if (GlyphListAGL.theInstance == null) {
+ GlyphListAGL.theInstance = new GlyphListAGL();
+ }
+ return GlyphListAGL.theInstance;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL2.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL2.java 2007-04-28 00:19:51 UTC (rev 9284)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL2.java 2007-04-28 20:05:13 UTC (rev 9285)
@@ -40,7 +40,7 @@
* This array contains the Unicode code points that correspond to the glyph
* names that are found in {@link GlyphListAGL#GLYPH_NAMES}.
*/
- public static final char[][] CHAR_FOR_GLYPH = {
+ static final char[][] CHAR_FOR_GLYPH = {
{ 0x0041 },
{ 0x00C6 },
{ 0x01FC },
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL3.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL3.java 2007-04-28 00:19:51 UTC (rev 9284)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL3.java 2007-04-28 20:05:13 UTC (rev 9285)
@@ -36,7 +36,8 @@
*/
public final class GlyphListAGL3 {
- /** The sorted list of Unicode codepoints whose names are stored in this
+ /**
+ * The sorted list of Unicode codepoints whose names are stored in this
* glyph list.
* This array is parallel to {@link GlyphListAGL4#GLYPH_NAME_INDEX} which
* contains an index to {@link GlyphListAGL#GLYPH_NAMES} for the codepoint
@@ -47,8 +48,9 @@
* Then index into {@link GlyphListAGL4#GLYPH_NAME_INDEX} to get the
* corresponding glyph name index.
* Then use that index to retrieve the glyph name from
- * {@link GlyphListAGL#GLYPH_NAMES}. */
- public static final char[] CHAR_LIST = {
+ * {@link GlyphListAGL#GLYPH_NAMES}.
+ */
+ static final char[] CHAR_LIST = {
0x0001,
0x0002,
0x0003,
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL4.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL4.java 2007-04-28 00:19:51 UTC (rev 9284)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListAGL4.java 2007-04-28 20:05:13 UTC (rev 9285)
@@ -36,11 +36,13 @@
*/
public final class GlyphListAGL4 {
- /** An array parallel to {@link GlyphListAGL3#CHAR_LIST} containing the
+ /**
+ * An array parallel to {@link GlyphListAGL3#CHAR_LIST} containing the
* index into {@link GlyphListAGL#GLYPH_NAMES} for the corresponding Unicode
* codepoint found there.
- * @see GlyphListAGL3#CHAR_LIST */
- public static final short[] GLYPH_NAME_INDEX = {
+ * @see GlyphListAGL3#CHAR_LIST
+ */
+ static final short[] GLYPH_NAME_INDEX = {
1454,
1453,
1443,
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListZapfDingbats.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListZapfDingbats.java 2007-04-28 00:19:51 UTC (rev 9284)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListZapfDingbats.java 2007-04-28 20:05:13 UTC (rev 9285)
@@ -41,7 +41,7 @@
/** The list of glyph names for this glyph list.
* This array must be sorted alphabatically as it is used in binary
* search). */
- public static final String[] GLYPH_NAMES = {
+ private static final String[] GLYPH_NAMES = {
"a1",
"a10",
"a100",
@@ -249,7 +249,7 @@
* This array contains the Unicode code points that correspond to the glyph
* names that are found in GlyphList.agl.
*/
- public static final char[][] CHAR_FOR_GLYPH = {
+ private static final char[][] CHAR_FOR_GLYPH = {
{ 0x2701 },
{ 0x2721 },
{ 0x275e },
@@ -464,7 +464,7 @@
* glyph name index.
* Then use that index to retrieve the glyph name from
* {@link #GLYPH_NAMES}. */
- public static final char[] CHAR_LIST = {
+ private static final char[] CHAR_LIST = {
0x2192,
0x2194,
0x2195,
@@ -671,7 +671,7 @@
/** An array parallel to {@link #CHAR_LIST} containing the index into
* {@link #GLYPH_NAMES} for the corresponding Unicode codepoint found there.
* @see #CHAR_LIST */
- public static final short[] GLYPH_NAME_INDEX = {
+ private static final short[] GLYPH_NAME_INDEX = {
65,
67,
68,
@@ -875,8 +875,14 @@
98
};
+ /** The singleton instance. */
+ private static GlyphListZapfDingbats theInstance;
+
/**
- * Constructor.
+ * Private Constructor. This class is a singleton and should be instantiated
+ * only internally.
+ * To obtain the singleton instance of this class, use
+ * {@link #getInstance()}.
*/
protected GlyphListZapfDingbats() {
super("ZapfDingbats", GlyphListZapfDingbats.GLYPH_NAMES,
@@ -885,4 +891,15 @@
GlyphListZapfDingbats.GLYPH_NAME_INDEX);
}
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton isntance of this class.
+ */
+ public static GlyphListZapfDingbats getInstance() {
+ if (GlyphListZapfDingbats.theInstance == null) {
+ GlyphListZapfDingbats.theInstance = new GlyphListZapfDingbats();
+ }
+ return GlyphListZapfDingbats.theInstance;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-28 00:19:50
|
Revision: 9284
http://svn.sourceforge.net/foray/?rev=9284&view=rev
Author: victormote
Date: 2007-04-27 17:19:51 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
Create the MarkerContent in the area tree when a retrieve-marker is encountered.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-04-27 21:09:52 UTC (rev 9283)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-04-28 00:19:51 UTC (rev 9284)
@@ -171,12 +171,12 @@
*/
public FOLinkageNormal getNormalLinkage(
final RetrieveMarker retrieveMarker) {
- if (this.getLinkage() instanceof FOLinkageNormal) {
- return (FOLinkageNormal) this.getLinkage();
+ final FOLinkage linkage = this.getLinkage();
+ if (linkage instanceof FOLinkageNormal) {
+ return (FOLinkageNormal) linkage;
}
- if (this.getLinkage() instanceof FOLinkageMarker) {
- final FOLinkageMarker linkageMarker = (FOLinkageMarker)
- this.getLinkage();
+ if (linkage instanceof FOLinkageMarker) {
+ final FOLinkageMarker linkageMarker = (FOLinkageMarker) linkage;
return linkageMarker.getNormalLinkage(retrieveMarker);
}
/* TODO: Consider throwing an Exception. This shouldn't happen. */
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java 2007-04-27 21:09:52 UTC (rev 9283)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java 2007-04-28 00:19:51 UTC (rev 9284)
@@ -62,11 +62,8 @@
private AreaNode parent;
/** The children of this node. */
- private List<Area> children = new ArrayList<Area>();
+ private List<AreaNode> children = new ArrayList<AreaNode>();
- /** The children markers. */
- private List<MarkerContent> markers = new ArrayList<MarkerContent>();
-
/** See {@link #getProgressionDimension()} for a description of
* "progression dimension". */
private int progressionDimension = 0;
@@ -223,7 +220,7 @@
return null;
}
final int lastIndex = this.getChildCount() - 1;
- final Area lastChild = this.getChildren().get(lastIndex);
+ final AreaNode lastChild = this.getChildren().get(lastIndex);
if (lastChild instanceof LineArea) {
return (LineArea) lastChild;
}
@@ -282,7 +279,7 @@
/**
* {@inheritDoc}
*/
- public List<Area> getChildren() {
+ public List<AreaNode> getChildren() {
return this.children;
}
@@ -293,7 +290,7 @@
final RetrieveMarker retrieve, final Marker marker) {
final MarkerContent newMarkerContent = MarkerContent.makeMarkerContent(
retrieve, this, marker);
- this.markers.add(newMarkerContent);
+ this.children.add(newMarkerContent);
return newMarkerContent;
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java 2007-04-27 21:09:52 UTC (rev 9283)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java 2007-04-28 00:19:51 UTC (rev 9284)
@@ -30,6 +30,8 @@
import org.axsl.areaW.Area;
import org.axsl.areaW.AreaWException;
+import org.axsl.areaW.MarkerAreaFactory;
+import org.axsl.areaW.MarkerContent;
import org.axsl.areaW.PageArea;
import org.axsl.foR.FoNode;
import org.axsl.foR.fo.Marker;
@@ -59,6 +61,12 @@
*/
public Status layout(final Area area, final RetrieveMarker retrieveMarker)
throws AreaWException {
+ if (! (area instanceof MarkerAreaFactory)) {
+ throw new AreaWException("Area not able to make MarkerContent: "
+ + area.getAreaName());
+ }
+ final MarkerAreaFactory markerAreaFactory = (MarkerAreaFactory) area;
+
/* RetrieveMarker can only exist in static content, so we don't care
* about tracking or setting progress at all. It either fits or it
* doesn't. */
@@ -71,9 +79,11 @@
// Necessary because the marker may get used multiple times.
markerPL.resetProgress();
markerPL.setProgress(0);
+ final MarkerContent markerContent = markerAreaFactory.makeMarkerContent(
+ this.node, bestMarker);
for (int i = 0; i < bestMarker.getChildren().size(); i++) {
final FoNode fo = bestMarker.getChildren().get(i);
- getLayoutProxy(fo).layout(area, this.node);
+ getLayoutProxy(fo).layout(markerContent, this.node);
}
return Status.OK;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-27 21:09:51
|
Revision: 9283
http://svn.sourceforge.net/foray/?rev=9283&view=rev
Author: victormote
Date: 2007-04-27 14:09:52 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
Add DescendantIterator class for FObj, and use it to validate the fo:title.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/java/org/foray/fotree/DescendantIterator.java
Added: trunk/foray/foray-fotree/src/java/org/foray/fotree/DescendantIterator.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/DescendantIterator.java (rev 0)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/DescendantIterator.java 2007-04-27 21:09:52 UTC (rev 9283)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * Iterates over the descendants of an {@link FObj} instance, returning them
+ * in pre-traversal order.
+ */
+public class DescendantIterator implements Iterator<FONode> {
+
+ /** The FObj instance whose descendants are iterated. */
+ private FObj fobj;
+
+ /** The next node to be returned. */
+ private FONode nextNode;
+
+ /**
+ * Constructor.
+ * @param fobj The FObj instance whose descendants are iterated.
+ */
+ public DescendantIterator(final FObj fobj) {
+ this.fobj = fobj;
+ this.nextNode = nextPreOrderBoundedNode(fobj, fobj);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasNext() {
+ return this.nextNode != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public FONode next() {
+ final FONode returnNode = this.nextNode;
+ if (returnNode == null) {
+ throw new NoSuchElementException(DescendantIterator.class.getName()
+ + " hs no more elements.");
+ }
+ this.nextNode = nextPreOrderBoundedNode(returnNode, this.fobj);
+ return returnNode;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void remove() {
+ throw new UnsupportedOperationException("The \"remove\" operation is" +
+ "not supported by " + DescendantIterator.class.getName());
+ }
+
+ /**
+ * Returns the next pre-order node in the tree that is below (bounded by)
+ * the root of the branch that we are examining.
+ * @param node The node for which the next node is needed.
+ * It is required that <code>node</code> be descended from
+ * <code>rootNode</code>, but no testing is done to ensure this condition.
+ * @param rootNode The node which is the root of the branch we are
+ * processing.
+ * Only descendants of this node may be returned.
+ * @return The next pre-order bounded node.
+ */
+ private FONode nextPreOrderBoundedNode(final FONode node,
+ final FONode rootNode) {
+ // Any children?
+ if (node.getChildCount() > 0) {
+ return node.getChildren().get(0);
+ }
+ FONode currentNode = node;
+ while (currentNode != rootNode) {
+ currentNode = (FONode) currentNode.getNextSibling();
+ if (currentNode != null) {
+ return currentNode;
+ }
+ // Go up a level and see if the parent has any siblings
+ currentNode = node.getParent();
+ }
+ /* Current node is equal to the root of the branch being examined. */
+ return null;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/java/org/foray/fotree/DescendantIterator.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-27 19:44:02 UTC (rev 9282)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-27 21:09:52 UTC (rev 9283)
@@ -3753,4 +3753,12 @@
return false;
}
+ /**
+ * Returns an iterator for the descendants of this node.
+ * @return An iterator for the descendants of this node.
+ */
+ public DescendantIterator getDescendantIterator() {
+ return new DescendantIterator(this);
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java 2007-04-27 19:44:02 UTC (rev 9282)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java 2007-04-27 21:09:52 UTC (rev 9283)
@@ -28,6 +28,7 @@
package org.foray.fotree.fo.obj;
+import org.foray.fotree.DescendantIterator;
import org.foray.fotree.FONode;
import org.foray.fotree.FOText;
import org.foray.fotree.FObj;
@@ -35,6 +36,7 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
+import org.axsl.common.value.AbsolutePosition;
import org.axsl.foR.FoTreeException;
import org.axsl.foR.ProxyFactory;
@@ -122,8 +124,24 @@
node.throwException(this.getFullName()
+ " may not have an fo:marker child.");
}
+ /* No descendant can be a block-container that is absolutely
+ * positioned. */
+ final DescendantIterator iterator = fobj.getDescendantIterator();
+ while (iterator.hasNext()) {
+ final FONode descendant = iterator.next();
+ if (descendant instanceof BlockContainer) {
+ final BlockContainer blockContainer
+ = (BlockContainer) descendant;
+ final AbsolutePosition absPosition
+ = blockContainer.traitAbsolutePosition(null);
+ if (absPosition.isAbsolutelyPositioned()) {
+ descendant.throwException("Absolutely-positioned "
+ + "block-container may not descend from "
+ + "fo:title");
+ }
+ }
+ }
}
- return;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-27 19:44:04
|
Revision: 9282
http://svn.sourceforge.net/foray/?rev=9282&view=rev
Author: victormote
Date: 2007-04-27 12:44:02 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
Add some validation for the children of fo:title.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java 2007-04-27 17:23:43 UTC (rev 9281)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java 2007-04-27 19:44:02 UTC (rev 9282)
@@ -28,7 +28,10 @@
package org.foray.fotree.fo.obj;
+import org.foray.fotree.FONode;
+import org.foray.fotree.FOText;
import org.foray.fotree.FObj;
+import org.foray.fotree.FObjMixed;
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
@@ -38,7 +41,7 @@
/**
* A "title" object in XSL-FO.
*/
-public class Title extends FObj implements org.axsl.foR.fo.Title {
+public class Title extends FObjMixed implements org.axsl.foR.fo.Title {
/** The parent of this node. */
private FObj parent;
@@ -90,6 +93,36 @@
* {@inheritDoc}
*/
protected void validateDescendants() throws FoTreeException {
+ for (FONode node : this.getChildren()) {
+ if (node instanceof FOText) {
+ /* Valid child. */
+ continue;
+ }
+ if (! (node instanceof FObj)) {
+ node.throwException("Invalid child of " + this.getFullName());
+ }
+ final FObj fobj = (FObj) node;
+
+ /* Title cannot have block-level children. */
+ if (fobj.isBlockLevelFO()) {
+ node.throwException(this.getFullName()
+ + " may not have a block-level child.");
+ }
+
+ /* If we go this far, the child is a %inline. */
+ if (fobj instanceof Float) {
+ node.throwException(this.getFullName()
+ + " may not have an fo:float child.");
+ }
+ if (fobj instanceof Footnote) {
+ node.throwException(this.getFullName()
+ + " may not have an fo:footnote child.");
+ }
+ if (fobj instanceof Marker) {
+ node.throwException(this.getFullName()
+ + " may not have an fo:marker child.");
+ }
+ }
return;
}
@@ -130,4 +163,11 @@
return this.parent;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean blockMustEnclosePCDATA() {
+ return false;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-27 17:23:42
|
Revision: 9281
http://svn.sourceforge.net/foray/?rev=9281&view=rev
Author: victormote
Date: 2007-04-27 10:23:43 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
Conform to axsl changes renaming method.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Region.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCaption.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -1321,7 +1321,7 @@
* @return True iff this area is a reference area.
*/
public boolean traitIsReferenceArea() {
- return traitGeneratedBy().isRAGenerator();
+ return traitGeneratedBy().traitIsReferenceArea();
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -334,7 +334,7 @@
/**
* {@inheritDoc}
*/
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
return false;
}
@@ -345,7 +345,7 @@
* @return The nearest ancestor FObj that generates reference areas.
*/
public FObj ancestorGeneratingRA(final FoContext context) {
- if (effectiveParent(context).isRAGenerator()) {
+ if (effectiveParent(context).traitIsReferenceArea()) {
return effectiveParent(context);
}
return effectiveParent(context).ancestorGeneratingRA(context);
@@ -358,7 +358,7 @@
* @return Self or the nearest ancestor FObj that generates reference areas.
*/
public FObj nearestGeneratingRA(final FoContext context) {
- if (this.isRAGenerator()) {
+ if (this.traitIsReferenceArea()) {
return this;
}
return ancestorGeneratingRA(context);
@@ -2960,7 +2960,7 @@
final FoContext context) {
/* Per XSL-FO Standard 1.0, Section 7.20.3, reference-orientation is
* only applied to FOs that establish a reference-area. */
- if (isRAGenerator()) {
+ if (traitIsReferenceArea()) {
final FoValue foValue = propertyList.traitReferenceOrientation(
context);
return convertReferenceOrientation(foValue);
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -78,7 +78,7 @@
* {@inheritDoc}
*/
@Override
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
return true;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -113,7 +113,7 @@
* {@inheritDoc}
*/
@Override
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
// See XSL-FO Standard, Section 5.6
return true;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -120,7 +120,7 @@
* {@inheritDoc}
*/
@Override
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
// See XSL-FO Standard, Section 5.6
return true;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Region.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Region.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Region.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -159,7 +159,7 @@
* {@inheritDoc}
*/
@Override
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
// See XSL-FO Standard, Section 5.6
return true;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -346,7 +346,7 @@
* {@inheritDoc}
*/
@Override
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
// See XSL-FO Standard, Section 5.6
return true;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -228,7 +228,7 @@
* {@inheritDoc}
*/
@Override
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
// See XSL-FO Standard, Section 5.6
return true;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCaption.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCaption.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCaption.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -112,7 +112,7 @@
* {@inheritDoc}
*/
@Override
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
// See XSL-FO Standard, Section 5.6
return true;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -191,7 +191,7 @@
* {@inheritDoc}
*/
@Override
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
// See XSL-FO Standard, Section 5.6
return true;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java 2007-04-27 16:53:00 UTC (rev 9280)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java 2007-04-27 17:23:43 UTC (rev 9281)
@@ -111,7 +111,7 @@
* {@inheritDoc}
*/
@Override
- public boolean isRAGenerator() {
+ public boolean traitIsReferenceArea() {
// See XSL-FO Standard, Section 5.6
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-27 16:53:03
|
Revision: 9280
http://svn.sourceforge.net/foray/?rev=9280&view=rev
Author: victormote
Date: 2007-04-27 09:53:00 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
Add another web site to the xsl-fo resources.
Modified Paths:
--------------
trunk/foray/doc/web/app/resources/other.html
trunk/foray/doc/web/dev/admin/release.html
Modified: trunk/foray/doc/web/app/resources/other.html
===================================================================
--- trunk/foray/doc/web/app/resources/other.html 2007-04-26 22:13:52 UTC (rev 9279)
+++ trunk/foray/doc/web/app/resources/other.html 2007-04-27 16:53:00 UTC (rev 9280)
@@ -149,6 +149,9 @@
href="http://www.cranesoftwrights.com/training/index.htm#pfux">Practical
Formatting Using XSLFO</a>, Crane Softwrights Ltd., 2003, ISBN
1-894049-11-X.</li>
+ <li>[web site] <a rel="external"
+href="http://www.xslfo.info">www.xslfo.info</a> A web site containing XSL-FO
+resources.</li>
</ul>
Modified: trunk/foray/doc/web/dev/admin/release.html
===================================================================
--- trunk/foray/doc/web/dev/admin/release.html 2007-04-26 22:13:52 UTC (rev 9279)
+++ trunk/foray/doc/web/dev/admin/release.html 2007-04-27 16:53:00 UTC (rev 9280)
@@ -64,8 +64,9 @@
<li>Publish website to get the new release notes updated.</li>
<li>Announce the release at:
<ol>
+ <li>The foray-dev and foray-announce mailing lists.</li>
<li>www.w3c.org</li>
- <li>The foray-dev and foray-announce mailing lists.</li>
+ <li>www.xslfo.info</li>
</ol>
</li>
<li>Update org.foray.core.Application.getVersion() and the build.common.xml
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-26 22:13:58
|
Revision: 9279
http://svn.sourceforge.net/foray/?rev=9279&view=rev
Author: victormote
Date: 2007-04-26 15:13:52 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
Javadoc improvements.
Modified Paths:
--------------
trunk/foray/doc/web/app/using/release.html
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/MaximumRepeats.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Name.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PageDimension.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pause.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeDimension.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlign.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VerticalAlign.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ZIndex.java
trunk/foray/scripts/checkstyle-suppressions.xml
Modified: trunk/foray/doc/web/app/using/release.html
===================================================================
--- trunk/foray/doc/web/app/using/release.html 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/doc/web/app/using/release.html 2007-04-26 22:13:52 UTC (rev 9279)
@@ -52,9 +52,9 @@
its methods have been replaced by standard Java 5.0 String and Character
methods.</li>
<li>Completion of javadoc API documentation for the FOrayGraphic,
- FOrayHyphen-R, FOrayOutput, FOrayLayout, FOrayText, FOrayMIF, FOrayPDF,
- FOrayArea, FOrayRender, FOrayApp, and FOrayCore modules.
- Only the FOTree now lacks comprehensive javadocs.</li>
+ FOrayHyphen-R, FOrayFOTree, FOrayOutput, FOrayLayout, FOrayText, FOrayMIF,
+ FOrayPDF, FOrayArea, FOrayRender, FOrayApp, and FOrayCore modules.
+ All FOray modules now have comprehensive javadocs.</li>
<li>The FOrayGraphicServer constructor no longer requires the name of the
parser class as a parameter.</li>
<li>JUnit tests have been introduced in most modules. Our testing is far
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -84,6 +84,7 @@
* Converts the unparsed property value into its parsed, storable value.
* @param propertyList The list of properties into which this new property
* will be added.
+ * @param propertyFullName The full name of the property.
* @param value The unparsed property value.
* @return The parsed, storable property value.
* @throws PropertyException For an invalid property value.
@@ -264,34 +265,58 @@
return FoProperty.FONT_FAMILY;
}
+ /**
+ * Returns the "font-style" component from this compound property.
+ * @return The "font-style" component from this compound property.
+ */
public FontStyle getStyle() {
final PropertyCollection collection = (PropertyCollection) value();
return (FontStyle) collection.findProperty(FoProperty.FONT_STYLE);
}
+ /**
+ * Returns the "font-variant" component from this compound property.
+ * @return The "font-variant" component from this compound property.
+ */
public FontVariant getVariant() {
final PropertyCollection collection = (PropertyCollection) value();
return (FontVariant) collection.findProperty(
FoProperty.FONT_VARIANT);
}
+ /**
+ * Returns the "font-weight" component from this compound property.
+ * @return The "font-weight" component from this compound property.
+ */
public FontWeight getWeight() {
final PropertyCollection collection = (PropertyCollection) value();
return (FontWeight) collection.findProperty(
FoProperty.FONT_WEIGHT);
}
+ /**
+ * Returns the "font-size" component from this compound property.
+ * @return The "font-size" component from this compound property.
+ */
public FontSize getSize() {
final PropertyCollection collection = (PropertyCollection) value();
return (FontSize) collection.findProperty(FoProperty.FONT_SIZE);
}
+ /**
+ * Returns the "line-height" component from this compound property.
+ * @return The "line-height" component from this compound property.
+ */
public LineHeight getLineHeight() {
final PropertyCollection collection = (PropertyCollection) value();
return (LineHeight) collection.findProperty(
FoProperty.LINE_HEIGHT);
}
+ /**
+ * Returns the "font-family" component from this compound property.
+ * @return The "font-family" component from this compound property.
+ */
public FontFamily getFamily() {
final PropertyCollection collection = (PropertyCollection) value();
return (FontFamily) collection.findProperty(
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -48,6 +48,7 @@
*/
public class FontFamily extends AbstractFoProperty {
+ /** Constant containing the default font family array. */
public static final String[] DEFAULT_FONT_FAMILY
= {"serif"};
@@ -78,6 +79,14 @@
setValue(createPropertyValue(propertyList, attributeValue));
}
+ /**
+ * Constructor for the case where the property value is already known.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The property value.
+ * @throws PropertyException For an invalid property value.
+ */
public FontFamily(final PropertyList propertyList,
final FoProperty enumeration,
final PropertyValue value) throws PropertyException {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -62,12 +62,25 @@
FoValue.INHERIT,
};
+ /** The index to the "xx-small" value in font-size arrays. */
private static final byte XX_SMALL_INDEX = 0;
+
+ /** The index to the "x-small" value in font-size arrays. */
private static final byte X_SMALL_INDEX = 1;
+
+ /** The index to the "small" value in font-size arrays. */
private static final byte SMALL_INDEX = 2;
+
+ /** The index to the "medium" value in font-size arrays. */
private static final byte MEDIUM_INDEX = 3;
+
+ /** The index to the "large" value in font-size arrays. */
private static final byte LARGE_INDEX = 4;
+
+ /** The index to the "x-large" value in font-size arrays. */
private static final byte X_LARGE_INDEX = 5;
+
+ /** The index to the "xx-large" value in font-size arrays. */
private static final byte XX_LARGE_INDEX = 6;
/** The scaling factor to apply for relative values. See Section 7.8.4 of
@@ -76,6 +89,8 @@
* also. */
private static final float RELATIVE_INCREMENT = 1.2f;
+ /** Array of the print-scaling factors for each of the font-size keyword
+ * values. */
private static final int[] PRINT_SCALING_FACTORS = {
6900,
8300,
@@ -103,6 +118,14 @@
setValue(createPropertyValue(propertyList, attributeValue));
}
+ /**
+ * Constructor for the case where the property value is already known.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The property value.
+ * @throws PropertyException For an invalid property value.
+ */
public FontSize(final PropertyList propertyList,
final FoProperty enumeration,
final PropertyValue value) throws PropertyException {
@@ -205,12 +228,16 @@
return getBaseFontSize(context, fobj);
}
+ /**
+ * Returns the "base font size".
+ * The "base font size" comes from the parent object, and is needed
+ * for "em" and percentage computations.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param fobj The FO for which this value is needed.
+ * @return The initial value for this property.
+ */
private static int getBaseFontSize(final FoContext context,
final FObj fobj) {
- /*
- * The base font size comes from the parent object, and is needed
- * for "em" and percentage computations.
- */
final FObj parent = fobj.effectiveParent(context);
int baseFontSize = getDefaultFontSize();
if (parent != null) {
@@ -219,6 +246,11 @@
return baseFontSize;
}
+ /**
+ * Returns the initial (default) font size. This value is not specified
+ * in the standard, but is left to the user agent.
+ * @return The default font size.
+ */
public static int getDefaultFontSize() {
return PRINT_SCALING_FACTORS[MEDIUM_INDEX];
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -68,6 +68,14 @@
setValue(createPropertyValue(propertyList, attributeValue));
}
+ /**
+ * Constructor for the case where the property value is already known.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The property value.
+ * @throws PropertyException For an invalid property value.
+ */
public FontSizeAdjust(final PropertyList propertyList,
final FoProperty enumeration,
final PropertyValue value) throws PropertyException {
@@ -134,6 +142,10 @@
return -1;
}
+ /**
+ * Returns the default value when there is no value to inherit.
+ * @return The default value.
+ */
public static double getInitialValue() {
return -1;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -78,6 +78,14 @@
setValue(createPropertyValue(propertyList, attributeValue));
}
+ /**
+ * Constructor for the case where the property value is already known.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The property value.
+ * @throws PropertyException For an invalid property value.
+ */
public FontStretch(final PropertyList propertyList,
final FoProperty enumeration,
final PropertyValue value) throws PropertyException {
@@ -158,6 +166,11 @@
return Font.Stretch.NORMAL;
}
+ /**
+ * Returns the initial (default) value for this property when there is no
+ * value to inherit.
+ * @return {@link Font.Stretch#NORMAL}, the initial value.
+ */
public static Font.Stretch getInitialValue() {
return Font.Stretch.NORMAL;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -70,6 +70,14 @@
setValue(createPropertyValue(propertyList, attributeValue));
}
+ /**
+ * Constructor for the case where the property value is already known.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The property value.
+ * @throws PropertyException For an invalid property value.
+ */
public FontStyle(final PropertyList propertyList,
final FoProperty enumeration,
final PropertyValue value) throws PropertyException {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -69,6 +69,14 @@
setValue(createPropertyValue(propertyList, attributeValue));
}
+ /**
+ * Constructor for the case where the property value is already known.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The property value.
+ * @throws PropertyException For an invalid property value.
+ */
public FontVariant(final PropertyList propertyList,
final FoProperty enumeration,
final PropertyValue value) throws PropertyException {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -73,6 +73,14 @@
setValue(createPropertyValue(propertyList, attributeValue));
}
+ /**
+ * Constructor for the case where the property value is already known.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The property value.
+ * @throws PropertyException For an invalid property value.
+ */
public FontWeight(final PropertyList propertyList,
final FoProperty enumeration,
final PropertyValue value) throws PropertyException {
@@ -177,6 +185,12 @@
return VALID_KEYWORDS;
}
+ /**
+ * Returns the inherited font.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param fobj The FO for which this value is needed.
+ * @return The inherited font.
+ */
FontUse getInheritedFont(final FoContext context, final FObj fobj) {
final FObj parent = fobj.effectiveParent(context);
if (parent == null) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -80,6 +80,7 @@
* Converts the unparsed property value into its parsed, storable value.
* @param propertyList The list of properties into which this new property
* will be added.
+ * @param enumeration The enumerated property type.
* @param value The unparsed property value.
* @return The parsed, storable property value.
* @throws PropertyException For an invalid property value.
@@ -93,6 +94,14 @@
return createSimpleValue(propertyList, value);
}
+ /**
+ * Creates the property value for the case where this is a simple property.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param value The unparsed property value.
+ * @return The parsed, storable property value.
+ * @throws PropertyException For an invalid property value.
+ */
private PropertyValue createSimpleValue(final PropertyList propertyList,
final String value) throws PropertyException {
final PropertyValue pv = standardParse(propertyList, value, false,
@@ -109,6 +118,16 @@
throw unexpectedValue(value, propertyList);
}
+ /**
+ * Creates the property value for the case where this property is a
+ * shorthand.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The unparsed property value.
+ * @return The parsed, storable property value.
+ * @throws PropertyException For an invalid property value.
+ */
private PropertyValue createShorthandValue(final PropertyList propertyList,
final FoProperty enumeration, final String value)
throws PropertyException {
@@ -127,7 +146,9 @@
/**
* Returns the value of this property.
* @param context An object that knows how to resolve FO context issues.
+ * @param direction The direction for which the property value is needed.
* @param fobj The FO for which this value is needed.
+ * @param widthContainingBlock The width of the containing block.
* @return The value of this property.
*/
public int getValue(final FoContext context,
@@ -161,6 +182,15 @@
return getValueNoInstance();
}
+ /**
+ * Returns the value of this property in the case where the property value
+ * is stored as a collection.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param direction The direction for which the property value is needed.
+ * @param fobj The FO for which this value is needed.
+ * @param widthContainingBlock The width of the containing block.
+ * @return The value of this property.
+ */
private int getCollectionValue(final FoContext context,
final AbsoluteCompass direction, final FObj fobj,
final int widthContainingBlock) {
@@ -173,6 +203,15 @@
widthContainingBlock);
}
+ /**
+ * Returns the value of this property for the case where the property value
+ * is a keyword.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param direction The direction for which the property value is needed.
+ * @param fobj The FO for which this value is needed.
+ * @param widthContainingBlock The width of the containing block.
+ * @return The value of this property.
+ */
private int getKeywordValue(final FoContext context,
final AbsoluteCompass direction,
final FObj fobj, final int widthContainingBlock) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/MaximumRepeats.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/MaximumRepeats.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/MaximumRepeats.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -44,7 +44,8 @@
*/
public class MaximumRepeats extends AbstractFoProperty {
- public static final int NO_LIMIT = 2147483647;
+ /** Constant for the "no-limit" value. */
+ public static final int NO_LIMIT = Integer.MAX_VALUE;
/** Array of valid keywords. */
private static final FoValue[] VALID_KEYWORDS = {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Name.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Name.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Name.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -117,8 +117,10 @@
}
/**
+ * Returns the value of this property.
* Overloaded version of {@link #getValue(FoContext, FObj)} for properties
* that have no inheritance, either implicit or explicit.
+ * @return The value of this property.
*/
public String getValue() {
if (value() instanceof DtName) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -82,6 +82,7 @@
* Converts the unparsed property value into its parsed, storable value.
* @param propertyList The list of properties into which this new property
* will be added.
+ * @param enumeration The enumerated property type.
* @param value The unparsed property value.
* @return The parsed, storable property value.
* @throws PropertyException For an invalid property value.
@@ -95,6 +96,15 @@
return createSimpleValue(propertyList, value);
}
+ /**
+ * Creates the property value for the case where this property is a simple
+ * property.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param value The unparsed property value.
+ * @return The parsed, storable property value.
+ * @throws PropertyException For an invalid property value.
+ */
private PropertyValue createSimpleValue(final PropertyList propertyList,
final String value) throws PropertyException {
final PropertyValue pv = standardParse(propertyList, value, false,
@@ -111,6 +121,16 @@
throw unexpectedValue(value, propertyList);
}
+ /**
+ * Creates the property value for the case where this property is a
+ * shorthand.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The unparsed property value.
+ * @return The parsed, storable property value.
+ * @throws PropertyException For an invalid property value.
+ */
private PropertyValue createShorthandValue(final PropertyList propertyList,
final FoProperty enumeration, final String value)
throws PropertyException {
@@ -137,7 +157,10 @@
/**
* Returns the value of this property.
* @param context An object that knows how to resolve FO context issues.
+ * @param direction The direction for which the property value is needed.
* @param fobj The FO for which this value is needed.
+ * @param isOuterEdge Indicates whether the direction sought is on the
+ * outer edge of the area.
* @return The value of this property.
*/
public int getValue(final FoContext context,
@@ -181,6 +204,16 @@
return getValueNoInstance();
}
+ /**
+ * Returns the value of this property for the case where this is a
+ * shorthand.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param direction The direction for which the property value is needed.
+ * @param fobj The FO for which this value is needed.
+ * @param isOuterEdge Indicates whether the direction sought is on the
+ * outer edge of the area.
+ * @return The value of this property.
+ */
private int getCollectionValue(final FoContext context,
final RelativeCompass direction, final FObj fobj,
final boolean isOuterEdge) {
@@ -192,6 +225,16 @@
return paddingProperty.getValue(context, direction, fobj, isOuterEdge);
}
+ /**
+ * Returns the value of this property for the case where the property value
+ * is a keyword.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param direction The direction for which the property value is needed.
+ * @param fobj The FO for which this value is needed.
+ * @param isOuterEdge Indicates whether the direction sought is on the
+ * outer edge of the area.
+ * @return The value of this property.
+ */
private int getKeywordValue(final FoContext context,
final RelativeCompass direction,
final FObj fobj, final boolean isOuterEdge) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PageDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PageDimension.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PageDimension.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -93,6 +93,7 @@
/**
* Returns the value of this property.
+ * @param axis The axis for which the property value is needed.
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
@@ -145,6 +146,7 @@
/**
* Returns the default (initial) value for this property.
+ * @param axis The axis for which the property value is needed.
* @return The initial value for this property.
*/
public static int getValueNoInstance(final AbsoluteAxis axis) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pause.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pause.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pause.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -76,6 +76,14 @@
setValue(createPropertyValue(propertyList, attributeValue));
}
+ /**
+ * Constructor for the case where the property value is already known.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param enumeration The enumerated property type.
+ * @param value The property value.
+ * @throws PropertyException For an invalid property value.
+ */
public Pause(final PropertyList propertyList, final FoProperty enumeration,
final PropertyValue value) throws PropertyException {
super(propertyList, enumeration, value);
@@ -105,6 +113,15 @@
throw unexpectedValue(value, propertyList);
}
+ /**
+ * Converts the unparsed property value into its parsed, storable value for
+ * the case where this property is a shorthand.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param value The unparsed property value.
+ * @return The parsed, storable property value.
+ * @throws PropertyException For an invalid property value.
+ */
private PropertyValue createShorthandValue(final PropertyList propertyList,
final String value) throws PropertyException {
final PropertyValue pv = checkKeywords(this.getValidKeywords(), value);
@@ -137,6 +154,8 @@
* Returns the value of this property.
* @param context An object that knows how to resolve FO context issues.
* @param fobj The FO for which this value is needed.
+ * @param propertyType The specific property type to be retrieved from this
+ * compound property.
* @return The value of this property.
*/
public double getValue(final FoContext context, final FObj fobj,
@@ -177,6 +196,14 @@
return 0;
}
+ /**
+ * Returns the value of this property for the case where it is a shorthand.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param fobj The FO for which this value is needed.
+ * @param propertyType The specific property type to be retrieved from this
+ * compound property.
+ * @return The value of this property.
+ */
public double getShorthandValue(final FoContext context, final FObj fobj,
final FoProperty propertyType) {
if (value() instanceof PropertyKeyword) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeDimension.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeDimension.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -103,7 +103,12 @@
/**
* Returns the value of this property.
* @param context An object that knows how to resolve FO context issues.
+ * @param axis The axis for which this property is needed.
+ * @param subProperty The length-range for the property needed (MINIMUM,
+ * OPTIMUM, OR MAXIMUM).
* @param fobj The FO for which this value is needed.
+ * @param parentAreaCRDimension The corresponding dimension of the parent
+ * area content-rectangle.
* @return The value of this property.
*/
public int getValue(final FoContext context, final RelativeAxis axis,
@@ -190,6 +195,8 @@
/**
* Adds a component value to the compound value.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
* @param propertyFullName The full name of the property, including both
* the base and the sub-property name.
* @param attributeValue The value of the component.
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -113,6 +113,16 @@
throw unexpectedValue(value, propertyList);
}
+ /**
+ * Creates the property value when it is a "space" value.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param value The unparsed property value.
+ * @param subPropertyName The sub-property portion of the property name.
+ * @param propertyFullName The full property name.
+ * @return The parsed property value.
+ * @throws PropertyException For an invalid property value.
+ */
private PropertyValue createPropertyValueSpace(
final PropertyList propertyList,
final String value, final String subPropertyName,
@@ -128,7 +138,13 @@
/**
* Returns the value of this property.
* @param context An object that knows how to resolve FO context issues.
+ * @param relativeDirection The direction for which this property value is
+ * needed.
+ * @param subProperty The length-range for the property needed (MINIMUM,
+ * OPTIMUM, OR MAXIMUM).
* @param fobj The FO for which this value is needed.
+ * @param ipdAncestorBlockArea The inline-progression-dimension of the
+ * ancestor block area.
* @return The value of this property.
*/
public int getValue(final FoContext context,
@@ -175,6 +191,18 @@
return getValueNoInstance();
}
+ /**
+ * Returns the inherited value of this property.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param relativeDirection The direction for which this property value is
+ * needed.
+ * @param subProperty The length-range for the property needed (MINIMUM,
+ * OPTIMUM, OR MAXIMUM).
+ * @param fobj The FO for which this value is needed.
+ * @param ipdAncestorBlockArea The inline-progression-dimension of the
+ * ancestor block area.
+ * @return The inherited value of this property.
+ */
private int getValueInherited(final FoContext context,
final RelativeCompass relativeDirection,
final LengthRange subProperty,
@@ -254,6 +282,10 @@
return getValueNoInstance();
}
+ /**
+ * Returns the conditionality component of this property.
+ * @return The conditionality component.
+ */
public FoValue getConditionality() {
if (value() instanceof DtSpace) {
final DtSpace spaceDT = (DtSpace) value();
@@ -262,6 +294,10 @@
return getConditionalityNoInstance();
}
+ /**
+ * Returns the precedence component of this property.
+ * @return The precedence component.
+ */
public int getPrecedence() {
if (value() instanceof DtSpace) {
final DtSpace spaceDT = (DtSpace) value();
@@ -307,6 +343,8 @@
/**
* Adds a component value to the compound value.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
* @param propertyFullName The full name of the property, including both
* the base and the sub-property name.
* @param attributeValue The value of the component.
@@ -328,6 +366,19 @@
return true;
}
+ /**
+ * Creates or adds the Space property value so that components can be added
+ * to it.
+ * @param inputSpaceDT The existing Space object. If it is null, it will be
+ * created.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param value The unparsed attribute value.
+ * @param subPropertyName The subproperty portion of the property name.
+ * @param propertyFullName The full name of the property.
+ * @return The space object that was created or updated.
+ * @throws PropertyException For an invalid property value.
+ */
private DtSpace createOrAddSpace(final DtSpace inputSpaceDT,
final PropertyList propertyList,
final String value, final String subPropertyName,
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlign.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlign.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlign.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -116,6 +116,10 @@
return getValueNoInstance(context, fobj);
}
+ /**
+ * Returns the value of this property if it is a String.
+ * @return The value of this property if it is a String, or null otherwise.
+ */
public String getStringValue() {
if (value() instanceof DtString) {
return ((DtString) value()).getValue();
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VerticalAlign.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VerticalAlign.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VerticalAlign.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -78,6 +78,7 @@
* Converts the unparsed property value into its parsed, storable value.
* @param propertyList The list of properties into which this new property
* will be added.
+ * @param propertyFullName The full name of the property.
* @param value The unparsed property value.
* @return The parsed, storable property value.
* @throws PropertyException For an invalid property value.
@@ -130,6 +131,15 @@
throw unexpectedValue(value, propertyList);
}
+ /**
+ * Creates the property value from a keyword.
+ * @param propertyList The list of properties into which this new property
+ * will be added.
+ * @param propertyFullName The full name of the property.
+ * @param value The unparsed property value.
+ * @return The parsed, storable property value.
+ * @throws PropertyException For an invalid property value.
+ */
public PropertyValue createFromKeyword(final PropertyList propertyList,
final String propertyFullName, final String value)
throws PropertyException {
@@ -279,6 +289,14 @@
baselineShift, dominantBaseline);
}
+ /**
+ * Create a property collection for the various components.
+ * @param alignmentBaseline The alignment-baseline component.
+ * @param alignmentAdjust The alignment-adjust component.
+ * @param baselineShift The baseline-shift component.
+ * @param dominantBaseline The dominant-baseline component.
+ * @return The property collection encapsulating the components.
+ */
private PropertyCollection createCollection(
final AlignmentBaseline alignmentBaseline,
final AlignmentAdjust alignmentAdjust,
@@ -296,6 +314,10 @@
return collection;
}
+ /**
+ * Returns the alignment-baseline component of this compound property.
+ * @return The alignment-baseline component of this compound property.
+ */
public AlignmentBaseline getAlignmentBaseline() {
PropertyCollection collection = null;
if (! (value() instanceof PropertyCollection)) {
@@ -306,6 +328,10 @@
FoProperty.ALIGNMENT_BASELINE);
}
+ /**
+ * Returns the alignment-adjust component of this compound property.
+ * @return The alignment-adjust component of this compound property.
+ */
public AlignmentAdjust getAlignmentAdjust() {
PropertyCollection collection = null;
if (! (value() instanceof PropertyCollection)) {
@@ -316,6 +342,10 @@
FoProperty.ALIGNMENT_ADJUST);
}
+ /**
+ * Returns the baseline-shift component of this compound property.
+ * @return The baseline-shift component of this compound property.
+ */
public BaselineShift getBaselineShift() {
PropertyCollection collection = null;
if (! (value() instanceof PropertyCollection)) {
@@ -326,6 +356,10 @@
FoProperty.BASELINE_SHIFT);
}
+ /**
+ * Returns the dominant-baseline component of this compound property.
+ * @return The dominant-baseline component of this compound property.
+ */
public DominantBaseline getDominantBaseline() {
PropertyCollection collection = null;
if (! (value() instanceof PropertyCollection)) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ZIndex.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ZIndex.java 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ZIndex.java 2007-04-26 22:13:52 UTC (rev 9279)
@@ -90,6 +90,8 @@
/**
* Returns the value of this property.
+ * User programs should check {@link #getValueIsAuto(FoContext, FObj)}
+ * first, so that this value can be ignored.
* @param context An object that knows how to resolve FO context issues.
* @param fobj The FO for which this value is needed.
* @return The value of this property.
@@ -121,11 +123,15 @@
* @return The initial value for this property.
*/
public static int getValueNoInstance() {
- /* User programs should check "traitZIndexIsAuto" first, so that this
- * value is ignored. */
return Integer.MIN_VALUE;
}
+ /**
+ * Indicates whether the value of this property is "auto".
+ * @param context An object that knows how to resolve FO context issues.
+ * @param fobj The FO for which this value is needed.
+ * @return True iff this property value is "auto".
+ */
public boolean getValueIsAuto(final FoContext context, final FObj fobj) {
if (value() instanceof PropertyKeyword) {
final FoValue keyword = ((PropertyKeyword) value()).getValue();
@@ -145,6 +151,10 @@
return false;
}
+ /**
+ * Returns the default for whether this value is "auto" or not.
+ * @return True always, as the default value of "z-index" is auto.
+ */
public static boolean getValueIsAutoNoInstance() {
return true;
}
Modified: trunk/foray/scripts/checkstyle-suppressions.xml
===================================================================
--- trunk/foray/scripts/checkstyle-suppressions.xml 2007-04-26 21:23:17 UTC (rev 9278)
+++ trunk/foray/scripts/checkstyle-suppressions.xml 2007-04-26 22:13:52 UTC (rev 9279)
@@ -6,11 +6,6 @@
<suppressions>
- <!-- Suppress partially-implemented checks where not yet implemented. -->
-
- <suppress checks="Javadoc[MV].*"
- files="org.foray.fotree.fo.prop.*"/>
-
<!-- Suppress Javadoc package documentation for test directories. -->
<suppress checks="PackageHtml"
files="src.javatest.*"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|