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
|
3
|
4
|
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
|
12
|
13
|
14
|
15
|
16
|
17
|
18
(3) |
|
19
|
20
|
21
(15) |
22
(3) |
23
(5) |
24
(21) |
25
(17) |
|
26
(2) |
27
(7) |
28
|
29
(30) |
30
(18) |
|
|
|
From: <vic...@us...> - 2009-04-30 23:34:46
|
Revision: 10840
http://foray.svn.sourceforge.net/foray/?rev=10840&view=rev
Author: victormote
Date: 2009-04-30 23:34:45 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Get doc from the interface.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList4a.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList4a.java 2009-04-30 23:33:39 UTC (rev 10839)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList4a.java 2009-04-30 23:34:45 UTC (rev 10840)
@@ -133,10 +133,7 @@
}
/**
- * Finds the glyph name for a given Unicode code point.
- * @param codePoint The Unicode code point for which a glyph name is sought.
- * @return The glyph name which corresponds to codePoint, or null if there
- * is none.
+ * {@inheritDoc}
*/
public String mapCodePointToGlyphName(final int codePoint) {
if (this.sortedCodePoints == null
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 23:33:41
|
Revision: 10839
http://foray.svn.sourceforge.net/foray/?rev=10839&view=rev
Author: victormote
Date: 2009-04-30 23:33:39 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Implement the aXSL methods.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-30 22:50:12 UTC (rev 10838)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-30 23:33:39 UTC (rev 10839)
@@ -215,18 +215,7 @@
}
/**
- * Parse an encoding vector from an input stream.
- * @param name The name of the encoding vector to be parsed.
- * @param inputStream The input stream containing the raw encoding vector information.
- * @param columnNum The column number in the input file that should be read to get the encoded value for this
- * encoding.
- * Column number 1 is the first field after the glyph name, that is, field 2.
- * @param radix The radix of the numbering system (10 for decimal, 8 for octal, etc.).
- * @param glyphLists A space-separated list of glyph lists to be consulted when mapping glyph names to Unicode code
- * points.
- * @return The parsed encoding vector.
- * @throws IOException For errors opening or reading the input stream.
- * @throws PsException For errors parsing the encoding vector.
+ * {@inheritDoc}
*/
public EncodingVector4a parseEncodingVector(final String name, final InputStream inputStream, final int columnNum,
final int radix, final List<String> glyphLists) throws IOException, PsException {
@@ -280,12 +269,7 @@
}
/**
- * Parse a character set from an input stream.
- * @param name The name of the character set to be parsed.
- * @param inputStream The input stream containing the raw character set information.
- * @return The parsed character set.
- * @throws IOException For errors opening or reading the input stream.
- * @throws PsException For errors parsing the character set.
+ * {@inheritDoc}
*/
public CharSet parseCharSet(final String name, final InputStream inputStream) throws IOException, PsException {
final CharSetParser parser = new CharSetParser(inputStream);
@@ -302,12 +286,7 @@
}
/**
- * Parse a glyph list from an input stream.
- * @param name The name of the glyph list to be parsed.
- * @param inputStream The input stream containing the raw glyph list information.
- * @return The parsed glyph list.
- * @throws IOException For errors opening or reading the input stream.
- * @throws PsException For errors parsing the glyph list.
+ * {@inheritDoc}
*/
public GlyphList4a parseGlyphList(final String name, final InputStream inputStream) throws IOException,
PsException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 22:50:32
|
Revision: 10838
http://foray.svn.sourceforge.net/foray/?rev=10838&view=rev
Author: victormote
Date: 2009-04-30 22:50:12 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Add server method to parse an encoding vector.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-04-30 17:50:15 UTC (rev 10837)
+++ trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-04-30 22:50:12 UTC (rev 10838)
@@ -55,9 +55,12 @@
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Stack;
+import java.util.StringTokenizer;
import javax.xml.parsers.SAXParserFactory;
@@ -762,8 +765,14 @@
return;
}
final int radix = Integer.parseInt(radixString);
- final EncodingParser parser = new EncodingParser(input, columnNumber, radix,
- attributes.getValue("glyph-lists"));
+ final List<String> glyphList = new ArrayList<String>();
+ final String glyphListString = attributes.getValue("glyph-lists");
+ final StringTokenizer tokenizer = new StringTokenizer(glyphListString);
+ while (tokenizer.hasMoreTokens()) {
+ final String token = tokenizer.nextToken();
+ glyphList.add(token);
+ }
+ final EncodingParser parser = new EncodingParser(input, columnNumber, radix, glyphList);
try {
parser.parseList();
} catch (final IOException e2) {
@@ -771,8 +780,7 @@
} catch (final PsException e2) {
logError("Error parsing: " + encodingFile);
}
- encoding = new EncodingCustom(name, parser.getGlyphListsToCheck(),
- parser.getCodePoints(),
+ encoding = new EncodingCustom(name, parser.getGlyphListsToCheck(), parser.getCodePoints(),
parser.getCodePointIndexes());
EncodingVector4a.registerEncoding(name, encoding);
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-30 17:50:15 UTC (rev 10837)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-30 22:50:12 UTC (rev 10838)
@@ -33,6 +33,8 @@
import org.foray.ps.encode.CharSet4a;
import org.foray.ps.encode.CharSetParser;
import org.foray.ps.encode.EncodingCustom;
+import org.foray.ps.encode.EncodingParser;
+import org.foray.ps.encode.EncodingVector4a;
import org.foray.ps.encode.GlyphList4a;
import org.foray.ps.encode.GlyphListParser;
import org.foray.ps.filter.Ascii85DecodeFilter;
@@ -67,6 +69,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.List;
/**
* Implementation of {@link PsServer} for FOray.
@@ -225,15 +228,14 @@
* @throws IOException For errors opening or reading the input stream.
* @throws PsException For errors parsing the encoding vector.
*/
-// public EncodingVector4a parseEncodingVector(final String name, final InputStream inputStream, final int columnNum,
-// final int radix, final List<GlyphList> glyphLists) throws IOException, PsException {
-// final EncodingParser parser = new EncodingParser(inputStream, columnNum, radix, glyphLists);
-// parser.parseList();
-// final EncodingVector4a encodingVector = new EncodingVector4a(name, parser.getGlyphNames(),
-// parser.getCodePointsForGlyphNames(),
-// parser.getCodePoints(), parser.getGlyphNameIndex());
-// return encodingVector;
-// }
+ public EncodingVector4a parseEncodingVector(final String name, final InputStream inputStream, final int columnNum,
+ final int radix, final List<String> glyphLists) throws IOException, PsException {
+ final EncodingParser parser = new EncodingParser(inputStream, columnNum, radix, glyphLists);
+ parser.parseList();
+ final EncodingVector4a encodingVector = new EncodingCustom(name, parser.getGlyphListsToCheck(),
+ parser.getCodePoints(), parser.getCodePointIndexes());
+ return encodingVector;
+ }
/**
* {@inheritDoc}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 17:50:15 UTC (rev 10837)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 22:50:12 UTC (rev 10838)
@@ -34,6 +34,7 @@
import org.foray.common.WKConstants;
import org.foray.common.url.URLFactory;
+import org.axsl.ps.GlyphList;
import org.axsl.ps.PsException;
import org.apache.commons.logging.Log;
@@ -133,7 +134,7 @@
/** The raw space-separated list of glyphs lists that should be consulted to
* map glyph names to Unicode codepoints for this encoding. */
- private String glyphLists;
+ private List<String> glyphLists;
/** The array of glyph lists that can be used to map names to codepoints. */
private List<GlyphList4a> glyphListsToCheck = null;
@@ -161,16 +162,20 @@
* encoding.
* Column number 1 is the first field after the glyph name, that is, field 2.
* @param radix The radix of the numbering system (10 for decimal, 8 for octal, etc.).
- * @param glyphLists A space-separated list of glyph lists to be consulted when mapping glyph names to Unicode code
- * points.
+ * @param glyphLists The list of glyph lists to be consulted when mapping glyph names to Unicode code points, listed
+ * in the order in which they should be checked.
* The Adobe Glyph List is always consulted, but only after any custom ones listed here.
*/
- public EncodingParser(final InputStream input, final int columnNum, final int radix, final String glyphLists) {
+ public EncodingParser(final InputStream input, final int columnNum, final int radix,
+ final List<String> glyphLists) {
final InputStreamReader isr = new InputStreamReader(input);
this.reader = new BufferedReader(isr);
this.columnNum = columnNum;
this.radix = radix;
this.glyphLists = glyphLists;
+ if (this.glyphLists == null) {
+ this.glyphLists = new ArrayList<String>();
+ }
}
/**
@@ -329,28 +334,17 @@
* @throws PsException If a glyph name cannot be mapped to a code point.
*/
private void createCodePoints() throws PsException {
- StringTokenizer tokenizer = null;
- int numListsToCheck = 1;
- if (this.glyphLists != null
- && ! this.glyphLists.equals("")) {
- tokenizer = new StringTokenizer(this.glyphLists);
- numListsToCheck += tokenizer.countTokens();
+ this.glyphListsToCheck = new ArrayList<GlyphList4a>(this.glyphLists.size() + 1);
+ for (String glyphListString : this.glyphLists) {
+ final GlyphList4a glyphList = GlyphList4a.getGlyphList(glyphListString);
+ this.glyphListsToCheck.add(glyphList);
}
- this.glyphListsToCheck = new ArrayList<GlyphList4a>(numListsToCheck);
- int index = 0;
- GlyphList4a glyphList = null;
- if (tokenizer != null) {
- while (tokenizer.hasMoreTokens()) {
- glyphList = GlyphList4a.getGlyphList(tokenizer.nextToken());
- this.glyphListsToCheck.add(glyphList);
- index++;
- }
- }
this.glyphListsToCheck.add(GlyphList4a.getGlyphList("AGL"));
+
for (int i = 0; i < this.glyphNames.size(); i++) {
final String glyphName = this.glyphNames.get(i);
for (int j = 0; j < this.glyphListsToCheck.size(); j++) {
- glyphList = this.glyphListsToCheck.get(j);
+ final GlyphList glyphList = this.glyphListsToCheck.get(j);
final char codePoint = glyphList.mapGlyphNameToCodePoint(
glyphName);
if (codePoint != Character.MAX_VALUE) {
@@ -648,9 +642,14 @@
}
// Get the custom glyph lists.
- String customGlyphLists = null;
+ final List<String> customGlyphLists = new ArrayList<String>();
if (args.length > EncodingParser.ARG_GLYPH_LISTS) {
- customGlyphLists = args[EncodingParser.ARG_GLYPH_LISTS];
+ final String customGlyphListsString = args[EncodingParser.ARG_GLYPH_LISTS];
+ final StringTokenizer tokenizer = new StringTokenizer(customGlyphListsString);
+ while (tokenizer.hasMoreTokens()) {
+ final String token = tokenizer.nextToken();
+ customGlyphLists.add(token);
+ }
}
final EncodingParser parser = new EncodingParser(input, columnNum, radix, customGlyphLists);
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 17:50:16
|
Revision: 10837
http://foray.svn.sourceforge.net/foray/?rev=10837&view=rev
Author: victormote
Date: 2009-04-30 17:50:15 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Convert some uses of arrays to Lists.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector4a.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList4a.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java 2009-04-30 17:22:25 UTC (rev 10836)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java 2009-04-30 17:50:15 UTC (rev 10837)
@@ -30,6 +30,8 @@
import org.axsl.ps.EncodingVector;
+import java.util.List;
+
/**
* An encoding that is not one of the predefined encodings, usually parsed from
* a Type 1 Font.
@@ -54,7 +56,7 @@
* codePoints. codePointIndexes[n] should contain the encoded index that
* corresponds to the Unicode code point at codePoints[n].
*/
- public EncodingCustom(final String name, final GlyphList4a[] sourceGlyphLists,
+ public EncodingCustom(final String name, final List<GlyphList4a> sourceGlyphLists,
final char[] codePoints, final char[] codePointIndexes) {
super(name, sourceGlyphLists, codePoints, codePointIndexes);
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 17:22:25 UTC (rev 10836)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 17:50:15 UTC (rev 10837)
@@ -136,7 +136,7 @@
private String glyphLists;
/** The array of glyph lists that can be used to map names to codepoints. */
- private GlyphList4a[] glyphListsToCheck = null;
+ private List<GlyphList4a> glyphListsToCheck = null;
/** The radix which should be used for parsing. For base-10 numbers, this
* value should be 10. For octal numbers, it should be 8. */
@@ -336,21 +336,21 @@
tokenizer = new StringTokenizer(this.glyphLists);
numListsToCheck += tokenizer.countTokens();
}
- this.glyphListsToCheck = new GlyphList4a[numListsToCheck];
+ this.glyphListsToCheck = new ArrayList<GlyphList4a>(numListsToCheck);
int index = 0;
GlyphList4a glyphList = null;
if (tokenizer != null) {
while (tokenizer.hasMoreTokens()) {
glyphList = GlyphList4a.getGlyphList(tokenizer.nextToken());
- this.glyphListsToCheck[index] = glyphList;
+ this.glyphListsToCheck.add(glyphList);
index++;
}
}
- this.glyphListsToCheck[index] = GlyphList4a.getGlyphList("AGL");
+ this.glyphListsToCheck.add(GlyphList4a.getGlyphList("AGL"));
for (int i = 0; i < this.glyphNames.size(); i++) {
final String glyphName = this.glyphNames.get(i);
- for (int j = 0; j < this.glyphListsToCheck.length; j++) {
- glyphList = this.glyphListsToCheck[j];
+ for (int j = 0; j < this.glyphListsToCheck.size(); j++) {
+ glyphList = this.glyphListsToCheck.get(j);
final char codePoint = glyphList.mapGlyphNameToCodePoint(
glyphName);
if (codePoint != Character.MAX_VALUE) {
@@ -562,7 +562,7 @@
* Returns the glyph lists to check.
* @return The glyph lists to check.
*/
- public GlyphList4a[] getGlyphListsToCheck() {
+ public List<GlyphList4a> getGlyphListsToCheck() {
return this.glyphListsToCheck;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector4a.java 2009-04-30 17:22:25 UTC (rev 10836)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector4a.java 2009-04-30 17:50:15 UTC (rev 10837)
@@ -36,6 +36,7 @@
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -98,15 +99,13 @@
* instantiated. The key to the map is a String containing the name of the
* encoding. The value is the Encoding instance.
*/
- private static Map<String, EncodingVector4a> predefinedEncodings
- = new HashMap<String, EncodingVector4a>();
+ private static Map<String, EncodingVector4a> predefinedEncodings = new HashMap<String, EncodingVector4a>();
/** The name of this encoding. */
private transient String name;
- /** The GlyphList instances, in order, which were used to create this
- * encoding. */
- private transient GlyphList4a[] sourceGlyphLists;
+ /** The GlyphList instances, in order, which were used to create this encoding. */
+ private transient List<GlyphList4a> sourceGlyphLists;
/** Array of Unicode code points, sorted. Elements in this array are keys
* to elements in {@link #codePointIndexes}. */
@@ -131,7 +130,7 @@
* codePoints. codePointIndexes[n] should contain the encoded index that
* corresponds to the Unicode code point at codePoints[n].
*/
- public EncodingVector4a(final String name, final GlyphList4a[] sourceGlyphLists,
+ public EncodingVector4a(final String name, final List<GlyphList4a> sourceGlyphLists,
final char[] codePoints, final char[] codePointIndexes) {
this.name = name;
this.sourceGlyphLists = sourceGlyphLists;
@@ -308,8 +307,7 @@
}
for (int i = 0; i < this.codePoints.length; i++) {
final char codePoint = this.codePoints[i];
- final String glyphName = GlyphList4a.mapCodePointToGlyphName(
- this.sourceGlyphLists, codePoint);
+ final String glyphName = GlyphList4a.mapCodePointToGlyphName(this.sourceGlyphLists, codePoint);
final int encodingIndex = this.codePointIndexes[i];
glyphList[encodingIndex] = glyphName;
}
@@ -500,8 +498,8 @@
* @throws ClassNotFoundException For classes in the input that cannot be
* found.
*/
- private void readObject(final ObjectInputStream stream)
- throws IOException, ClassNotFoundException {
+ @SuppressWarnings("unchecked")
+ private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
if (this.isStatic()) {
/* The static instances do not need to be serialized as they are
* derived entirely from static data. */
@@ -509,7 +507,7 @@
}
stream.defaultReadObject();
this.name = (String) stream.readObject();
- this.sourceGlyphLists = (GlyphList4a[]) stream.readObject();
+ this.sourceGlyphLists = (List<GlyphList4a>) stream.readObject();
this.codePoints = (char[]) stream.readObject();
this.codePointIndexes = (char[]) stream.readObject();
}
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 2009-04-30 17:22:25 UTC (rev 10836)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java 2009-04-30 17:50:15 UTC (rev 10837)
@@ -32,6 +32,8 @@
import java.io.ObjectStreamException;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
/**
@@ -62,10 +64,11 @@
/** The array of glyph lists that should be used to map glyph names to
* Unicode code points for this font. */
- private static final GlyphList4a[] GLYPH_LISTS_USED = {
- GlyphList4a.getGlyphList("ZapfDingbats"),
- /* We need the Adobe Glyph List to get the "space" char. */
- GlyphList4a.getGlyphList("AGL")
+ private static final List<GlyphList4a> GLYPH_LISTS_USED = new ArrayList<GlyphList4a>(2);
+ static {
+ EncodingZapfDingbats.GLYPH_LISTS_USED.add(GlyphList4a.getGlyphList("ZapfDingbats"));
+ /* We need the Adobe Glyph List to get the "space" char. */
+ EncodingZapfDingbats.GLYPH_LISTS_USED.add(GlyphList4a.getGlyphList("AGL"));
};
/*
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList4a.java 2009-04-30 17:22:25 UTC (rev 10836)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList4a.java 2009-04-30 17:50:15 UTC (rev 10837)
@@ -34,8 +34,11 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -60,10 +63,15 @@
/** An array of glyph lists representing those that should be consulted
* as a standard source. */
- private static final GlyphList4a[] STANDARD_SOURCE_GLYPH_LISTS = {
- GlyphList4a.getGlyphList("AGL")
+ private static final List<GlyphList4a> STANDARD_SOURCE_GLYPH_LISTS = new ArrayList<GlyphList4a>();
+ static {
+ GlyphList4a.STANDARD_SOURCE_GLYPH_LISTS.add(GlyphList4a.getGlyphList("AGL"));
};
+ /** An immutable view of {@link #STANDARD_SOURCE_GLYPH_LISTS}. */
+ private static final List<GlyphList4a> STANDARD_SOURCE_GLYPH_LISTS_IMMUTABLE
+ = Collections.unmodifiableList(GlyphList4a.STANDARD_SOURCE_GLYPH_LISTS);
+
/** A unique, descriptive name for this GlyphList. */
private transient String name;
@@ -250,13 +258,12 @@
* is none.
* @see GlyphList4a#mapCodePointToGlyphName(int)
*/
- public static String mapCodePointToGlyphName(final GlyphList4a[] glyphLists,
- final int codePoint) {
+ public static String mapCodePointToGlyphName(final List<GlyphList4a> glyphLists, final int codePoint) {
if (glyphLists == null) {
return null;
}
- for (int i = 0; i < glyphLists.length; i++) {
- final GlyphList4a list = glyphLists[i];
+ for (int i = 0; i < glyphLists.size(); i++) {
+ final GlyphList4a list = glyphLists.get(i);
if (list == null) {
continue;
}
@@ -285,13 +292,12 @@
* {@link Encoding4a#INVALID_UNICODE_CHAR} if there is none.
* @see GlyphList4a#mapGlyphNameToCodePoint(String)
*/
- public static char mapGlyphNameToCodePoint(final GlyphList4a[] glyphLists,
- final String glyphName) {
+ public static char mapGlyphNameToCodePoint(final List<GlyphList4a> glyphLists, final String glyphName) {
if (glyphLists == null) {
return Encoding4a.INVALID_UNICODE_CHAR;
}
- for (int i = 0; i < glyphLists.length; i++) {
- final GlyphList4a list = glyphLists[i];
+ for (int i = 0; i < glyphLists.size(); i++) {
+ final GlyphList4a list = glyphLists.get(i);
if (list == null) {
continue;
}
@@ -307,8 +313,8 @@
* Returns the standard glyphs lists.
* @return The standard glyph lists.
*/
- public static GlyphList4a[] standardSourceGlyphLists() {
- return GlyphList4a.STANDARD_SOURCE_GLYPH_LISTS;
+ public static List<GlyphList4a> standardSourceGlyphLists() {
+ return GlyphList4a.STANDARD_SOURCE_GLYPH_LISTS_IMMUTABLE;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 17:22:31
|
Revision: 10836
http://foray.svn.sourceforge.net/foray/?rev=10836&view=rev
Author: victormote
Date: 2009-04-30 17:22:25 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Add some methods for parsing CharSet and GlyphList instances.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-30 16:22:59 UTC (rev 10835)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PsServer4a.java 2009-04-30 17:22:25 UTC (rev 10836)
@@ -31,8 +31,10 @@
import org.foray.ps.encode.CMap04;
import org.foray.ps.encode.CMap12;
import org.foray.ps.encode.CharSet4a;
+import org.foray.ps.encode.CharSetParser;
import org.foray.ps.encode.EncodingCustom;
import org.foray.ps.encode.GlyphList4a;
+import org.foray.ps.encode.GlyphListParser;
import org.foray.ps.filter.Ascii85DecodeFilter;
import org.foray.ps.filter.Ascii85EncodeFilter;
import org.foray.ps.filter.AsciiHexDecodeFilter;
@@ -55,6 +57,7 @@
import org.axsl.ps.Cmap12;
import org.axsl.ps.EncodingVector;
import org.axsl.ps.GlyphList;
+import org.axsl.ps.PsException;
import org.axsl.ps.PsFilterType;
import org.axsl.ps.PsInput;
import org.axsl.ps.PsServer;
@@ -209,6 +212,30 @@
}
/**
+ * Parse an encoding vector from an input stream.
+ * @param name The name of the encoding vector to be parsed.
+ * @param inputStream The input stream containing the raw encoding vector information.
+ * @param columnNum The column number in the input file that should be read to get the encoded value for this
+ * encoding.
+ * Column number 1 is the first field after the glyph name, that is, field 2.
+ * @param radix The radix of the numbering system (10 for decimal, 8 for octal, etc.).
+ * @param glyphLists A space-separated list of glyph lists to be consulted when mapping glyph names to Unicode code
+ * points.
+ * @return The parsed encoding vector.
+ * @throws IOException For errors opening or reading the input stream.
+ * @throws PsException For errors parsing the encoding vector.
+ */
+// public EncodingVector4a parseEncodingVector(final String name, final InputStream inputStream, final int columnNum,
+// final int radix, final List<GlyphList> glyphLists) throws IOException, PsException {
+// final EncodingParser parser = new EncodingParser(inputStream, columnNum, radix, glyphLists);
+// parser.parseList();
+// final EncodingVector4a encodingVector = new EncodingVector4a(name, parser.getGlyphNames(),
+// parser.getCodePointsForGlyphNames(),
+// parser.getCodePoints(), parser.getGlyphNameIndex());
+// return encodingVector;
+// }
+
+ /**
* {@inheritDoc}
*/
public Cmap04 makeCmap04(final String name, final int expectedEntries) {
@@ -251,10 +278,42 @@
}
/**
+ * Parse a character set from an input stream.
+ * @param name The name of the character set to be parsed.
+ * @param inputStream The input stream containing the raw character set information.
+ * @return The parsed character set.
+ * @throws IOException For errors opening or reading the input stream.
+ * @throws PsException For errors parsing the character set.
+ */
+ public CharSet parseCharSet(final String name, final InputStream inputStream) throws IOException, PsException {
+ final CharSetParser parser = new CharSetParser(inputStream);
+ parser.parseList();
+ final CharSet4a charSet = new CharSet4a(name, parser.getCharacterSet());
+ return charSet;
+ }
+
+ /**
* {@inheritDoc}
*/
public GlyphList getPredefinedGlyphList(final GlyphList.Predefined predefined) {
return GlyphList4a.getGlyphList(predefined);
}
+ /**
+ * Parse a glyph list from an input stream.
+ * @param name The name of the glyph list to be parsed.
+ * @param inputStream The input stream containing the raw glyph list information.
+ * @return The parsed glyph list.
+ * @throws IOException For errors opening or reading the input stream.
+ * @throws PsException For errors parsing the glyph list.
+ */
+ public GlyphList4a parseGlyphList(final String name, final InputStream inputStream) throws IOException,
+ PsException {
+ final GlyphListParser parser = new GlyphListParser(inputStream);
+ parser.parseList();
+ final GlyphList4a glyphList = new GlyphList4a(name, parser.getGlyphNames(), parser.getCodePointsForGlyphNames(),
+ parser.getCodePoints(), parser.getGlyphNameIndex());
+ return glyphList;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 16:23:05
|
Revision: 10835
http://foray.svn.sourceforge.net/foray/?rev=10835&view=rev
Author: victormote
Date: 2009-04-30 16:22:59 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Throw Exceptions instead of logging errors.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-04-30 16:03:09 UTC (rev 10834)
+++ trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-04-30 16:22:59 UTC (rev 10835)
@@ -36,6 +36,7 @@
import org.foray.ps.encode.GlyphListParser;
import org.axsl.font.FontException;
+import org.axsl.ps.PsException;
import org.apache.commons.logging.Log;
@@ -761,13 +762,14 @@
return;
}
final int radix = Integer.parseInt(radixString);
- final EncodingParser parser = new EncodingParser(
- this.fontServer.getLogger(), input, columnNumber, radix,
+ final EncodingParser parser = new EncodingParser(input, columnNumber, radix,
attributes.getValue("glyph-lists"));
try {
parser.parseList();
} catch (final IOException e2) {
logError("Error parsing: " + encodingFile);
+ } catch (final PsException e2) {
+ logError("Error parsing: " + encodingFile);
}
encoding = new EncodingCustom(name, parser.getGlyphListsToCheck(),
parser.getCodePoints(),
@@ -813,11 +815,13 @@
logError("Unable to read: " + file);
return;
}
- final GlyphListParser parser = new GlyphListParser(this.fontServer.getLogger(), input);
+ final GlyphListParser parser = new GlyphListParser(input);
try {
parser.parseList();
} catch (final IOException e2) {
logError("Error parsing: " + file);
+ } catch (final PsException e2) {
+ logError("Error parsing: " + file);
}
glyphList = new GlyphList4a(name, parser.getGlyphNames(),
parser.getCodePointsForGlyphNames(), parser.getCodePoints(),
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java 2009-04-30 16:03:09 UTC (rev 10834)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java 2009-04-30 16:22:59 UTC (rev 10835)
@@ -33,6 +33,8 @@
import org.foray.common.StringUtil;
import org.foray.common.url.URLFactory;
+import org.axsl.ps.PsException;
+
import org.apache.commons.logging.Log;
import java.io.BufferedReader;
@@ -76,16 +78,11 @@
/** The array of glyph names in the character set. */
private List<String> glyphNames = new ArrayList<String>();
- /** The logger. */
- private Log logger;
-
/**
* Create a new CharSetParser instance.
- * @param logger The logger to use for user messages.
* @param input The reader encapsulating the file to be read.
*/
- public CharSetParser(final Log logger, final InputStream input) {
- this.logger = logger;
+ public CharSetParser(final InputStream input) {
final InputStreamReader isr = new InputStreamReader(input);
this.reader = new BufferedReader(isr);
}
@@ -93,8 +90,9 @@
/**
* Parses a glyph list.
* @throws IOException For I/O error.
+ * @throws PsException For errors parsing the input.
*/
- public void parseList() throws IOException {
+ public void parseList() throws IOException, PsException {
parseLines();
sortCharacterSet();
}
@@ -102,8 +100,9 @@
/**
* Parses the lines of the character set input file.
* @throws IOException For I/O error.
+ * @throws PsException For errors parsing the input.
*/
- private void parseLines() throws IOException {
+ private void parseLines() throws IOException, PsException {
boolean endOfFile = false;
endOfFile = false;
int arrayIndex = 0;
@@ -147,14 +146,15 @@
* Process a content line.
* @param line The text from the line.
* @param arrayIndex The current glyph index being processed.
+ * @throws PsException For errors parsing the line.
*/
- private void processCurrentLine(final String line, final int arrayIndex) {
+ private void processCurrentLine(final String line, final int arrayIndex) throws PsException {
this.characterSet.add(Character.MIN_VALUE);
this.glyphNames.add(StringUtil.EMPTY_STRING);
final GlyphList4a gl = GlyphList4a.getGlyphList("AGL");
final char theChar = gl.mapGlyphNameToCodePoint(line);
if (theChar == Character.MAX_VALUE) {
- this.logger.error("Character not found in Adobe Glyph List, line "
+ throw new PsException("Character not found in Adobe Glyph List, line "
+ this.currentLineNumber + ": " + line);
}
@@ -274,13 +274,17 @@
+ args[1] + "\n");
System.exit(1);
}
- final CharSetParser parser = new CharSetParser(logger, input);
+ final CharSetParser parser = new CharSetParser(input);
try {
parser.parseList();
} catch (final IOException e3) {
logger.error("Error parsing: " + args[0] + "\n");
logger.error(" " + e3.getMessage());
System.exit(1);
+ } catch (final PsException e3) {
+ logger.error("Error parsing: " + args[0] + "\n");
+ logger.error(" " + e3.getMessage());
+ System.exit(1);
}
try {
parser.writeAsJavaStatics(output);
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 16:03:09 UTC (rev 10834)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 16:22:59 UTC (rev 10835)
@@ -34,6 +34,8 @@
import org.foray.common.WKConstants;
import org.foray.common.url.URLFactory;
+import org.axsl.ps.PsException;
+
import org.apache.commons.logging.Log;
import java.io.BufferedReader;
@@ -129,9 +131,6 @@
* different column. */
private int columnNum = -1;
- /** The logger. */
- private Log logger;
-
/** The raw space-separated list of glyphs lists that should be consulted to
* map glyph names to Unicode codepoints for this encoding. */
private String glyphLists;
@@ -157,22 +156,16 @@
/**
* Create a new EncodingParser instance.
- * @param logger The logger.
* @param input The reader encapsulating the file to be parsed.
- * @param columnNum The column number in the input file that should be
- * read to get the encoded value for this encoding.
- * Column number 1 is the first field after the glyph name, that is, field
- * 2.
- * @param radix The radix of the numbering system (10 for decimal, 8 for
- * octal, etc.).
- * @param glyphLists A space-separated list of glyph lists to be consulted
- * when mapping glyph names to Unicode code points.
- * The Adobe Glyph List is always consulted, but only after any custom ones
- * listed here.
+ * @param columnNum The column number in the input file that should be read to get the encoded value for this
+ * encoding.
+ * Column number 1 is the first field after the glyph name, that is, field 2.
+ * @param radix The radix of the numbering system (10 for decimal, 8 for octal, etc.).
+ * @param glyphLists A space-separated list of glyph lists to be consulted when mapping glyph names to Unicode code
+ * points.
+ * The Adobe Glyph List is always consulted, but only after any custom ones listed here.
*/
- public EncodingParser(final Log logger, final InputStream input, final int columnNum, final int radix,
- final String glyphLists) {
- this.logger = logger;
+ public EncodingParser(final InputStream input, final int columnNum, final int radix, final String glyphLists) {
final InputStreamReader isr = new InputStreamReader(input);
this.reader = new BufferedReader(isr);
this.columnNum = columnNum;
@@ -183,8 +176,9 @@
/**
* Parses a glyph list.
* @throws IOException For I/O Errors.
+ * @throws PsException For errors parsing the input.
*/
- public void parseList() throws IOException {
+ public void parseList() throws IOException, PsException {
parseLines();
sortGlyphNames();
createCodePoints();
@@ -194,8 +188,9 @@
/**
* Parses the lines of the file.
* @throws IOException For I/O Error.
+ * @throws PsException For errors parsing the input.
*/
- private void parseLines() throws IOException {
+ private void parseLines() throws IOException, PsException {
boolean endOfFile = false;
endOfFile = false;
int arrayIndex = 0;
@@ -258,10 +253,10 @@
/**
* Parsed the content line.
* @param line The String of text for the line being parsed.
- * @param arrayIndex The current index into the arrays containing the parsed
- * data.
+ * @param arrayIndex The current index into the arrays containing the parsed data.
+ * @throws PsException For errors parsing the line.
*/
- private void processCurrentLine(final String line, final int arrayIndex) {
+ private void processCurrentLine(final String line, final int arrayIndex) throws PsException {
this.glyphNames.add(StringUtil.EMPTY_STRING);
this.glyphIndexes.add(Character.MIN_VALUE);
this.codePoints.add(Character.MIN_VALUE);
@@ -274,9 +269,7 @@
try {
index = Integer.parseInt(numericString, this.radix);
} catch (final NumberFormatException e) {
- this.logger.error("Invalid octal string, line "
- + this.currentLineNumber
- + ": " + numericString);
+ throw new PsException("Invalid octal string, line " + this.currentLineNumber + ": " + numericString, e);
}
if (index > WKConstants.MAX_8_BIT_UNSIGNED_VALUES - 1) {
index = WKConstants.MAX_8_BIT_UNSIGNED_VALUES - 1;
@@ -333,8 +326,9 @@
* For each glyph name in the encoding, finds all known Unicode code points
* that map to that glyph name, and writes them to an array. It also writes
* the glyph index for this encoding to a parallel array.
+ * @throws PsException If a glyph name cannot be mapped to a code point.
*/
- private void createCodePoints() {
+ private void createCodePoints() throws PsException {
StringTokenizer tokenizer = null;
int numListsToCheck = 1;
if (this.glyphLists != null
@@ -368,7 +362,7 @@
}
if (this.codePointIndexes.get(i) == 0
&& ! glyphName.equals(EncodingVector4a.NOTDEF)) {
- this.logger.error("Glyph name not found: " + glyphName);
+ throw new PsException("Glyph name not found: " + glyphName);
}
}
}
@@ -658,8 +652,7 @@
if (args.length > EncodingParser.ARG_GLYPH_LISTS) {
customGlyphLists = args[EncodingParser.ARG_GLYPH_LISTS];
}
- final EncodingParser parser = new EncodingParser(logger, input,
- columnNum, radix, customGlyphLists);
+ final EncodingParser parser = new EncodingParser(input, columnNum, radix, customGlyphLists);
try {
parser.parseList();
} catch (final IOException e3) {
@@ -667,6 +660,11 @@
+ args[EncodingParser.ARG_INPUT_URL] + "\n");
logger.error(" " + e3.getMessage());
System.exit(1);
+ } catch (final PsException e3) {
+ logger.error("Error parsing: "
+ + args[EncodingParser.ARG_INPUT_URL] + "\n");
+ logger.error(" " + e3.getMessage());
+ System.exit(1);
}
try {
parser.writeAsJavaStatics(output);
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 16:03:09 UTC (rev 10834)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 16:22:59 UTC (rev 10835)
@@ -33,6 +33,8 @@
import org.foray.common.WKConstants;
import org.foray.common.url.URLFactory;
+import org.axsl.ps.PsException;
+
import org.apache.commons.logging.Log;
import java.io.BufferedReader;
@@ -80,16 +82,11 @@
* @see #getGlyphNameIndex() */
private short[] glyphNameIndex;
- /** The logger. */
- private Log logger;
-
/**
* Create a new GlyphListParser instance.
- * @param logger The logger.
* @param input The file to be parsed.
*/
- public GlyphListParser(final Log logger, final InputStream input) {
- this.logger = logger;
+ public GlyphListParser(final InputStream input) {
final InputStreamReader isr = new InputStreamReader(input);
this.reader = new BufferedReader(isr);
}
@@ -97,8 +94,9 @@
/**
* Parses a glyph list.
* @throws IOException For I/O Error.
+ * @throws PsException For errors parsing the input.
*/
- public void parseList() throws IOException {
+ public void parseList() throws IOException, PsException {
parseLines();
sortGlyphNames();
copyCodePoints();
@@ -109,8 +107,9 @@
/**
* Parse the lines of the file.
* @throws IOException For I/O Error.
+ * @throws PsException For errors parsing the input.
*/
- private void parseLines() throws IOException {
+ private void parseLines() throws IOException, PsException {
boolean endOfFile = false;
endOfFile = false;
int arrayIndex = 0;
@@ -153,10 +152,10 @@
/**
* Parsed the current line of content.
* @param line The line from the input file.
- * @param arrayIndex The index into the arrays of parsed input into which
- * the parsed input should be placed.
+ * @param arrayIndex The index into the arrays of parsed input into which the parsed input should be placed.
+ * @throws PsException For errors parsing the line.
*/
- private void processCurrentLine(final String line, final int arrayIndex) {
+ private void processCurrentLine(final String line, final int arrayIndex) throws PsException {
this.glyphNames.add(StringUtil.EMPTY_STRING);
this.codePointsForGlyphNames.add(GlyphListParser.EMPTY_CHAR_ARRAY);
@@ -167,17 +166,12 @@
this.glyphNames.set(arrayIndex, tokens[0]);
final char[] charArray = new char[tokens.length - 1];
for (int i = 1; i < tokens.length; i++) {
- int parsedValue = Integer.parseInt(tokens[i],
- WKConstants.MAX_4_BIT_UNSIGNED_VALUES);
+ final int parsedValue = Integer.parseInt(tokens[i], WKConstants.MAX_4_BIT_UNSIGNED_VALUES);
if (parsedValue < 0) {
- this.logger.error("Value out of range, line "
- + this.currentLineNumber);
- parsedValue = 0;
+ throw new PsException("Value out of range, line " + this.currentLineNumber);
}
if (parsedValue > WKConstants.MAX_16_BIT_UNSIGNED_VALUES - 1) {
- this.logger.error("Value out of range, line "
- + this.currentLineNumber);
- parsedValue = WKConstants.MAX_16_BIT_UNSIGNED_VALUES - 1;
+ throw new PsException("Value out of range, line " + this.currentLineNumber);
}
charArray[i - 1] = (char) parsedValue;
}
@@ -437,13 +431,17 @@
+ args[1] + "\n");
System.exit(1);
}
- final GlyphListParser parser = new GlyphListParser(logger, input);
+ final GlyphListParser parser = new GlyphListParser(input);
try {
parser.parseList();
} catch (final IOException e3) {
logger.error("Error parsing: " + args[0] + "\n");
logger.error(" " + e3.getMessage());
System.exit(1);
+ } catch (final PsException e3) {
+ logger.error("Error parsing: " + args[0] + "\n");
+ logger.error(" " + e3.getMessage());
+ System.exit(1);
}
try {
parser.writeAsJavaStatics(output);
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java 2009-04-30 16:03:09 UTC (rev 10834)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java 2009-04-30 16:22:59 UTC (rev 10835)
@@ -28,9 +28,10 @@
package org.foray.ps.encode;
-import org.foray.common.Logging;
import org.foray.common.TestFOrayCommon;
+import org.axsl.ps.PsException;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -46,15 +47,16 @@
/**
* Black-box test, parsing the glyph list for the WinAnsi Encoding.
* @throws IOException For errors opening or reading the input file.
+ * @throws PsException For errors parsing the input.
*/
- public void testWinAnsi() throws IOException {
+ public void testWinAnsi() throws IOException, PsException {
final File sandbox = TestFOrayCommon.getSandbox();
final File testFile = new File(sandbox, "foray-ps/resource/encoding/latin-pdf.txt");
final InputStream input = new FileInputStream(testFile);
assertNotNull(input);
/* The WinAnsi content is in column 3, and the radix is octal. See the file itself for details. */
- final EncodingParser parser = new EncodingParser(Logging.makeDefaultLogger(), input, 3, 8, null);
+ final EncodingParser parser = new EncodingParser(input, 3, 8, null);
parser.parseList();
/* Did we parse the right number of elements. Last element is on line 237. First 8 lines are blank. In the
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java 2009-04-30 16:03:09 UTC (rev 10834)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java 2009-04-30 16:22:59 UTC (rev 10835)
@@ -28,9 +28,10 @@
package org.foray.ps.encode;
-import org.foray.common.Logging;
import org.foray.common.TestFOrayCommon;
+import org.axsl.ps.PsException;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -45,14 +46,15 @@
/**
* Black-box test, parsing the glyph list for Zapf Dingbats.
* @throws IOException For errors opening or reading the input file.
+ * @throws PsException For errors parsing the input.
*/
- public void testZdGl() throws IOException {
+ public void testZdGl() throws IOException, PsException {
final File sandbox = TestFOrayCommon.getSandbox();
final File testFile = new File(sandbox, "foray-ps/resource/glyph-list/zapfdingbats.txt");
final FileInputStream input = new FileInputStream(testFile);
assertNotNull(input);
- final GlyphListParser parser = new GlyphListParser(Logging.makeDefaultLogger(), input);
+ final GlyphListParser parser = new GlyphListParser(input);
parser.parseList();
/* Test that we parsed the right number of elements. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 16:03:13
|
Revision: 10834
http://foray.svn.sourceforge.net/foray/?rev=10834&view=rev
Author: victormote
Date: 2009-04-30 16:03:09 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Change the input to InputStream for a more general solution.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-04-30 15:48:23 UTC (rev 10833)
+++ trunk/foray/foray-font/src/java/org/foray/font/ConfigParser.java 2009-04-30 16:03:09 UTC (rev 10834)
@@ -28,7 +28,6 @@
package org.foray.font;
-import org.foray.common.RandomReader;
import org.foray.common.url.URLFactory;
import org.foray.ps.encode.EncodingCustom;
import org.foray.ps.encode.EncodingParser;
@@ -52,6 +51,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
@@ -738,9 +738,9 @@
logError("Unable to create URL: " + encodingFile);
return;
}
- RandomReader reader;
+ InputStream input;
try {
- reader = new RandomReader(url);
+ input = url.openStream();
} catch (final IOException e1) {
logError("Unable to read: " + encodingFile);
return;
@@ -762,7 +762,7 @@
}
final int radix = Integer.parseInt(radixString);
final EncodingParser parser = new EncodingParser(
- this.fontServer.getLogger(), reader, columnNumber, radix,
+ this.fontServer.getLogger(), input, columnNumber, radix,
attributes.getValue("glyph-lists"));
try {
parser.parseList();
@@ -806,15 +806,14 @@
logError("Unable to create URL: " + file);
return;
}
- RandomReader reader;
+ InputStream input;
try {
- reader = new RandomReader(url);
+ input = url.openStream();
} catch (final IOException e1) {
logError("Unable to read: " + file);
return;
}
- final GlyphListParser parser = new GlyphListParser(
- this.fontServer.getLogger(), reader);
+ final GlyphListParser parser = new GlyphListParser(this.fontServer.getLogger(), input);
try {
parser.parseList();
} catch (final IOException e2) {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java 2009-04-30 15:48:23 UTC (rev 10833)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java 2009-04-30 16:03:09 UTC (rev 10834)
@@ -30,15 +30,17 @@
import org.foray.common.CharacterUtil;
import org.foray.common.Logging;
-import org.foray.common.RandomReader;
import org.foray.common.StringUtil;
import org.foray.common.url.URLFactory;
import org.apache.commons.logging.Log;
+import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
@@ -63,7 +65,7 @@
private static final int DESIRED_COLUMN = 28;
/** The reader for the file. */
- private RandomReader reader = null;
+ private BufferedReader reader = null;
/** The current line number. */
private transient int currentLineNumber = 0;
@@ -80,11 +82,12 @@
/**
* Create a new CharSetParser instance.
* @param logger The logger to use for user messages.
- * @param reader The reader encapsulating the file to be read.
+ * @param input The reader encapsulating the file to be read.
*/
- public CharSetParser(final Log logger, final RandomReader reader) {
+ public CharSetParser(final Log logger, final InputStream input) {
this.logger = logger;
- this.reader = reader;
+ final InputStreamReader isr = new InputStreamReader(input);
+ this.reader = new BufferedReader(isr);
}
/**
@@ -101,7 +104,6 @@
* @throws IOException For I/O error.
*/
private void parseLines() throws IOException {
- this.reader.seek(0);
boolean endOfFile = false;
endOfFile = false;
int arrayIndex = 0;
@@ -257,9 +259,9 @@
logger.error(" " + e.getMessage());
System.exit(1);
}
- RandomReader input = null;
+ InputStream input = null;
try {
- input = new RandomReader(url);
+ input = url.openStream();
} catch (final IOException e1) {
logger.error("Unable to create Reader for: " + args[0] + "\n");
System.exit(1);
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 15:48:23 UTC (rev 10833)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 16:03:09 UTC (rev 10834)
@@ -30,16 +30,18 @@
import org.foray.common.CharacterUtil;
import org.foray.common.Logging;
-import org.foray.common.RandomReader;
import org.foray.common.StringUtil;
import org.foray.common.WKConstants;
import org.foray.common.url.URLFactory;
import org.apache.commons.logging.Log;
+import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
@@ -116,7 +118,7 @@
private static final int CODE_POINTS_INDEX_1 = 18;
/** The reader for the input file. */
- private RandomReader reader = null;
+ private BufferedReader reader = null;
/** Counter for the current line number. */
private int currentLineNumber = 0;
@@ -156,7 +158,7 @@
/**
* Create a new EncodingParser instance.
* @param logger The logger.
- * @param reader The reader encapsulating the file to be parsed.
+ * @param input The reader encapsulating the file to be parsed.
* @param columnNum The column number in the input file that should be
* read to get the encoded value for this encoding.
* Column number 1 is the first field after the glyph name, that is, field
@@ -168,10 +170,11 @@
* The Adobe Glyph List is always consulted, but only after any custom ones
* listed here.
*/
- public EncodingParser(final Log logger, final RandomReader reader,
- final int columnNum, final int radix, final String glyphLists) {
+ public EncodingParser(final Log logger, final InputStream input, final int columnNum, final int radix,
+ final String glyphLists) {
this.logger = logger;
- this.reader = reader;
+ final InputStreamReader isr = new InputStreamReader(input);
+ this.reader = new BufferedReader(isr);
this.columnNum = columnNum;
this.radix = radix;
this.glyphLists = glyphLists;
@@ -193,7 +196,6 @@
* @throws IOException For I/O Error.
*/
private void parseLines() throws IOException {
- this.reader.seek(0);
boolean endOfFile = false;
endOfFile = false;
int arrayIndex = 0;
@@ -613,9 +615,9 @@
logger.error(" " + e.getMessage());
System.exit(1);
}
- RandomReader input = null;
+ InputStream input = null;
try {
- input = new RandomReader(url);
+ input = url.openStream();
} catch (final IOException e1) {
logger.error("Unable to create Reader for: "
+ args[EncodingParser.ARG_INPUT_URL]
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 15:48:23 UTC (rev 10833)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 16:03:09 UTC (rev 10834)
@@ -29,16 +29,18 @@
package org.foray.ps.encode;
import org.foray.common.Logging;
-import org.foray.common.RandomReader;
import org.foray.common.StringUtil;
import org.foray.common.WKConstants;
import org.foray.common.url.URLFactory;
import org.apache.commons.logging.Log;
+import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
@@ -55,7 +57,7 @@
private static final char[] EMPTY_CHAR_ARRAY = new char[0];
/** The reader used by this parser. */
- private RandomReader reader = null;
+ private BufferedReader reader = null;
/** Counter for the current line number. */
private int currentLineNumber = 0;
@@ -84,11 +86,12 @@
/**
* Create a new GlyphListParser instance.
* @param logger The logger.
- * @param reader The reader encapsulating the file to be parsed.
+ * @param input The file to be parsed.
*/
- public GlyphListParser(final Log logger, final RandomReader reader) {
+ public GlyphListParser(final Log logger, final InputStream input) {
this.logger = logger;
- this.reader = reader;
+ final InputStreamReader isr = new InputStreamReader(input);
+ this.reader = new BufferedReader(isr);
}
/**
@@ -108,7 +111,6 @@
* @throws IOException For I/O Error.
*/
private void parseLines() throws IOException {
- this.reader.seek(0);
boolean endOfFile = false;
endOfFile = false;
int arrayIndex = 0;
@@ -420,9 +422,9 @@
logger.error(" " + e.getMessage());
System.exit(1);
}
- RandomReader input = null;
+ InputStream input = null;
try {
- input = new RandomReader(url);
+ input = url.openStream();
} catch (final IOException e1) {
logger.error("Unable to create Reader for: " + args[0] + "\n");
System.exit(1);
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java 2009-04-30 15:48:23 UTC (rev 10833)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java 2009-04-30 16:03:09 UTC (rev 10834)
@@ -29,11 +29,12 @@
package org.foray.ps.encode;
import org.foray.common.Logging;
-import org.foray.common.RandomReader;
import org.foray.common.TestFOrayCommon;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import junit.framework.TestCase;
@@ -49,11 +50,11 @@
public void testWinAnsi() throws IOException {
final File sandbox = TestFOrayCommon.getSandbox();
final File testFile = new File(sandbox, "foray-ps/resource/encoding/latin-pdf.txt");
- final RandomReader reader = new RandomReader(testFile.toURI().toURL());
- assertNotNull(reader);
+ final InputStream input = new FileInputStream(testFile);
+ assertNotNull(input);
/* The WinAnsi content is in column 3, and the radix is octal. See the file itself for details. */
- final EncodingParser parser = new EncodingParser(Logging.makeDefaultLogger(), reader, 3, 8, null);
+ final EncodingParser parser = new EncodingParser(Logging.makeDefaultLogger(), input, 3, 8, null);
parser.parseList();
/* Did we parse the right number of elements. Last element is on line 237. First 8 lines are blank. In the
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java 2009-04-30 15:48:23 UTC (rev 10833)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java 2009-04-30 16:03:09 UTC (rev 10834)
@@ -29,10 +29,10 @@
package org.foray.ps.encode;
import org.foray.common.Logging;
-import org.foray.common.RandomReader;
import org.foray.common.TestFOrayCommon;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import junit.framework.TestCase;
@@ -49,10 +49,10 @@
public void testZdGl() throws IOException {
final File sandbox = TestFOrayCommon.getSandbox();
final File testFile = new File(sandbox, "foray-ps/resource/glyph-list/zapfdingbats.txt");
- final RandomReader reader = new RandomReader(testFile.toURI().toURL());
- assertNotNull(reader);
+ final FileInputStream input = new FileInputStream(testFile);
+ assertNotNull(input);
- final GlyphListParser parser = new GlyphListParser(Logging.makeDefaultLogger(), reader);
+ final GlyphListParser parser = new GlyphListParser(Logging.makeDefaultLogger(), input);
parser.parseList();
/* Test that we parsed the right number of elements. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 15:48:25
|
Revision: 10833
http://foray.svn.sourceforge.net/foray/?rev=10833&view=rev
Author: victormote
Date: 2009-04-30 15:48:23 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Use Lists instead of arrays to avoid the need to read the input twice.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 15:28:13 UTC (rev 10832)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 15:48:23 UTC (rev 10833)
@@ -30,6 +30,7 @@
import org.foray.common.Logging;
import org.foray.common.RandomReader;
+import org.foray.common.StringUtil;
import org.foray.common.WKConstants;
import org.foray.common.url.URLFactory;
@@ -41,6 +42,8 @@
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
/**
* A GlyphListParser instance parses a glyph list, arranging its data for
@@ -48,6 +51,9 @@
*/
public class GlyphListParser {
+ /** Empty character array used as a placeholder. */
+ private static final char[] EMPTY_CHAR_ARRAY = new char[0];
+
/** The reader used by this parser. */
private RandomReader reader = null;
@@ -57,11 +63,11 @@
/** The sorted list of glyph names in this glyph list.
* The corresponding Unicode codepoints are found in {@link #codePointsForGlyphNames}.
* @see #getGlyphNames() */
- private String[] glyphNames;
+ private List<String> glyphNames = new ArrayList<String>();
/** The array of Unicode codepoints that corresponds to {@link #glyphNames}.
* @see #getCodePointsForGlyphNames() */
- private char[][] codePointsForGlyphNames;
+ private List<char[]> codePointsForGlyphNames = new ArrayList<char[]>();
/** The sorted list of codepoints.
* The corresponding indexes into the glyph names is found in {@link #glyphNameIndex}.
@@ -90,12 +96,6 @@
* @throws IOException For I/O Error.
*/
public void parseList() throws IOException {
- final int numberOfLines = countLines();
- if (numberOfLines < 1) {
- return;
- }
- this.glyphNames = new String[numberOfLines];
- this.codePointsForGlyphNames = new char[numberOfLines][];
parseLines();
sortGlyphNames();
copyCodePoints();
@@ -104,28 +104,6 @@
}
/**
- * Counts the number of lines of input.
- * @return The number of content lines in the input.
- * @throws IOException For I/O Error.
- */
- private int countLines() throws IOException {
- int count = 0;
- this.reader.seek(0);
- boolean endOfFile = false;
- while (! endOfFile) {
- final String currentLine = this.reader.readLine();
- if (currentLine == null) {
- endOfFile = true;
- break;
- }
- if (lineHasContent(currentLine)) {
- count++;
- }
- }
- return count;
- }
-
- /**
* Parse the lines of the file.
* @throws IOException For I/O Error.
*/
@@ -177,11 +155,14 @@
* the parsed input should be placed.
*/
private void processCurrentLine(final String line, final int arrayIndex) {
+ this.glyphNames.add(StringUtil.EMPTY_STRING);
+ this.codePointsForGlyphNames.add(GlyphListParser.EMPTY_CHAR_ARRAY);
+
final String[] tokens = line.split("[; ]");
if (tokens.length < 2) {
return;
}
- this.glyphNames[arrayIndex] = tokens[0];
+ this.glyphNames.set(arrayIndex, tokens[0]);
final char[] charArray = new char[tokens.length - 1];
for (int i = 1; i < tokens.length; i++) {
int parsedValue = Integer.parseInt(tokens[i],
@@ -198,7 +179,7 @@
}
charArray[i - 1] = (char) parsedValue;
}
- this.codePointsForGlyphNames[arrayIndex] = charArray;
+ this.codePointsForGlyphNames.set(arrayIndex, charArray);
}
/**
@@ -209,20 +190,17 @@
boolean anyChanges = true;
while (anyChanges) {
anyChanges = false;
- for (int i = 0; i < this.glyphNames.length - 1; i++) {
- final int compareValue = this.glyphNames[i].compareTo(
- this.glyphNames[i + 1]);
+ for (int i = 0; i < this.glyphNames.size() - 1; i++) {
+ final int compareValue = this.glyphNames.get(i).compareTo(this.glyphNames.get(i + 1));
if (compareValue > 0) {
/* Item at [i + 1] is less than item at [i]. Switch them
* and the same elements in codePointsForGlyphNames. */
- final String storeString = this.glyphNames[i];
- this.glyphNames[i] = this.glyphNames[i + 1];
- this.glyphNames[i + 1] = storeString;
- final char[] storeCharArray
- = this.codePointsForGlyphNames[i];
- this.codePointsForGlyphNames[i]
- = this.codePointsForGlyphNames[i + 1];
- this.codePointsForGlyphNames[i + 1] = storeCharArray;
+ final String storeString = this.glyphNames.get(i);
+ this.glyphNames.set(i, this.glyphNames.get(i + 1));
+ this.glyphNames.set(i + 1, storeString);
+ final char[] storeCharArray = this.codePointsForGlyphNames.get(i);
+ this.codePointsForGlyphNames.set(i, this.codePointsForGlyphNames.get(i + 1));
+ this.codePointsForGlyphNames.set(i + 1, storeCharArray);
anyChanges = true;
}
}
@@ -234,9 +212,9 @@
* name for a given Unicode code point.
*/
private void copyCodePoints() {
- this.codePoints = new char[this.codePointsForGlyphNames.length];
- for (int i = 0; i < this.codePointsForGlyphNames.length; i++) {
- this.codePoints[i] = this.codePointsForGlyphNames[i][0];
+ this.codePoints = new char[this.codePointsForGlyphNames.size()];
+ for (int i = 0; i < this.codePointsForGlyphNames.size(); i++) {
+ this.codePoints[i] = this.codePointsForGlyphNames.get(i)[0];
}
}
@@ -301,11 +279,11 @@
out.write(s.getBytes());
s = " public static final String[] glyphList = {\n";
out.write(s.getBytes());
- for (int i = 0; i < this.glyphNames.length; i++) {
+ for (int i = 0; i < this.glyphNames.size(); i++) {
s = " \"";
- s = s + this.glyphNames[i];
+ s = s + this.glyphNames.get(i);
s = s + "\"";
- if (i < this.glyphNames.length - 1) {
+ if (i < this.glyphNames.size() - 1) {
s = s + ",";
}
s = s + "\n";
@@ -319,8 +297,8 @@
out.write(s.getBytes());
s = " public static final char[][] charForGlyph = {\n";
out.write(s.getBytes());
- for (int i = 0; i < this.codePointsForGlyphNames.length; i++) {
- final char[] charArray = this.codePointsForGlyphNames[i];
+ for (int i = 0; i < this.codePointsForGlyphNames.size(); i++) {
+ final char[] charArray = this.codePointsForGlyphNames.get(i);
s = " { ";
for (int j = 0; j < charArray.length; j++) {
final char theChar = charArray[j];
@@ -332,7 +310,7 @@
s = s + " ";
}
s = s + "}";
- if (i < this.codePointsForGlyphNames.length - 1) {
+ if (i < this.codePointsForGlyphNames.size() - 1) {
s = s + ",";
}
s = s + "\n";
@@ -384,7 +362,8 @@
* @return The glyph names.
*/
public String[] getGlyphNames() {
- return this.glyphNames;
+ final String[] returnArray = new String[this.glyphNames.size()];
+ return this.glyphNames.toArray(returnArray);
}
/**
@@ -392,7 +371,11 @@
* @return The codepoints for glyph names.
*/
public char[][] getCodePointsForGlyphNames() {
- return this.codePointsForGlyphNames;
+ final char[][] returnArray = new char[this.codePointsForGlyphNames.size()][];
+ for (int i = 0; i < this.codePointsForGlyphNames.size(); i++) {
+ returnArray[i] = this.codePointsForGlyphNames.get(i);
+ }
+ return returnArray;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 15:28:14
|
Revision: 10832
http://foray.svn.sourceforge.net/foray/?rev=10832&view=rev
Author: victormote
Date: 2009-04-30 15:28:13 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Use Lists instead of arrays to avoid the need to read the input twice.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java 2009-04-30 15:17:46 UTC (rev 10831)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CharSetParser.java 2009-04-30 15:28:13 UTC (rev 10832)
@@ -28,6 +28,7 @@
package org.foray.ps.encode;
+import org.foray.common.CharacterUtil;
import org.foray.common.Logging;
import org.foray.common.RandomReader;
import org.foray.common.StringUtil;
@@ -41,6 +42,8 @@
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
/**
* A GlyphListParser instance parses a glyph list, arranging its data for
@@ -66,10 +69,10 @@
private transient int currentLineNumber = 0;
/** The array of characters in the character set. */
- private char[] characterSet;
+ private List<Character> characterSet = new ArrayList<Character>();
/** The array of glyph names in the character set. */
- private String[] glyphNames;
+ private List<String> glyphNames = new ArrayList<String>();
/** The logger. */
private Log logger;
@@ -89,39 +92,11 @@
* @throws IOException For I/O error.
*/
public void parseList() throws IOException {
- final int numberOfLines = countLines();
- if (numberOfLines < 1) {
- return;
- }
- this.characterSet = new char[numberOfLines];
- this.glyphNames = new String[numberOfLines];
parseLines();
sortCharacterSet();
}
/**
- * Counts the content lines in the file.
- * @return The number of content lines in the file.
- * @throws IOException For I/O Error.
- */
- private int countLines() throws IOException {
- int count = 0;
- this.reader.seek(0);
- boolean endOfFile = false;
- while (! endOfFile) {
- final String currentLine = this.reader.readLine();
- if (currentLine == null) {
- endOfFile = true;
- break;
- }
- if (lineHasContent(currentLine)) {
- count++;
- }
- }
- return count;
- }
-
- /**
* Parses the lines of the character set input file.
* @throws IOException For I/O error.
*/
@@ -172,6 +147,8 @@
* @param arrayIndex The current glyph index being processed.
*/
private void processCurrentLine(final String line, final int arrayIndex) {
+ this.characterSet.add(Character.MIN_VALUE);
+ this.glyphNames.add(StringUtil.EMPTY_STRING);
final GlyphList4a gl = GlyphList4a.getGlyphList("AGL");
final char theChar = gl.mapGlyphNameToCodePoint(line);
if (theChar == Character.MAX_VALUE) {
@@ -179,8 +156,8 @@
+ this.currentLineNumber + ": " + line);
}
- this.characterSet[arrayIndex] = theChar;
- this.glyphNames[arrayIndex] = line;
+ this.characterSet.set(arrayIndex, theChar);
+ this.glyphNames.set(arrayIndex, line);
}
/**
@@ -191,16 +168,16 @@
boolean anyChanges = true;
while (anyChanges) {
anyChanges = false;
- for (int i = 0; i < this.characterSet.length - 1; i++) {
- if (this.characterSet[i] > this.characterSet[i + 1]) {
+ for (int i = 0; i < this.characterSet.size() - 1; i++) {
+ if (this.characterSet.get(i) > this.characterSet.get(i + 1)) {
/* They are out of order. Switch the corresponding elements
* in both arrays. */
- final char storeChar = this.characterSet[i];
- this.characterSet[i] = this.characterSet[i + 1];
- this.characterSet[i + 1] = storeChar;
- final String storeString = this.glyphNames[i];
- this.glyphNames[i] = this.glyphNames[i + 1];
- this.glyphNames[i + 1] = storeString;
+ final char storeChar = this.characterSet.get(i);
+ this.characterSet.set(i, this.characterSet.get(i + 1));
+ this.characterSet.set(i + 1, storeChar);
+ final String storeString = this.glyphNames.get(i);
+ this.glyphNames.set(i, this.glyphNames.get(i + 1));
+ this.glyphNames.set(i + 1, storeString);
anyChanges = true;
}
}
@@ -228,11 +205,11 @@
out.write(s.getBytes());
s = " public static final char[] characterSet = {\n";
out.write(s.getBytes());
- for (int i = 0; i < this.characterSet.length; i++) {
+ for (int i = 0; i < this.characterSet.size(); i++) {
s = " 0x";
- s = s + StringUtil.charToHexString(this.characterSet[i], true,
+ s = s + StringUtil.charToHexString(this.characterSet.get(i), true,
CharSetParser.MINIMUM_CHAR_SIZE);
- if (i < this.characterSet.length - 1) {
+ if (i < this.characterSet.size() - 1) {
s = s + ",";
} else {
s = s + " ";
@@ -240,7 +217,7 @@
s = s + " // " + EncodingParser.formatArrayIndex(i);
s = EncodingParser.padSpaces(s, CharSetParser.DESIRED_COLUMN,
CharSetParser.MINIMUM_PADDING_SIZE);
- s = s + this.glyphNames[i];
+ s = s + this.glyphNames.get(i);
s = s + "\n";
out.write(s.getBytes());
}
@@ -249,6 +226,14 @@
}
/**
+ * Returns the parsed Unicode code points in this character set.
+ * @return The Unicode code points in this character set.
+ */
+ public char[] getCharacterSet() {
+ return CharacterUtil.toArray(this.characterSet);
+ }
+
+ /**
* Main method useful for parsing a glyph list file from the command-line
* and generating the java code that encapsulates that glyph list.
* @param args Element 0 is the URL of the glyph list to be parsed.
@@ -306,12 +291,4 @@
/* Checkstyle-GenericIllegalRegexp-On. */
}
- /**
- * Returns the parsed Unicode code points in this character set.
- * @return The Unicode code points in this character set.
- */
- public char[] getCharacterSet() {
- return this.characterSet;
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 15:17:47
|
Revision: 10831
http://foray.svn.sourceforge.net/foray/?rev=10831&view=rev
Author: victormote
Date: 2009-04-30 15:17:46 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Use lists instead of arrays to avoid needing to read the file twice.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/CharacterUtil.java
Added: trunk/foray/foray-common/src/java/org/foray/common/CharacterUtil.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/CharacterUtil.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/CharacterUtil.java 2009-04-30 15:17:46 UTC (rev 10831)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2009 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common;
+
+import java.util.List;
+
+/**
+ * Utilities related to char and Character.
+ */
+public final class CharacterUtil {
+
+ /**
+ * Private constructor. This is a utility class, and should never be instantiated.
+ */
+ private CharacterUtil() { }
+
+ /**
+ * Converts a List of Character instances into an array of chars.
+ * @param list The List of Character instances to be converted to an array.
+ * @return The array of chars.
+ */
+ public static char[] toArray(final List<Character> list) {
+ if (list == null) {
+ return new char[0];
+ }
+ final char[] returnArray = new char[list.size()];
+ for (int i = 0; i < list.size(); i++) {
+ returnArray[i] = list.get(i);
+ }
+ return returnArray;
+ }
+
+}
Property changes on: trunk/foray/foray-common/src/java/org/foray/common/CharacterUtil.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 14:23:39 UTC (rev 10830)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 15:17:46 UTC (rev 10831)
@@ -28,6 +28,7 @@
package org.foray.ps.encode;
+import org.foray.common.CharacterUtil;
import org.foray.common.Logging;
import org.foray.common.RandomReader;
import org.foray.common.StringUtil;
@@ -42,6 +43,8 @@
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
import java.util.StringTokenizer;
/**
@@ -134,21 +137,21 @@
/** The array of glyph lists that can be used to map names to codepoints. */
private GlyphList4a[] glyphListsToCheck = null;
- /** The names of the glyphs parsed from the encoding. */
- private String[] glyphNames;
-
/** The radix which should be used for parsing. For base-10 numbers, this
* value should be 10. For octal numbers, it should be 8. */
private int radix;
+ /** The names of the glyphs parsed from the encoding. */
+ private List<String> glyphNames = new ArrayList<String>();
+
/** The parsed glyph indexes. */
- private char[] glyphIndexes;
+ private List<Character> glyphIndexes = new ArrayList<Character>();
/** The parsed Unicode codepoints. */
- private char[] codePoints;
+ private List<Character> codePoints = new ArrayList<Character>();
/** The parsed encoded indexes. */
- private char[] codePointIndexes;
+ private List<Character> codePointIndexes = new ArrayList<Character>();
/**
* Create a new EncodingParser instance.
@@ -179,42 +182,13 @@
* @throws IOException For I/O Errors.
*/
public void parseList() throws IOException {
- final int numberOfLines = countLines();
- if (numberOfLines < 1) {
- return;
- }
- this.glyphNames = new String[numberOfLines];
- this.glyphIndexes = new char[numberOfLines];
parseLines();
sortGlyphNames();
createCodePoints();
- EncodingVector4a.sortCodePoints(this.codePoints, this.codePointIndexes);
+ EncodingVector4a.sortCodePoints(this.getCodePoints(), this.getCodePointIndexes());
}
/**
- * Counts the number of content lines in the input file.
- * @return The number of content lines in the input file.
- * @throws IOException For I/O Exception.
- */
- private int countLines() throws IOException {
- int count = 0;
- this.reader.seek(0);
- boolean endOfFile = false;
- while (! endOfFile) {
- final String currentLine = this.reader.readLine();
- if (currentLine == null) {
- endOfFile = true;
- break;
- }
- if (lineHasContent(currentLine)
- && lineAppliesToEncoding(currentLine)) {
- count++;
- }
- }
- return count;
- }
-
- /**
* Parses the lines of the file.
* @throws IOException For I/O Error.
*/
@@ -286,8 +260,13 @@
* data.
*/
private void processCurrentLine(final String line, final int arrayIndex) {
+ this.glyphNames.add(StringUtil.EMPTY_STRING);
+ this.glyphIndexes.add(Character.MIN_VALUE);
+ this.codePoints.add(Character.MIN_VALUE);
+ this.codePointIndexes.add(Character.MIN_VALUE);
+
final String[] tokens = tokenizeLine(line);
- this.glyphNames[arrayIndex] = tokens[0];
+ this.glyphNames.set(arrayIndex, tokens[0]);
final String numericString = tokens[this.columnNum];
int index = -1;
try {
@@ -303,7 +282,7 @@
if (index < 0) {
index = 0;
}
- this.glyphIndexes[arrayIndex] = (char) index;
+ this.glyphIndexes.set(arrayIndex, (char) index);
}
/**
@@ -331,18 +310,17 @@
boolean anyChanges = true;
while (anyChanges) {
anyChanges = false;
- for (int i = 0; i < this.glyphNames.length - 1; i++) {
- final int compareValue = this.glyphNames[i].compareTo(
- this.glyphNames[i + 1]);
+ for (int i = 0; i < this.glyphNames.size() - 1; i++) {
+ final int compareValue = this.glyphNames.get(i).compareTo(this.glyphNames.get(i + 1));
if (compareValue > 0) {
/* Item at [i + 1] is less than item at [i]. Switch them
* and the same elements in codePointsForGlyphNames. */
- final String storeString = this.glyphNames[i];
- this.glyphNames[i] = this.glyphNames[i + 1];
- this.glyphNames[i + 1] = storeString;
- final char storeChar = this.glyphIndexes[i];
- this.glyphIndexes[i] = this.glyphIndexes[i + 1];
- this.glyphIndexes[i + 1] = storeChar;
+ final String storeString = this.glyphNames.get(i);
+ this.glyphNames.set(i, this.glyphNames.get(i + 1));
+ this.glyphNames.set(i + 1, storeString);
+ final Character storeChar = this.glyphIndexes.get(i);
+ this.glyphIndexes.set(i, this.glyphIndexes.get(i + 1));
+ this.glyphIndexes.set(i + 1, storeChar);
anyChanges = true;
}
}
@@ -373,22 +351,20 @@
}
}
this.glyphListsToCheck[index] = GlyphList4a.getGlyphList("AGL");
- this.codePoints = new char[this.glyphNames.length];
- this.codePointIndexes = new char[this.codePoints.length];
- for (int i = 0; i < this.glyphNames.length; i++) {
- final String glyphName = this.glyphNames[i];
+ for (int i = 0; i < this.glyphNames.size(); i++) {
+ final String glyphName = this.glyphNames.get(i);
for (int j = 0; j < this.glyphListsToCheck.length; j++) {
glyphList = this.glyphListsToCheck[j];
final char codePoint = glyphList.mapGlyphNameToCodePoint(
glyphName);
if (codePoint != Character.MAX_VALUE) {
- this.codePoints[i] = codePoint;
- final char glyphIndex = this.glyphIndexes[i];
- this.codePointIndexes[i] = glyphIndex;
+ this.codePoints.set(i, codePoint);
+ final char glyphIndex = this.glyphIndexes.get(i);
+ this.codePointIndexes.set(i, glyphIndex);
break;
}
}
- if (this.codePointIndexes[i] == 0
+ if (this.codePointIndexes.get(i) == 0
&& ! glyphName.equals(EncodingVector4a.NOTDEF)) {
this.logger.error("Glyph name not found: " + glyphName);
}
@@ -419,20 +395,20 @@
// Write the glyph names.
s = " public static final String[] sortedGlyphNames = {\n";
out.write(s.getBytes());
- for (int i = 0; i < this.glyphNames.length; i++) {
+ for (int i = 0; i < this.glyphNames.size(); i++) {
s = " \"";
- s = s + this.glyphNames[i];
+ s = s + this.glyphNames.get(i);
s = s + "\"";
- if (i < this.glyphNames.length - 1) {
+ if (i < this.glyphNames.size() - 1) {
s = s + ",";
}
s = padSpaces(s, EncodingParser.GLYPH_NAMES_COLUMN_1, 2);
s = s + "// " + formatArrayIndex(i);
s = padSpaces(s, EncodingParser.GLYPH_NAMES_COLUMN_2, 1);
s = s + " glyph-index: 0x"
- + StringUtil.charToHexString(this.glyphIndexes[i], true,
+ + StringUtil.charToHexString(this.glyphIndexes.get(i), true,
EncodingParser.HEX_STRING_SIZE);
- s = s + " \\" + StringUtil.charToOctalString(this.glyphIndexes[i],
+ s = s + " \\" + StringUtil.charToOctalString(this.glyphIndexes.get(i),
EncodingParser.OCTAL_STRING_SIZE);
s = s + "\n";
out.write(s.getBytes());
@@ -445,13 +421,13 @@
out.write(s.getBytes());
s = " public static final short[] glyphIndexes = {\n";
out.write(s.getBytes());
- for (int i = 0; i < this.glyphIndexes.length; i++) {
- final char index = this.glyphIndexes[i];
+ for (int i = 0; i < this.glyphIndexes.size(); i++) {
+ final char index = this.glyphIndexes.get(i);
s = " ";
s = s + "0x";
s = s + StringUtil.charToHexString(index, true,
EncodingParser.HEX_STRING_SIZE);
- if (i < this.glyphIndexes.length - 1) {
+ if (i < this.glyphIndexes.size() - 1) {
s = s + ",";
}
s = padSpaces(s, EncodingParser.GLYPH_NAME_CODE_POINTS_COLUMN_1, 2);
@@ -460,7 +436,7 @@
s = s + "\\" + StringUtil.charToOctalString(index,
EncodingParser.OCTAL_STRING_SIZE);
s = padSpaces(s, EncodingParser.GLYPH_NAME_CODE_POINTS_COLUMN_3, 1);
- s = s + this.glyphNames[i];
+ s = s + this.glyphNames.get(i);
s = s + "\n";
out.write(s.getBytes());
}
@@ -476,23 +452,23 @@
out.write(s.getBytes());
s = " public static final char[] codePoints = {\n";
out.write(s.getBytes());
- for (int i = 0; i < this.codePoints.length; i++) {
- final char index = this.codePoints[i];
+ for (int i = 0; i < this.codePoints.size(); i++) {
+ final char index = this.codePoints.get(i);
s = " ";
s = s + "0x";
s = s + StringUtil.charToHexString(index, true,
EncodingParser.HEX_STRING_SIZE);
- if (i < this.codePoints.length - 1) {
+ if (i < this.codePoints.size() - 1) {
s = s + ",";
}
s = padSpaces(s, EncodingParser.CODE_POINTS_COLUMN_1, 2);
s = s + "// " + formatArrayIndex(i);
s = padSpaces(s, EncodingParser.CODE_POINTS_COLUMN_2, 2);
s = s + " glyph: 0x" + StringUtil.charToHexString(
- this.codePointIndexes[i], true,
+ this.codePointIndexes.get(i), true,
EncodingParser.HEX_STRING_SIZE);
s = s + " \\" + StringUtil.charToOctalString(
- this.codePointIndexes[i], EncodingParser.HEX_STRING_SIZE);
+ this.codePointIndexes.get(i), EncodingParser.HEX_STRING_SIZE);
s = s + "\n";
out.write(s.getBytes());
}
@@ -504,13 +480,13 @@
out.write(s.getBytes());
s = " public static final char[] codePointIndexes = {\n";
out.write(s.getBytes());
- for (int i = 0; i < this.codePointIndexes.length; i++) {
- final char index = this.codePointIndexes[i];
+ for (int i = 0; i < this.codePointIndexes.size(); i++) {
+ final char index = this.codePointIndexes.get(i);
s = " ";
s = s + "0x";
s = s + StringUtil.charToHexString(index, true,
EncodingParser.HEX_STRING_SIZE);
- if (i < this.codePointIndexes.length - 1) {
+ if (i < this.codePointIndexes.size() - 1) {
s = s + ",";
}
s = padSpaces(s, EncodingParser.CODE_POINTS_INDEX_1, 2);
@@ -558,7 +534,7 @@
* @return The codepoint indexes.
*/
public char[] getCodePointIndexes() {
- return this.codePointIndexes;
+ return CharacterUtil.toArray(this.codePointIndexes);
}
/**
@@ -566,7 +542,7 @@
* @return The codepoints.
*/
public char[] getCodePoints() {
- return this.codePoints;
+ return CharacterUtil.toArray(this.codePoints);
}
/**
@@ -574,7 +550,7 @@
* @return The glyph indexes.
*/
public char[] getGlyphIndexes() {
- return this.glyphIndexes;
+ return CharacterUtil.toArray(this.glyphIndexes);
}
/**
@@ -582,7 +558,8 @@
* @return The glyph names.
*/
public String[] getGlyphNames() {
- return this.glyphNames;
+ final String[] returnArray = new String[this.glyphNames.size()];
+ return this.glyphNames.toArray(returnArray);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 14:23:40
|
Revision: 10830
http://foray.svn.sourceforge.net/foray/?rev=10830&view=rev
Author: victormote
Date: 2009-04-30 14:23:39 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Fix method name.
Modified Paths:
--------------
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java 2009-04-30 14:21:00 UTC (rev 10829)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java 2009-04-30 14:23:39 UTC (rev 10830)
@@ -46,13 +46,13 @@
* Black-box test, parsing the glyph list for the WinAnsi Encoding.
* @throws IOException For errors opening or reading the input file.
*/
- public void testZdGl() throws IOException {
+ public void testWinAnsi() throws IOException {
final File sandbox = TestFOrayCommon.getSandbox();
final File testFile = new File(sandbox, "foray-ps/resource/encoding/latin-pdf.txt");
final RandomReader reader = new RandomReader(testFile.toURI().toURL());
assertNotNull(reader);
- /* The WinAnsi content is in column 3, and the radix is octal. */
+ /* The WinAnsi content is in column 3, and the radix is octal. See the file itself for details. */
final EncodingParser parser = new EncodingParser(Logging.makeDefaultLogger(), reader, 3, 8, null);
parser.parseList();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 14:22:17
|
Revision: 10828
http://foray.svn.sourceforge.net/foray/?rev=10828&view=rev
Author: victormote
Date: 2009-04-30 13:33:42 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Style change only: Keep main method at bottom of class.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 13:25:24 UTC (rev 10827)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2009-04-30 13:33:42 UTC (rev 10828)
@@ -554,6 +554,46 @@
}
/**
+ * Returns the codepoint indexes.
+ * @return The codepoint indexes.
+ */
+ public char[] getCodePointIndexes() {
+ return this.codePointIndexes;
+ }
+
+ /**
+ * Returns the codepoints.
+ * @return The codepoints.
+ */
+ public char[] getCodePoints() {
+ return this.codePoints;
+ }
+
+ /**
+ * Returns the glyph indexes.
+ * @return The glyph indexes.
+ */
+ public char[] getGlyphIndexes() {
+ return this.glyphIndexes;
+ }
+
+ /**
+ * Returns the glyph names.
+ * @return The glyph names.
+ */
+ public String[] getGlyphNames() {
+ return this.glyphNames;
+ }
+
+ /**
+ * Returns the glyph lists to check.
+ * @return The glyph lists to check.
+ */
+ public GlyphList4a[] getGlyphListsToCheck() {
+ return this.glyphListsToCheck;
+ }
+
+ /**
* Main method useful for parsing an encoding list file from the
* command-line and generating the java code that encapsulates that
* encoding.
@@ -661,44 +701,4 @@
/* Checkstyle-GenericIllegalRegexp-On. */
}
- /**
- * Returns the codepoint indexes.
- * @return The codepoint indexes.
- */
- public char[] getCodePointIndexes() {
- return this.codePointIndexes;
- }
-
- /**
- * Returns the codepoints.
- * @return The codepoints.
- */
- public char[] getCodePoints() {
- return this.codePoints;
- }
-
- /**
- * Returns the glyph indexes.
- * @return The glyph indexes.
- */
- public char[] getGlyphIndexes() {
- return this.glyphIndexes;
- }
-
- /**
- * Returns the glyph names.
- * @return The glyph names.
- */
- public String[] getGlyphNames() {
- return this.glyphNames;
- }
-
- /**
- * Returns the glyph lists to check.
- * @return The glyph lists to check.
- */
- public GlyphList4a[] getGlyphListsToCheck() {
- return this.glyphListsToCheck;
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 14:21:20
|
Revision: 10829
http://foray.svn.sourceforge.net/foray/?rev=10829&view=rev
Author: victormote
Date: 2009-04-30 14:21:00 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Add class to test the encoding parser.
Modified Paths:
--------------
trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
Added Paths:
-----------
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java 2009-04-30 13:33:42 UTC (rev 10828)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java 2009-04-30 14:21:00 UTC (rev 10829)
@@ -28,6 +28,7 @@
package org.foray.ps;
+import org.foray.ps.encode.TestEncodingParser;
import org.foray.ps.encode.TestGlyphListParser;
import org.foray.ps.filter.TestAscii85EncodeFilter;
import org.foray.ps.filter.TestRunLengthEncodeFilter;
@@ -50,6 +51,7 @@
testSuite.addTestSuite(TestPsSystemDict.class);
+ testSuite.addTestSuite(TestEncodingParser.class);
testSuite.addTestSuite(TestGlyphListParser.class);
testSuite.addTestSuite(TestAscii85EncodeFilter.class);
Added: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java (rev 0)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java 2009-04-30 14:21:00 UTC (rev 10829)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2009 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps.encode;
+
+import org.foray.common.Logging;
+import org.foray.common.RandomReader;
+import org.foray.common.TestFOrayCommon;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+/**
+ * JUnit test class for the class {@link EncodingParser}.
+ */
+public class TestEncodingParser extends TestCase {
+
+ /**
+ * Black-box test, parsing the glyph list for the WinAnsi Encoding.
+ * @throws IOException For errors opening or reading the input file.
+ */
+ public void testZdGl() throws IOException {
+ final File sandbox = TestFOrayCommon.getSandbox();
+ final File testFile = new File(sandbox, "foray-ps/resource/encoding/latin-pdf.txt");
+ final RandomReader reader = new RandomReader(testFile.toURI().toURL());
+ assertNotNull(reader);
+
+ /* The WinAnsi content is in column 3, and the radix is octal. */
+ final EncodingParser parser = new EncodingParser(Logging.makeDefaultLogger(), reader, 3, 8, null);
+ parser.parseList();
+
+ /* Did we parse the right number of elements. Last element is on line 237. First 8 lines are blank. In the
+ * WinAnsi column, there are 13 unencoded characters. 237 - 8 - 13 = 216. */
+ assertEquals(216, parser.getGlyphNames().length);
+ assertEquals(216, parser.getGlyphIndexes().length);
+ assertEquals(216, parser.getCodePoints().length);
+ assertEquals(216, parser.getCodePointIndexes().length);
+
+ /* Test the first item, as sorted in glyph name order. */
+ assertEquals("A", parser.getGlyphNames()[0]);
+ assertEquals('\101', parser.getGlyphIndexes()[0]);
+
+ /* Test the last item, as sorted in glyph name order. */
+ assertEquals("zero", parser.getGlyphNames()[215]);
+ assertEquals('\060', parser.getGlyphIndexes()[215]);
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestEncodingParser.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java 2009-04-30 13:33:42 UTC (rev 10828)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java 2009-04-30 14:21:00 UTC (rev 10829)
@@ -55,7 +55,7 @@
final GlyphListParser parser = new GlyphListParser(Logging.makeDefaultLogger(), reader);
parser.parseList();
- /* Did we parse the right number of elements. */
+ /* Test that we parsed the right number of elements. */
assertEquals(201, parser.getGlyphNames().length);
assertEquals(201, parser.getCodePointsForGlyphNames().length);
assertEquals(201, parser.getCodePoints().length);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 13:25:26
|
Revision: 10827
http://foray.svn.sourceforge.net/foray/?rev=10827&view=rev
Author: victormote
Date: 2009-04-30 13:25:24 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Add tests of the parsed content.
Modified Paths:
--------------
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java 2009-04-30 13:18:05 UTC (rev 10826)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java 2009-04-30 13:25:24 UTC (rev 10827)
@@ -46,7 +46,7 @@
* Black-box test, parsing the glyph list for Zapf Dingbats.
* @throws IOException For errors opening or reading the input file.
*/
- public void testAGL() throws IOException {
+ public void testZdGl() throws IOException {
final File sandbox = TestFOrayCommon.getSandbox();
final File testFile = new File(sandbox, "foray-ps/resource/glyph-list/zapfdingbats.txt");
final RandomReader reader = new RandomReader(testFile.toURI().toURL());
@@ -55,10 +55,21 @@
final GlyphListParser parser = new GlyphListParser(Logging.makeDefaultLogger(), reader);
parser.parseList();
+ /* Did we parse the right number of elements. */
+ assertEquals(201, parser.getGlyphNames().length);
+ assertEquals(201, parser.getCodePointsForGlyphNames().length);
assertEquals(201, parser.getCodePoints().length);
- assertEquals(201, parser.getCodePointsForGlyphNames().length);
assertEquals(201, parser.getGlyphNameIndex().length);
- assertEquals(201, parser.getGlyphNames().length);
+
+ /* Test the first item, as sorted in glyph name order. */
+ assertEquals("a1", parser.getGlyphNames()[0]);
+ assertEquals(1, parser.getCodePointsForGlyphNames()[0].length);
+ assertEquals('\u2701', parser.getCodePointsForGlyphNames()[0][0]);
+
+ /* Test the last item, as sorted in glyph name order. */
+ assertEquals("a99", parser.getGlyphNames()[200]);
+ assertEquals(1, parser.getCodePointsForGlyphNames()[200].length);
+ assertEquals('\u275D', parser.getCodePointsForGlyphNames()[200][0]);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 13:18:06
|
Revision: 10826
http://foray.svn.sourceforge.net/foray/?rev=10826&view=rev
Author: victormote
Date: 2009-04-30 13:18:05 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Style change only.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 13:14:38 UTC (rev 10825)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 13:18:05 UTC (rev 10826)
@@ -379,12 +379,12 @@
}
/**
- * Returns the sorted list of codepoints.
- * The corresponding indexes into the glyph names is found in {@link #getGlyphNameIndex()}.
- * @return The codepoints.
+ * Returns the sorted list of glyph names in this glyph list.
+ * The corresponding Unicode codepoints are found in {@link #getCodePointsForGlyphNames()}.
+ * @return The glyph names.
*/
- public char[] getCodePoints() {
- return this.codePoints;
+ public String[] getGlyphNames() {
+ return this.glyphNames;
}
/**
@@ -396,6 +396,15 @@
}
/**
+ * Returns the sorted list of codepoints.
+ * The corresponding indexes into the glyph names is found in {@link #getGlyphNameIndex()}.
+ * @return The codepoints.
+ */
+ public char[] getCodePoints() {
+ return this.codePoints;
+ }
+
+ /**
* Returns the array of indexes into {@link #getGlyphNames()} that corresponds to the Unicode codepoint in
* {@link #getCodePoints()}.
* @return The glyph name index.
@@ -405,15 +414,6 @@
}
/**
- * Returns the sorted list of glyph names in this glyph list.
- * The corresponding Unicode codepoints are found in {@link #getCodePointsForGlyphNames()}.
- * @return The glyph names.
- */
- public String[] getGlyphNames() {
- return this.glyphNames;
- }
-
- /**
* Main method useful for parsing a glyph list file from the command-line
* and generating the java code that encapsulates that glyph list.
* @param args Element 0 is the URL of the glyph list to be parsed.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 13:14:40
|
Revision: 10825
http://foray.svn.sourceforge.net/foray/?rev=10825&view=rev
Author: victormote
Date: 2009-04-30 13:14:38 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Doc changes only.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 12:42:09 UTC (rev 10824)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 13:14:38 UTC (rev 10825)
@@ -55,20 +55,21 @@
private int currentLineNumber = 0;
/** The sorted list of glyph names in this glyph list.
- * Corresponds to GlyphList#sortedGlyphNames. */
+ * The corresponding Unicode codepoints are found in {@link #codePointsForGlyphNames}.
+ * @see #getGlyphNames() */
private String[] glyphNames;
/** The array of Unicode codepoints that corresponds to {@link #glyphNames}.
- * Corresponds to GlyphList#codePointsForGlyphNames. */
+ * @see #getCodePointsForGlyphNames() */
private char[][] codePointsForGlyphNames;
/** The sorted list of codepoints.
- * Corresponds to GlyphList#sortedCodePoints. */
+ * The corresponding indexes into the glyph names is found in {@link #glyphNameIndex}.
+ * @see #getCodePoints() */
private char[] codePoints;
- /** The array of indexes into {@link #glyphNames} that corresponds to the
- * Unicode codepoint in {@link #codePoints}.
- * Corresponds to GlyphList#glyphNamesForCodePoints. */
+ /** The array of indexes into {@link #glyphNames} that corresponds to the Unicode codepoint in {@link #codePoints}.
+ * @see #getGlyphNameIndex() */
private short[] glyphNameIndex;
/** The logger. */
@@ -378,7 +379,8 @@
}
/**
- * Returns the codepoints.
+ * Returns the sorted list of codepoints.
+ * The corresponding indexes into the glyph names is found in {@link #getGlyphNameIndex()}.
* @return The codepoints.
*/
public char[] getCodePoints() {
@@ -386,7 +388,7 @@
}
/**
- * Returns the codepoints for glyph names.
+ * Returns the array of Unicode codepoints that corresponds to {@link #getGlyphNames()}.
* @return The codepoints for glyph names.
*/
public char[][] getCodePointsForGlyphNames() {
@@ -394,7 +396,8 @@
}
/**
- * Returns the glyph name index.
+ * Returns the array of indexes into {@link #getGlyphNames()} that corresponds to the Unicode codepoint in
+ * {@link #getCodePoints()}.
* @return The glyph name index.
*/
public short[] getGlyphNameIndex() {
@@ -402,7 +405,8 @@
}
/**
- * Returns the glyph names.
+ * Returns the sorted list of glyph names in this glyph list.
+ * The corresponding Unicode codepoints are found in {@link #getCodePointsForGlyphNames()}.
* @return The glyph names.
*/
public String[] getGlyphNames() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 12:42:15
|
Revision: 10824
http://foray.svn.sourceforge.net/foray/?rev=10824&view=rev
Author: victormote
Date: 2009-04-30 12:42:09 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
First pass at a test of the GlyphListParser.
Modified Paths:
--------------
trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java
Added Paths:
-----------
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/
trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java 2009-04-30 12:29:49 UTC (rev 10823)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java 2009-04-30 12:42:09 UTC (rev 10824)
@@ -28,6 +28,7 @@
package org.foray.ps;
+import org.foray.ps.encode.TestGlyphListParser;
import org.foray.ps.filter.TestAscii85EncodeFilter;
import org.foray.ps.filter.TestRunLengthEncodeFilter;
@@ -48,6 +49,9 @@
final TestSuite testSuite = new TestSuite("FOray PostScript");
testSuite.addTestSuite(TestPsSystemDict.class);
+
+ testSuite.addTestSuite(TestGlyphListParser.class);
+
testSuite.addTestSuite(TestAscii85EncodeFilter.class);
testSuite.addTestSuite(TestRunLengthEncodeFilter.class);
Added: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java (rev 0)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java 2009-04-30 12:42:09 UTC (rev 10824)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2009 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps.encode;
+
+import org.foray.common.Logging;
+import org.foray.common.RandomReader;
+import org.foray.common.TestFOrayCommon;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+/**
+ * JUnit test class for the class {@link GlyphListParser}.
+ */
+public class TestGlyphListParser extends TestCase {
+
+ /**
+ * Black-box test, parsing the glyph list for Zapf Dingbats.
+ * @throws IOException For errors opening or reading the input file.
+ */
+ public void testAGL() throws IOException {
+ final File sandbox = TestFOrayCommon.getSandbox();
+ final File testFile = new File(sandbox, "foray-ps/resource/glyph-list/zapfdingbats.txt");
+ final RandomReader reader = new RandomReader(testFile.toURI().toURL());
+ assertNotNull(reader);
+
+ final GlyphListParser parser = new GlyphListParser(Logging.makeDefaultLogger(), reader);
+ parser.parseList();
+
+ assertEquals(201, parser.getCodePoints().length);
+ assertEquals(201, parser.getCodePointsForGlyphNames().length);
+ assertEquals(201, parser.getGlyphNameIndex().length);
+ assertEquals(201, parser.getGlyphNames().length);
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/javatest/org/foray/ps/encode/TestGlyphListParser.java
___________________________________________________________________
Added: svn:keywords
+ "Author Id Rev Date URL"
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-30 12:29:56
|
Revision: 10823
http://foray.svn.sourceforge.net/foray/?rev=10823&view=rev
Author: victormote
Date: 2009-04-30 12:29:49 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Style change only: keep main method at bottom of class.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-29 21:10:17 UTC (rev 10822)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2009-04-30 12:29:49 UTC (rev 10823)
@@ -378,6 +378,38 @@
}
/**
+ * Returns the codepoints.
+ * @return The codepoints.
+ */
+ public char[] getCodePoints() {
+ return this.codePoints;
+ }
+
+ /**
+ * Returns the codepoints for glyph names.
+ * @return The codepoints for glyph names.
+ */
+ public char[][] getCodePointsForGlyphNames() {
+ return this.codePointsForGlyphNames;
+ }
+
+ /**
+ * Returns the glyph name index.
+ * @return The glyph name index.
+ */
+ public short[] getGlyphNameIndex() {
+ return this.glyphNameIndex;
+ }
+
+ /**
+ * Returns the glyph names.
+ * @return The glyph names.
+ */
+ public String[] getGlyphNames() {
+ return this.glyphNames;
+ }
+
+ /**
* Main method useful for parsing a glyph list file from the command-line
* and generating the java code that encapsulates that glyph list.
* @param args Element 0 is the URL of the glyph list to be parsed.
@@ -435,36 +467,4 @@
/* Checkstyle-GenericIllegalRegexp-On. */
}
- /**
- * Returns the codepoints.
- * @return The codepoints.
- */
- public char[] getCodePoints() {
- return this.codePoints;
- }
-
- /**
- * Returns the codepoints for glyph names.
- * @return The codepoints for glyph names.
- */
- public char[][] getCodePointsForGlyphNames() {
- return this.codePointsForGlyphNames;
- }
-
- /**
- * Returns the glyph name index.
- * @return The glyph name index.
- */
- public short[] getGlyphNameIndex() {
- return this.glyphNameIndex;
- }
-
- /**
- * Returns the glyph names.
- * @return The glyph names.
- */
- public String[] getGlyphNames() {
- return this.glyphNames;
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 22:07:22
|
Revision: 10818
http://foray.svn.sourceforge.net/foray/?rev=10818&view=rev
Author: victormote
Date: 2009-04-29 20:32:21 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Remove some dependencies on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java
trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2009-04-29 20:24:07 UTC (rev 10817)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2009-04-29 20:32:21 UTC (rev 10818)
@@ -618,7 +618,7 @@
final TTFTableDirEntry dirTableEntry = getTTFDirTabEntry("cmap");
if (dirTableEntry.getTable() == null) {
try {
- return new TTFTableCMAP(this);
+ return new TTFTableCMAP(this, this.in.getFontServer().getPsServer());
} catch (final IOException e) {
return null;
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java 2009-04-29 20:24:07 UTC (rev 10817)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java 2009-04-29 20:32:21 UTC (rev 10818)
@@ -34,6 +34,7 @@
import org.axsl.ps.Cmap;
import org.axsl.ps.Cmap04;
import org.axsl.ps.Cmap12;
+import org.axsl.ps.PsServer;
import java.io.IOException;
@@ -75,19 +76,21 @@
/**
* Constructor.
* @param ttfFile The parent font.
+ * @param psServer The PostScript server.
* @throws IOException For I/O error.
*/
- TTFTableCMAP(final TTFFont ttfFile) throws IOException {
+ TTFTableCMAP(final TTFFont ttfFile, final PsServer psServer) throws IOException {
super(ttfFile);
- parseTable();
+ parseTable(psServer);
}
/**
* Parse the cmap table.
* Currently only unicode cmaps are supported.
+ * @param psServer The PostScript server.
* @throws IOException For I/O error.
*/
- protected void parseTable() throws IOException {
+ protected void parseTable(final PsServer psServer) throws IOException {
/* Skip table version. */
getReader().skipBytes(USHORT_BYTES);
final int numSubtables = getReader().readUnsignedShort();
@@ -136,16 +139,17 @@
getLogger().warn("No Unicode cmap table: " + this.ttfFont().getFontName());
return;
}
- this.unicodeCMap = parseCMap(offsetToParse);
+ this.unicodeCMap = parseCMap(psServer, offsetToParse);
}
/**
* Parse one cmap table.
+ * @param psServer The PostScript server.
* @param offsetToParse The offset of the table to be parsed.
* @return The parsed CMap instance.
* @throws IOException For I/O Error.
*/
- private Cmap parseCMap(final long offsetToParse) throws IOException {
+ private Cmap parseCMap(final PsServer psServer, final long offsetToParse) throws IOException {
int tableOffset = ttfFont().getTTFDirTabEntry(getTableTag())
.getOffset();
tableOffset += offsetToParse;
@@ -165,10 +169,10 @@
}
switch (formatHigh) {
case TTFTableCMAP.CMAP_FORMAT_4: {
- return parseCMap04();
+ return parseCMap04(psServer);
}
case TTFTableCMAP.CMAP_FORMAT_12: {
- return parseCMap12();
+ return parseCMap12(psServer);
}
}
return null;
@@ -176,10 +180,11 @@
/**
* Parse a CMap format 4 table.
+ * @param psServer The PostScript server.
* @return The parsed CMap format 4 table.
* @throws IOException For I/O Error.
*/
- private Cmap04 parseCMap04() throws IOException {
+ private Cmap04 parseCMap04(final PsServer psServer) throws IOException {
/* Format and Length have already been read. */
/* Skip version */
getReader().skipBytes(USHORT_BYTES);
@@ -253,13 +258,14 @@
/**
* Creates a CMap12 instance by parsing the subtable contents.
+ * @param psServer The PostScript server.
* @return A CMap12 instance.
* @throws IOException If error reading file.
* @see
* <a href="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6cmap.html">
* The Apple doc for the cmap table</a>
*/
- private Cmap12 parseCMap12() throws IOException {
+ private Cmap12 parseCMap12(final PsServer psServer) throws IOException {
/* Format and Length have already been read. */
/* Skip language. */
getReader().skipBytes(ULONG_BYTES);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 21:10:19
|
Revision: 10822
http://foray.svn.sourceforge.net/foray/?rev=10822&view=rev
Author: victormote
Date: 2009-04-29 21:10:17 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Remove some dependencies on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/ConsumerFont4a.java
trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/ConsumerFont4a.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/ConsumerFont4a.java 2009-04-29 20:58:52 UTC (rev 10821)
+++ trunk/foray/foray-font/src/java/org/foray/font/ConsumerFont4a.java 2009-04-29 21:10:17 UTC (rev 10822)
@@ -28,12 +28,9 @@
package org.foray.font;
-import org.foray.ps.encode.EncodingStandard;
-import org.foray.ps.encode.EncodingSymbol;
-import org.foray.ps.encode.EncodingVector4a;
-import org.foray.ps.encode.EncodingZapfDingbats;
-
import org.axsl.ps.Encoding;
+import org.axsl.ps.EncodingVector;
+import org.axsl.ps.PsServer;
import org.apache.commons.logging.Log;
@@ -275,32 +272,36 @@
private Encoding getBestEncoding(final int codePoint) {
Encoding trialEncoding = null;
final Encoding internalEncoding = this.font.getInternalEncoding();
- if (! (internalEncoding instanceof EncodingVector4a)) {
+ if (! (internalEncoding instanceof EncodingVector)) {
/* CMap encodings should be able to handle any character in the
* font's character set. */
return internalEncoding;
}
- if (internalEncoding instanceof EncodingSymbol
- || internalEncoding instanceof EncodingZapfDingbats) {
+ /* Cast checked above. */
+ final EncodingVector internalEncodingVector = (EncodingVector) internalEncoding;
+ if (internalEncodingVector.getPredefinedType() == EncodingVector.Predefined.SYMBOL
+ || internalEncodingVector.getPredefinedType() == EncodingVector.Predefined.ZAPF_DINGBATS) {
/* The specialized encodings cover their entire character set. */
return internalEncoding;
}
- if (internalEncoding instanceof EncodingStandard) {
+ if (internalEncodingVector.getPredefinedType() == EncodingVector.Predefined.STANDARD) {
+ final PsServer psServer = this.getFontConsumer().getFontServer().getPsServer();
/* Try WinAnsiEncoding. */
- trialEncoding = EncodingVector4a.getPredefinedEncoding(
- "WinAnsiEncoding");
+ trialEncoding = psServer.getPredefinedEncoding(EncodingVector.Predefined.WIN_ANSI);
if (trialEncoding.canEncode(codePoint)) {
return trialEncoding;
}
/* Try the Central European encoding. */
- trialEncoding = EncodingVector4a.getPredefinedEncoding("CEEncoding");
+ trialEncoding = psServer.getPredefinedEncoding(EncodingVector.Predefined.CE);
if (trialEncoding.canEncode(codePoint)) {
return trialEncoding;
}
/* Try the FOray catch-all encoding. */
- trialEncoding = EncodingVector4a.getPredefinedEncoding(
- "FOrayLatinExtraEncoding");
- if (trialEncoding.canEncode(codePoint)) {
+ /* TODO: Move this encoding from the PS package to the Fonts package so that we don't have to address it
+ * by name. */
+ trialEncoding = psServer.getPredefinedEncoding("FOrayLatinExtraEncoding");
+ if (trialEncoding != null
+ && trialEncoding.canEncode(codePoint)) {
return trialEncoding;
}
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2009-04-29 20:58:52 UTC (rev 10821)
+++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2009-04-29 21:10:17 UTC (rev 10822)
@@ -36,10 +36,11 @@
import org.foray.font.format.Type1File;
import org.foray.font.format.Type1PFAFile;
import org.foray.font.format.Type1PFBFile;
-import org.foray.ps.encode.EncodingVector4a;
import org.axsl.font.Font;
import org.axsl.font.FontException;
+import org.axsl.ps.EncodingVector;
+import org.axsl.ps.PsServer;
import java.io.IOException;
import java.io.InputStream;
@@ -139,14 +140,14 @@
/* If not already set, set the Encoding. */
if (this.getInternalEncoding() == null) {
final String encodingName = this.metricsFile.getEncoding();
- EncodingVector4a encoding = null;
+ EncodingVector encoding = null;
+ final PsServer psServer = this.getRegisteredFont().getFontServer().getPsServer();
if (encodingName.equals("StandardEncoding")
|| encodingName.equals("AdobeStandardEncoding")) {
- encoding = EncodingVector4a.getPredefinedEncoding(
- "WinAnsiEncoding");
+ encoding = psServer.getPredefinedEncoding(EncodingVector.Predefined.WIN_ANSI);
}
if (getRegisteredFont().getConfiguredFontName().equals("Symbol")) {
- encoding = EncodingVector4a.getPredefinedEncoding("Symbol");
+ encoding = psServer.getPredefinedEncoding(EncodingVector.Predefined.SYMBOL);
}
this.setInternalEncoding(encoding);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 20:58:59
|
Revision: 10821
http://foray.svn.sourceforge.net/foray/?rev=10821&view=rev
Author: victormote
Date: 2009-04-29 20:58:52 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Conform to new aXSL requirment that predefined encodings identify themselves by their enumerated EncodingVector.Predefined.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingStandard.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingWinAnsi.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCE.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
/**
@@ -973,4 +975,11 @@
return EncodingCE.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.CE;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingCustom.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
/**
* An encoding that is not one of the predefined encodings, usually parsed from
* a Type 1 Font.
@@ -64,4 +66,11 @@
return false;
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return null;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpert.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
/**
@@ -772,4 +774,11 @@
return EncodingExpert.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.EXPERT;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingExpertSubset.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
/**
@@ -457,4 +459,11 @@
return EncodingExpertSubset.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.EXPERT_SUBSET;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingFOrayLatinExtra.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
/**
@@ -307,4 +309,11 @@
return EncodingFOrayLatinExtra.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return null;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingISOLatin1.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
/**
@@ -919,4 +921,11 @@
return EncodingISOLatin1.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.ISO_LATIN_1;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacExpert.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
@@ -779,4 +781,11 @@
return EncodingMacExpert.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.MAC_EXPERT;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacRoman.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
@@ -947,4 +949,11 @@
return EncodingMacRoman.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.MAC_ROMAN;
+ }
+
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingMacStandard.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -1153,4 +1153,11 @@
return EncodingMacStandard.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.STANDARD_MACINTOSH_ORDERING;
+ }
+
}
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 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingPDFDoc.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
@@ -1035,4 +1037,11 @@
return EncodingPDFDoc.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.PDF_DOC;
+ }
+
}
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 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingStandard.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
/**
@@ -718,4 +720,11 @@
return EncodingStandard.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.STANDARD;
+ }
+
}
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 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingSymbol.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
@@ -876,4 +878,11 @@
return EncodingSymbol.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.SYMBOL;
+ }
+
}
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 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingWinAnsi.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.Serializable;
@@ -995,4 +997,11 @@
return EncodingWinAnsi.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.WIN_ANSI;
+ }
+
}
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 2009-04-29 20:40:22 UTC (rev 10820)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingZapfDingbats.java 2009-04-29 20:58:52 UTC (rev 10821)
@@ -28,6 +28,8 @@
package org.foray.ps.encode;
+import org.axsl.ps.EncodingVector;
+
import java.io.ObjectStreamException;
import java.io.Serializable;
@@ -936,4 +938,11 @@
return EncodingZapfDingbats.getInstance();
}
+ /**
+ * {@inheritDoc}
+ */
+ public EncodingVector.Predefined getPredefinedType() {
+ return EncodingVector.Predefined.ZAPF_DINGBATS;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 20:40:28
|
Revision: 10820
http://foray.svn.sourceforge.net/foray/?rev=10820&view=rev
Author: victormote
Date: 2009-04-29 20:40:22 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Remove no-longer-needed package.
Removed Paths:
-------------
trunk/foray/foray-font/src/java/org/foray/font/charset/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 20:35:59
|
Revision: 10819
http://foray.svn.sourceforge.net/foray/?rev=10819&view=rev
Author: victormote
Date: 2009-04-29 20:35:57 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Remove some dependencies on FOrayPS.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java 2009-04-29 20:32:21 UTC (rev 10818)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java 2009-04-29 20:35:57 UTC (rev 10819)
@@ -28,9 +28,6 @@
package org.foray.font.format;
-import org.foray.ps.encode.CMap04;
-import org.foray.ps.encode.CMap12;
-
import org.axsl.ps.Cmap;
import org.axsl.ps.Cmap04;
import org.axsl.ps.Cmap12;
@@ -225,7 +222,7 @@
// Parse the table entries and build a CMap4 from them.
final String encodingName = "internal-"
+ this.ttfFont().getPostscriptName();
- final Cmap04 cmap04 = new CMap04(encodingName, segCountX2 / 2);
+ final Cmap04 cmap04 = psServer.makeCmap04(encodingName, segCountX2 / 2);
for (int i = 0; i < startCount.length; i++) {
if (rangeOffset[i] == 0) {
cmap04.addEntry(startCount[i],
@@ -273,7 +270,7 @@
final String encodingName = "internal-"
+ this.ttfFont().getPostscriptName();
- final Cmap12 cmap12 = new CMap12(encodingName, nGroups);
+ final Cmap12 cmap12 = psServer.makeCmap12(encodingName, nGroups);
for (int i = 0; i < nGroups; i++) {
final int startCharCode = (int) getReader().readUnsignedInt();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 20:24:09
|
Revision: 10817
http://foray.svn.sourceforge.net/foray/?rev=10817&view=rev
Author: victormote
Date: 2009-04-29 20:24:07 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Remove unneeded abstract method.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java
trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCFF.java
trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java 2009-04-29 20:17:08 UTC (rev 10816)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java 2009-04-29 20:24:07 UTC (rev 10817)
@@ -103,12 +103,6 @@
}
/**
- * Parse the needed information from the table contents.
- * @throws IOException For I/O Error.
- */
- abstract void parseTable() throws IOException;
-
- /**
* Return the 4-character name of this table, for example, "post" or "glyf".
* @return The name of this table.
*/
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCFF.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCFF.java 2009-04-29 20:17:08 UTC (rev 10816)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCFF.java 2009-04-29 20:24:07 UTC (rev 10817)
@@ -46,9 +46,10 @@
}
/**
- * {@inheritDoc}
+ * Parse the needed information from the table contents.
+ * @throws IOException For I/O Error.
*/
- protected void parseTable() throws IOException {
+ private void parseTable() throws IOException {
// TTFTableDirEntry dirTab = ttfFont.getTTFDirTabEntry("CFF");
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java 2009-04-29 20:17:08 UTC (rev 10816)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java 2009-04-29 20:24:07 UTC (rev 10817)
@@ -64,9 +64,10 @@
}
/**
- * {@inheritDoc}
+ * Parse the needed information from the table contents.
+ * @throws IOException For I/O Error.
*/
- protected void parseTable() throws IOException {
+ private void parseTable() throws IOException {
/* Skip the Table Version. */
getReader().skipBytes(USHORT_BYTES);
final int qtySubtables = getReader().readUnsignedShort();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2009-04-29 20:17:18
|
Revision: 10816
http://foray.svn.sourceforge.net/foray/?rev=10816&view=rev
Author: victormote
Date: 2009-04-29 20:17:08 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Remove some dependencies on FOrayPS.
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 2009-04-29 20:16:30 UTC (rev 10815)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java 2009-04-29 20:17:08 UTC (rev 10816)
@@ -30,8 +30,6 @@
import org.foray.common.Bit;
import org.foray.font.output.FontPdf4a;
-import org.foray.ps.encode.EncodingCustom;
-import org.foray.ps.encode.EncodingVector4a;
import org.axsl.font.Font;
import org.axsl.font.FontException;
@@ -1639,13 +1637,9 @@
this.internalCodePointCount);
this.internalCodePointIndexes = newArray;
}
- // Make the arrays suitable for use in Encoding by sorting them
- EncodingVector4a.sortCodePoints(this.internalCodePoints,
- this.internalCodePointIndexes);
/* Create a tentative EncodingVector instance. */
- final EncodingVector4a newEncoding = new EncodingCustom("internal-"
- + this.getPostscriptName(), null, this.internalCodePoints,
- this.internalCodePointIndexes);
+ final EncodingVector newEncoding = psServer.makeEncodingVector("internal-" + this.getPostscriptName(),
+ this.internalCodePoints, this.internalCodePointIndexes);
/* Is this a predefined encoding? */
EncodingVector predefinedEncoding = null;
if (this.getPostscriptName().equals("ZapfDingbats")) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|