jeremias 2003/01/08 06:02:48
Modified: src/org/apache/fop/render/pdf EmbedFontInfo.java
FontReader.java FontSetup.java PDFRenderer.java
Removed: src/org/apache/fop/render/pdf CIDFont.java CMap.java
Font.java
src/org/apache/fop/render/pdf/fonts BFEntry.java
LazyFont.java MultiByteFont.java
SingleByteFont.java package.html
Log:
Second part of font refactoring:
Moved most of the non-PDF-specific classes to the fonts package.
Makes dependencies clearer
First step towards the centralized font registry
Lots of Javadocs
Fixed Checkstyle errors
Revision Changes Path
1.3 +30 -6 xml-fop/src/org/apache/fop/render/pdf/EmbedFontInfo.java
Index: EmbedFontInfo.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/EmbedFontInfo.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- EmbedFontInfo.java 1 Nov 2002 10:49:35 -0000 1.2
+++ EmbedFontInfo.java 8 Jan 2003 14:02:47 -0000 1.3
@@ -1,43 +1,67 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.render.pdf;
-import java.util.ArrayList;
+import java.util.List;
/**
* FontInfo contains meta information on fonts (where is the metrics file etc.)
*/
public class EmbedFontInfo {
+
private String metricsFile, embedFile;
private boolean kerning;
- private ArrayList fontTriplets;
+ private List fontTriplets;
+ /**
+ * Main constructor
+ * @param metricsFile Path to the xml file containing font metrics
+ * @param kerning True if kerning should be enabled
+ * @param fontTriplets List of font triplets to associate with this font
+ * @param embedFile Path to the embeddable font file (may be null)
+ */
public EmbedFontInfo(String metricsFile, boolean kerning,
- ArrayList fontTriplets, String embedFile) {
+ List fontTriplets, String embedFile) {
this.metricsFile = metricsFile;
this.embedFile = embedFile;
this.kerning = kerning;
this.fontTriplets = fontTriplets;
}
+ /**
+ * Returns the path to the metrics file
+ * @return the metrics file path
+ */
public String getMetricsFile() {
return metricsFile;
}
+ /**
+ * Returns the path to the embeddable font file
+ * @return the font file path
+ */
public String getEmbedFile() {
return embedFile;
}
+ /**
+ * Determines if kerning is enabled
+ * @return True if enabled
+ */
public boolean getKerning() {
return kerning;
}
- public ArrayList getFontTriplets() {
+ /**
+ * Returns the list of font triplets associated with this font.
+ * @return List of font triplets
+ */
+ public List getFontTriplets() {
return fontTriplets;
}
1.7 +97 -137 xml-fop/src/org/apache/fop/render/pdf/FontReader.java
Index: FontReader.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/FontReader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FontReader.java 4 Sep 2002 08:36:36 -0000 1.6
+++ FontReader.java 8 Jan 2003 14:02:47 -0000 1.7
@@ -1,25 +1,33 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.render.pdf;
-import org.apache.fop.render.pdf.fonts.*;
-import org.xml.sax.helpers.DefaultHandler;
+
+//Java
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+
+//SAX
import org.xml.sax.XMLReader;
import org.xml.sax.SAXException;
-import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.Attributes;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.ArrayList;
-import java.util.HashMap;
-import org.apache.fop.pdf.PDFWArray;
-import org.apache.fop.pdf.PDFCIDFont;
+import org.xml.sax.helpers.DefaultHandler;
+
+//FOP
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.BFEntry;
+import org.apache.fop.fonts.CIDFontType;
+import org.apache.fop.fonts.CustomFont;
+import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.FontType;
+import org.apache.fop.fonts.MultiByteFont;
+import org.apache.fop.fonts.SingleByteFont;
/**
* Class for reading a metric.xml file and creating a font object.
@@ -32,19 +40,20 @@
* </pre>
*/
public class FontReader extends DefaultHandler {
+
private Locator locator = null;
private boolean isCID = false;
+ private CustomFont returnFont = null;
private MultiByteFont multiFont = null;
private SingleByteFont singleFont = null;
- private Font returnFont = null;
- private String text = null;
+ private StringBuffer text = new StringBuffer();
- private ArrayList cidWidths = null;
+ private List cidWidths = null;
private int cidWidthIndex = 0;
- private HashMap currentKerning = null;
+ private Map currentKerning = null;
- private ArrayList bfranges = null;
+ private List bfranges = null;
private void createFont(String path) throws FOPException {
XMLReader parser = null;
@@ -54,8 +63,9 @@
} catch (Exception e) {
throw new FOPException(e);
}
- if (parser == null)
+ if (parser == null) {
throw new FOPException("Unable to create SAX parser");
+ }
try {
parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
@@ -78,23 +88,17 @@
}
/**
- * Sets the path to embed a font. a null value disables font embedding
+ * Sets the path to embed a font. A null value disables font embedding.
*/
public void setFontEmbedPath(String path) {
- if (isCID)
- multiFont.embedFileName = path;
- else
- singleFont.embedFileName = path;
+ returnFont.setEmbedFileName(path);
}
/**
* Enable/disable use of kerning for the font
*/
- public void useKerning(boolean kern) {
- if (isCID)
- multiFont.useKerning = true;
- else
- singleFont.useKerning = true;
+ public void setKerningEnabled(boolean enabled) {
+ returnFont.setKerningEnabled(enabled);
}
@@ -128,52 +132,40 @@
isCID = true;
} else if ("TRUETYPE".equals(attributes.getValue("type"))) {
singleFont = new SingleByteFont();
- singleFont.subType = org.apache.fop.pdf.PDFFont.TRUETYPE;
+ singleFont.setFontType(FontType.TRUETYPE);
returnFont = singleFont;
isCID = false;
} else {
singleFont = new SingleByteFont();
- singleFont.subType = org.apache.fop.pdf.PDFFont.TYPE1;
+ singleFont.setFontType(FontType.TYPE1);
returnFont = singleFont;
isCID = false;
}
} else if ("embed".equals(localName)) {
- if (isCID) {
- // This *is* annoying... should create a common
- // interface for sing/multibytefonts...
- multiFont.embedFileName = attributes.getValue("file");
- multiFont.embedResourceName = attributes.getValue("class");
- } else {
- singleFont.embedFileName = attributes.getValue("file");
- singleFont.embedResourceName = attributes.getValue("class");
- }
+ returnFont.setEmbedFileName(attributes.getValue("file"));
+ returnFont.setEmbedResourceName(attributes.getValue("class"));
} else if ("cid-widths".equals(localName)) {
cidWidthIndex = getInt(attributes.getValue("start-index"));
- cidWidths = new ArrayList();
+ cidWidths = new java.util.ArrayList();
} else if ("kerning".equals(localName)) {
- currentKerning = new HashMap();
- if (isCID)
- multiFont.kerning.put(new Integer(attributes.getValue("kpx1")),
- currentKerning);
- else
- singleFont.kerning.put(new Integer(attributes.getValue("kpx1")),
- currentKerning);
+ currentKerning = new java.util.HashMap();
+ returnFont.putKerningEntry(new Integer(attributes.getValue("kpx1")),
+ currentKerning);
} else if ("bfranges".equals(localName)) {
- bfranges = new ArrayList();
+ bfranges = new java.util.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"));
+ BFEntry entry = new BFEntry(getInt(attributes.getValue("us")),
+ getInt(attributes.getValue("ue")),
+ getInt(attributes.getValue("gi")));
bfranges.add(entry);
} else if ("wx".equals(localName)) {
cidWidths.add(new Integer(attributes.getValue("w")));
} else if ("widths".equals(localName)) {
- singleFont.width = new int[256];
+ //singleFont.width = new int[256];
} else if ("char".equals(localName)) {
try {
- singleFont.width[Integer.parseInt(attributes.getValue("idx"))] =
- Integer.parseInt(attributes.getValue("wdt"));
+ singleFont.setWidth( Integer.parseInt(attributes.getValue("idx")),
+ Integer.parseInt(attributes.getValue("wdt")));
} catch (NumberFormatException ne) {
System.out.println("Malformed width in metric file: "
+ ne.getMessage());
@@ -188,87 +180,57 @@
int ret = 0;
try {
ret = Integer.parseInt(str);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ /**@todo log this exception */
+ }
return ret;
}
public void endElement(String uri, String localName, String qName) {
- if ("font-name".equals(localName))
- if (isCID)
- multiFont.fontName = text;
- else
- singleFont.fontName = text;
- if ("ttc-name".equals(localName) && isCID)
- multiFont.ttcName = text;
- else if ("cap-height".equals(localName))
- if (isCID)
- multiFont.capHeight = getInt(text);
- else
- singleFont.capHeight = getInt(text);
- else if ("x-height".equals(localName))
- if (isCID)
- multiFont.xHeight = getInt(text);
- else
- singleFont.xHeight = getInt(text);
- else if ("ascender".equals(localName))
- if (isCID)
- multiFont.ascender = getInt(text);
- else
- singleFont.ascender = getInt(text);
- else if ("descender".equals(localName))
- if (isCID)
- multiFont.descender = getInt(text);
- else
- singleFont.descender = getInt(text);
- else if ("left".equals(localName))
- if (isCID)
- multiFont.fontBBox[0] = getInt(text);
- else
- singleFont.fontBBox[0] = getInt(text);
- else if ("bottom".equals(localName))
- if (isCID)
- multiFont.fontBBox[1] = getInt(text);
- else
- singleFont.fontBBox[1] = getInt(text);
- else if ("right".equals(localName))
- if (isCID)
- multiFont.fontBBox[2] = getInt(text);
- else
- singleFont.fontBBox[2] = getInt(text);
- else if ("first-char".equals(localName))
- singleFont.firstChar = getInt(text);
- else if ("last-char".equals(localName))
- singleFont.lastChar = getInt(text);
- else if ("top".equals(localName))
- if (isCID)
- multiFont.fontBBox[3] = getInt(text);
- else
- singleFont.fontBBox[3] = getInt(text);
- else if ("flags".equals(localName))
- if (isCID)
- multiFont.flags = getInt(text);
- else
- singleFont.flags = getInt(text);
- else if ("stemv".equals(localName))
- if (isCID)
- multiFont.stemV = getInt(text);
- else
- singleFont.stemV = getInt(text);
- else if ("italic-angle".equals(localName))
- if (isCID)
- multiFont.italicAngle = getInt(text);
- else
- singleFont.italicAngle = getInt(text);
- else if ("missing-width".equals(localName))
- if (isCID)
- multiFont.missingWidth = getInt(text);
- else
- singleFont.missingWidth = getInt(text);
- else if ("cid-type".equals(localName)) {
- if ("CIDFontType2".equals(text))
- multiFont.cidType = PDFCIDFont.CID_TYPE2;
+ if ("font-name".equals(localName)) {
+ returnFont.setFontName(text.toString());
+ } else if ("ttc-name".equals(localName) && isCID) {
+ multiFont.setTTCName(text.toString());
+ } else if ("cap-height".equals(localName)) {
+ returnFont.setCapHeight(getInt(text.toString()));
+ } else if ("x-height".equals(localName)) {
+ returnFont.setXHeight(getInt(text.toString()));
+ } else if ("ascender".equals(localName)) {
+ returnFont.setAscender(getInt(text.toString()));
+ } else if ("descender".equals(localName)) {
+ returnFont.setDescender(getInt(text.toString()));
+ } else if ("left".equals(localName)) {
+ int[] bbox = returnFont.getFontBBox();
+ bbox[0] = getInt(text.toString());
+ returnFont.setFontBBox(bbox);
+ } else if ("bottom".equals(localName)) {
+ int[] bbox = returnFont.getFontBBox();
+ bbox[1] = getInt(text.toString());
+ returnFont.setFontBBox(bbox);
+ } else if ("right".equals(localName)) {
+ int[] bbox = returnFont.getFontBBox();
+ bbox[2] = getInt(text.toString());
+ returnFont.setFontBBox(bbox);
+ } else if ("top".equals(localName)) {
+ int[] bbox = returnFont.getFontBBox();
+ bbox[3] = getInt(text.toString());
+ returnFont.setFontBBox(bbox);
+ } else if ("first-char".equals(localName)) {
+ returnFont.setFirstChar(getInt(text.toString()));
+ } else if ("last-char".equals(localName)) {
+ returnFont.setLastChar(getInt(text.toString()));
+ } else if ("flags".equals(localName)) {
+ returnFont.setFlags(getInt(text.toString()));
+ } else if ("stemv".equals(localName)) {
+ returnFont.setStemV(getInt(text.toString()));
+ } else if ("italic-angle".equals(localName)) {
+ returnFont.setItalicAngle(getInt(text.toString()));
+ } else if ("missing-width".equals(localName)) {
+ returnFont.setMissingWidth(getInt(text.toString()));
+ } else if ("cid-type".equals(localName)) {
+ multiFont.setCIDType(CIDFontType.byName(text.toString()));
} else if ("default-width".equals(localName)) {
- multiFont.defaultWidth = getInt(text);
+ multiFont.setDefaultWidth(getInt(text.toString()));
} else if ("cid-widths".equals(localName)) {
int[] wds = new int[cidWidths.size()];
int j = 0;
@@ -277,19 +239,17 @@
wds[j++] = i.intValue();
}
- multiFont.warray.addEntry(cidWidthIndex, wds);
- multiFont.width = wds;
+ multiFont.addCIDWidthEntry(cidWidthIndex, wds);
+ multiFont.setWidthArray(wds);
} else if ("bfranges".equals(localName)) {
- multiFont.bfentries = (BFEntry[])bfranges.toArray(new BFEntry[0]);
+ multiFont.setBFEntries((BFEntry[])bfranges.toArray(new BFEntry[0]));
}
-
+ text.setLength(0); //Reset text buffer (see characters())
}
public void characters(char[] ch, int start, int length) {
- char c[] = new char[length];
- System.arraycopy(ch, start, c, 0, length);
- text = new String(c);
+ text.append(ch, start, length);
}
}
1.21 +75 -54 xml-fop/src/org/apache/fop/render/pdf/FontSetup.java
Index: FontSetup.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/FontSetup.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- FontSetup.java 29 Nov 2002 23:18:57 -0000 1.20
+++ FontSetup.java 8 Jan 2003 14:02:47 -0000 1.21
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -8,16 +8,32 @@
package org.apache.fop.render.pdf;
// FOP
-import org.apache.fop.render.pdf.fonts.*;
+import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.FontDescriptor;
+import org.apache.fop.fonts.LazyFont;
import org.apache.fop.layout.FontInfo;
-import org.apache.fop.layout.FontDescriptor;
import org.apache.fop.pdf.PDFDocument;
import org.apache.fop.pdf.PDFResources;
+// FOP (base 14 fonts)
+import org.apache.fop.fonts.base14.Helvetica;
+import org.apache.fop.fonts.base14.HelveticaBold;
+import org.apache.fop.fonts.base14.HelveticaOblique;
+import org.apache.fop.fonts.base14.HelveticaBoldOblique;
+import org.apache.fop.fonts.base14.TimesRoman;
+import org.apache.fop.fonts.base14.TimesBold;
+import org.apache.fop.fonts.base14.TimesItalic;
+import org.apache.fop.fonts.base14.TimesBoldItalic;
+import org.apache.fop.fonts.base14.Courier;
+import org.apache.fop.fonts.base14.CourierBold;
+import org.apache.fop.fonts.base14.CourierOblique;
+import org.apache.fop.fonts.base14.CourierBoldOblique;
+import org.apache.fop.fonts.base14.Symbol;
+import org.apache.fop.fonts.base14.ZapfDingbats;
// Java
-import java.util.HashMap;
+import java.util.Map;
import java.util.Iterator;
-import java.util.ArrayList;
+import java.util.List;
/**
* sets up the PDF fonts.
@@ -28,14 +44,15 @@
public class FontSetup {
/**
- * sets up the font info object.
+ * Sets up the font info object.
*
- * adds metrics for basic fonts and useful family-style-weight
- * triplets for lookup
+ * Adds metrics for basic fonts and useful family-style-weight
+ * triplets for lookup.
*
* @param fontInfo the font info object to set up
+ * @param embedList ???
*/
- public static void setup(FontInfo fontInfo, ArrayList embedList) {
+ public static void setup(FontInfo fontInfo, List embedList) {
fontInfo.addMetrics("F1", new Helvetica());
fontInfo.addMetrics("F2", new HelveticaOblique());
@@ -133,63 +150,67 @@
/**
* Add fonts from configuration file starting with
* internalnames F<num>
+ * @param fontInfo the font info object to set up
+ * @param fontInfos ???
+ * @param num starting index for internal font numbering
*/
- public static void addConfiguredFonts(FontInfo fontInfo, ArrayList fontInfos,
int num) {
- if (fontInfos == null)
- return;
+ public static void addConfiguredFonts(FontInfo fontInfo, List fontInfos, int
num) {
+ if (fontInfos == null) {
+ return; //No fonts to process
+ }
String internalName = null;
- FontReader reader = null;
+ //FontReader reader = null;
- for (int count = 0; count < fontInfos.size(); count++) {
- EmbedFontInfo configFontInfo =
- (EmbedFontInfo)fontInfos.get(count);
-
- String metricsFile = configFontInfo.getMetricsFile();
- if (metricsFile != null) {
- internalName = "F" + num;
- num++;
- /*
- reader = new FontReader(metricsFile);
- reader.useKerning(configFontInfo.getKerning());
- reader.setFontEmbedPath(configFontInfo.getEmbedFile());
- fontInfo.addMetrics(internalName, reader.getFont());
- */
- LazyFont font = new LazyFont(configFontInfo.getEmbedFile(),
- metricsFile,
- configFontInfo.getKerning());
- fontInfo.addMetrics(internalName, font);
-
- ArrayList triplets = configFontInfo.getFontTriplets();
- for (int c = 0; c < triplets.size(); c++) {
- FontTriplet triplet = (FontTriplet)triplets.get(c);
-
- int weight = 400;
- try {
- weight = Integer.parseInt(triplet.getWeight());
- weight = ((int)weight/100) * 100;
- if(weight < 100) weight = 100;
- if(weight > 900) weight = 900;
- } catch(NumberFormatException nfe) {
-
- }
- fontInfo.addFontProperties(internalName,
- triplet.getName(),
- triplet.getStyle(),
- weight);
+ for (int i = 0; i < fontInfos.size(); i++) {
+ EmbedFontInfo configFontInfo = (EmbedFontInfo)fontInfos.get(i);
+
+ String metricsFile = configFontInfo.getMetricsFile();
+ if (metricsFile != null) {
+ internalName = "F" + num;
+ num++;
+ /*
+ reader = new FontReader(metricsFile);
+ reader.useKerning(configFontInfo.getKerning());
+ reader.setFontEmbedPath(configFontInfo.getEmbedFile());
+ fontInfo.addMetrics(internalName, reader.getFont());
+ */
+ LazyFont font = new LazyFont(configFontInfo.getEmbedFile(),
+ metricsFile,
+ configFontInfo.getKerning());
+ fontInfo.addMetrics(internalName, font);
+
+ List triplets = configFontInfo.getFontTriplets();
+ for (int c = 0; c < triplets.size(); c++) {
+ FontTriplet triplet = (FontTriplet)triplets.get(c);
+
+ int weight = 400;
+ try {
+ weight = Integer.parseInt(triplet.getWeight());
+ weight = ((int)weight / 100) * 100;
+ weight = Math.min(weight, 100);
+ weight = Math.max(weight, 900);
+ } catch (NumberFormatException nfe) {
+ /**@todo log this exception */
}
+ fontInfo.addFontProperties(internalName,
+ triplet.getName(),
+ triplet.getStyle(),
+ weight);
}
+ }
}
}
/**
- * add the fonts in the font info to the PDF document
+ * Add the fonts in the font info to the PDF document
*
* @param doc PDF document to add fonts to
+ * @param resources PDFResources object to attach the font to
* @param fontInfo font info object to get font information from
*/
public static void addToResources(PDFDocument doc, PDFResources resources,
FontInfo fontInfo) {
- HashMap fonts = fontInfo.getUsedFonts();
+ Map fonts = fontInfo.getUsedFonts();
Iterator e = fonts.keySet().iterator();
while (e.hasNext()) {
String f = (String)e.next();
@@ -198,8 +219,8 @@
if (font instanceof FontDescriptor) {
desc = (FontDescriptor)font;
}
- resources.addFont(doc.makeFont(f, font.fontName(),
- font.encoding(), font, desc));
+ resources.addFont(doc.makeFont(f, font.getFontName(),
+ font.getEncoding(), font, desc));
}
}
}
1.134 +17 -19 xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
Index: PDFRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -r1.133 -r1.134
--- PDFRenderer.java 18 Dec 2002 14:50:35 -0000 1.133
+++ PDFRenderer.java 8 Jan 2003 14:02:47 -0000 1.134
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -18,6 +18,8 @@
import org.apache.fop.apps.Version;
import org.apache.fop.fo.properties.RuleStyle;
import org.apache.fop.fo.properties.BackgroundRepeat;
+import org.apache.fop.fonts.*;
+import org.apache.fop.fonts.FontMetrics;
import org.apache.fop.pdf.PDFStream;
import org.apache.fop.pdf.PDFDocument;
import org.apache.fop.pdf.PDFInfo;
@@ -51,11 +53,9 @@
import org.apache.fop.area.inline.Leader;
import org.apache.fop.area.inline.InlineParent;
import org.apache.fop.layout.FontState;
-import org.apache.fop.layout.FontMetric;
import org.apache.fop.traits.BorderProps;
import org.apache.fop.datatypes.ColorType;
-import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -67,9 +67,8 @@
import java.awt.Color;
import java.awt.geom.Rectangle2D;
import java.awt.geom.AffineTransform;
-import java.util.HashMap;
+import java.util.Map;
import java.util.List;
-import java.util.ArrayList;
/*
todo:
@@ -103,15 +102,15 @@
* this is used for prepared pages that cannot be immediately
* rendered
*/
- protected HashMap pages = null;
+ protected Map pages = null;
/**
* Page references are stored using the PageViewport as the key
* when a reference is made the PageViewport is used
* for pdf this means we need the pdf page reference
*/
- protected HashMap pageReferences = new HashMap();
- protected HashMap pvReferences = new HashMap();
+ protected Map pageReferences = new java.util.HashMap();
+ protected Map pvReferences = new java.util.HashMap();
private String producer = "FOP";
@@ -149,7 +148,7 @@
protected int currentFontSize = 0;
protected int pageHeight;
- protected HashMap filterMap = new HashMap();
+ protected Map filterMap = new java.util.HashMap();
/**
* true if a TJ command is left to be written
@@ -192,7 +191,7 @@
public void configure(Configuration conf) throws ConfigurationException {
Configuration filters = conf.getChild("filterList");
Configuration[] filt = filters.getChildren("value");
- ArrayList filterList = new ArrayList();
+ List filterList = new java.util.ArrayList();
for (int i = 0; i < filt.length; i++) {
String name = filt[i].getValue();
filterList.add(name);
@@ -203,7 +202,7 @@
Configuration[] font = conf.getChildren("font");
for (int i = 0; i < font.length; i++) {
Configuration[] triple = font[i].getChildren("font-triplet");
- ArrayList tripleList = new ArrayList();
+ List tripleList = new java.util.ArrayList();
for (int j = 0; j < triple.length; j++) {
tripleList.add(new FontTriplet(triple[j].getAttribute("name"),
triple[j].getAttribute("style"),
@@ -216,7 +215,7 @@
tripleList, font[i].getAttribute("embed-url"));
if(fontList == null) {
- fontList = new ArrayList();
+ fontList = new java.util.ArrayList();
}
fontList.add(efi);
}
@@ -354,7 +353,7 @@
currentPage = this.pdfDoc.makePage(this.pdfResources,
(int) Math.round(w / 1000), (int)
Math.round(h / 1000));
if (pages == null) {
- pages = new HashMap();
+ pages = new java.util.HashMap();
}
pages.put(page, currentPage);
pageReferences.put(page.getKey(), currentPage.referencePDF());
@@ -840,7 +839,7 @@
String s = word.getWord();
- FontMetric metrics = fontInfo.getMetricsFor(name);
+ FontMetrics metrics = fontInfo.getMetricsFor(name);
FontState fs = new FontState(name, metrics, size);
escapeText(s, fs, useMultiByte, pdf);
pdf.append(endText);
@@ -856,8 +855,7 @@
String endText = useMultiByte ? "> " : ") ";
boolean kerningAvailable = false;
- HashMap kerning = null;
- kerning = fs.getKerning();
+ Map kerning = fs.getKerning();
if (kerning != null && !kerning.isEmpty()) {
kerningAvailable = true;
}
@@ -922,8 +920,8 @@
}
private void addKerning(StringBuffer buf, Integer ch1, Integer ch2,
- HashMap kerning, String startText, String endText) {
- HashMap kernPair = (HashMap) kerning.get(ch1);
+ Map kerning, String startText, String endText) {
+ Map kernPair = (Map) kerning.get(ch1);
if (kernPair != null) {
Integer width = (Integer) kernPair.get(ch2);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]