You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by sp...@apache.org on 2010/11/26 14:40:28 UTC

svn commit: r1039350 [2/2] - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fonts/ fonts/autodetect/ fonts/truetype/ layoutmgr/inline/ pdf/ render/ render/afp/ render/java2d/ render/ps/ tools/fontlist/

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Fri Nov 26 13:40:27 2010
@@ -27,7 +27,6 @@ import java.util.ListIterator;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.area.Area;
 import org.apache.fop.area.LineArea;
 import org.apache.fop.area.Trait;
@@ -94,7 +93,7 @@ public class LineLayoutManager extends I
      */
     private static Log log = LogFactory.getLog(LineLayoutManager.class);
 
-    private Block fobj;
+    private final Block fobj;
     private boolean isFirstInBlock;
 
     /**
@@ -103,19 +102,19 @@ public class LineLayoutManager extends I
      * inline break positions.
      */
     private static class LineBreakPosition extends LeafPosition {
-        private int parIndex; // index of the Paragraph this Position refers to
-        private int startIndex; //index of the first element this Position refers to
-        private int availableShrink;
-        private int availableStretch;
-        private int difference;
-        private double dAdjust; // Percentage to adjust (stretch or shrink)
-        private double ipdAdjust; // Percentage to adjust (stretch or shrink)
-        private int startIndent;
-        private int lineHeight;
-        private int lineWidth;
-        private int spaceBefore;
-        private int spaceAfter;
-        private int baseline;
+        private final int parIndex; // index of the Paragraph this Position refers to
+        private final int startIndex; //index of the first element this Position refers to
+        private final int availableShrink;
+        private final int availableStretch;
+        private final int difference;
+        private final double dAdjust; // Percentage to adjust (stretch or shrink)
+        private final double ipdAdjust; // Percentage to adjust (stretch or shrink)
+        private final int startIndent;
+        private final int lineHeight;
+        private final int lineWidth;
+        private final int spaceBefore;
+        private final int spaceAfter;
+        private final int baseline;
 
         LineBreakPosition(                                       // CSOK: ParameterNumber
                 LayoutManager lm, int index, int startIndex, int breakIndex,
@@ -151,9 +150,9 @@ public class LineLayoutManager extends I
     private int whiteSpaceTreament;
     //private LayoutProps layoutProps;
 
-    private Length lineHeight;
-    private int lead;
-    private int follow;
+    private final Length lineHeight;
+    private final int lead;
+    private final int follow;
     private AlignmentContext alignmentContext;
 
     private List knuthParagraphs;
@@ -194,12 +193,12 @@ public class LineLayoutManager extends I
 
         // space at the end of the last line (in millipoints)
         private MinOptMax lineFiller;
-        private int textAlignment;
-        private int textAlignmentLast;
-        private int textIndent;
-        private int lastLineEndIndent;
+        private final int textAlignment;
+        private final int textAlignmentLast;
+        private final int textIndent;
+        private final int lastLineEndIndent;
         // the LM which created the paragraph
-        private LineLayoutManager layoutManager;
+        private final LineLayoutManager layoutManager;
 
         Paragraph(LineLayoutManager llm, int alignment, int alignmentLast,
                          int indent, int endIndent) {
@@ -211,6 +210,7 @@ public class LineLayoutManager extends I
             lastLineEndIndent = endIndent;
         }
 
+        @Override
         public void startSequence() {
             // set the minimum amount of empty space at the end of the
             // last line
@@ -245,6 +245,7 @@ public class LineLayoutManager extends I
             }
         }
 
+        @Override
         public KnuthSequence endSequence() {
             if (this.size() > ignoreAtStart) {
                 if (textAlignment == EN_CENTER
@@ -294,14 +295,14 @@ public class LineLayoutManager extends I
     }
 
     private class LineBreakingAlgorithm extends BreakingAlgorithm {
-        private LineLayoutManager thisLLM;
-        private int pageAlignment;
+        private final LineLayoutManager thisLLM;
+        private final int pageAlignment;
         private int activePossibility;
         private int addedPositions;
-        private int textIndent;
-        private int lineHeight;
-        private int lead;
-        private int follow;
+        private final int textIndent;
+        private final int lineHeight;
+        private final int lead;
+        private final int follow;
         private static final double MAX_DEMERITS = 10e6;
 
         public LineBreakingAlgorithm(                            // CSOK: ParameterNumber
@@ -317,6 +318,7 @@ public class LineLayoutManager extends I
             activePossibility = -1;
         }
 
+        @Override
         public void updateData1(int lineCount, double demerits) {
             lineLayouts.addPossibility(lineCount, demerits);
             if (log.isTraceEnabled()) {
@@ -324,6 +326,7 @@ public class LineLayoutManager extends I
             }
         }
 
+        @Override
         public void updateData2(KnuthNode bestActiveNode,
                                 KnuthSequence par,
                                 int total) {
@@ -466,6 +469,7 @@ public class LineLayoutManager extends I
             }
         }
 
+        @Override
         protected int filterActiveNodes() {
             KnuthNode bestActiveNode = null;
 
@@ -537,6 +541,7 @@ public class LineLayoutManager extends I
     }
 
     /** {@inheritDoc} */
+    @Override
     public void initialize() {
         textAlignment = fobj.getTextAlign();
         textAlignmentLast = fobj.getTextAlignLast();
@@ -560,6 +565,7 @@ public class LineLayoutManager extends I
     }
 
     /** {@inheritDoc} */
+    @Override
     public List getNextKnuthElements(LayoutContext context, int alignment) {
         if (alignmentContext == null) {
             FontInfo fi = fobj.getFOEventHandler().getFontInfo();
@@ -771,7 +777,8 @@ public class LineLayoutManager extends I
                 // we only need an entry in lineLayoutsList.
                 llPoss = new LineLayoutPossibilities();
             } else {
-                llPoss = findOptimalBreakingPoints(alignment, (Paragraph) seq, !paragraphsIterator.hasNext());
+                llPoss = findOptimalBreakingPoints(alignment, (Paragraph) seq,
+                                                   !paragraphsIterator.hasNext());
             }
             lineLayoutsList[i] = llPoss;
         }
@@ -789,7 +796,8 @@ public class LineLayoutManager extends I
      * @param isLastPar flag indicating whether currPar is the last paragraph
      * @return the line layout possibilities for the paragraph
      */
-    private LineLayoutPossibilities findOptimalBreakingPoints(int alignment, Paragraph currPar, boolean isLastPar) {
+    private LineLayoutPossibilities findOptimalBreakingPoints(int alignment, Paragraph currPar,
+                                                              boolean isLastPar) {
         // use the member lineLayouts, which is read by LineBreakingAlgorithm.updateData1 and 2
         lineLayouts = new LineLayoutPossibilities();
         double maxAdjustment = 1;
@@ -855,7 +863,7 @@ public class LineLayoutManager extends I
             // use non-hyphenated breaks, when possible
             lineLayouts.restorePossibilities();
         }
-        
+
         return lineLayouts;
     }
 
@@ -1158,6 +1166,7 @@ public class LineLayoutManager extends I
     }
 
     /** {@inheritDoc} */
+    @Override
     public List getChangedKnuthElements(List oldList, int alignment) {
         List returnList = new LinkedList();
         for (int p = 0; p < knuthParagraphs.size(); p++) {
@@ -1340,6 +1349,7 @@ public class LineLayoutManager extends I
      * @param isNotFirst ignored
      * @return always true
      */
+    @Override
     protected boolean hasLeadingFence(boolean isNotFirst) {
         return true;
     }
@@ -1349,6 +1359,7 @@ public class LineLayoutManager extends I
      * @param isNotLast ignored
      * @return always true
      */
+    @Override
     protected boolean hasTrailingFence(boolean isNotLast) {
         return true;
     }
@@ -1396,6 +1407,7 @@ public class LineLayoutManager extends I
      * @param parentIter the iterator of break positions
      * @param context the context for adding areas
      */
+    @Override
     public void addAreas(PositionIterator parentIter,
                          LayoutContext context) {
         while (parentIter.hasNext()) {
@@ -1566,6 +1578,7 @@ public class LineLayoutManager extends I
     }
 
     /** {@inheritDoc} */
+    @Override
     public void addChildArea(Area childArea) {
         // Make sure childArea is inline area
         if (childArea instanceof InlineArea) {
@@ -1581,16 +1594,19 @@ public class LineLayoutManager extends I
     // --------- Property Resolution related functions --------- //
 
     /** {@inheritDoc} */
+    @Override
     public boolean getGeneratesBlockArea() {
         return true;
     }
 
     /** {@inheritDoc} */
+    @Override
     public boolean getGeneratesLineArea() {
         return true;
     }
 
     /** {@inheritDoc} */
+    @Override
     public boolean isRestartable() {
         return true;
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFResources.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFResources.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFResources.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFResources.java Fri Nov 26 13:40:27 2010
@@ -98,11 +98,9 @@ public class PDFResources extends PDFObj
      * @param fontInfo font info object to get font information from
      */
    public void addFonts(PDFDocument doc, FontInfo fontInfo) {
-        Map usedFonts = fontInfo.getUsedFonts();
-        Iterator e = usedFonts.keySet().iterator();
-        while (e.hasNext()) {
-            String f = (String)e.next();
-            Typeface font = (Typeface)usedFonts.get(f);
+        Map<String, Typeface> usedFonts = fontInfo.getUsedFonts();
+        for (String f : usedFonts.keySet()) {
+            Typeface font = usedFonts.get(f);
 
             //Check if the font actually had any mapping operations. If not, it is an indication
             //that it has never actually been used and therefore doesn't have to be embedded.
@@ -196,6 +194,7 @@ public class PDFResources extends PDFObj
      * @return the PDF
      * {@inheritDoc}
      */
+    @Override
     public String toPDFString() {
         StringBuffer p = new StringBuffer(128);
         p.append(getObjectID() + "<<\n");

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRenderer.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRenderer.java Fri Nov 26 13:40:27 2010
@@ -30,6 +30,7 @@ import org.apache.fop.apps.FOPException;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Trait;
 import org.apache.fop.fonts.CustomFontCollection;
+import org.apache.fop.fonts.EmbedFontInfo;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontCollection;
 import org.apache.fop.fonts.FontInfo;
@@ -48,13 +49,13 @@ public abstract class PrintRenderer exte
     protected FontResolver fontResolver = null;
 
     /** list of fonts */
-    protected List/*<EmbedFontInfo>*/ embedFontInfoList = null;
+    protected List<EmbedFontInfo> embedFontInfoList = null;
 
     /**
      * Adds a font list to current list of fonts
      * @param fontList a font info list
      */
-    public void addFontList(List/*<EmbedFontInfo>*/ fontList) {
+    public void addFontList(List<EmbedFontInfo> fontList) {
         if (embedFontInfoList == null) {
             setFontList(fontList);
         } else {
@@ -65,14 +66,14 @@ public abstract class PrintRenderer exte
     /**
      * @param embedFontInfoList list of available fonts
      */
-    public void setFontList(List/*<EmbedFontInfo>*/ embedFontInfoList) {
+    public void setFontList(List<EmbedFontInfo> embedFontInfoList) {
         this.embedFontInfoList = embedFontInfoList;
     }
 
     /**
      * @return list of available embedded fonts
      */
-    public List/*<EmbedFontInfo>*/ getFontList() {
+    public List<EmbedFontInfo> getFontList() {
         return this.embedFontInfoList;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRendererConfigurator.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRendererConfigurator.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRendererConfigurator.java Fri Nov 26 13:40:27 2010
@@ -19,6 +19,7 @@
 
 package org.apache.fop.render;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.avalon.framework.configuration.Configuration;
@@ -76,7 +77,7 @@ public class PrintRendererConfigurator e
 
         FontEventListener listener = new FontEventAdapter(
                 renderer.getUserAgent().getEventBroadcaster());
-        List/*<EmbedFontInfo>*/ embedFontInfoList = buildFontList(cfg, fontResolver, listener);
+        List<EmbedFontInfo> embedFontInfoList = buildFontList(cfg, fontResolver, listener);
         printRenderer.addFontList(embedFontInfoList);
     }
 
@@ -88,7 +89,7 @@ public class PrintRendererConfigurator e
      * @return the list of {@link EmbedFontInfo} objects
      * @throws FOPException if an error occurs while processing the configuration
      */
-    protected List/*<EmbedFontInfo>*/ buildFontList(Configuration cfg, FontResolver fontResolver,
+    protected List<EmbedFontInfo> buildFontList(Configuration cfg, FontResolver fontResolver,
                     FontEventListener listener) throws FOPException {
         FopFactory factory = userAgent.getFactory();
         FontManager fontManager = factory.getFontManager();
@@ -102,7 +103,7 @@ public class PrintRendererConfigurator e
         //Read font configuration
         FontInfoConfigurator fontInfoConfigurator
             = new FontInfoConfigurator(cfg, fontManager, fontResolver, listener, strict);
-        List/*<EmbedFontInfo>*/ fontInfoList = new java.util.ArrayList/*<EmbedFontInfo>*/();
+        List<EmbedFontInfo> fontInfoList = new ArrayList<EmbedFontInfo>();
         fontInfoConfigurator.configure(fontInfoList);
         return fontInfoList;
     }
@@ -118,7 +119,7 @@ public class PrintRendererConfigurator e
     public void setupFontInfo(IFDocumentHandler documentHandler, FontInfo fontInfo)
                 throws FOPException {
         FontManager fontManager = userAgent.getFactory().getFontManager();
-        List fontCollections = new java.util.ArrayList();
+        List<FontCollection> fontCollections = new ArrayList<FontCollection>();
         fontCollections.add(new Base14FontCollection(fontManager.isBase14KerningEnabled()));
 
         Configuration cfg = super.getRendererConfig(documentHandler.getMimeType());
@@ -126,7 +127,7 @@ public class PrintRendererConfigurator e
             FontResolver fontResolver = new DefaultFontResolver(userAgent);
             FontEventListener listener = new FontEventAdapter(
                     userAgent.getEventBroadcaster());
-            List fontList = buildFontList(cfg, fontResolver, listener);
+            List<EmbedFontInfo> fontList = buildFontList(cfg, fontResolver, listener);
             fontCollections.add(new CustomFontCollection(fontResolver, fontList));
         }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPPainter.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPPainter.java Fri Nov 26 13:40:27 2010
@@ -30,11 +30,6 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Map;
 
-import org.w3c.dom.Document;
-
-import org.apache.xmlgraphics.image.loader.ImageProcessingHints;
-import org.apache.xmlgraphics.image.loader.ImageSessionContext;
-
 import org.apache.fop.afp.AFPBorderPainter;
 import org.apache.fop.afp.AFPPaintingState;
 import org.apache.fop.afp.AFPUnitConverter;
@@ -55,6 +50,7 @@ import org.apache.fop.afp.util.ResourceA
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontTriplet;
+import org.apache.fop.fonts.Typeface;
 import org.apache.fop.render.RenderingContext;
 import org.apache.fop.render.intermediate.AbstractIFPainter;
 import org.apache.fop.render.intermediate.BorderPainter;
@@ -64,6 +60,9 @@ import org.apache.fop.render.intermediat
 import org.apache.fop.traits.BorderProps;
 import org.apache.fop.traits.RuleStyle;
 import org.apache.fop.util.CharUtilities;
+import org.apache.xmlgraphics.image.loader.ImageProcessingHints;
+import org.apache.xmlgraphics.image.loader.ImageSessionContext;
+import org.w3c.dom.Document;
 
 /**
  * IFPainter implementation that produces AFP (MO:DCA).
@@ -76,12 +75,12 @@ public class AFPPainter extends Abstract
     private static final int X = 0;
     private static final int Y = 1;
 
-    private AFPDocumentHandler documentHandler;
+    private final AFPDocumentHandler documentHandler;
 
     /** the border painter */
-    private AFPBorderPainterAdapter borderPainter;
+    private final AFPBorderPainterAdapter borderPainter;
     /** the rectangle painter */
-    private AbstractAFPPainter rectanglePainter;
+    private final AbstractAFPPainter rectanglePainter;
 
     /** unit converter */
     private final AFPUnitConverter unitConv;
@@ -101,6 +100,7 @@ public class AFPPainter extends Abstract
     }
 
     /** {@inheritDoc} */
+    @Override
     protected IFContext getContext() {
         return this.documentHandler.getContext();
     }
@@ -165,6 +165,7 @@ public class AFPPainter extends Abstract
     }
 
     /** {@inheritDoc} */
+    @Override
     protected Map createDefaultImageProcessingHints(ImageSessionContext sessionContext) {
         Map hints = super.createDefaultImageProcessingHints(sessionContext);
 
@@ -175,6 +176,7 @@ public class AFPPainter extends Abstract
     }
 
     /** {@inheritDoc} */
+    @Override
     protected RenderingContext createRenderingContext() {
         AFPRenderingContext psContext = new AFPRenderingContext(
                 getUserAgent(),
@@ -256,6 +258,7 @@ public class AFPPainter extends Abstract
     }
 
     /** {@inheritDoc} */
+    @Override
     public void drawBorderRect(Rectangle rect, BorderProps before, BorderProps after,
             BorderProps start, BorderProps end) throws IFException {
         if (before != null || after != null || start != null || end != null) {
@@ -271,32 +274,38 @@ public class AFPPainter extends Abstract
     //and this one. Not done for now to avoid a lot of re-implementation and code duplication.
     private static class AFPBorderPainterAdapter extends BorderPainter {
 
-        private AFPBorderPainter delegate;
+        private final AFPBorderPainter delegate;
 
         public AFPBorderPainterAdapter(AFPBorderPainter borderPainter) {
             this.delegate = borderPainter;
         }
 
+        @Override
         protected void clip() throws IOException {
             //not supported by AFP
         }
 
+        @Override
         protected void closePath() throws IOException {
             //used for clipping only, so not implemented
         }
 
+        @Override
         protected void moveTo(int x, int y) throws IOException {
             //used for clipping only, so not implemented
         }
 
+        @Override
         protected void lineTo(int x, int y) throws IOException {
             //used for clipping only, so not implemented
         }
 
+        @Override
         protected void saveGraphicsState() throws IOException {
             //used for clipping only, so not implemented
         }
 
+        @Override
         protected void restoreGraphicsState() throws IOException {
             //used for clipping only, so not implemented
         }
@@ -305,6 +314,7 @@ public class AFPPainter extends Abstract
             return mpt / 1000f;
         }
 
+        @Override
         protected void drawBorderLine(                           // CSOK: ParameterNumber
                 int x1, int y1, int x2, int y2, boolean horz,
                 boolean startOrBefore, int style, Color color) throws IOException {
@@ -314,6 +324,7 @@ public class AFPPainter extends Abstract
             delegate.paint(borderPaintInfo);
         }
 
+        @Override
         public void drawLine(Point start, Point end, int width, Color color, RuleStyle style)
                 throws IOException {
             if (start.y != end.y) {
@@ -331,6 +342,7 @@ public class AFPPainter extends Abstract
     }
 
     /** {@inheritDoc} */
+    @Override
     public void drawLine(Point start, Point end, int width, Color color, RuleStyle style)
                 throws IFException {
         try {
@@ -357,7 +369,7 @@ public class AFPPainter extends Abstract
         }
 
         // register font as necessary
-        Map/*<String,FontMetrics>*/ fontMetricMap = documentHandler.getFontInfo().getFonts();
+        Map<String, Typeface> fontMetricMap = documentHandler.getFontInfo().getFonts();
         final AFPFont afpFont = (AFPFont)fontMetricMap.get(fontKey);
         final Font font = getFontInfo().getFontInstance(triplet, fontSize);
         AFPPageFonts pageFonts = getPaintingState().getPageFonts();

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java Fri Nov 26 13:40:27 2010
@@ -95,7 +95,7 @@ public class ConfiguredFontCollection im
 
                 fontInfo.addMetrics(internalName, font);
 
-                List triplets = configFontInfo.getFontTriplets();
+                List<FontTriplet> triplets = configFontInfo.getFontTriplets();
                 for (int c = 0; c < triplets.size(); c++) {
                     FontTriplet triplet = (FontTriplet) triplets.get(c);
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java Fri Nov 26 13:40:27 2010
@@ -161,7 +161,7 @@ public class CustomFontMetricsMapper ext
     }
 
     /** {@inheritDoc} */
-    public final Set getFamilyNames() {
+    public final Set<String> getFamilyNames() {
         return typeface.getFamilyNames();
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/FontResourceCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/FontResourceCache.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/FontResourceCache.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/FontResourceCache.java Fri Nov 26 13:40:27 2010
@@ -21,18 +21,17 @@ package org.apache.fop.render.ps;
 
 import java.util.Map;
 
-import org.apache.xmlgraphics.ps.PSResource;
-
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.LazyFont;
 import org.apache.fop.fonts.Typeface;
+import org.apache.xmlgraphics.ps.PSResource;
 
 /**
  * A cache for font resource objects.
  */
 class FontResourceCache {
 
-    private FontInfo fontInfo;
+    private final FontInfo fontInfo;
 
     /** This is a map of PSResource instances of all fonts defined (key: font key) */
     private Map fontResources = new java.util.HashMap();
@@ -67,8 +66,8 @@ class FontResourceCache {
             postFix = key.substring(pos);
             key = key.substring(0, pos);
         }
-        Map fonts = fontInfo.getFonts();
-        Typeface tf = (Typeface)fonts.get(key);
+        Map<String, Typeface> fonts = fontInfo.getFonts();
+        Typeface tf = fonts.get(key);
         if (tf instanceof LazyFont) {
             tf = ((LazyFont)tf).getRealFont();
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontUtils.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontUtils.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontUtils.java Fri Nov 26 13:40:27 2010
@@ -23,7 +23,6 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
-import java.util.Iterator;
 import java.util.Map;
 
 import javax.xml.transform.Source;
@@ -31,13 +30,6 @@ import javax.xml.transform.stream.Stream
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import org.apache.xmlgraphics.fonts.Glyphs;
-import org.apache.xmlgraphics.ps.DSCConstants;
-import org.apache.xmlgraphics.ps.PSGenerator;
-import org.apache.xmlgraphics.ps.PSResource;
-import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
-
 import org.apache.fop.fonts.Base14Font;
 import org.apache.fop.fonts.CustomFont;
 import org.apache.fop.fonts.Font;
@@ -47,6 +39,11 @@ import org.apache.fop.fonts.LazyFont;
 import org.apache.fop.fonts.SingleByteEncoding;
 import org.apache.fop.fonts.SingleByteFont;
 import org.apache.fop.fonts.Typeface;
+import org.apache.xmlgraphics.fonts.Glyphs;
+import org.apache.xmlgraphics.ps.DSCConstants;
+import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.ps.PSResource;
+import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
 
 /**
  * Utility code for font handling in PostScript.
@@ -80,7 +77,8 @@ public class PSFontUtils extends org.apa
      * @return a Map of PSResource instances representing all defined fonts (key: font key)
      * @throws IOException in case of an I/O problem
      */
-    public static Map writeFontDict(PSGenerator gen, FontInfo fontInfo, Map fonts)
+    public static Map writeFontDict(PSGenerator gen, FontInfo fontInfo,
+            Map<String, Typeface> fonts)
                 throws IOException {
         return writeFontDict(gen, fontInfo, fonts, false);
     }
@@ -95,14 +93,12 @@ public class PSFontUtils extends org.apa
      * @return a Map of PSResource instances representing all defined fonts (key: font key)
      * @throws IOException in case of an I/O problem
      */
-    private static Map writeFontDict(PSGenerator gen, FontInfo fontInfo, Map fonts,
-            boolean encodeAllCharacters) throws IOException {
+    private static Map writeFontDict(PSGenerator gen, FontInfo fontInfo,
+            Map<String, Typeface> fonts, boolean encodeAllCharacters) throws IOException {
         gen.commentln("%FOPBeginFontDict");
 
         Map fontResources = new java.util.HashMap();
-        Iterator iter = fonts.keySet().iterator();
-        while (iter.hasNext()) {
-            String key = (String)iter.next();
+        for (String key : fonts.keySet()) {
             Typeface tf = getTypeFace(fontInfo, fonts, key);
             PSResource fontRes = new PSResource(PSResource.TYPE_FONT, tf.getFontName());
             fontResources.put(key, fontRes);
@@ -130,7 +126,8 @@ public class PSFontUtils extends org.apa
         return fontResources;
     }
 
-    private static void reencodeFonts(PSGenerator gen, Map fonts) throws IOException {
+    private static void reencodeFonts(PSGenerator gen, Map<String, Typeface> fonts)
+            throws IOException {
         ResourceTracker tracker = gen.getResourceTracker();
 
         if (!tracker.isResourceSupplied(WINANSI_ENCODING_RESOURCE)) {
@@ -140,10 +137,8 @@ public class PSFontUtils extends org.apa
         gen.commentln("%FOPBeginFontReencode");
 
         //Rewrite font encodings
-        Iterator iter = fonts.keySet().iterator();
-        while (iter.hasNext()) {
-            String key = (String)iter.next();
-            Typeface tf = (Typeface)fonts.get(key);
+        for (String key : fonts.keySet()) {
+            Typeface tf = fonts.get(key);
             if (tf instanceof LazyFont) {
                 tf = ((LazyFont)tf).getRealFont();
                 if (tf == null) {
@@ -172,8 +167,9 @@ public class PSFontUtils extends org.apa
         gen.commentln("%FOPEndFontReencode");
     }
 
-    private static Typeface getTypeFace(FontInfo fontInfo, Map fonts, String key) {
-        Typeface tf = (Typeface)fonts.get(key);
+    private static Typeface getTypeFace(FontInfo fontInfo, Map<String, Typeface> fonts,
+            String key) {
+        Typeface tf = fonts.get(key);
         if (tf instanceof LazyFont) {
             tf = ((LazyFont)tf).getRealFont();
         }
@@ -181,7 +177,7 @@ public class PSFontUtils extends org.apa
             //This is to avoid an NPE if a malconfigured font is in the configuration but not
             //used in the document. If it were used, we wouldn't get this far.
             String fallbackKey = fontInfo.getInternalFontKey(Font.DEFAULT_FONT);
-            tf = (Typeface)fonts.get(fallbackKey);
+            tf = fonts.get(fallbackKey);
         }
         return tf;
     }
@@ -271,11 +267,9 @@ public class PSFontUtils extends org.apa
      * @return a Map of PSResource instances representing all defined fonts (key: font key)
      */
     public static Map determineSuppliedFonts(ResourceTracker resTracker,
-            FontInfo fontInfo, Map fonts) {
+            FontInfo fontInfo, Map<String, Typeface> fonts) {
         Map fontResources = new java.util.HashMap();
-        Iterator iter = fonts.keySet().iterator();
-        while (iter.hasNext()) {
-            String key = (String)iter.next();
+        for (String key : fonts.keySet()) {
             Typeface tf = getTypeFace(fontInfo, fonts, key);
             PSResource fontRes = new PSResource("font", tf.getFontName());
             fontResources.put(key, fontRes);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/fontlist/FontSpec.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/fontlist/FontSpec.java?rev=1039350&r1=1039349&r2=1039350&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/fontlist/FontSpec.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/fontlist/FontSpec.java Fri Nov 26 13:40:27 2010
@@ -22,6 +22,7 @@ package org.apache.fop.tools.fontlist;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.SortedSet;
+import java.util.TreeSet;
 
 import org.apache.fop.fonts.FontMetrics;
 import org.apache.fop.fonts.FontTriplet;
@@ -33,8 +34,8 @@ public class FontSpec implements Compara
 
     private String key;
     private FontMetrics metrics;
-    private SortedSet familyNames = new java.util.TreeSet();
-    private Collection triplets = new java.util.TreeSet();
+    private SortedSet<String> familyNames = new TreeSet<String>();
+    private Collection triplets = new TreeSet();
 
     /**
      * Creates a new font spec.
@@ -50,7 +51,7 @@ public class FontSpec implements Compara
      * Adds font family names.
      * @param names the names
      */
-    public void addFamilyNames(Collection names) {
+    public void addFamilyNames(Collection<String> names) {
         this.familyNames.addAll(names);
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org