diff options
author | Keiron Liddle <keiron@apache.org> | 2001-11-02 11:06:09 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2001-11-02 11:06:09 +0000 |
commit | cfc0da75fcc187e6dd7596e7480c4941e278b9d5 (patch) | |
tree | 8dadcac1a3dc6bcda7017fe8a71736fd044fb575 /src/org/apache/fop/render | |
parent | 4cf83fe1e5dab96e2e348877b0e43d8abdc6c0d9 (diff) | |
download | xmlgraphics-fop-cfc0da75fcc187e6dd7596e7480c4941e278b9d5.tar.gz xmlgraphics-fop-cfc0da75fcc187e6dd7596e7480c4941e278b9d5.zip |
updated a few hashtables and vectors
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194535 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/render')
-rw-r--r-- | src/org/apache/fop/render/mif/FontSetup.java | 12 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/FontReader.java | 23 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/FontSetup.java | 27 | ||||
-rw-r--r-- | src/org/apache/fop/render/ps/PSGraphics2D.java | 48 | ||||
-rw-r--r-- | src/org/apache/fop/render/ps/PSRenderer.java | 19 | ||||
-rwxr-xr-x | src/org/apache/fop/render/txt/TXTRenderer.java | 3 |
6 files changed, 62 insertions, 70 deletions
diff --git a/src/org/apache/fop/render/mif/FontSetup.java b/src/org/apache/fop/render/mif/FontSetup.java index 4691751d9..39c9b32d1 100644 --- a/src/org/apache/fop/render/mif/FontSetup.java +++ b/src/org/apache/fop/render/mif/FontSetup.java @@ -16,8 +16,8 @@ import org.apache.fop.mif.MIFDocument; // import org.apache.fop.pdf.PDFResources; // Java -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.Iterator; +import java.util.HashMap; /** * sets up the PDF fonts. @@ -137,10 +137,10 @@ public class FontSetup { public static void addToFontFormat(MIFDocument mifDoc, FontInfo fontInfo) { - Hashtable fonts = fontInfo.getFonts(); - Enumeration e = fonts.keys(); - while (e.hasMoreElements()) { - String f = (String)e.nextElement(); + HashMap fonts = fontInfo.getFonts(); + Iterator e = fonts.keySet().iterator(); + while (e.hasNext()) { + String f = (String)e.next(); Font font = (Font)fonts.get(f); FontDescriptor desc = null; if (font instanceof FontDescriptor) { diff --git a/src/org/apache/fop/render/pdf/FontReader.java b/src/org/apache/fop/render/pdf/FontReader.java index 132030d92..31cfdb2e9 100644 --- a/src/org/apache/fop/render/pdf/FontReader.java +++ b/src/org/apache/fop/render/pdf/FontReader.java @@ -15,7 +15,7 @@ import org.xml.sax.Locator; import org.xml.sax.Attributes; import java.io.IOException; import java.util.Enumeration; -import java.util.Vector; +import java.util.ArrayList; import java.util.Hashtable; import org.apache.fop.pdf.PDFWArray; import org.apache.fop.pdf.PDFCIDFont; @@ -41,12 +41,12 @@ public class FontReader extends DefaultHandler { // private SingleByteFont singleFont = null; private String text = null; - private Vector cidWidths = null; + private ArrayList cidWidths = null; private int cidWidthIndex = 0; private Hashtable currentKerning = null; - private Vector bfranges = null; + private ArrayList bfranges = null; private void createFont(String path) throws FOPException { XMLReader parser = ConfigurationReader.createParser(); @@ -145,7 +145,7 @@ public class FontReader extends DefaultHandler { } } else if ("cid-widths".equals(localName)) { cidWidthIndex = getInt(attributes.getValue("start-index")); - cidWidths = new Vector(); + cidWidths = new ArrayList(); } else if ("kerning".equals(localName)) { currentKerning = new Hashtable(); if (isCID) @@ -155,15 +155,15 @@ public class FontReader extends DefaultHandler { singleFont.kerning.put(new Integer(attributes.getValue("kpx1")), currentKerning); } else if ("bfranges".equals(localName)) { - bfranges = new Vector(); + bfranges = new ArrayList(); } else if ("bf".equals(localName)) { BFEntry entry = new BFEntry(); entry.unicodeStart = getInt(attributes.getValue("us")); entry.unicodeEnd = getInt(attributes.getValue("ue")); entry.glyphStartIndex = getInt(attributes.getValue("gi")); - bfranges.addElement(entry); + bfranges.add(entry); } else if ("wx".equals(localName)) { - cidWidths.addElement(new Integer(attributes.getValue("w"))); + cidWidths.add(new Integer(attributes.getValue("w"))); } else if ("widths".equals(localName)) { singleFont.width = new int[256]; } else if ("char".equals(localName)) { @@ -268,9 +268,8 @@ public class FontReader extends DefaultHandler { } else if ("cid-widths".equals(localName)) { int[] wds = new int[cidWidths.size()]; int j = 0; - for (Enumeration e = cidWidths.elements(); - e.hasMoreElements(); ) { - Integer i = (Integer)e.nextElement(); + for (int count = 0; count < cidWidths.size(); count++) { + Integer i = (Integer)cidWidths.get(count); wds[j++] = i.intValue(); } @@ -278,9 +277,7 @@ public class FontReader extends DefaultHandler { multiFont.width = wds; } else if ("bfranges".equals(localName)) { - BFEntry[] entries = new BFEntry[bfranges.size()]; - bfranges.copyInto(entries); - multiFont.bfentries = entries; + multiFont.bfentries = (BFEntry[])bfranges.toArray(new BFEntry[0]); } } diff --git a/src/org/apache/fop/render/pdf/FontSetup.java b/src/org/apache/fop/render/pdf/FontSetup.java index 00a415230..33d7ffe7e 100644 --- a/src/org/apache/fop/render/pdf/FontSetup.java +++ b/src/org/apache/fop/render/pdf/FontSetup.java @@ -18,9 +18,9 @@ import org.apache.fop.configuration.Configuration; import org.apache.fop.configuration.FontTriplet; // Java -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; +import java.util.HashMap; +import java.util.Iterator; +import java.util.ArrayList; /** * sets up the PDF fonts. @@ -143,13 +143,13 @@ public class FontSetup { String internalName = null; FontReader reader = null; - Vector fontInfos = Configuration.getFonts(); + ArrayList fontInfos = Configuration.getFonts(); if (fontInfos == null) return; - for (Enumeration e = fontInfos.elements(); e.hasMoreElements(); ) { + for (int count = 0; count < fontInfos.size(); count++) { org.apache.fop.configuration.FontInfo configFontInfo = - (org.apache.fop.configuration.FontInfo)e.nextElement(); + (org.apache.fop.configuration.FontInfo)fontInfos.get(count); try { String metricsFile = configFontInfo.getMetricsFile(); @@ -167,10 +167,9 @@ public class FontSetup { configFontInfo.getKerning()); fontInfo.addMetrics(internalName, font); - Vector triplets = configFontInfo.getFontTriplets(); - for (Enumeration t = triplets.elements(); - t.hasMoreElements(); ) { - FontTriplet triplet = (FontTriplet)t.nextElement(); + ArrayList triplets = configFontInfo.getFontTriplets(); + for (int c = 0; c < triplets.size(); c++) { + FontTriplet triplet = (FontTriplet)triplets.get(c); fontInfo.addFontProperties(internalName, triplet.getName(), @@ -193,11 +192,11 @@ public class FontSetup { * @param fontInfo font info object to get font information from */ public static void addToResources(PDFDocument doc, FontInfo fontInfo) { - Hashtable fonts = fontInfo.getUsedFonts(); - Enumeration e = fonts.keys(); + HashMap fonts = fontInfo.getUsedFonts(); + Iterator e = fonts.keySet().iterator(); PDFResources resources = doc.getResources(); - while (e.hasMoreElements()) { - String f = (String)e.nextElement(); + while (e.hasNext()) { + String f = (String)e.next(); Font font = (Font)fonts.get(f); FontDescriptor desc = null; if (font instanceof FontDescriptor) { diff --git a/src/org/apache/fop/render/ps/PSGraphics2D.java b/src/org/apache/fop/render/ps/PSGraphics2D.java index ab9a976fc..0ab552695 100644 --- a/src/org/apache/fop/render/ps/PSGraphics2D.java +++ b/src/org/apache/fop/render/ps/PSGraphics2D.java @@ -28,7 +28,7 @@ import java.awt.image.renderable.*; import java.io.*; import java.util.Map; -import java.util.Vector; +import java.util.ArrayList; /** * This concrete implementation of <tt>AbstractGraphics2D</tt> is a @@ -515,40 +515,40 @@ public class PSGraphics2D extends AbstractGraphics2D { Point2D p2 = gp.getPoint2(); boolean cyclic = gp.isCyclic(); - Vector theCoords = new Vector(); - theCoords.addElement(new Double(p1.getX())); - theCoords.addElement(new Double(p1.getY())); - theCoords.addElement(new Double(p2.getX())); - theCoords.addElement(new Double(p2.getY())); + ArrayList theCoords = new ArrayList(); + theCoords.add(new Double(p1.getX())); + theCoords.add(new Double(p1.getY())); + theCoords.add(new Double(p2.getX())); + theCoords.add(new Double(p2.getY())); - Vector theExtend = new Vector(); - theExtend.addElement(new Boolean(true)); - theExtend.addElement(new Boolean(true)); + ArrayList theExtend = new ArrayList(); + theExtend.add(new Boolean(true)); + theExtend.add(new Boolean(true)); - Vector theDomain = new Vector(); - theDomain.addElement(new Double(0)); - theDomain.addElement(new Double(1)); + ArrayList theDomain = new ArrayList(); + theDomain.add(new Double(0)); + theDomain.add(new Double(1)); - Vector theEncode = new Vector(); - theEncode.addElement(new Double(0)); - theEncode.addElement(new Double(1)); - theEncode.addElement(new Double(0)); - theEncode.addElement(new Double(1)); + ArrayList theEncode = new ArrayList(); + theEncode.add(new Double(0)); + theEncode.add(new Double(1)); + theEncode.add(new Double(0)); + theEncode.add(new Double(1)); - Vector theBounds = new Vector(); - theBounds.addElement(new Double(0)); - theBounds.addElement(new Double(1)); + ArrayList theBounds = new ArrayList(); + theBounds.add(new Double(0)); + theBounds.add(new Double(1)); - Vector theFunctions = new Vector(); + ArrayList theFunctions = new ArrayList(); - Vector someColors = new Vector(); + ArrayList someColors = new ArrayList(); PDFColor color1 = new PDFColor(c1.getRed(), c1.getGreen(), c1.getBlue()); - someColors.addElement(color1); + someColors.add(color1); PDFColor color2 = new PDFColor(c2.getRed(), c2.getGreen(), c2.getBlue()); - someColors.addElement(color2); + someColors.add(color2); ColorSpace aColorSpace = new ColorSpace(ColorSpace.DEVICE_RGB); } else if (paint instanceof TexturePaint) {} diff --git a/src/org/apache/fop/render/ps/PSRenderer.java b/src/org/apache/fop/render/ps/PSRenderer.java index 31d2b73fe..08f17b3f9 100644 --- a/src/org/apache/fop/render/ps/PSRenderer.java +++ b/src/org/apache/fop/render/ps/PSRenderer.java @@ -42,9 +42,8 @@ import java.io.*; import java.util.*; import java.io.IOException; import java.io.OutputStream; -import java.util.Enumeration; -import java.util.Vector; -import java.util.Hashtable; +import java.util.Iterator; +import java.util.HashMap; import java.awt.geom.AffineTransform; import java.awt.geom.Dimension2D; import java.awt.Point; @@ -204,18 +203,18 @@ public class PSRenderer extends AbstractRenderer { // write("/gfF1{/Helvetica findfont} bd"); // write("/gfF3{/Helvetica-Bold findfont} bd"); - Hashtable fonts = fontInfo.getFonts(); - Enumeration enum = fonts.keys(); - while (enum.hasMoreElements()) { - String key = (String)enum.nextElement(); + HashMap fonts = fontInfo.getFonts(); + Iterator enum = fonts.keySet().iterator(); + while (enum.hasNext()) { + String key = (String)enum.next(); Font fm = (Font)fonts.get(key); write("/" + key + " /" + fm.fontName() + " def"); } write("end def"); write("%%EndResource"); - enum = fonts.keys(); - while (enum.hasMoreElements()) { - String key = (String)enum.nextElement(); + enum = fonts.keySet().iterator(); + while (enum.hasNext()) { + String key = (String)enum.next(); Font fm = (Font)fonts.get(key); write("/" + fm.fontName() + " findfont"); write("dup length dict begin"); diff --git a/src/org/apache/fop/render/txt/TXTRenderer.java b/src/org/apache/fop/render/txt/TXTRenderer.java index fcc26a743..00a1ef686 100755 --- a/src/org/apache/fop/render/txt/TXTRenderer.java +++ b/src/org/apache/fop/render/txt/TXTRenderer.java @@ -28,9 +28,6 @@ import org.w3c.dom.svg.SVGDocument; // Java import java.io.IOException; import java.io.OutputStream; -import java.util.Enumeration; -import java.util.Vector; -import java.util.Hashtable; /** * Renderer that renders areas to plain text |