aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2001-11-14 13:45:45 +0000
committerKeiron Liddle <keiron@apache.org>2001-11-14 13:45:45 +0000
commit777dbd0139d29b074adc4ddd05e64b66b0cd5d48 (patch)
tree944733f61e2f83042f87bc82ca78e2975f5e5240 /src
parent364a97a6e14a63a4df36b64d492a26ea59cfa173 (diff)
downloadxmlgraphics-fop-777dbd0139d29b074adc4ddd05e64b66b0cd5d48.tar.gz
xmlgraphics-fop-777dbd0139d29b074adc4ddd05e64b66b0cd5d48.zip
changed a few more vector and hastable
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194566 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/fo/FObj.java50
-rw-r--r--src/org/apache/fop/fo/FObjMixed.java2
-rw-r--r--src/org/apache/fop/fo/PropertyList.java6
-rw-r--r--src/org/apache/fop/fo/expr/PropertyParser.java6
-rw-r--r--src/org/apache/fop/fo/flow/BasicLink.java2
-rw-r--r--src/org/apache/fop/fo/flow/Block.java12
-rw-r--r--src/org/apache/fop/fo/flow/BlockContainer.java5
-rw-r--r--src/org/apache/fop/fo/flow/ExternalGraphic.java2
-rw-r--r--src/org/apache/fop/fo/flow/Flow.java16
-rw-r--r--src/org/apache/fop/fo/flow/Footnote.java17
-rw-r--r--src/org/apache/fop/fo/flow/FootnoteBody.java4
-rw-r--r--src/org/apache/fop/fo/flow/InstreamForeignObject.java2
-rw-r--r--src/org/apache/fop/fo/flow/ListBlock.java10
-rw-r--r--src/org/apache/fop/fo/flow/ListItem.java10
-rw-r--r--src/org/apache/fop/fo/flow/ListItemBody.java4
-rw-r--r--src/org/apache/fop/fo/flow/ListItemLabel.java2
-rw-r--r--src/org/apache/fop/fo/flow/Marker.java2
-rw-r--r--src/org/apache/fop/fo/flow/Table.java46
-rw-r--r--src/org/apache/fop/fo/flow/TableBody.java24
-rw-r--r--src/org/apache/fop/fo/flow/TableCell.java2
-rw-r--r--src/org/apache/fop/fo/flow/TableRow.java22
-rw-r--r--src/org/apache/fop/fo/pagination/LayoutMasterSet.java45
-rw-r--r--src/org/apache/fop/fo/pagination/PageSequence.java10
-rw-r--r--src/org/apache/fop/fo/pagination/Root.java9
-rw-r--r--src/org/apache/fop/fo/pagination/SimplePageMaster.java22
-rw-r--r--src/org/apache/fop/fonts/PFMFile.java12
-rw-r--r--src/org/apache/fop/fonts/TTFFile.java124
-rw-r--r--src/org/apache/fop/fonts/TTFMtxEntry.java6
-rw-r--r--src/org/apache/fop/fonts/apps/PFMReader.java32
-rw-r--r--src/org/apache/fop/fonts/apps/TTFReader.java46
30 files changed, 268 insertions, 284 deletions
diff --git a/src/org/apache/fop/fo/FObj.java b/src/org/apache/fop/fo/FObj.java
index 325a937c1..326f9674f 100644
--- a/src/org/apache/fop/fo/FObj.java
+++ b/src/org/apache/fop/fo/FObj.java
@@ -26,8 +26,8 @@ import org.xml.sax.Attributes;
import java.util.Iterator;
import java.util.ListIterator;
-import java.util.Vector;
-import java.util.Hashtable;
+import java.util.ArrayList;
+import java.util.HashMap;
/**
* base class for representation of formatting objects and their processing
@@ -54,7 +54,7 @@ public class FObj extends FONode {
*/
protected int marker = START;
- protected Vector children = new Vector(); // made public for searching for id's
+ protected ArrayList children = new ArrayList(); // made public for searching for id's
protected boolean isInTableCell = false;
@@ -70,11 +70,11 @@ public class FObj extends FONode {
public int areasGenerated = 0;
// markers
- protected Hashtable markers;
+ protected HashMap markers;
public FObj(FONode parent) {
super(parent);
- markers = new Hashtable();
+ markers = new HashMap();
if (parent instanceof FObj)
this.areaClass = ((FObj)parent).areaClass;
}
@@ -127,7 +127,7 @@ public class FObj extends FONode {
}
protected void addChild(FONode child) {
- children.addElement(child);
+ children.add(child);
}
/**
@@ -165,7 +165,7 @@ public class FObj extends FONode {
idReferences.removeID(((FObj)this).properties.get("id").getString());
int numChildren = this.children.size();
for (int i = 0; i < numChildren; i++) {
- FONode child = (FONode)children.elementAt(i);
+ FONode child = (FONode)children.get(i);
if ((child instanceof FObj)) {
((FObj)child).removeID(idReferences);
}
@@ -213,7 +213,7 @@ public class FObj extends FONode {
this.isInTableCell = true;
// made recursive by Eric Schaeffer
for (int i = 0; i < this.children.size(); i++) {
- Object obj = this.children.elementAt(i);
+ Object obj = this.children.get(i);
if(obj instanceof FObj) {
FObj child = (FObj)obj;
child.setIsInTableCell();
@@ -225,7 +225,7 @@ public class FObj extends FONode {
this.forcedStartOffset = offset;
// made recursive by Eric Schaeffer
for (int i = 0; i < this.children.size(); i++) {
- Object obj = this.children.elementAt(i);
+ Object obj = this.children.get(i);
if(obj instanceof FObj) {
FObj child = (FObj)obj;
child.forceStartOffset(offset);
@@ -237,7 +237,7 @@ public class FObj extends FONode {
this.forcedWidth = width;
// made recursive by Eric Schaeffer
for (int i = 0; i < this.children.size(); i++) {
- Object obj = this.children.elementAt(i);
+ Object obj = this.children.get(i);
if(obj instanceof FObj) {
FObj child = (FObj)obj;
child.forceWidth(width);
@@ -249,7 +249,7 @@ public class FObj extends FONode {
this.marker = START;
int numChildren = this.children.size();
for (int i = 0; i < numChildren; i++) {
- Object obj = this.children.elementAt(i);
+ Object obj = this.children.get(i);
if(obj instanceof FObj) {
FObj child = (FObj)obj;
child.resetMarker();
@@ -272,7 +272,7 @@ public class FObj extends FONode {
public void setLinkSet(LinkSet linkSet) {
this.linkSet = linkSet;
for (int i = 0; i < this.children.size(); i++) {
- Object obj = this.children.elementAt(i);
+ Object obj = this.children.get(i);
if(obj instanceof FObj) {
FObj child = (FObj)obj;
child.setLinkSet(linkSet);
@@ -288,11 +288,11 @@ public class FObj extends FONode {
* At the start of a new span area layout may be partway through a
* nested FO, and balancing requires rollback to this known point.
* The snapshot records exactly where layout is at.
- * @param snapshot a Vector of markers (Integer)
- * @returns the updated Vector of markers (Integers)
+ * @param snapshot a ArrayList of markers (Integer)
+ * @returns the updated ArrayList of markers (Integers)
*/
- public Vector getMarkerSnapshot(Vector snapshot) {
- snapshot.addElement(new Integer(this.marker));
+ public ArrayList getMarkerSnapshot(ArrayList snapshot) {
+ snapshot.add(new Integer(this.marker));
// terminate if no kids or child not yet accessed
if (this.marker < 0)
@@ -300,18 +300,18 @@ public class FObj extends FONode {
else if (children.isEmpty())
return snapshot;
else
- return ((FObj)children.elementAt(this.marker)).getMarkerSnapshot(snapshot);
+ return ((FObj)children.get(this.marker)).getMarkerSnapshot(snapshot);
}
/**
* When balancing occurs, the flow layout() method restarts at the
* point specified by the current marker snapshot, which is retrieved
* and restored using this method.
- * @param snapshot the Vector of saved markers (Integers)
+ * @param snapshot the ArrayList of saved markers (Integers)
*/
- public void rollback(Vector snapshot) {
- this.marker = ((Integer)snapshot.elementAt(0)).intValue();
- snapshot.removeElementAt(0);
+ public void rollback(ArrayList snapshot) {
+ this.marker = ((Integer)snapshot.get(0)).intValue();
+ snapshot.remove(0);
if (this.marker == START) {
// make sure all the children of this FO are also reset
@@ -327,13 +327,13 @@ public class FObj extends FONode {
}
for (int i = this.marker + 1; i < numChildren; i++) {
- Object obj = this.children.elementAt(i);
+ Object obj = this.children.get(i);
if(obj instanceof FObj) {
FObj child = (FObj)obj;
child.resetMarker();
}
}
- ((FObj)children.elementAt(this.marker)).rollback(snapshot);
+ ((FObj)children.get(this.marker)).rollback(snapshot);
}
@@ -353,8 +353,8 @@ public class FObj extends FONode {
return !markers.isEmpty();
}
- public Vector getMarkers() {
- return new Vector(markers.values());
+ public ArrayList getMarkers() {
+ return new ArrayList(markers.values());
}
}
diff --git a/src/org/apache/fop/fo/FObjMixed.java b/src/org/apache/fop/fo/FObjMixed.java
index 5a535be84..cb7b4b3ff 100644
--- a/src/org/apache/fop/fo/FObjMixed.java
+++ b/src/org/apache/fop/fo/FObjMixed.java
@@ -83,7 +83,7 @@ public class FObjMixed extends FObj {
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
- FONode fo = (FONode)children.elementAt(i);
+ FONode fo = (FONode)children.get(i);
Status status;
if ((status = fo.layout(area)).isIncomplete()) {
this.marker = i;
diff --git a/src/org/apache/fop/fo/PropertyList.java b/src/org/apache/fop/fo/PropertyList.java
index f6cd8747f..cb8d89d81 100644
--- a/src/org/apache/fop/fo/PropertyList.java
+++ b/src/org/apache/fop/fo/PropertyList.java
@@ -7,12 +7,12 @@
package org.apache.fop.fo;
-import java.util.Hashtable;
+import java.util.HashMap;
import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.fo.properties.WritingMode;
import org.apache.fop.apps.FOPException;
-public class PropertyList extends Hashtable {
+public class PropertyList extends HashMap {
private byte[] wmtable = null; // writing-mode values
public static final int LEFT = 0;
@@ -38,7 +38,7 @@ public class PropertyList extends Hashtable {
"inline-progression-dimension"
};
- static private final Hashtable wmtables = new Hashtable(4);
+ static private final HashMap wmtables = new HashMap(4);
{
wmtables.put(new Integer(WritingMode.LR_TB), /* lr-tb */
new byte[] {
diff --git a/src/org/apache/fop/fo/expr/PropertyParser.java b/src/org/apache/fop/fo/expr/PropertyParser.java
index f41cfc43a..aa113834a 100644
--- a/src/org/apache/fop/fo/expr/PropertyParser.java
+++ b/src/org/apache/fop/fo/expr/PropertyParser.java
@@ -15,7 +15,7 @@ import org.apache.fop.fo.StringProperty;
import org.apache.fop.fo.ColorTypeProperty;
import org.apache.fop.datatypes.*;
-import java.util.Hashtable;
+import java.util.HashMap;
/**
* Class to parse XSL FO property expression.
@@ -27,10 +27,10 @@ public class PropertyParser extends PropertyTokenizer {
static private final String RELUNIT = "em";
static private final Numeric negOne = new Numeric(new Double(-1.0));
- static final private Hashtable functionTable = new Hashtable();
+ static final private HashMap functionTable = new HashMap();
static {
- // Initialize the Hashtable of XSL-defined functions
+ // Initialize the HashMap of XSL-defined functions
functionTable.put("ceiling", new CeilingFunction());
functionTable.put("floor", new FloorFunction());
functionTable.put("round", new RoundFunction());
diff --git a/src/org/apache/fop/fo/flow/BasicLink.java b/src/org/apache/fop/fo/flow/BasicLink.java
index 0530385cd..5b8344341 100644
--- a/src/org/apache/fop/fo/flow/BasicLink.java
+++ b/src/org/apache/fop/fo/flow/BasicLink.java
@@ -92,7 +92,7 @@ public class BasicLink extends Inline {
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
- FONode fo = (FONode)children.elementAt(i);
+ FONode fo = (FONode)children.get(i);
if(fo instanceof FObj)
((FObj)fo).setLinkSet(ls);
diff --git a/src/org/apache/fop/fo/flow/Block.java b/src/org/apache/fop/fo/flow/Block.java
index 196cf6aa0..3b43e16cb 100644
--- a/src/org/apache/fop/fo/flow/Block.java
+++ b/src/org/apache/fop/fo/flow/Block.java
@@ -174,13 +174,13 @@ public class Block extends FObjMixed {
int numChildren = this.children.size();
for (int i = 0; i < numChildren; i++) {
- FONode fo = (FONode)children.elementAt(i);
+ FONode fo = (FONode)children.get(i);
if (fo instanceof FOText) {
if (((FOText)fo).willCreateArea()) {
//fo.setWidows(blockWidows);
break;
} else {
- children.removeElementAt(i);
+ children.remove(i);
numChildren = this.children.size();
i--;
}
@@ -191,7 +191,7 @@ public class Block extends FObjMixed {
}
for (int i = numChildren - 1; i >= 0; i--) {
- FONode fo = (FONode)children.elementAt(i);
+ FONode fo = (FONode)children.get(i);
if (fo instanceof FOText) {
if (((FOText)fo).willCreateArea()) {
//fo.setOrphans(blockOrphans);
@@ -230,8 +230,8 @@ public class Block extends FObjMixed {
blockArea.addLineagePair(this, this.areasGenerated);
// markers
- if (this.hasMarkers())
- blockArea.addMarkers(this.getMarkers());
+ //if (this.hasMarkers())
+ //blockArea.addMarkers(this.getMarkers());
blockArea.setParent(area); // BasicLink needs it
blockArea.setPage(area.getPage());
@@ -247,7 +247,7 @@ public class Block extends FObjMixed {
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
- FONode fo = (FONode)children.elementAt(i);
+ FONode fo = (FONode)children.get(i);
Status status;
if ((status = fo.layout(blockArea)).isIncomplete()) {
this.marker = i;
diff --git a/src/org/apache/fop/fo/flow/BlockContainer.java b/src/org/apache/fop/fo/flow/BlockContainer.java
index 401506209..e96a45f85 100644
--- a/src/org/apache/fop/fo/flow/BlockContainer.java
+++ b/src/org/apache/fop/fo/flow/BlockContainer.java
@@ -15,9 +15,6 @@ import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.*;
-// Java
-import java.util.Hashtable;
-import java.util.Enumeration;
import org.xml.sax.Attributes;
@@ -120,7 +117,7 @@ public class BlockContainer extends FObj {
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
- FObj fo = (FObj)children.elementAt(i);
+ FObj fo = (FObj)children.get(i);
Status status;
if ((status = fo.layout(areaContainer)).isIncomplete()) {
/*
diff --git a/src/org/apache/fop/fo/flow/ExternalGraphic.java b/src/org/apache/fop/fo/flow/ExternalGraphic.java
index 2f36956a1..dac5ca9f9 100644
--- a/src/org/apache/fop/fo/flow/ExternalGraphic.java
+++ b/src/org/apache/fop/fo/flow/ExternalGraphic.java
@@ -15,8 +15,6 @@ import org.apache.fop.apps.FOPException;
import org.apache.fop.image.*;
// Java
-import java.util.Enumeration;
-import java.util.Hashtable;
import java.net.URL;
import java.net.MalformedURLException;
diff --git a/src/org/apache/fop/fo/flow/Flow.java b/src/org/apache/fop/fo/flow/Flow.java
index 2fb72bfae..56ad56fab 100644
--- a/src/org/apache/fop/fo/flow/Flow.java
+++ b/src/org/apache/fop/fo/flow/Flow.java
@@ -18,9 +18,7 @@ import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.FlowLayoutManager;
// Java
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
+import java.util.ArrayList;
import org.xml.sax.Attributes;
@@ -37,9 +35,9 @@ public class Flow extends FObj {
private Area area;
/**
- * Vector to store snapshot
+ * ArrayList to store snapshot
*/
- private Vector markerSnapshot;
+ private ArrayList markerSnapshot;
/**
* flow-name attribute
@@ -118,14 +116,14 @@ public class Flow extends FObj {
BodyAreaContainer bac = (BodyAreaContainer)area;
boolean prevChildMustKeepWithNext = false;
- Vector pageMarker = this.getMarkerSnapshot(new Vector());
+ ArrayList pageMarker = this.getMarkerSnapshot(new ArrayList());
int numChildren = this.children.size();
if (numChildren == 0) {
throw new FOPException("fo:flow must contain block-level children");
}
for (int i = this.marker; i < numChildren; i++) {
- FObj fo = (FObj)children.elementAt(i);
+ FObj fo = (FObj)children.get(i);
if (bac.isBalancingRequired(fo)) {
// reset the the just-done span area in preparation
@@ -143,7 +141,7 @@ public class Flow extends FObj {
currentArea.setIDReferences(bac.getIDReferences());
if (bac.isNewSpanArea()) {
this.marker = i;
- markerSnapshot = this.getMarkerSnapshot(new Vector());
+ markerSnapshot = this.getMarkerSnapshot(new ArrayList());
}
// Set current content width for percent-based lengths in children
setContentWidth(currentArea.getContentWidth());
@@ -163,7 +161,7 @@ public class Flow extends FObj {
if (_status.isIncomplete()) {
if ((prevChildMustKeepWithNext) && (_status.laidOutNone())) {
this.marker = i - 1;
- FObj prevChild = (FObj)children.elementAt(this.marker);
+ FObj prevChild = (FObj)children.get(this.marker);
prevChild.removeAreas();
prevChild.resetMarker();
prevChild.removeID(area.getIDReferences());
diff --git a/src/org/apache/fop/fo/flow/Footnote.java b/src/org/apache/fop/fo/flow/Footnote.java
index 913b4060e..a9a450a40 100644
--- a/src/org/apache/fop/fo/flow/Footnote.java
+++ b/src/org/apache/fop/fo/flow/Footnote.java
@@ -15,8 +15,7 @@ import org.apache.fop.fo.properties.*;
import org.apache.fop.messaging.*;
// Java
-import java.util.Enumeration;
-import java.util.Vector;
+import java.util.ArrayList;
public class Footnote extends FObj {
@@ -33,7 +32,7 @@ public class Footnote extends FObj {
}
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
- FONode fo = (FONode)children.elementAt(i);
+ FONode fo = (FONode)children.get(i);
if (fo instanceof Inline) {
inline = fo;
Status status = fo.layout(area);
@@ -85,7 +84,7 @@ public class Footnote extends FObj {
// bac.setMaxHeight(bac.getMaxHeight() - footArea.getHeight() + oldHeight);
if (bac.getFootnoteState() == 0) {
Area ar = bac.getMainReferenceArea();
- decreaseMaxHeight(ar, footArea.getHeight() - oldHeight);
+ //decreaseMaxHeight(ar, footArea.getHeight() - oldHeight);
footArea.setYPosition(basePos + footArea.getHeight());
}
}
@@ -95,16 +94,16 @@ public class Footnote extends FObj {
return true;
}
- protected static void decreaseMaxHeight(Area ar, int change) {
+/* protected static void decreaseMaxHeight(Area ar, int change) {
ar.setMaxHeight(ar.getMaxHeight() - change);
- Vector childs = ar.getChildren();
- for (Enumeration en = childs.elements(); en.hasMoreElements(); ) {
- Object obj = en.nextElement();
+ ArrayList childs = ar.getChildren();
+ for (Iterator en = childs.iterator(); en.hasNext(); ) {
+ Object obj = en.next();
if (obj instanceof Area) {
Area childArea = (Area)obj;
decreaseMaxHeight(childArea, change);
}
}
}
-
+*/
}
diff --git a/src/org/apache/fop/fo/flow/FootnoteBody.java b/src/org/apache/fop/fo/flow/FootnoteBody.java
index 9f78a1326..ac9e4629e 100644
--- a/src/org/apache/fop/fo/flow/FootnoteBody.java
+++ b/src/org/apache/fop/fo/flow/FootnoteBody.java
@@ -16,7 +16,7 @@ import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
// Java
-import java.util.Enumeration;
+import java.util.Iterator;
public class FootnoteBody extends FObj {
@@ -54,7 +54,7 @@ public class FootnoteBody extends FObj {
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
- FONode fo = (FONode)children.elementAt(i);
+ FONode fo = (FONode)children.get(i);
Status status;
if ((status = fo.layout(blockArea)).isIncomplete()) {
this.resetMarker();
diff --git a/src/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/org/apache/fop/fo/flow/InstreamForeignObject.java
index 2f1da6625..8103c66e5 100644
--- a/src/org/apache/fop/fo/flow/InstreamForeignObject.java
+++ b/src/org/apache/fop/fo/flow/InstreamForeignObject.java
@@ -161,7 +161,7 @@ public class InstreamForeignObject extends FObj {
}
/* layout foreign object */
if (this.children.size() > 0) {
- FONode fo = (FONode)children.elementAt(0);
+ FONode fo = (FONode)children.get(0);
Status status;
if ((status =
fo.layout(this.areaCurrent)).isIncomplete()) {
diff --git a/src/org/apache/fop/fo/flow/ListBlock.java b/src/org/apache/fop/fo/flow/ListBlock.java
index 8c8d65d60..fc631a128 100644
--- a/src/org/apache/fop/fo/flow/ListBlock.java
+++ b/src/org/apache/fop/fo/flow/ListBlock.java
@@ -17,7 +17,7 @@ import org.apache.fop.layout.FontState;
import org.apache.fop.apps.FOPException;
// Java
-import java.util.Enumeration;
+import java.util.Iterator;
public class ListBlock extends FObj {
@@ -115,8 +115,8 @@ public class ListBlock extends FObj {
blockArea.addLineagePair(this, this.areasGenerated);
// markers
- if (this.hasMarkers())
- blockArea.addMarkers(this.getMarkers());
+ //if (this.hasMarkers())
+ //blockArea.addMarkers(this.getMarkers());
blockArea.setPage(area.getPage());
@@ -128,11 +128,11 @@ public class ListBlock extends FObj {
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
- if (!(children.elementAt(i) instanceof ListItem)) {
+ if (!(children.get(i) instanceof ListItem)) {
log.error("children of list-blocks must be list-items");
return new Status(Status.OK);
}
- ListItem listItem = (ListItem)children.elementAt(i);
+ ListItem listItem = (ListItem)children.get(i);
Status status;
if ((status = listItem.layout(blockArea)).isIncomplete()) {
if (status.getCode() == Status.AREA_FULL_NONE && i > 0) {
diff --git a/src/org/apache/fop/fo/flow/ListItem.java b/src/org/apache/fop/fo/flow/ListItem.java
index 68af21547..6a0ebbced 100644
--- a/src/org/apache/fop/fo/flow/ListItem.java
+++ b/src/org/apache/fop/fo/flow/ListItem.java
@@ -16,7 +16,7 @@ import org.apache.fop.layout.FontState;
import org.apache.fop.apps.FOPException;
// Java
-import java.util.Enumeration;
+import java.util.Iterator;
public class ListItem extends FObj {
@@ -100,8 +100,8 @@ public class ListItem extends FObj {
this.blockArea.addLineagePair(this, this.areasGenerated);
// markers
- if (this.hasMarkers())
- this.blockArea.addMarkers(this.getMarkers());
+ //if (this.hasMarkers())
+ //this.blockArea.addMarkers(this.getMarkers());
blockArea.setPage(area.getPage());
blockArea.start();
@@ -113,8 +113,8 @@ public class ListItem extends FObj {
if (numChildren != 2) {
throw new FOPException("list-item must have exactly two children");
}
- ListItemLabel label = (ListItemLabel)children.elementAt(0);
- ListItemBody body = (ListItemBody)children.elementAt(1);
+ ListItemLabel label = (ListItemLabel)children.get(0);
+ ListItemBody body = (ListItemBody)children.get(1);
Status status;
diff --git a/src/org/apache/fop/fo/flow/ListItemBody.java b/src/org/apache/fop/fo/flow/ListItemBody.java
index 7fc592019..3a3daa0c8 100644
--- a/src/org/apache/fop/fo/flow/ListItemBody.java
+++ b/src/org/apache/fop/fo/flow/ListItemBody.java
@@ -15,7 +15,7 @@ import org.apache.fop.layout.FontState;
import org.apache.fop.apps.FOPException;
// Java
-import java.util.Enumeration;
+import java.util.Iterator;
public class ListItemBody extends FObj {
@@ -48,7 +48,7 @@ public class ListItemBody extends FObj {
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
- FObj fo = (FObj)children.elementAt(i);
+ FObj fo = (FObj)children.get(i);
Status status;
if ((status = fo.layout(area)).isIncomplete()) {
diff --git a/src/org/apache/fop/fo/flow/ListItemLabel.java b/src/org/apache/fop/fo/flow/ListItemLabel.java
index 9f8bc76ee..0134117f5 100644
--- a/src/org/apache/fop/fo/flow/ListItemLabel.java
+++ b/src/org/apache/fop/fo/flow/ListItemLabel.java
@@ -41,7 +41,7 @@ public class ListItemLabel extends FObj {
String id = this.properties.get("id").getString();
area.getIDReferences().initializeID(id, area);
- Block block = (Block)children.elementAt(0);
+ Block block = (Block)children.get(0);
/*
* For calculating the lineage - The fo:list-item-label formatting object
diff --git a/src/org/apache/fop/fo/flow/Marker.java b/src/org/apache/fop/fo/flow/Marker.java
index 5d0a73a68..513033732 100644
--- a/src/org/apache/fop/fo/flow/Marker.java
+++ b/src/org/apache/fop/fo/flow/Marker.java
@@ -57,7 +57,7 @@ public class Marker extends FObjMixed {
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
- FONode fo = (FONode)children.elementAt(i);
+ FONode fo = (FONode)children.get(i);
Status status;
if ((status = fo.layout(area)).isIncomplete()) {
diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java
index 38e4a79af..9e7788d69 100644
--- a/src/org/apache/fop/fo/flow/Table.java
+++ b/src/org/apache/fop/fo/flow/Table.java
@@ -15,8 +15,8 @@ import org.apache.fop.datatypes.*;
import org.apache.fop.apps.FOPException;
// Java
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Iterator;
public class Table extends FObj {
@@ -34,7 +34,7 @@ public class Table extends FObj {
boolean omitHeaderAtBreak = false;
boolean omitFooterAtBreak = false;
- Vector columns = new Vector();
+ ArrayList columns = new ArrayList();
int bodyCount = 0;
private boolean bAutoLayout=false;
private int contentWidth = 0; // Sum of column widths
@@ -187,7 +187,7 @@ public class Table extends FObj {
layoutColumns(areaContainer);
for (int i = this.marker; i < numChildren; i++) {
- FONode fo = (FONode)children.elementAt(i);
+ FONode fo = (FONode)children.get(i);
if (fo instanceof TableHeader) {
if (columns.size() == 0) {
log.warn("current implementation of tables requires a table-column for each column, indicating column-width");
@@ -337,9 +337,9 @@ public class Table extends FObj {
}
protected void setupColumnHeights() {
- Enumeration eCol = columns.elements();
- while (eCol.hasMoreElements()) {
- TableColumn c = (TableColumn)eCol.nextElement();
+ Iterator eCol = columns.iterator();
+ while (eCol.hasNext()) {
+ TableColumn c = (TableColumn)eCol.next();
if ( c != null) {
c.setHeight(areaContainer.getContentHeight());
}
@@ -348,9 +348,9 @@ public class Table extends FObj {
private void findColumns(Area areaContainer) throws FOPException {
int nextColumnNumber = 1;
- Enumeration e = children.elements();
- while (e.hasMoreElements()) {
- FONode fo = (FONode)e.nextElement();
+ Iterator e = children.iterator();
+ while (e.hasNext()) {
+ FONode fo = (FONode)e.next();
if (fo instanceof TableColumn) {
TableColumn c = (TableColumn)fo;
c.doSetup(areaContainer);
@@ -362,14 +362,14 @@ public class Table extends FObj {
for (int j = 0; j < numColumnsRepeated; j++) {
if (currentColumnNumber > columns.size()) {
- columns.setSize(currentColumnNumber);
+ columns.ensureCapacity(currentColumnNumber);
}
- if (columns.elementAt(currentColumnNumber - 1) != null) {
+ if (columns.get(currentColumnNumber - 1) != null) {
log.warn("More than one column object assigned " +
"to column " +
currentColumnNumber);
}
- columns.setElementAt(c, currentColumnNumber - 1);
+ columns.set(currentColumnNumber - 1, c);
currentColumnNumber++;
}
nextColumnNumber = currentColumnNumber;
@@ -387,9 +387,9 @@ public class Table extends FObj {
double dWidthFactor = 0.0;
double dUnitLength = 0.0;
double tuMin = 100000.0 ; // Minimum number of proportional units
- Enumeration eCol = columns.elements();
- while (eCol.hasMoreElements()) {
- TableColumn c = (TableColumn)eCol.nextElement();
+ Iterator eCol = columns.iterator();
+ while (eCol.hasNext()) {
+ TableColumn c = (TableColumn)eCol.next();
if (c == null) {
log.warn("No table-column specification for column " +
nextColumnNumber);
@@ -461,9 +461,9 @@ public class Table extends FObj {
}
// Now distribute the extra units onto each column and set offsets
int offset = 0;
- eCol = columns.elements();
- while (eCol.hasMoreElements()) {
- TableColumn c = (TableColumn)eCol.nextElement();
+ eCol = columns.iterator();
+ while (eCol.hasNext()) {
+ TableColumn c = (TableColumn)eCol.next();
if (c != null) {
c.setColumnOffset(offset);
Length l = c.getColumnWidthAsLength();
@@ -487,9 +487,9 @@ public class Table extends FObj {
}
private void layoutColumns(Area tableArea) throws FOPException {
- Enumeration eCol = columns.elements();
- while (eCol.hasMoreElements()) {
- TableColumn c = (TableColumn)eCol.nextElement();
+ Iterator eCol = columns.iterator();
+ while (eCol.hasNext()) {
+ TableColumn c = (TableColumn)eCol.next();
if (c != null) {
c.layout(tableArea);
}
@@ -599,7 +599,7 @@ public class Table extends FObj {
// * ATTENTION: for now we assume columns are in order in the array!
// */
// BorderInfo getColumnBorder(BorderInfo.Side side, int iColNumber) {
- // TableColumn col = (TableColumn)columns.elementAt(iColNumber);
+ // TableColumn col = (TableColumn)columns.get(iColNumber);
// return col.getBorderInfo(side);
// }
}
diff --git a/src/org/apache/fop/fo/flow/TableBody.java b/src/org/apache/fop/fo/flow/TableBody.java
index 930f2a76a..d487e1a81 100644
--- a/src/org/apache/fop/fo/flow/TableBody.java
+++ b/src/org/apache/fop/fo/flow/TableBody.java
@@ -15,8 +15,8 @@ import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
// Java
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Iterator;
public class TableBody extends FObj {
@@ -25,7 +25,7 @@ public class TableBody extends FObj {
ColorType backgroundColor;
String id;
- Vector columns;
+ ArrayList columns;
RowSpanMgr rowSpanMgr; // manage information about spanning rows
AreaContainer areaContainer;
@@ -35,7 +35,7 @@ public class TableBody extends FObj {
this.name = "fo:table-body";
}
- public void setColumns(Vector columns) {
+ public void setColumns(ArrayList columns) {
this.columns = columns;
}
@@ -131,12 +131,12 @@ public class TableBody extends FObj {
areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
areaContainer.setIDReferences(area.getIDReferences());
- Vector keepWith = new Vector();
+ ArrayList keepWith = new ArrayList();
int numChildren = this.children.size();
TableRow lastRow = null;
boolean endKeepGroup = true;
for (int i = this.marker; i < numChildren; i++) {
- Object child = children.elementAt(i);
+ Object child = children.get(i);
if (!(child instanceof TableRow)) {
throw new FOPException("Currently only Table Rows are supported in table body, header and footer");
}
@@ -149,10 +149,10 @@ public class TableBody extends FObj {
!= KeepValue.KEEP_WITH_AUTO && lastRow != null
&& keepWith.indexOf(lastRow)
== -1) {
- keepWith.addElement(lastRow);
+ keepWith.add(lastRow);
} else {
if (endKeepGroup && keepWith.size() > 0) {
- keepWith = new Vector();
+ keepWith = new ArrayList();
}
}
@@ -178,9 +178,9 @@ public class TableBody extends FObj {
> 0) { // && status.getCode() == Status.AREA_FULL_NONE
// FIXME!!! Handle rows spans!!!
row.removeLayout(areaContainer);
- for (Enumeration e = keepWith.elements();
- e.hasMoreElements(); ) {
- TableRow tr = (TableRow)e.nextElement();
+ for (Iterator e = keepWith.iterator();
+ e.hasNext(); ) {
+ TableRow tr = (TableRow)e.next();
tr.removeLayout(areaContainer);
i--;
}
@@ -203,7 +203,7 @@ public class TableBody extends FObj {
return status;
} else if (status.getCode() == Status.KEEP_WITH_NEXT
|| rowSpanMgr.hasUnfinishedSpans()) {
- keepWith.addElement(row);
+ keepWith.add(row);
endKeepGroup = false;
} else {
endKeepGroup = true;
diff --git a/src/org/apache/fop/fo/flow/TableCell.java b/src/org/apache/fop/fo/flow/TableCell.java
index 98913d3e8..9f99de0f0 100644
--- a/src/org/apache/fop/fo/flow/TableCell.java
+++ b/src/org/apache/fop/fo/flow/TableCell.java
@@ -251,7 +251,7 @@ public class TableCell extends FObj {
int numChildren = this.children.size();
for (int i = this.marker; bDone==false && i < numChildren; i++) {
- FObj fo = (FObj)children.elementAt(i);
+ FObj fo = (FObj)children.get(i);
fo.setIsInTableCell();
fo.forceWidth(width); // ???
diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java
index f4b5b75e6..658d466ae 100644
--- a/src/org/apache/fop/fo/flow/TableRow.java
+++ b/src/org/apache/fop/fo/flow/TableRow.java
@@ -15,8 +15,8 @@ import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
// Java
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Iterator;
public class TableRow extends FObj {
@@ -33,7 +33,7 @@ public class TableRow extends FObj {
int widthOfCellsSoFar = 0;
int largestCellHeight = 0;
int minHeight = 0; // force row height
- Vector columns;
+ ArrayList columns;
AreaContainer areaContainer;
@@ -164,7 +164,7 @@ public class TableRow extends FObj {
super(parent);
}
- public void setColumns(Vector columns) {
+ public void setColumns(ArrayList columns) {
this.columns = columns;
}
@@ -292,7 +292,7 @@ public class TableRow extends FObj {
*/
int offset = 0; // Offset of each cell from table start edge
int iColIndex = 0; // 1-based column index
- Enumeration eCols = columns.elements();
+ Iterator eCols = columns.iterator();
/*
* Ideas: set offset on each column when they are initialized
* no need to calculate for each row.
@@ -300,10 +300,10 @@ public class TableRow extends FObj {
* info if borders are "collapsed".
*/
- while (eCols.hasMoreElements()) {
+ while (eCols.hasNext()) {
TableCell cell;
++iColIndex;
- TableColumn tcol = (TableColumn)eCols.nextElement();
+ TableColumn tcol = (TableColumn)eCols.next();
int colWidth = tcol.getColumnWidth();
if (cellArray.getCellType(iColIndex) == CellArray.CELLSTART) {
cell = cellArray.getCell(iColIndex);
@@ -471,13 +471,13 @@ public class TableRow extends FObj {
private void initCellArray() {
cellArray = new CellArray(rowSpanMgr, columns.size());
int colNum = 1;
- Enumeration eCells = children.elements();
- while (eCells.hasMoreElements()) {
+ Iterator eCells = children.iterator();
+ while (eCells.hasNext()) {
colNum = cellArray.getNextFreeCell(colNum);
// If off the end, the rest of the cells had better be
// explicitly positioned!!! (returns -1)
- TableCell cell = (TableCell)eCells.nextElement();
+ TableCell cell = (TableCell)eCells.next();
int numCols = cell.getNumColumnsSpanned();
int numRows = cell.getNumRowsSpanned();
int cellColNum = cell.getColumnNumber();
@@ -522,7 +522,7 @@ public class TableRow extends FObj {
private int getCellWidth(int startCol, int numCols) {
int width = 0;
for (int count = 0; count < numCols; count++) {
- width += ((TableColumn)columns.elementAt(startCol + count
+ width += ((TableColumn)columns.get(startCol + count
- 1)).getColumnWidth();
}
return width;
diff --git a/src/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/org/apache/fop/fo/pagination/LayoutMasterSet.java
index 82dfd1801..d56e74cb9 100644
--- a/src/org/apache/fop/fo/pagination/LayoutMasterSet.java
+++ b/src/org/apache/fop/fo/pagination/LayoutMasterSet.java
@@ -14,15 +14,16 @@ import org.apache.fop.apps.FOPException;
import org.apache.fop.layout.PageMaster;
// Java
-import java.util.*;
+import java.util.HashMap;
+import java.util.Iterator;
import org.xml.sax.Attributes;
public class LayoutMasterSet extends FObj {
- private Hashtable simplePageMasters;
- private Hashtable pageSequenceMasters;
- private Hashtable allRegions;
+ private HashMap simplePageMasters;
+ private HashMap pageSequenceMasters;
+ private HashMap allRegions;
private Root root;
@@ -32,8 +33,8 @@ public class LayoutMasterSet extends FObj {
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
- this.simplePageMasters = new Hashtable();
- this.pageSequenceMasters = new Hashtable();
+ this.simplePageMasters = new HashMap();
+ this.pageSequenceMasters = new HashMap();
if (parent.getName().equals("fo:root")) {
this.root = (Root)parent;
@@ -42,7 +43,7 @@ public class LayoutMasterSet extends FObj {
throw new FOPException("fo:layout-master-set must be child of fo:root, not "
+ parent.getName());
}
- allRegions = new Hashtable();
+ allRegions = new HashMap();
}
@@ -85,24 +86,23 @@ public class LayoutMasterSet extends FObj {
}
protected void resetPageMasters() {
- for (Enumeration e = pageSequenceMasters.elements();
- e.hasMoreElements(); ) {
- ((PageSequenceMaster)e.nextElement()).reset();
+ for (Iterator e = pageSequenceMasters.values().iterator();
+ e.hasNext(); ) {
+ ((PageSequenceMaster)e.next()).reset();
}
-
}
protected void checkRegionNames() throws FOPException {
// Section 7.33.15 check to see that if a region-name is a
// duplicate, that it maps to the same region-class.
- for (Enumeration spm = simplePageMasters.elements();
- spm.hasMoreElements(); ) {
+ for (Iterator spm = simplePageMasters.values().iterator();
+ spm.hasNext(); ) {
SimplePageMaster simplePageMaster =
- (SimplePageMaster)spm.nextElement();
- Hashtable spmRegions = simplePageMaster.getRegions();
- for (Enumeration e = spmRegions.elements();
- e.hasMoreElements(); ) {
- Region region = (Region)e.nextElement();
+ (SimplePageMaster)spm.next();
+ HashMap spmRegions = simplePageMaster.getRegions();
+ for (Iterator e = spmRegions.values().iterator();
+ e.hasNext(); ) {
+ Region region = (Region)e.next();
if (allRegions.containsKey(region.getRegionName())) {
String localClass =
(String)allRegions.get(region.getRegionName());
@@ -128,16 +128,15 @@ public class LayoutMasterSet extends FObj {
*/
protected boolean regionNameExists(String regionName) {
boolean result = false;
- for (Enumeration e = simplePageMasters.elements();
- e.hasMoreElements(); ) {
+ for (Iterator e = simplePageMasters.values().iterator();
+ e.hasNext(); ) {
result =
- ((SimplePageMaster)e.nextElement()).regionNameExists(regionName);
+ ((SimplePageMaster)e.next()).regionNameExists(regionName);
if (result) {
return result;
}
}
return result;
}
-
-
}
+
diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java
index 1e05cef5c..32aa24897 100644
--- a/src/org/apache/fop/fo/pagination/PageSequence.java
+++ b/src/org/apache/fop/fo/pagination/PageSequence.java
@@ -64,13 +64,13 @@ public class PageSequence extends FObj {
// There doesn't seem to be anything in the spec requiring flows
// to be in the order given, only that they map to the regions
- // defined in the page sequence, so all we need is this one hashtable
+ // defined in the page sequence, so all we need is this one hashmap
// the set of flows includes StaticContent flows also
/**
* Map of flows to their flow name (flow-name, Flow)
*/
- private Hashtable _flowMap;
+ private HashMap _flowMap;
/**
* the "master-reference" attribute
@@ -158,7 +158,7 @@ public class PageSequence extends FObj {
// best time to run some checks on LayoutMasterSet
layoutMasterSet.checkRegionNames();
- _flowMap = new Hashtable();
+ _flowMap = new HashMap();
thisIsFirstPage =
true; // we are now on the first page of the page sequence
@@ -652,8 +652,8 @@ public class PageSequence extends FObj {
// private boolean flowsAreIncomplete() {
// boolean isIncomplete = false;
-// for (Enumeration e = _flowMap.elements(); e.hasMoreElements(); ) {
-// Flow flow = (Flow)e.nextElement();
+// for (Iterator e = _flowMap.values().iterator(); e.hasNext(); ) {
+// Flow flow = (Flow)e.next();
// if (flow instanceof StaticContent) {
// continue;
// }
diff --git a/src/org/apache/fop/fo/pagination/Root.java b/src/org/apache/fop/fo/pagination/Root.java
index 197bb54bc..7e501a7e0 100644
--- a/src/org/apache/fop/fo/pagination/Root.java
+++ b/src/org/apache/fop/fo/pagination/Root.java
@@ -16,8 +16,7 @@ import org.apache.fop.apps.FOPException;
import org.apache.fop.extensions.ExtensionObj;
// Java
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.ArrayList;
/**
* The fo:root formatting object. Contains page masters, root extensions,
@@ -26,7 +25,7 @@ import java.util.Enumeration;
public class Root extends FObj {
LayoutMasterSet layoutMasterSet;
- Vector pageSequences;
+ ArrayList pageSequences;
/**
* keeps count of page number from over PageSequence instances
@@ -38,7 +37,7 @@ public class Root extends FObj {
// this.properties.get("media-usage");
- pageSequences = new Vector();
+ pageSequences = new ArrayList();
if (parent != null) {
//throw new FOPException("root must be root element");
@@ -67,7 +66,7 @@ public class Root extends FObj {
if (currentIndex == -1)
return null;
if (currentIndex < (pageSequences.size() - 1)) {
- return (PageSequence)pageSequences.elementAt(currentIndex + 1);
+ return (PageSequence)pageSequences.get(currentIndex + 1);
} else {
return null;
}
diff --git a/src/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/org/apache/fop/fo/pagination/SimplePageMaster.java
index 3c3931cf9..e759e31cd 100644
--- a/src/org/apache/fop/fo/pagination/SimplePageMaster.java
+++ b/src/org/apache/fop/fo/pagination/SimplePageMaster.java
@@ -19,8 +19,8 @@ import org.apache.fop.layout.PageMaster;
import org.apache.fop.apps.FOPException;
import java.awt.Rectangle;
-import java.util.Hashtable;
-import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
import org.xml.sax.Attributes;
@@ -29,7 +29,7 @@ public class SimplePageMaster extends FObj {
/**
* Page regions (regionClass, Region)
*/
- private Hashtable _regions;
+ private HashMap _regions;
LayoutMasterSet layoutMasterSet;
PageMaster pageMaster;
@@ -56,7 +56,7 @@ public class SimplePageMaster extends FObj {
+ "of fo:layout-master-set, not "
+ parent.getName());
}
- _regions = new Hashtable();
+ _regions = new HashMap();
}
@@ -88,9 +88,9 @@ public class SimplePageMaster extends FObj {
boolean bHasBody=false;
- for (Enumeration regenum = _regions.elements();
- regenum.hasMoreElements(); ) {
- Region r = (Region)regenum.nextElement();
+ for (Iterator regenum = _regions.values().iterator();
+ regenum.hasNext(); ) {
+ Region r = (Region)regenum.next();
RegionViewport rvp = r.makeRegionViewport(pageRefRect);
rvp.setRegion(r.makeRegionReferenceArea());
page.setRegion(r.getRegionAreaClass(), rvp);
@@ -149,14 +149,14 @@ public class SimplePageMaster extends FObj {
return (Region)_regions.get(regionClass);
}
- protected Hashtable getRegions() {
+ protected HashMap getRegions() {
return _regions;
}
protected boolean regionNameExists(String regionName) {
- for (Enumeration regenum = _regions.elements();
- regenum.hasMoreElements(); ) {
- Region r = (Region)regenum.nextElement();
+ for (Iterator regenum = _regions.values().iterator();
+ regenum.hasNext(); ) {
+ Region r = (Region)regenum.next();
if (r.getRegionName().equals(regionName)) {
return true;
}
diff --git a/src/org/apache/fop/fonts/PFMFile.java b/src/org/apache/fop/fonts/PFMFile.java
index cf1c7e8d7..9dce84478 100644
--- a/src/org/apache/fop/fonts/PFMFile.java
+++ b/src/org/apache/fop/fonts/PFMFile.java
@@ -8,7 +8,7 @@
package org.apache.fop.fonts;
import java.io.*;
-import java.util.Hashtable;
+import java.util.HashMap;
/**
* This class represents a PFM file (or parts of it) as a Java object.
@@ -42,9 +42,9 @@ public class PFMFile {
// Extent table
private int[] extentTable;
- private Hashtable kerningTab;
+ private HashMap kerningTab;
public PFMFile() {
- kerningTab = new Hashtable();
+ kerningTab = new HashMap();
}
/**
@@ -160,9 +160,9 @@ public class PFMFile {
String glyph1 = Glyphs.tex8r[g1];
String glyph2 = Glyphs.tex8r[g2];
- Hashtable adjTab = (Hashtable)kerningTab.get(new Integer(g1));
+ HashMap adjTab = (HashMap)kerningTab.get(new Integer(g1));
if (adjTab == null)
- adjTab = new Hashtable();
+ adjTab = new HashMap();
adjTab.put(new Integer(g2), new Integer(adj));
kerningTab.put(new Integer(g1), adjTab);
}
@@ -212,7 +212,7 @@ public class PFMFile {
* strings with glyphnames as keys, containing hashtables as value.
* The value hashtable contain a glyph name string key and an Integer value
*/
- public Hashtable getKerning() {
+ public HashMap getKerning() {
return kerningTab;
}
diff --git a/src/org/apache/fop/fonts/TTFFile.java b/src/org/apache/fop/fonts/TTFFile.java
index d48a1948e..7404c7c23 100644
--- a/src/org/apache/fop/fonts/TTFFile.java
+++ b/src/org/apache/fop/fonts/TTFFile.java
@@ -7,9 +7,9 @@
package org.apache.fop.fonts;
import java.io.*;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.ArrayList;
/**
* Reads a TrueType file or a TrueType Collection.
@@ -26,11 +26,11 @@ public class TTFFile {
short firstChar = 0;
boolean is_embeddable = true;
boolean hasSerifs = true;
- Hashtable dirTabs; // Table directory
- Hashtable kerningTab; // for CIDs
- Hashtable ansiKerningTab; // For winAnsiEncoding
- Vector cmaps;
- Vector unicodeMapping; //
+ HashMap dirTabs; // Table directory
+ HashMap kerningTab; // for CIDs
+ HashMap ansiKerningTab; // For winAnsiEncoding
+ ArrayList cmaps;
+ ArrayList unicodeMapping; //
int upem; // unitsPerEm from "head" table
int nhmtx; // Number of horizontal metrics
@@ -65,7 +65,7 @@ public class TTFFile {
short lastChar = 0;
int ansiWidth[];
- Hashtable ansiIndex;
+ HashMap ansiIndex;
/**
* Position inputstream to position indicated
@@ -111,7 +111,7 @@ public class TTFFile {
*/
private boolean readCMAP(FontFileReader in) throws IOException {
- unicodeMapping = new Vector();
+ unicodeMapping = new ArrayList();
/**
* Read CMAP table and correct mtx_tab.index
@@ -193,7 +193,7 @@ public class TTFFile {
int glyphIdArrayOffset = in.getCurrentPos();
// Insert the unicode id for the glyphs in mtx_tab
- // and fill in the cmaps Vector
+ // and fill in the cmaps ArrayList
for (int i = 0; i < cmap_startCounts.length; i++) {
/*
@@ -218,9 +218,9 @@ public class TTFFile {
glyphIdx = (in.readTTFUShort() + cmap_deltas[i])
& 0xffff;
- unicodeMapping.addElement(new UnicodeMapping(glyphIdx,
+ unicodeMapping.add(new UnicodeMapping(glyphIdx,
j));
- mtx_tab[glyphIdx].unicodeIndex.addElement(new Integer(j));
+ mtx_tab[glyphIdx].unicodeIndex.add(new Integer(j));
// Also add winAnsiWidth
@@ -231,13 +231,13 @@ public class TTFFile {
if (d < ansiWidth.length)
ansiWidth[d] = mtx_tab[glyphIdx].wx;
} else {
- Vector v =
- (Vector)ansiIndex.get(new Integer(j));
+ ArrayList v =
+ (ArrayList)ansiIndex.get(new Integer(j));
if (v != null) {
- for (Enumeration e = v.elements();
- e.hasMoreElements(); ) {
+ for (Iterator e = v.listIterator();
+ e.hasNext(); ) {
Integer aIdx =
- (Integer)e.nextElement();
+ (Integer)e.next();
ansiWidth[aIdx.intValue()] =
mtx_tab[glyphIdx].wx;
/*
@@ -263,16 +263,16 @@ public class TTFFile {
glyphIdx = (j + cmap_deltas[i]) & 0xffff;
if (glyphIdx < mtx_tab.length)
- mtx_tab[glyphIdx].unicodeIndex.addElement(new Integer(j));
+ mtx_tab[glyphIdx].unicodeIndex.add(new Integer(j));
else
System.out.println("Glyph " + glyphIdx
+ " out of range: "
+ mtx_tab.length);
- unicodeMapping.addElement(new UnicodeMapping(glyphIdx,
+ unicodeMapping.add(new UnicodeMapping(glyphIdx,
j));
if (glyphIdx < mtx_tab.length)
- mtx_tab[glyphIdx].unicodeIndex.addElement(new Integer(j));
+ mtx_tab[glyphIdx].unicodeIndex.add(new Integer(j));
else
System.out.println("Glyph " + glyphIdx
+ " out of range: "
@@ -289,13 +289,13 @@ public class TTFFile {
if (d < ansiWidth.length)
ansiWidth[d] = mtx_tab[glyphIdx].wx;
} else {
- Vector v =
- (Vector)ansiIndex.get(new Integer(j));
+ ArrayList v =
+ (ArrayList)ansiIndex.get(new Integer(j));
if (v != null) {
- for (Enumeration e = v.elements();
- e.hasMoreElements(); ) {
+ for (Iterator e = v.listIterator();
+ e.hasNext(); ) {
Integer aIdx =
- (Integer)e.nextElement();
+ (Integer)e.next();
ansiWidth[aIdx.intValue()] =
mtx_tab[glyphIdx].wx;
}
@@ -357,17 +357,17 @@ public class TTFFile {
// Create an index hash to the ansiWidth
// Can't just index the winAnsiEncoding when inserting widths
// same char (eg bullet) is repeated more than one place
- ansiIndex = new Hashtable();
+ ansiIndex = new HashMap();
for (int i = 32; i < Glyphs.winAnsiEncoding.length; i++) {
Integer ansi = new Integer(i);
Integer uni = new Integer((int)Glyphs.winAnsiEncoding[i]);
- Vector v = (Vector)ansiIndex.get(uni);
+ ArrayList v = (ArrayList)ansiIndex.get(uni);
if (v == null) {
- v = new Vector();
+ v = new ArrayList();
ansiIndex.put(uni, v);
}
- v.addElement(ansi);
+ v.add(ansi);
}
}
@@ -408,22 +408,22 @@ public class TTFFile {
}
private void createCMaps() {
- cmaps = new Vector();
+ cmaps = new ArrayList();
TTFCmapEntry tce = new TTFCmapEntry();
- Enumeration e = unicodeMapping.elements();
- UnicodeMapping um = (UnicodeMapping)e.nextElement();
+ Iterator e = unicodeMapping.listIterator();
+ UnicodeMapping um = (UnicodeMapping)e.next();
UnicodeMapping lastMapping = um;
tce.unicodeStart = um.uIdx;
tce.glyphStartIndex = um.gIdx;
- while (e.hasMoreElements()) {
- um = (UnicodeMapping)e.nextElement();
+ while (e.hasNext()) {
+ um = (UnicodeMapping)e.next();
if (((lastMapping.uIdx + 1) != um.uIdx)
|| ((lastMapping.gIdx + 1) != um.gIdx)) {
tce.unicodeEnd = lastMapping.uIdx;
- cmaps.addElement(tce);
+ cmaps.add(tce);
tce = new TTFCmapEntry();
tce.unicodeStart = um.uIdx;
@@ -433,7 +433,7 @@ public class TTFFile {
}
tce.unicodeEnd = um.uIdx;
- cmaps.addElement(tce);
+ cmaps.add(tce);
}
public void printStuff() {
@@ -573,11 +573,11 @@ public class TTFFile {
return (int)get_ttf_funit(ansiWidth[idx]);
}
- public Hashtable getKerning() {
+ public HashMap getKerning() {
return kerningTab;
}
- public Hashtable getAnsiKerning() {
+ public HashMap getAnsiKerning() {
return ansiKerningTab;
}
@@ -588,7 +588,7 @@ public class TTFFile {
/**
* Read Table Directory from the current position in the
- * FontFileReader and fill the global Hashtable dirTabs
+ * FontFileReader and fill the global HashMap dirTabs
* with the table name (String) as key and a TTFDirTabEntry
* as value.
*/
@@ -597,7 +597,7 @@ public class TTFFile {
int ntabs = in.readTTFUShort();
in.skip(6); // 3xTTF_USHORT_SIZE
- dirTabs = new Hashtable();
+ dirTabs = new HashMap();
TTFDirTabEntry[] pd = new TTFDirTabEntry[ntabs];
// System.out.println("Reading " + ntabs + " dir tables");
for (int i = 0; i < ntabs; i++) {
@@ -928,8 +928,8 @@ public class TTFFile {
*/
private final void readKerning(FontFileReader in) throws IOException {
// Read kerning
- kerningTab = new Hashtable();
- ansiKerningTab = new Hashtable();
+ kerningTab = new HashMap();
+ ansiKerningTab = new HashMap();
TTFDirTabEntry dirTab = (TTFDirTabEntry)dirTabs.get("kern");
if (dirTab != null) {
seek_tab(in, "kern", 2);
@@ -950,9 +950,9 @@ public class TTFFile {
if (kpx != 0) {
// CID table
Integer iObj = new Integer(i);
- Hashtable adjTab = (Hashtable)kerningTab.get(iObj);
+ HashMap adjTab = (HashMap)kerningTab.get(iObj);
if (adjTab == null)
- adjTab = new java.util.Hashtable();
+ adjTab = new HashMap();
adjTab.put(new Integer(j),
new Integer((int)get_ttf_funit(kpx)));
kerningTab.put(iObj, adjTab);
@@ -963,18 +963,18 @@ public class TTFFile {
// Create winAnsiEncoded kerning table
- for (Enumeration ae = kerningTab.keys(); ae.hasMoreElements(); ) {
- Integer cidKey = (Integer)ae.nextElement();
- Hashtable akpx = new Hashtable();
- Hashtable ckpx = (Hashtable)kerningTab.get(cidKey);
+ for (Iterator ae = kerningTab.keySet().iterator(); ae.hasNext(); ) {
+ Integer cidKey = (Integer)ae.next();
+ HashMap akpx = new HashMap();
+ HashMap ckpx = (HashMap)kerningTab.get(cidKey);
- for (Enumeration aee = ckpx.keys(); aee.hasMoreElements(); ) {
- Integer cidKey2 = (Integer)aee.nextElement();
+ for (Iterator aee = ckpx.keySet().iterator(); aee.hasNext(); ) {
+ Integer cidKey2 = (Integer)aee.next();
Integer kern = (Integer)ckpx.get(cidKey2);
- for (Enumeration uniMap = mtx_tab[cidKey2.intValue()].unicodeIndex.elements();
- uniMap.hasMoreElements(); ) {
- Integer unicodeKey = (Integer)uniMap.nextElement();
+ for (Iterator uniMap = mtx_tab[cidKey2.intValue()].unicodeIndex.listIterator();
+ uniMap.hasNext(); ) {
+ Integer unicodeKey = (Integer)uniMap.next();
Integer[] ansiKeys =
unicodeToWinAnsi(unicodeKey.intValue());
for (int u = 0; u < ansiKeys.length; u++) {
@@ -984,9 +984,9 @@ public class TTFFile {
}
if (akpx.size() > 0)
- for (Enumeration uniMap = mtx_tab[cidKey.intValue()].unicodeIndex.elements();
- uniMap.hasMoreElements(); ) {
- Integer unicodeKey = (Integer)uniMap.nextElement();
+ for (Iterator uniMap = mtx_tab[cidKey.intValue()].unicodeIndex.listIterator();
+ uniMap.hasNext(); ) {
+ Integer unicodeKey = (Integer)uniMap.next();
Integer[] ansiKeys =
unicodeToWinAnsi(unicodeKey.intValue());
for (int u = 0; u < ansiKeys.length; u++) {
@@ -1000,7 +1000,7 @@ public class TTFFile {
/**
* Return a vector with TTFCmapEntry
*/
- public Vector getCMaps() {
+ public ArrayList getCMaps() {
return cmaps;
}
@@ -1077,13 +1077,11 @@ public class TTFFile {
* doesn't matter...
*/
private Integer[] unicodeToWinAnsi(int unicode) {
- Vector ret = new Vector();
+ ArrayList ret = new ArrayList();
for (int i = 32; i < Glyphs.winAnsiEncoding.length; i++)
if (unicode == Glyphs.winAnsiEncoding[i])
- ret.addElement(new Integer(i));
- Integer[] itg = new Integer[ret.size()];
- ret.copyInto(itg);
- return itg;
+ ret.add(new Integer(i));
+ return (Integer[])ret.toArray(new Integer[0]);
}
}
diff --git a/src/org/apache/fop/fonts/TTFMtxEntry.java b/src/org/apache/fop/fonts/TTFMtxEntry.java
index 286593c04..67451d447 100644
--- a/src/org/apache/fop/fonts/TTFMtxEntry.java
+++ b/src/org/apache/fop/fonts/TTFMtxEntry.java
@@ -8,14 +8,14 @@
package org.apache.fop.fonts;
import java.io.*;
-import java.util.Vector;
+import java.util.ArrayList;
class TTFMtxEntry {
int wx;
int lsb;
String name;
int index;
- Vector unicodeIndex;
+ ArrayList unicodeIndex;
int[] bbox;
long offset;
byte found;
@@ -23,7 +23,7 @@ class TTFMtxEntry {
TTFMtxEntry() {
name = "";
found = 0;
- unicodeIndex = new Vector();
+ unicodeIndex = new ArrayList();
bbox = new int[4];
}
diff --git a/src/org/apache/fop/fonts/apps/PFMReader.java b/src/org/apache/fop/fonts/apps/PFMReader.java
index 4dba53e94..5bf0f3e79 100644
--- a/src/org/apache/fop/fonts/apps/PFMReader.java
+++ b/src/org/apache/fop/fonts/apps/PFMReader.java
@@ -13,9 +13,9 @@ import org.apache.xerces.dom.*;
import org.apache.xml.serialize.*;
import org.apache.xalan.xslt.*;
import org.apache.fop.fonts.*;
-import java.util.Hashtable;
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Iterator;
/**
* A tool which reads PFM files from Adobe Type 1 fonts and creates
@@ -30,14 +30,14 @@ public class PFMReader {
/**
- * Parse commandline arguments. put options in the Hashtable and return
+ * Parse commandline arguments. put options in the HashMap and return
* arguments in the String array
* the arguments: -fn Perpetua,Bold -cn PerpetuaBold per.ttf Perpetua.xml
* returns a String[] with the per.ttf and Perpetua.xml. The hash
* will have the (key, value) pairs: (-fn, Perpetua) and (-cn, PerpetuaBold)
*/
- private static String[] parseArguments(Hashtable options, String[] args) {
- Vector arguments = new Vector();
+ private static String[] parseArguments(HashMap options, String[] args) {
+ ArrayList arguments = new ArrayList();
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-")) {
if ((i + 1) < args.length &&!args[i + 1].startsWith("-")) {
@@ -47,13 +47,11 @@ public class PFMReader {
options.put(args[i], "");
}
} else {
- arguments.addElement(args[i]);
+ arguments.add(args[i]);
}
}
- String[] argStrings = new String[arguments.size()];
- arguments.copyInto(argStrings);
- return argStrings;
+ return (String[])arguments.toArray(new String[0]);
}
private final static void displayUsage() {
@@ -92,7 +90,7 @@ public class PFMReader {
String className = null;
String fontName = null;
- Hashtable options = new Hashtable();
+ HashMap options = new HashMap();
String[] arguments = parseArguments(options, args);
PFMReader app = new PFMReader();
@@ -320,17 +318,17 @@ public class PFMReader {
// Get kerning
- for (Enumeration enum = pfm.getKerning().keys();
- enum.hasMoreElements(); ) {
- Integer kpx1 = (Integer)enum.nextElement();
+ for (Iterator enum = pfm.getKerning().keySet().iterator();
+ enum.hasNext(); ) {
+ Integer kpx1 = (Integer)enum.next();
el = doc.createElement("kerning");
el.setAttribute("kpx1", kpx1.toString());
root.appendChild(el);
Element el2 = null;
- Hashtable h2 = (Hashtable)pfm.getKerning().get(kpx1);
- for (Enumeration enum2 = h2.keys(); enum2.hasMoreElements(); ) {
- Integer kpx2 = (Integer)enum2.nextElement();
+ HashMap h2 = (HashMap)pfm.getKerning().get(kpx1);
+ for (Iterator enum2 = h2.keySet().iterator(); enum2.hasNext(); ) {
+ Integer kpx2 = (Integer)enum2.next();
el2 = doc.createElement("pair");
el2.setAttribute("kpx2", kpx2.toString());
Integer val = (Integer)h2.get(kpx2);
diff --git a/src/org/apache/fop/fonts/apps/TTFReader.java b/src/org/apache/fop/fonts/apps/TTFReader.java
index 5a7c47919..d7c7b0a34 100644
--- a/src/org/apache/fop/fonts/apps/TTFReader.java
+++ b/src/org/apache/fop/fonts/apps/TTFReader.java
@@ -12,9 +12,9 @@ import org.apache.xerces.dom.*;
import org.apache.xml.serialize.*;
import org.apache.xalan.xslt.*;
import org.apache.fop.fonts.*;
-import java.util.Hashtable;
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Iterator;
/**
* A tool which reads TTF files and generates
@@ -29,14 +29,14 @@ public class TTFReader {
/**
- * Parse commandline arguments. put options in the Hashtable and return
+ * Parse commandline arguments. put options in the HashMap and return
* arguments in the String array
* the arguments: -fn Perpetua,Bold -cn PerpetuaBold per.ttf Perpetua.xml
* returns a String[] with the per.ttf and Perpetua.xml. The hash
* will have the (key, value) pairs: (-fn, Perpetua) and (-cn, PerpetuaBold)
*/
- private static String[] parseArguments(Hashtable options, String[] args) {
- Vector arguments = new Vector();
+ private static String[] parseArguments(HashMap options, String[] args) {
+ ArrayList arguments = new ArrayList();
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-")) {
if ((i + 1) < args.length &&!args[i + 1].startsWith("-")) {
@@ -46,13 +46,11 @@ public class TTFReader {
options.put(args[i], "");
}
} else {
- arguments.addElement(args[i]);
+ arguments.add(args[i]);
}
}
- String[] argStrings = new String[arguments.size()];
- arguments.copyInto(argStrings);
- return argStrings;
+ return (String[])arguments.toArray(new String[0]);;
}
@@ -106,7 +104,7 @@ public class TTFReader {
String ttcName = null;
boolean isCid = true;
- Hashtable options = new Hashtable();
+ HashMap options = new HashMap();
String[] arguments = parseArguments(options, args);
TTFReader app = new TTFReader();
@@ -317,9 +315,9 @@ public class TTFReader {
el = doc.createElement("bfranges");
mel.appendChild(el);
- for (Enumeration e = ttf.getCMaps().elements();
- e.hasMoreElements(); ) {
- TTFCmapEntry ce = (TTFCmapEntry)e.nextElement();
+ for (Iterator e = ttf.getCMaps().listIterator();
+ e.hasNext(); ) {
+ TTFCmapEntry ce = (TTFCmapEntry)e.next();
Element el2 = doc.createElement("bf");
el.appendChild(el2);
el2.setAttribute("us", String.valueOf(ce.unicodeStart));
@@ -368,28 +366,28 @@ public class TTFReader {
}
// Get kerning
- Enumeration enum;
+ Iterator enum;
if (isCid)
- enum = ttf.getKerning().keys();
+ enum = ttf.getKerning().keySet().iterator();
else
- enum = ttf.getAnsiKerning().keys();
+ enum = ttf.getAnsiKerning().keySet().iterator();
- while (enum.hasMoreElements()) {
- Integer kpx1 = (Integer)enum.nextElement();
+ while (enum.hasNext()) {
+ Integer kpx1 = (Integer)enum.next();
el = doc.createElement("kerning");
el.setAttribute("kpx1", kpx1.toString());
root.appendChild(el);
Element el2 = null;
- Hashtable h2;
+ HashMap h2;
if (isCid)
- h2 = (Hashtable)ttf.getKerning().get(kpx1);
+ h2 = (HashMap)ttf.getKerning().get(kpx1);
else
- h2 = (Hashtable)ttf.getAnsiKerning().get(kpx1);
+ h2 = (HashMap)ttf.getAnsiKerning().get(kpx1);
- for (Enumeration enum2 = h2.keys(); enum2.hasMoreElements(); ) {
- Integer kpx2 = (Integer)enum2.nextElement();
+ for (Iterator enum2 = h2.keySet().iterator(); enum2.hasNext(); ) {
+ Integer kpx2 = (Integer)enum2.next();
if (isCid || kpx2.intValue() < 256) {
el2 = doc.createElement("pair");
el2.setAttribute("kpx2", kpx2.toString());