aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Schweinsberg <[email protected]>2007-01-24 09:47:48 +0000
committerDavid Schweinsberg <[email protected]>2007-01-24 09:47:48 +0000
commitcc800f17d22d6a2c5f68d8f49afc09fd9b9e5970 (patch)
treef7ba30ca69b842f027882b99dc8cb3876c82ada3
parent8b29f425021d3dc8f7754f18472ea88300852360 (diff)
Updated licence header and a bit of a tidy up.
-rw-r--r--src/net/java/dev/typecast/ot/table/Feature.java83
-rw-r--r--src/net/java/dev/typecast/ot/table/FeatureList.java103
-rw-r--r--src/net/java/dev/typecast/ot/table/FeatureRecord.java82
-rw-r--r--src/net/java/dev/typecast/ot/table/FeatureTags.java64
-rw-r--r--src/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java42
-rw-r--r--src/net/java/dev/typecast/ot/table/GlyfDescript.java14
-rw-r--r--src/net/java/dev/typecast/ot/table/GlyfSimpleDescript.java12
-rw-r--r--src/net/java/dev/typecast/ot/table/GlyfTable.java39
-rw-r--r--src/net/java/dev/typecast/ot/table/GlyphDescription.java4
-rw-r--r--src/net/java/dev/typecast/ot/table/GposTable.java65
-rw-r--r--src/net/java/dev/typecast/ot/table/GsubTable.java26
-rw-r--r--src/net/java/dev/typecast/ot/table/LangSys.java90
-rw-r--r--src/net/java/dev/typecast/ot/table/LangSysRecord.java78
-rw-r--r--src/net/java/dev/typecast/ot/table/Ligature.java82
-rw-r--r--src/net/java/dev/typecast/ot/table/LigatureSet.java88
-rw-r--r--src/net/java/dev/typecast/ot/table/LigatureSubst.java72
-rw-r--r--src/net/java/dev/typecast/ot/table/LigatureSubstFormat1.java95
-rw-r--r--src/net/java/dev/typecast/ot/table/Lookup.java103
-rw-r--r--src/net/java/dev/typecast/ot/table/LookupList.java97
-rw-r--r--src/net/java/dev/typecast/ot/table/LookupSubtable.java58
-rw-r--r--src/net/java/dev/typecast/ot/table/LookupSubtableFactory.java62
-rw-r--r--src/net/java/dev/typecast/ot/table/RangeRecord.java78
-rw-r--r--src/net/java/dev/typecast/ot/table/Script.java117
-rw-r--r--src/net/java/dev/typecast/ot/table/ScriptList.java101
-rw-r--r--src/net/java/dev/typecast/ot/table/ScriptRecord.java82
-rw-r--r--src/net/java/dev/typecast/ot/table/ScriptTags.java60
-rw-r--r--src/net/java/dev/typecast/ot/table/SingleSubst.java71
-rw-r--r--src/net/java/dev/typecast/ot/table/SingleSubstFormat1.java81
-rw-r--r--src/net/java/dev/typecast/ot/table/SingleSubstFormat2.java89
29 files changed, 1487 insertions, 551 deletions
diff --git a/src/net/java/dev/typecast/ot/table/Feature.java b/src/net/java/dev/typecast/ot/table/Feature.java
index 6679fbc..34adf46 100644
--- a/src/net/java/dev/typecast/ot/table/Feature.java
+++ b/src/net/java/dev/typecast/ot/table/Feature.java
@@ -1,44 +1,85 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInput;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: Feature.java,v 1.1.1.1 2004-12-05 23:14:37 davidsch Exp $
+ * @version $Id: Feature.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $
*/
public class Feature {
- private int featureParams;
- private int lookupCount;
- private int[] lookupListIndex;
+ private int _featureParams;
+ private int _lookupCount;
+ private int[] _lookupListIndex;
/** Creates new Feature */
- protected Feature(RandomAccessFile raf, int offset) throws IOException {
- raf.seek(offset);
- featureParams = raf.readUnsignedShort();
- lookupCount = raf.readUnsignedShort();
- lookupListIndex = new int[lookupCount];
- for (int i = 0; i < lookupCount; i++) {
- lookupListIndex[i] = raf.readUnsignedShort();
+ protected Feature(DataInput di) throws IOException {
+ _featureParams = di.readUnsignedShort();
+ _lookupCount = di.readUnsignedShort();
+ _lookupListIndex = new int[_lookupCount];
+ for (int i = 0; i < _lookupCount; i++) {
+ _lookupListIndex[i] = di.readUnsignedShort();
}
}
public int getLookupCount() {
- return lookupCount;
+ return _lookupCount;
}
public int getLookupListIndex(int i) {
- return lookupListIndex[i];
+ return _lookupListIndex[i];
}
}
diff --git a/src/net/java/dev/typecast/ot/table/FeatureList.java b/src/net/java/dev/typecast/ot/table/FeatureList.java
index 97a589c..edda0fc 100644
--- a/src/net/java/dev/typecast/ot/table/FeatureList.java
+++ b/src/net/java/dev/typecast/ot/table/FeatureList.java
@@ -1,51 +1,100 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: FeatureList.java,v 1.1.1.1 2004-12-05 23:14:38 davidsch Exp $
+ * @version $Id: FeatureList.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $
*/
public class FeatureList {
- private int featureCount;
- private FeatureRecord[] featureRecords;
- private Feature[] features;
+ private int _featureCount;
+ private FeatureRecord[] _featureRecords;
+ private Feature[] _features;
/** Creates new FeatureList */
- public FeatureList(RandomAccessFile raf, int offset) throws IOException {
- raf.seek(offset);
- featureCount = raf.readUnsignedShort();
- featureRecords = new FeatureRecord[featureCount];
- features = new Feature[featureCount];
- for (int i = 0; i < featureCount; i++) {
- featureRecords[i] = new FeatureRecord(raf);
+ public FeatureList(DataInputStream dis, int offset) throws IOException {
+
+ // Ensure we're in the right place
+ dis.reset();
+ dis.skipBytes(offset);
+
+ // Start reading
+ _featureCount = dis.readUnsignedShort();
+ _featureRecords = new FeatureRecord[_featureCount];
+ _features = new Feature[_featureCount];
+ for (int i = 0; i < _featureCount; i++) {
+ _featureRecords[i] = new FeatureRecord(dis);
}
- for (int i = 0; i < featureCount; i++) {
- features[i] = new Feature(raf, offset + featureRecords[i].getOffset());
+ for (int i = 0; i < _featureCount; i++) {
+ dis.reset();
+ dis.skipBytes(offset + _featureRecords[i].getOffset());
+ _features[i] = new Feature(dis);
}
}
public int getFeatureCount() {
- return featureCount;
+ return _featureCount;
}
public FeatureRecord getFeatureRecord(int i) {
- return featureRecords[i];
+ return _featureRecords[i];
}
public Feature getFeature(int i) {
- return features[i];
+ return _features[i];
}
public Feature findFeature(LangSys langSys, String tag) {
@@ -56,10 +105,10 @@ public class FeatureList {
| (tag.charAt(1)<<16)
| (tag.charAt(2)<<8)
| tag.charAt(3));
- for (int i = 0; i < featureCount; i++) {
- if (featureRecords[i].getTag() == tagVal) {
+ for (int i = 0; i < _featureCount; i++) {
+ if (_featureRecords[i].getTag() == tagVal) {
if (langSys.isFeatureIndexed(i)) {
- return features[i];
+ return _features[i];
}
}
}
diff --git a/src/net/java/dev/typecast/ot/table/FeatureRecord.java b/src/net/java/dev/typecast/ot/table/FeatureRecord.java
index e5f89c7..7c27888 100644
--- a/src/net/java/dev/typecast/ot/table/FeatureRecord.java
+++ b/src/net/java/dev/typecast/ot/table/FeatureRecord.java
@@ -1,46 +1,88 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInput;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: FeatureRecord.java,v 1.1.1.1 2004-12-05 23:14:38 davidsch Exp $
+ * @version $Id: FeatureRecord.java,v 1.2 2007-01-24 09:47:48 davidsch Exp $
*/
public class FeatureRecord {
- private int tag;
- private int offset;
+ private int _tag;
+ private int _offset;
/** Creates new FeatureRecord */
- public FeatureRecord(RandomAccessFile raf) throws IOException {
- tag = raf.readInt();
- offset = raf.readUnsignedShort();
+ protected FeatureRecord(DataInput di) throws IOException {
+ _tag = di.readInt();
+ _offset = di.readUnsignedShort();
}
public int getTag() {
- return tag;
+ return _tag;
}
public int getOffset() {
- return offset;
+ return _offset;
}
public String getTagAsString() {
return new StringBuffer()
- .append((char)((tag>>24)&0xff))
- .append((char)((tag>>16)&0xff))
- .append((char)((tag>>8)&0xff))
- .append((char)((tag)&0xff))
+ .append((char)((_tag>>24)&0xff))
+ .append((char)((_tag>>16)&0xff))
+ .append((char)((_tag>>8)&0xff))
+ .append((char)((_tag)&0xff))
.toString();
}
}
diff --git a/src/net/java/dev/typecast/ot/table/FeatureTags.java b/src/net/java/dev/typecast/ot/table/FeatureTags.java
index 9e7c63d..8d573d0 100644
--- a/src/net/java/dev/typecast/ot/table/FeatureTags.java
+++ b/src/net/java/dev/typecast/ot/table/FeatureTags.java
@@ -1,21 +1,63 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
/**
* Definition of Feature tags
*
- * @version $Id: FeatureTags.java,v 1.1.1.1 2004-12-05 23:14:38 davidsch Exp $
+ * @version $Id: FeatureTags.java,v 1.2 2007-01-24 09:47:48 davidsch Exp $
* @author <a href="mailto:[email protected]">Vincent Hardy</a>
*/
public interface FeatureTags {
- String FEATURE_TAG_INIT = "init";
- String FEATURE_TAG_MEDI = "medi";
- String FEATURE_TAG_FINA = "fina";
+ public static final String FEATURE_TAG_INIT = "init";
+ public static final String FEATURE_TAG_MEDI = "medi";
+ public static final String FEATURE_TAG_FINA = "fina";
}
diff --git a/src/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java b/src/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java
index 9a6c681..d836fb9 100644
--- a/src/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java
+++ b/src/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java
@@ -52,6 +52,7 @@ package net.java.dev.typecast.ot.table;
import java.io.DataInput;
import java.io.IOException;
+
import java.util.ArrayList;
/**
@@ -59,7 +60,7 @@ import java.util.ArrayList;
* or more simple glyphs, usually with some sort of transformation applied to
* each.
*
- * @version $Id: GlyfCompositeDescript.java,v 1.2 2004-12-15 14:10:26 davidsch Exp $
+ * @version $Id: GlyfCompositeDescript.java,v 1.3 2007-01-24 09:47:48 davidsch Exp $
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public class GlyfCompositeDescript extends GlyfDescript {
@@ -67,29 +68,31 @@ public class GlyfCompositeDescript extends GlyfDescript {
private ArrayList<GlyfCompositeComp> _components =
new ArrayList<GlyfCompositeComp>();
- public GlyfCompositeDescript(GlyfTable parentTable, DataInput di)
- throws IOException {
- super(parentTable, (short) -1, di);
+ public GlyfCompositeDescript(
+ GlyfTable parentTable,
+ int glyphIndex,
+ DataInput di) throws IOException {
+ super(parentTable, glyphIndex, (short) -1, di);
// Get all of the composite components
GlyfCompositeComp comp;
int firstIndex = 0;
int firstContour = 0;
try {
- do {
- _components.add(comp = new GlyfCompositeComp(firstIndex, firstContour, di));
- firstIndex += parentTable.getDescription(comp.getGlyphIndex()).getPointCount();
- firstContour += parentTable.getDescription(comp.getGlyphIndex()).getContourCount();
- } while ((comp.getFlags() & GlyfCompositeComp.MORE_COMPONENTS) != 0);
-
- // Are there hinting intructions to read?
- if ((comp.getFlags() & GlyfCompositeComp.WE_HAVE_INSTRUCTIONS) != 0) {
- readInstructions(di, di.readShort());
- }
+ do {
+ _components.add(comp = new GlyfCompositeComp(firstIndex, firstContour, di));
+ firstIndex += parentTable.getDescription(comp.getGlyphIndex()).getPointCount();
+ firstContour += parentTable.getDescription(comp.getGlyphIndex()).getContourCount();
+ } while ((comp.getFlags() & GlyfCompositeComp.MORE_COMPONENTS) != 0);
+
+ // Are there hinting intructions to read?
+ if ((comp.getFlags() & GlyfCompositeComp.WE_HAVE_INSTRUCTIONS) != 0) {
+ readInstructions(di, di.readShort());
+ }
} catch (IOException e) {
throw e;
- } catch (Exception e) {
- int foo = 0;
+// } catch (Exception e) {
+// int foo = 0;
}
}
@@ -145,7 +148,12 @@ public class GlyfCompositeDescript extends GlyfDescript {
public int getPointCount() {
GlyfCompositeComp c = _components.get(_components.size()-1);
- return c.getFirstIndex() + _parentTable.getDescription(c.getGlyphIndex()).getPointCount();
+ GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex());
+ if (gd != null) {
+ return c.getFirstIndex() + gd.getPointCount();
+ } else {
+ return 0;
+ }
}
public int getContourCount() {
diff --git a/src/net/java/dev/typecast/ot/table/GlyfDescript.java b/src/net/java/dev/typecast/ot/table/GlyfDescript.java
index f96b785..49ae5b4 100644
--- a/src/net/java/dev/typecast/ot/table/GlyfDescript.java
+++ b/src/net/java/dev/typecast/ot/table/GlyfDescript.java
@@ -54,7 +54,7 @@ import java.io.DataInput;
import java.io.IOException;
/**
- * @version $Id: GlyfDescript.java,v 1.2 2004-12-15 14:10:26 davidsch Exp $
+ * @version $Id: GlyfDescript.java,v 1.3 2007-01-24 09:47:48 davidsch Exp $
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public abstract class GlyfDescript extends Program implements GlyphDescription {
@@ -68,14 +68,18 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
public static final byte yDual = 0x20;
protected GlyfTable _parentTable;
+ private int _glyphIndex;
private int _numberOfContours;
private short _xMin;
private short _yMin;
private short _xMax;
private short _yMax;
- protected GlyfDescript(GlyfTable parentTable, short numberOfContours, DataInput di)
- throws IOException {
+ protected GlyfDescript(
+ GlyfTable parentTable,
+ int glyphIndex,
+ short numberOfContours,
+ DataInput di) throws IOException {
_parentTable = parentTable;
_numberOfContours = numberOfContours;
_xMin = di.readShort();
@@ -88,6 +92,10 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
return _numberOfContours;
}
+ public int getGlyphIndex() {
+ return _glyphIndex;
+ }
+
public short getXMaximum() {
return _xMax;
}
diff --git a/src/net/java/dev/typecast/ot/table/GlyfSimpleDescript.java b/src/net/java/dev/typecast/ot/table/GlyfSimpleDescript.java
index 83f9424..e2c3a2c 100644
--- a/src/net/java/dev/typecast/ot/table/GlyfSimpleDescript.java
+++ b/src/net/java/dev/typecast/ot/table/GlyfSimpleDescript.java
@@ -55,7 +55,7 @@ import java.io.IOException;
import net.java.dev.typecast.ot.Disassembler;
/**
- * @version $Id: GlyfSimpleDescript.java,v 1.2 2004-12-15 14:10:27 davidsch Exp $
+ * @version $Id: GlyfSimpleDescript.java,v 1.3 2007-01-24 09:47:47 davidsch Exp $
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public class GlyfSimpleDescript extends GlyfDescript {
@@ -66,10 +66,12 @@ public class GlyfSimpleDescript extends GlyfDescript {
private short[] _yCoordinates;
private int _count;
- public GlyfSimpleDescript(GlyfTable parentTable, short numberOfContours, DataInput di)
- throws IOException {
-
- super(parentTable, numberOfContours, di);
+ public GlyfSimpleDescript(
+ GlyfTable parentTable,
+ int glyphIndex,
+ short numberOfContours,
+ DataInput di) throws IOException {
+ super(parentTable, glyphIndex, numberOfContours, di);
// Simple glyph description
_endPtsOfContours = new int[numberOfContours];
diff --git a/src/net/java/dev/typecast/ot/table/GlyfTable.java b/src/net/java/dev/typecast/ot/table/GlyfTable.java
index ae93ae3..1afcfb7 100644
--- a/src/net/java/dev/typecast/ot/table/GlyfTable.java
+++ b/src/net/java/dev/typecast/ot/table/GlyfTable.java
@@ -56,7 +56,7 @@ import java.io.DataInputStream;
import java.io.IOException;
/**
- * @version $Id: GlyfTable.java,v 1.2 2004-12-15 14:10:28 davidsch Exp $
+ * @version $Id: GlyfTable.java,v 1.3 2007-01-24 09:47:46 davidsch Exp $
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public class GlyfTable implements Table {
@@ -67,38 +67,11 @@ public class GlyfTable implements Table {
protected GlyfTable(DirectoryEntry de, DataInput di) throws IOException {
_de = (DirectoryEntry) de.clone();
+
+ // We need to buffer this and then initialise once we have the
+ // "loca" table
_buf = new byte[de.getLength()];
di.readFully(_buf);
-/*
- TableMaxp t_maxp = (TableMaxp) td.getEntryByTag(maxp).getTable();
- TableLoca t_loca = (TableLoca) td.getEntryByTag(loca).getTable();
- descript = new TableGlyfDescript[t_maxp.getNumGlyphs()];
- for (int i = 0; i < t_maxp.getNumGlyphs(); i++) {
- raf.seek(tde.getOffset() + t_loca.getOffset(i));
- int len = t_loca.getOffset((short)(i + 1)) - t_loca.getOffset(i);
- if (len > 0) {
- short numberOfContours = raf.readShort();
- if (numberOfContours < 0) {
- // descript[i] = new TableGlyfCompositeDescript(this, raf);
- } else {
- descript[i] = new TableGlyfSimpleDescript(this, numberOfContours, raf);
- }
- } else {
- descript[i] = null;
- }
- }
-
- for (int i = 0; i < t_maxp.getNumGlyphs(); i++) {
- raf.seek(tde.getOffset() + t_loca.getOffset(i));
- int len = t_loca.getOffset((short)(i + 1)) - t_loca.getOffset(i);
- if (len > 0) {
- short numberOfContours = raf.readShort();
- if (numberOfContours < 0) {
- descript[i] = new TableGlyfCompositeDescript(this, raf);
- }
- }
- }
-*/
}
public void init(int numGlyphs, LocaTable loca) throws IOException {
@@ -117,7 +90,7 @@ public class GlyfTable implements Table {
DataInputStream dis = new DataInputStream(bais);
short numberOfContours = dis.readShort();
if (numberOfContours >= 0) {
- _descript[i] = new GlyfSimpleDescript(this, numberOfContours, dis);
+ _descript[i] = new GlyfSimpleDescript(this, i, numberOfContours, dis);
}
} else {
_descript[i] = null;
@@ -133,7 +106,7 @@ public class GlyfTable implements Table {
DataInputStream dis = new DataInputStream(bais);
short numberOfContours = dis.readShort();
if (numberOfContours < 0) {
- _descript[i] = new GlyfCompositeDescript(this, dis);
+ _descript[i] = new GlyfCompositeDescript(this, i, dis);
}
}
}
diff --git a/src/net/java/dev/typecast/ot/table/GlyphDescription.java b/src/net/java/dev/typecast/ot/table/GlyphDescription.java
index 91c020a..b23f313 100644
--- a/src/net/java/dev/typecast/ot/table/GlyphDescription.java
+++ b/src/net/java/dev/typecast/ot/table/GlyphDescription.java
@@ -52,11 +52,13 @@ package net.java.dev.typecast.ot.table;
/**
* Specifies access to glyph description classes, simple and composite.
- * @version $Id: GlyphDescription.java,v 1.2 2004-12-15 14:10:28 davidsch Exp $
+ * @version $Id: GlyphDescription.java,v 1.3 2007-01-24 09:47:45 davidsch Exp $
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public interface GlyphDescription {
+ public int getGlyphIndex();
+
public int getEndPtOfContours(int i);
public byte getFlags(int i);
diff --git a/src/net/java/dev/typecast/ot/table/GposTable.java b/src/net/java/dev/typecast/ot/table/GposTable.java
index f1e9e4d..3efeeaa 100644
--- a/src/net/java/dev/typecast/ot/table/GposTable.java
+++ b/src/net/java/dev/typecast/ot/table/GposTable.java
@@ -1,60 +1,45 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+ * $Id: GposTable.java,v 1.2 2007-01-24 09:47:47 davidsch Exp $
+ *
+ * Typecast - The Font Development Environment
+ *
+ * Copyright (c) 2004 David Schweinsberg
+ *
+ * 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.
+ */
package net.java.dev.typecast.ot.table;
-import java.io.IOException;
import java.io.DataInput;
+import java.io.IOException;
/**
- *
+ * TODO: To be implemented
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: GposTable.java,v 1.1.1.1 2004-12-05 23:14:42 davidsch Exp $
+ * @version $Id: GposTable.java,v 1.2 2007-01-24 09:47:47 davidsch Exp $
*/
public class GposTable implements Table {
- private DirectoryEntry de;
+ private DirectoryEntry _de;
protected GposTable(DirectoryEntry de, DataInput di) throws IOException {
- this.de = (DirectoryEntry) de.clone();
+ _de = (DirectoryEntry) de.clone();
// GPOS Header
int version = di.readInt();
int scriptList = di.readInt();
int featureList = di.readInt();
int lookupList = di.readInt();
-/*
- for (int i = 0; i < t_maxp.getNumGlyphs(); i++) {
- raf.seek(tde.getOffset() + t_loca.getOffset(i));
- int len = t_loca.getOffset((short)(i + 1)) - t_loca.getOffset(i);
- if (len > 0) {
- short numberOfContours = raf.readShort();
- if (numberOfContours < 0) {
- // descript[i] = new TableGlyfCompositeDescript(this, raf);
- } else {
- descript[i] = new TableGlyfSimpleDescript(this, numberOfContours, raf);
- }
- } else {
- descript[i] = null;
- }
- }
-
- for (int i = 0; i < t_maxp.getNumGlyphs(); i++) {
- raf.seek(tde.getOffset() + t_loca.getOffset(i));
- int len = t_loca.getOffset((short)(i + 1)) - t_loca.getOffset(i);
- if (len > 0) {
- short numberOfContours = raf.readShort();
- if (numberOfContours < 0) {
- descript[i] = new TableGlyfCompositeDescript(this, raf);
- }
- }
- }
-*/
}
/** Get the table type, as a table directory value.
@@ -75,7 +60,7 @@ public class GposTable implements Table {
* @return A directory entry
*/
public DirectoryEntry getDirectoryEntry() {
- return de;
+ return _de;
}
}
diff --git a/src/net/java/dev/typecast/ot/table/GsubTable.java b/src/net/java/dev/typecast/ot/table/GsubTable.java
index e2bbe3c..d7f9c35 100644
--- a/src/net/java/dev/typecast/ot/table/GsubTable.java
+++ b/src/net/java/dev/typecast/ot/table/GsubTable.java
@@ -55,12 +55,10 @@ import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
-
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: GsubTable.java,v 1.2 2004-12-09 23:46:21 davidsch Exp $
+ * @version $Id: GsubTable.java,v 1.3 2007-01-24 09:47:46 davidsch Exp $
*/
public class GsubTable implements Table, LookupSubtableFactory {
@@ -75,7 +73,7 @@ public class GsubTable implements Table, LookupSubtableFactory {
// Load into a temporary buffer, and create another input stream
byte[] buf = new byte[de.getLength()];
di.readFully(buf);
- DataInput dis = new DataInputStream(new ByteArrayInputStream(buf));
+ DataInputStream dis = new DataInputStream(new ByteArrayInputStream(buf));
// GSUB Header
int version = dis.readInt();
@@ -84,13 +82,13 @@ public class GsubTable implements Table, LookupSubtableFactory {
int lookupListOffset = dis.readUnsignedShort();
// Script List
-// scriptList = new ScriptList(raf, de.getOffset() + scriptListOffset);
+ _scriptList = new ScriptList(dis, scriptListOffset);
// Feature List
-// featureList = new FeatureList(raf, de.getOffset() + featureListOffset);
+ _featureList = new FeatureList(dis, featureListOffset);
// Lookup List
-// lookupList = new LookupList(raf, de.getOffset() + lookupListOffset, this);
+ _lookupList = new LookupList(dis, lookupListOffset, this);
}
/**
@@ -103,27 +101,27 @@ public class GsubTable implements Table, LookupSubtableFactory {
*/
public LookupSubtable read(
int type,
- RandomAccessFile raf,
+ DataInputStream dis,
int offset) throws IOException {
LookupSubtable s = null;
switch (type) {
case 1:
- s = SingleSubst.read(raf, offset);
+ s = SingleSubst.read(dis, offset);
break;
case 2:
-// s = MultipleSubst.read(raf, offset);
+// s = MultipleSubst.read(dis, offset);
break;
case 3:
-// s = AlternateSubst.read(raf, offset);
+// s = AlternateSubst.read(dis, offset);
break;
case 4:
- s = LigatureSubst.read(raf, offset);
+ s = LigatureSubst.read(dis, offset);
break;
case 5:
-// s = ContextSubst.read(raf, offset);
+// s = ContextSubst.read(dis, offset);
break;
case 6:
-// s = ChainingSubst.read(raf, offset);
+// s = ChainingSubst.read(dis, offset);
break;
}
return s;
diff --git a/src/net/java/dev/typecast/ot/table/LangSys.java b/src/net/java/dev/typecast/ot/table/LangSys.java
index 4a07ee6..9963bf6 100644
--- a/src/net/java/dev/typecast/ot/table/LangSys.java
+++ b/src/net/java/dev/typecast/ot/table/LangSys.java
@@ -1,10 +1,52 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
@@ -14,45 +56,45 @@ import java.io.IOException;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: LangSys.java,v 1.1.1.1 2004-12-05 23:14:49 davidsch Exp $
+ * @version $Id: LangSys.java,v 1.2 2007-01-24 09:47:47 davidsch Exp $
*/
public class LangSys {
- private int lookupOrder;
- private int reqFeatureIndex;
- private int featureCount;
- private int[] featureIndex;
+ private int _lookupOrder;
+ private int _reqFeatureIndex;
+ private int _featureCount;
+ private int[] _featureIndex;
/** Creates new LangSys */
protected LangSys(DataInput di) throws IOException {
- lookupOrder = di.readUnsignedShort();
- reqFeatureIndex = di.readUnsignedShort();
- featureCount = di.readUnsignedShort();
- featureIndex = new int[featureCount];
- for (int i = 0; i < featureCount; i++) {
- featureIndex[i] = di.readUnsignedShort();
+ _lookupOrder = di.readUnsignedShort();
+ _reqFeatureIndex = di.readUnsignedShort();
+ _featureCount = di.readUnsignedShort();
+ _featureIndex = new int[_featureCount];
+ for (int i = 0; i < _featureCount; i++) {
+ _featureIndex[i] = di.readUnsignedShort();
}
}
public int getLookupOrder() {
- return lookupOrder;
+ return _lookupOrder;
}
public int getReqFeatureIndex() {
- return reqFeatureIndex;
+ return _reqFeatureIndex;
}
public int getFeatureCount() {
- return featureCount;
+ return _featureCount;
}
public int getFeatureIndex(int i) {
- return featureIndex[i];
+ return _featureIndex[i];
}
protected boolean isFeatureIndexed(int n) {
- for (int i = 0; i < featureCount; i++) {
- if (featureIndex[i] == n) {
+ for (int i = 0; i < _featureCount; i++) {
+ if (_featureIndex[i] == n) {
return true;
}
}
diff --git a/src/net/java/dev/typecast/ot/table/LangSysRecord.java b/src/net/java/dev/typecast/ot/table/LangSysRecord.java
index 6d5e5c0..a69c12a 100644
--- a/src/net/java/dev/typecast/ot/table/LangSysRecord.java
+++ b/src/net/java/dev/typecast/ot/table/LangSysRecord.java
@@ -1,10 +1,52 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
@@ -14,33 +56,33 @@ import java.io.IOException;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: LangSysRecord.java,v 1.1.1.1 2004-12-05 23:14:49 davidsch Exp $
+ * @version $Id: LangSysRecord.java,v 1.2 2007-01-24 09:47:48 davidsch Exp $
*/
public class LangSysRecord {
- private int tag;
- private int offset;
+ private int _tag;
+ private int _offset;
/** Creates new LangSysRecord */
public LangSysRecord(DataInput di) throws IOException {
- tag = di.readInt();
- offset = di.readUnsignedShort();
+ _tag = di.readInt();
+ _offset = di.readUnsignedShort();
}
public int getTag() {
- return tag;
+ return _tag;
}
public int getOffset() {
- return offset;
+ return _offset;
}
public String getTagAsString() {
return new StringBuffer()
- .append((char)((tag>>24)&0xff))
- .append((char)((tag>>16)&0xff))
- .append((char)((tag>>8)&0xff))
- .append((char)((tag)&0xff))
+ .append((char)((_tag>>24)&0xff))
+ .append((char)((_tag>>16)&0xff))
+ .append((char)((_tag>>8)&0xff))
+ .append((char)((_tag)&0xff))
.toString();
}
}
diff --git a/src/net/java/dev/typecast/ot/table/Ligature.java b/src/net/java/dev/typecast/ot/table/Ligature.java
index c2dd631..36969ba 100644
--- a/src/net/java/dev/typecast/ot/table/Ligature.java
+++ b/src/net/java/dev/typecast/ot/table/Ligature.java
@@ -1,43 +1,85 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInput;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: Ligature.java,v 1.1.1.1 2004-12-05 23:14:49 davidsch Exp $
+ * @version $Id: Ligature.java,v 1.2 2007-01-24 09:47:48 davidsch Exp $
*/
public class Ligature {
- private int ligGlyph;
- private int compCount;
- private int[] components;
+ private int _ligGlyph;
+ private int _compCount;
+ private int[] _components;
/** Creates new Ligature */
- public Ligature(RandomAccessFile raf) throws IOException {
- ligGlyph = raf.readUnsignedShort();
- compCount = raf.readUnsignedShort();
- components = new int[compCount - 1];
- for (int i = 0; i < compCount - 1; i++) {
- components[i] = raf.readUnsignedShort();
+ public Ligature(DataInput di) throws IOException {
+ _ligGlyph = di.readUnsignedShort();
+ _compCount = di.readUnsignedShort();
+ _components = new int[_compCount - 1];
+ for (int i = 0; i < _compCount - 1; i++) {
+ _components[i] = di.readUnsignedShort();
}
}
public int getGlyphCount() {
- return compCount;
+ return _compCount;
}
public int getGlyphId(int i) {
- return (i == 0) ? ligGlyph : components[i-1];
+ return (i == 0) ? _ligGlyph : _components[i-1];
}
}
diff --git a/src/net/java/dev/typecast/ot/table/LigatureSet.java b/src/net/java/dev/typecast/ot/table/LigatureSet.java
index f72fdea..fe6db04 100644
--- a/src/net/java/dev/typecast/ot/table/LigatureSet.java
+++ b/src/net/java/dev/typecast/ot/table/LigatureSet.java
@@ -1,39 +1,83 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: LigatureSet.java,v 1.1.1.1 2004-12-05 23:14:49 davidsch Exp $
+ * @version $Id: LigatureSet.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $
*/
public class LigatureSet {
- private int ligatureCount;
- private int[] ligatureOffsets;
- private Ligature[] ligatures;
+ private int _ligatureCount;
+ private int[] _ligatureOffsets;
+ private Ligature[] _ligatures;
/** Creates new LigatureSet */
- public LigatureSet(RandomAccessFile raf, int offset) throws IOException {
- raf.seek(offset);
- ligatureCount = raf.readUnsignedShort();
- ligatureOffsets = new int[ligatureCount];
- ligatures = new Ligature[ligatureCount];
- for (int i = 0; i < ligatureCount; i++) {
- ligatureOffsets[i] = raf.readUnsignedShort();
+ public LigatureSet(DataInputStream dis, int offset) throws IOException {
+ dis.reset();
+ dis.skipBytes(offset);
+ _ligatureCount = dis.readUnsignedShort();
+ _ligatureOffsets = new int[_ligatureCount];
+ _ligatures = new Ligature[_ligatureCount];
+ for (int i = 0; i < _ligatureCount; i++) {
+ _ligatureOffsets[i] = dis.readUnsignedShort();
}
- for (int i = 0; i < ligatureCount; i++) {
- raf.seek(offset + ligatureOffsets[i]);
- ligatures[i] = new Ligature(raf);
+ for (int i = 0; i < _ligatureCount; i++) {
+ dis.reset();
+ dis.skipBytes(offset + _ligatureOffsets[i]);
+ _ligatures[i] = new Ligature(dis);
}
}
diff --git a/src/net/java/dev/typecast/ot/table/LigatureSubst.java b/src/net/java/dev/typecast/ot/table/LigatureSubst.java
index f574a3b..73a8b9d 100644
--- a/src/net/java/dev/typecast/ot/table/LigatureSubst.java
+++ b/src/net/java/dev/typecast/ot/table/LigatureSubst.java
@@ -1,31 +1,73 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: LigatureSubst.java,v 1.1.1.1 2004-12-05 23:14:49 davidsch Exp $
+ * @version $Id: LigatureSubst.java,v 1.2 2007-01-24 09:47:48 davidsch Exp $
*/
public abstract class LigatureSubst extends LookupSubtable {
- public static LigatureSubst read(RandomAccessFile raf, int offset) throws IOException {
- LigatureSubst ls = null;
- raf.seek(offset);
- int format = raf.readUnsignedShort();
+ public static LigatureSubst read(DataInputStream dis, int offset) throws IOException {
+ dis.reset();
+ dis.skipBytes(offset);
+ int format = dis.readUnsignedShort();
if (format == 1) {
- ls = new LigatureSubstFormat1(raf, offset);
+ return new LigatureSubstFormat1(dis, offset);
}
- return ls;
+ return null;
}
}
diff --git a/src/net/java/dev/typecast/ot/table/LigatureSubstFormat1.java b/src/net/java/dev/typecast/ot/table/LigatureSubstFormat1.java
index 99910cc..b19b071 100644
--- a/src/net/java/dev/typecast/ot/table/LigatureSubstFormat1.java
+++ b/src/net/java/dev/typecast/ot/table/LigatureSubstFormat1.java
@@ -1,42 +1,87 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: LigatureSubstFormat1.java,v 1.1.1.1 2004-12-05 23:14:49 davidsch Exp $
+ * @version $Id: LigatureSubstFormat1.java,v 1.2 2007-01-24 09:47:47 davidsch Exp $
*/
public class LigatureSubstFormat1 extends LigatureSubst {
- private int coverageOffset;
- private int ligSetCount;
- private int[] ligatureSetOffsets;
- private Coverage coverage;
- private LigatureSet[] ligatureSets;
+ private int _coverageOffset;
+ private int _ligSetCount;
+ private int[] _ligatureSetOffsets;
+ private Coverage _coverage;
+ private LigatureSet[] _ligatureSets;
/** Creates new LigatureSubstFormat1 */
- protected LigatureSubstFormat1(RandomAccessFile raf,int offset) throws IOException {
- coverageOffset = raf.readUnsignedShort();
- ligSetCount = raf.readUnsignedShort();
- ligatureSetOffsets = new int[ligSetCount];
- ligatureSets = new LigatureSet[ligSetCount];
- for (int i = 0; i < ligSetCount; i++) {
- ligatureSetOffsets[i] = raf.readUnsignedShort();
+ protected LigatureSubstFormat1(
+ DataInputStream dis,
+ int offset) throws IOException {
+ _coverageOffset = dis.readUnsignedShort();
+ _ligSetCount = dis.readUnsignedShort();
+ _ligatureSetOffsets = new int[_ligSetCount];
+ _ligatureSets = new LigatureSet[_ligSetCount];
+ for (int i = 0; i < _ligSetCount; i++) {
+ _ligatureSetOffsets[i] = dis.readUnsignedShort();
}
- raf.seek(offset + coverageOffset);
- coverage = Coverage.read(raf);
- for (int i = 0; i < ligSetCount; i++) {
- ligatureSets[i] = new LigatureSet(raf, offset + ligatureSetOffsets[i]);
+ dis.reset();
+ dis.skipBytes(offset + _coverageOffset);
+ _coverage = Coverage.read(dis);
+ for (int i = 0; i < _ligSetCount; i++) {
+ _ligatureSets[i] = new LigatureSet(dis, offset + _ligatureSetOffsets[i]);
}
}
diff --git a/src/net/java/dev/typecast/ot/table/Lookup.java b/src/net/java/dev/typecast/ot/table/Lookup.java
index 1d4e009..d6e46cd 100644
--- a/src/net/java/dev/typecast/ot/table/Lookup.java
+++ b/src/net/java/dev/typecast/ot/table/Lookup.java
@@ -1,20 +1,62 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: Lookup.java,v 1.1.1.1 2004-12-05 23:14:50 davidsch Exp $
+ * @version $Id: Lookup.java,v 1.2 2007-01-24 09:47:47 davidsch Exp $
*/
public class Lookup {
@@ -24,39 +66,44 @@ public class Lookup {
public static final int IGNORE_BASE_MARKS = 0x0008;
public static final int MARK_ATTACHMENT_TYPE = 0xFF00;
- private int type;
- private int flag;
- private int subTableCount;
- private int[] subTableOffsets;
- private LookupSubtable[] subTables;
+ private int _type;
+ private int _flag;
+ private int _subTableCount;
+ private int[] _subTableOffsets;
+ private LookupSubtable[] _subTables;
/** Creates new Lookup */
- public Lookup(LookupSubtableFactory factory, RandomAccessFile raf, int offset)
+ public Lookup(LookupSubtableFactory factory, DataInputStream dis, int offset)
throws IOException {
- raf.seek(offset);
- type = raf.readUnsignedShort();
- flag = raf.readUnsignedShort();
- subTableCount = raf.readUnsignedShort();
- subTableOffsets = new int[subTableCount];
- subTables = new LookupSubtable[subTableCount];
- for (int i = 0; i < subTableCount; i++) {
- subTableOffsets[i] = raf.readUnsignedShort();
+
+ // Ensure we're in the right place
+ dis.reset();
+ dis.skipBytes(offset);
+
+ // Start reading
+ _type = dis.readUnsignedShort();
+ _flag = dis.readUnsignedShort();
+ _subTableCount = dis.readUnsignedShort();
+ _subTableOffsets = new int[_subTableCount];
+ _subTables = new LookupSubtable[_subTableCount];
+ for (int i = 0; i < _subTableCount; i++) {
+ _subTableOffsets[i] = dis.readUnsignedShort();
}
- for (int i = 0; i < subTableCount; i++) {
- subTables[i] = factory.read(type, raf, offset + subTableOffsets[i]);
+ for (int i = 0; i < _subTableCount; i++) {
+ _subTables[i] = factory.read(_type, dis, offset + _subTableOffsets[i]);
}
}
public int getType() {
- return type;
+ return _type;
}
public int getSubtableCount() {
- return subTableCount;
+ return _subTableCount;
}
public LookupSubtable getSubtable(int i) {
- return subTables[i];
+ return _subTables[i];
}
}
diff --git a/src/net/java/dev/typecast/ot/table/LookupList.java b/src/net/java/dev/typecast/ot/table/LookupList.java
index 0c286ec..9ac76ab 100644
--- a/src/net/java/dev/typecast/ot/table/LookupList.java
+++ b/src/net/java/dev/typecast/ot/table/LookupList.java
@@ -1,58 +1,105 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: LookupList.java,v 1.1.1.1 2004-12-05 23:14:50 davidsch Exp $
+ * @version $Id: LookupList.java,v 1.2 2007-01-24 09:47:47 davidsch Exp $
*/
public class LookupList {
- private int lookupCount;
- private int[] lookupOffsets;
- private Lookup[] lookups;
+ private int _lookupCount;
+ private int[] _lookupOffsets;
+ private Lookup[] _lookups;
/** Creates new LookupList */
- public LookupList(RandomAccessFile raf, int offset, LookupSubtableFactory factory)
+ public LookupList(DataInputStream dis, int offset, LookupSubtableFactory factory)
throws IOException {
- raf.seek(offset);
- lookupCount = raf.readUnsignedShort();
- lookupOffsets = new int[lookupCount];
- lookups = new Lookup[lookupCount];
- for (int i = 0; i < lookupCount; i++) {
- lookupOffsets[i] = raf.readUnsignedShort();
+
+ // Ensure we're in the right place
+ dis.reset();
+ dis.skipBytes(offset);
+
+ // Start reading
+ _lookupCount = dis.readUnsignedShort();
+ _lookupOffsets = new int[_lookupCount];
+ _lookups = new Lookup[_lookupCount];
+ for (int i = 0; i < _lookupCount; i++) {
+ _lookupOffsets[i] = dis.readUnsignedShort();
}
- for (int i = 0; i < lookupCount; i++) {
- lookups[i] = new Lookup(factory, raf, offset + lookupOffsets[i]);
+ for (int i = 0; i < _lookupCount; i++) {
+ _lookups[i] = new Lookup(factory, dis, offset + _lookupOffsets[i]);
}
}
public int getLookupCount() {
- return lookupCount;
+ return _lookupCount;
}
public int getLookupOffset(int i) {
- return lookupOffsets[i];
+ return _lookupOffsets[i];
}
public Lookup getLookup(int i) {
- return lookups[i];
+ return _lookups[i];
}
public Lookup getLookup(Feature feature, int index) {
if (feature.getLookupCount() > index) {
int i = feature.getLookupListIndex(index);
- return lookups[i];
+ return _lookups[i];
}
return null;
}
diff --git a/src/net/java/dev/typecast/ot/table/LookupSubtable.java b/src/net/java/dev/typecast/ot/table/LookupSubtable.java
index f44049a..4d8dbb1 100644
--- a/src/net/java/dev/typecast/ot/table/LookupSubtable.java
+++ b/src/net/java/dev/typecast/ot/table/LookupSubtable.java
@@ -1,17 +1,59 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: LookupSubtable.java,v 1.1.1.1 2004-12-05 23:14:50 davidsch Exp $
+ * @version $Id: LookupSubtable.java,v 1.2 2007-01-24 09:47:45 davidsch Exp $
*/
public abstract class LookupSubtable {
public abstract String getTypeAsString();
diff --git a/src/net/java/dev/typecast/ot/table/LookupSubtableFactory.java b/src/net/java/dev/typecast/ot/table/LookupSubtableFactory.java
index d77abd2..2081e2e 100644
--- a/src/net/java/dev/typecast/ot/table/LookupSubtableFactory.java
+++ b/src/net/java/dev/typecast/ot/table/LookupSubtableFactory.java
@@ -1,22 +1,64 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: LookupSubtableFactory.java,v 1.1.1.1 2004-12-05 23:14:50 davidsch Exp $
+ * @version $Id: LookupSubtableFactory.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $
*/
public interface LookupSubtableFactory {
- public LookupSubtable read(int type, RandomAccessFile raf, int offset)
+ public LookupSubtable read(int type, DataInputStream dis, int offset)
throws IOException;
}
diff --git a/src/net/java/dev/typecast/ot/table/RangeRecord.java b/src/net/java/dev/typecast/ot/table/RangeRecord.java
index c321cea..3bcb9cc 100644
--- a/src/net/java/dev/typecast/ot/table/RangeRecord.java
+++ b/src/net/java/dev/typecast/ot/table/RangeRecord.java
@@ -1,42 +1,84 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInput;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
* Coverage Index (GlyphID) = StartCoverageIndex + GlyphID - Start GlyphID
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: RangeRecord.java,v 1.1.1.1 2004-12-05 23:14:57 davidsch Exp $
+ * @version $Id: RangeRecord.java,v 1.2 2007-01-24 09:47:47 davidsch Exp $
*/
public class RangeRecord {
- private int start;
- private int end;
- private int startCoverageIndex;
+ private int _start;
+ private int _end;
+ private int _startCoverageIndex;
/** Creates new RangeRecord */
- public RangeRecord(RandomAccessFile raf) throws IOException {
- start = raf.readUnsignedShort();
- end = raf.readUnsignedShort();
- startCoverageIndex = raf.readUnsignedShort();
+ public RangeRecord(DataInput di) throws IOException {
+ _start = di.readUnsignedShort();
+ _end = di.readUnsignedShort();
+ _startCoverageIndex = di.readUnsignedShort();
}
public boolean isInRange(int glyphId) {
- return (start <= glyphId && glyphId <= end);
+ return (_start <= glyphId && glyphId <= _end);
}
public int getCoverageIndex(int glyphId) {
if (isInRange(glyphId)) {
- return startCoverageIndex + glyphId - start;
+ return _startCoverageIndex + glyphId - _start;
}
return -1;
}
diff --git a/src/net/java/dev/typecast/ot/table/Script.java b/src/net/java/dev/typecast/ot/table/Script.java
index 36fc82e..e3022c1 100644
--- a/src/net/java/dev/typecast/ot/table/Script.java
+++ b/src/net/java/dev/typecast/ot/table/Script.java
@@ -1,69 +1,118 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: Script.java,v 1.1.1.1 2004-12-05 23:14:57 davidsch Exp $
+ * @version $Id: Script.java,v 1.2 2007-01-24 09:47:47 davidsch Exp $
*/
public class Script {
- private int defaultLangSysOffset;
- private int langSysCount;
- private LangSysRecord[] langSysRecords;
- private LangSys defaultLangSys;
- private LangSys[] langSys;
+ private int _defaultLangSysOffset;
+ private int _langSysCount;
+ private LangSysRecord[] _langSysRecords;
+ private LangSys _defaultLangSys;
+ private LangSys[] _langSys;
/** Creates new ScriptTable */
- protected Script(RandomAccessFile raf, int offset) throws IOException {
- raf.seek(offset);
- defaultLangSysOffset = raf.readUnsignedShort();
- langSysCount = raf.readUnsignedShort();
- if (langSysCount > 0) {
- langSysRecords = new LangSysRecord[langSysCount];
- for (int i = 0; i < langSysCount; i++) {
- langSysRecords[i] = new LangSysRecord(raf);
+ protected Script(DataInputStream dis, int offset) throws IOException {
+
+ // Ensure we're in the right place
+ dis.reset();
+ dis.skipBytes(offset);
+
+ // Start reading
+ _defaultLangSysOffset = dis.readUnsignedShort();
+ _langSysCount = dis.readUnsignedShort();
+ if (_langSysCount > 0) {
+ _langSysRecords = new LangSysRecord[_langSysCount];
+ for (int i = 0; i < _langSysCount; i++) {
+ _langSysRecords[i] = new LangSysRecord(dis);
}
}
// Read the LangSys tables
- if (langSysCount > 0) {
- langSys = new LangSys[langSysCount];
- for (int i = 0; i < langSysCount; i++) {
- raf.seek(offset + langSysRecords[i].getOffset());
- langSys[i] = new LangSys(raf);
+ if (_langSysCount > 0) {
+ _langSys = new LangSys[_langSysCount];
+ for (int i = 0; i < _langSysCount; i++) {
+ dis.reset();
+ dis.skipBytes(offset + _langSysRecords[i].getOffset());
+ _langSys[i] = new LangSys(dis);
}
}
- if (defaultLangSysOffset > 0) {
- raf.seek(offset + defaultLangSysOffset);
- defaultLangSys = new LangSys(raf);
+ if (_defaultLangSysOffset > 0) {
+ dis.reset();
+ dis.skipBytes(offset + _defaultLangSysOffset);
+ _defaultLangSys = new LangSys(dis);
}
}
public int getLangSysCount() {
- return langSysCount;
+ return _langSysCount;
}
public LangSysRecord getLangSysRecord(int i) {
- return langSysRecords[i];
+ return _langSysRecords[i];
}
public LangSys getDefaultLangSys() {
- return defaultLangSys;
+ return _defaultLangSys;
}
public LangSys getLangSys(int i) {
- return langSys[i];
+ return _langSys[i];
}
}
diff --git a/src/net/java/dev/typecast/ot/table/ScriptList.java b/src/net/java/dev/typecast/ot/table/ScriptList.java
index cfee02b..0aa213f 100644
--- a/src/net/java/dev/typecast/ot/table/ScriptList.java
+++ b/src/net/java/dev/typecast/ot/table/ScriptList.java
@@ -1,51 +1,98 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: ScriptList.java,v 1.1.1.1 2004-12-05 23:14:57 davidsch Exp $
+ * @version $Id: ScriptList.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $
*/
public class ScriptList {
- private int scriptCount = 0;
- private ScriptRecord[] scriptRecords;
- private Script[] scripts;
+ private int _scriptCount = 0;
+ private ScriptRecord[] _scriptRecords;
+ private Script[] _scripts;
/** Creates new ScriptList */
- protected ScriptList(RandomAccessFile raf, int offset) throws IOException {
- raf.seek(offset);
- scriptCount = raf.readUnsignedShort();
- scriptRecords = new ScriptRecord[scriptCount];
- scripts = new Script[scriptCount];
- for (int i = 0; i < scriptCount; i++) {
- scriptRecords[i] = new ScriptRecord(raf);
+ protected ScriptList(DataInputStream dis, int offset) throws IOException {
+
+ // Ensure we're in the right place
+ dis.reset();
+ dis.skipBytes(offset);
+
+ // Start reading
+ _scriptCount = dis.readUnsignedShort();
+ _scriptRecords = new ScriptRecord[_scriptCount];
+ _scripts = new Script[_scriptCount];
+ for (int i = 0; i < _scriptCount; i++) {
+ _scriptRecords[i] = new ScriptRecord(dis);
}
- for (int i = 0; i < scriptCount; i++) {
- scripts[i] = new Script(raf, offset + scriptRecords[i].getOffset());
+ for (int i = 0; i < _scriptCount; i++) {
+ _scripts[i] = new Script(dis, offset + _scriptRecords[i].getOffset());
}
}
public int getScriptCount() {
- return scriptCount;
+ return _scriptCount;
}
public ScriptRecord getScriptRecord(int i) {
- return scriptRecords[i];
+ return _scriptRecords[i];
}
public Script getScript(int i) {
- return scripts[i];
+ return _scripts[i];
}
public Script findScript(String tag) {
@@ -56,9 +103,9 @@ public class ScriptList {
| (tag.charAt(1)<<16)
| (tag.charAt(2)<<8)
| tag.charAt(3));
- for (int i = 0; i < scriptCount; i++) {
- if (scriptRecords[i].getTag() == tagVal) {
- return scripts[i];
+ for (int i = 0; i < _scriptCount; i++) {
+ if (_scriptRecords[i].getTag() == tagVal) {
+ return _scripts[i];
}
}
return null;
diff --git a/src/net/java/dev/typecast/ot/table/ScriptRecord.java b/src/net/java/dev/typecast/ot/table/ScriptRecord.java
index 639b7fa..aea0bf0 100644
--- a/src/net/java/dev/typecast/ot/table/ScriptRecord.java
+++ b/src/net/java/dev/typecast/ot/table/ScriptRecord.java
@@ -1,46 +1,88 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInput;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: ScriptRecord.java,v 1.1.1.1 2004-12-05 23:14:58 davidsch Exp $
+ * @version $Id: ScriptRecord.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $
*/
public class ScriptRecord {
- private int tag;
- private int offset;
+ private int _tag;
+ private int _offset;
/** Creates new ScriptRecord */
- protected ScriptRecord(RandomAccessFile raf) throws IOException {
- tag = raf.readInt();
- offset = raf.readUnsignedShort();
+ protected ScriptRecord(DataInput di) throws IOException {
+ _tag = di.readInt();
+ _offset = di.readUnsignedShort();
}
public int getTag() {
- return tag;
+ return _tag;
}
public int getOffset() {
- return offset;
+ return _offset;
}
public String getTagAsString() {
return new StringBuffer()
- .append((char)((tag>>24)&0xff))
- .append((char)((tag>>16)&0xff))
- .append((char)((tag>>8)&0xff))
- .append((char)((tag)&0xff))
+ .append((char)((_tag>>24)&0xff))
+ .append((char)((_tag>>16)&0xff))
+ .append((char)((_tag>>8)&0xff))
+ .append((char)((_tag)&0xff))
.toString();
}
}
diff --git a/src/net/java/dev/typecast/ot/table/ScriptTags.java b/src/net/java/dev/typecast/ot/table/ScriptTags.java
index 04929e7..eeb4f8e 100644
--- a/src/net/java/dev/typecast/ot/table/ScriptTags.java
+++ b/src/net/java/dev/typecast/ot/table/ScriptTags.java
@@ -1,19 +1,61 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
/**
* Definition of Script tags
*
- * @version $Id: ScriptTags.java,v 1.1.1.1 2004-12-05 23:14:58 davidsch Exp $
+ * @version $Id: ScriptTags.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $
* @author <a href="mailto:[email protected]">Vincent Hardy</a>
*/
public interface ScriptTags {
- String SCRIPT_TAG_ARAB = "arab";
+ public static final String SCRIPT_TAG_ARAB = "arab";
}
diff --git a/src/net/java/dev/typecast/ot/table/SingleSubst.java b/src/net/java/dev/typecast/ot/table/SingleSubst.java
index b90b380..91c9858 100644
--- a/src/net/java/dev/typecast/ot/table/SingleSubst.java
+++ b/src/net/java/dev/typecast/ot/table/SingleSubst.java
@@ -1,20 +1,62 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: SingleSubst.java,v 1.1.1.1 2004-12-05 23:14:58 davidsch Exp $
+ * @version $Id: SingleSubst.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $
*/
public abstract class SingleSubst extends LookupSubtable {
@@ -22,14 +64,15 @@ public abstract class SingleSubst extends LookupSubtable {
public abstract int substitute(int glyphId);
- public static SingleSubst read(RandomAccessFile raf, int offset) throws IOException {
+ public static SingleSubst read(DataInputStream dis, int offset) throws IOException {
SingleSubst s = null;
- raf.seek(offset);
- int format = raf.readUnsignedShort();
+ dis.reset();
+ dis.skipBytes(offset);
+ int format = dis.readUnsignedShort();
if (format == 1) {
- s = new SingleSubstFormat1(raf, offset);
+ s = new SingleSubstFormat1(dis, offset);
} else if (format == 2) {
- s = new SingleSubstFormat2(raf, offset);
+ s = new SingleSubstFormat2(dis, offset);
}
return s;
}
diff --git a/src/net/java/dev/typecast/ot/table/SingleSubstFormat1.java b/src/net/java/dev/typecast/ot/table/SingleSubstFormat1.java
index e7c4ead..538c57f 100644
--- a/src/net/java/dev/typecast/ot/table/SingleSubstFormat1.java
+++ b/src/net/java/dev/typecast/ot/table/SingleSubstFormat1.java
@@ -1,33 +1,76 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: SingleSubstFormat1.java,v 1.1.1.1 2004-12-05 23:14:58 davidsch Exp $
+ * @version $Id: SingleSubstFormat1.java,v 1.2 2007-01-24 09:47:45 davidsch Exp $
*/
public class SingleSubstFormat1 extends SingleSubst {
- private int coverageOffset;
- private short deltaGlyphID;
- private Coverage coverage;
+ private int _coverageOffset;
+ private short _deltaGlyphID;
+ private Coverage _coverage;
/** Creates new SingleSubstFormat1 */
- protected SingleSubstFormat1(RandomAccessFile raf, int offset) throws IOException {
- coverageOffset = raf.readUnsignedShort();
- deltaGlyphID = raf.readShort();
- raf.seek(offset + coverageOffset);
- coverage = Coverage.read(raf);
+ protected SingleSubstFormat1(DataInputStream dis, int offset) throws IOException {
+ _coverageOffset = dis.readUnsignedShort();
+ _deltaGlyphID = dis.readShort();
+ dis.reset();
+ dis.skipBytes(offset + _coverageOffset);
+ _coverage = Coverage.read(dis);
}
public int getFormat() {
@@ -35,9 +78,9 @@ public class SingleSubstFormat1 extends SingleSubst {
}
public int substitute(int glyphId) {
- int i = coverage.findGlyph(glyphId);
+ int i = _coverage.findGlyph(glyphId);
if (i > -1) {
- return glyphId + deltaGlyphID;
+ return glyphId + _deltaGlyphID;
}
return glyphId;
}
diff --git a/src/net/java/dev/typecast/ot/table/SingleSubstFormat2.java b/src/net/java/dev/typecast/ot/table/SingleSubstFormat2.java
index a01f064..74c68f7 100644
--- a/src/net/java/dev/typecast/ot/table/SingleSubstFormat2.java
+++ b/src/net/java/dev/typecast/ot/table/SingleSubstFormat2.java
@@ -1,38 +1,81 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Batik" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package net.java.dev.typecast.ot.table;
+import java.io.DataInputStream;
import java.io.IOException;
-import java.io.RandomAccessFile;
/**
*
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- * @version $Id: SingleSubstFormat2.java,v 1.1.1.1 2004-12-05 23:14:59 davidsch Exp $
+ * @version $Id: SingleSubstFormat2.java,v 1.2 2007-01-24 09:47:48 davidsch Exp $
*/
public class SingleSubstFormat2 extends SingleSubst {
- private int coverageOffset;
- private int glyphCount;
- private int[] substitutes;
- private Coverage coverage;
+ private int _coverageOffset;
+ private int _glyphCount;
+ private int[] _substitutes;
+ private Coverage _coverage;
/** Creates new SingleSubstFormat2 */
- protected SingleSubstFormat2(RandomAccessFile raf, int offset) throws IOException {
- coverageOffset = raf.readUnsignedShort();
- glyphCount = raf.readUnsignedShort();
- substitutes = new int[glyphCount];
- for (int i = 0; i < glyphCount; i++) {
- substitutes[i] = raf.readUnsignedShort();
+ protected SingleSubstFormat2(DataInputStream dis, int offset) throws IOException {
+ _coverageOffset = dis.readUnsignedShort();
+ _glyphCount = dis.readUnsignedShort();
+ _substitutes = new int[_glyphCount];
+ for (int i = 0; i < _glyphCount; i++) {
+ _substitutes[i] = dis.readUnsignedShort();
}
- raf.seek(offset + coverageOffset);
- coverage = Coverage.read(raf);
+ dis.reset();
+ dis.skipBytes(offset + _coverageOffset);
+ _coverage = Coverage.read(dis);
}
public int getFormat() {
@@ -40,9 +83,9 @@ public class SingleSubstFormat2 extends SingleSubst {
}
public int substitute(int glyphId) {
- int i = coverage.findGlyph(glyphId);
+ int i = _coverage.findGlyph(glyphId);
if (i > -1) {
- return substitutes[i];
+ return _substitutes[i];
}
return glyphId;
}