aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/afp/fonts/AFPFontCollection.java
diff options
context:
space:
mode:
authorPeter Hancock <phancock@apache.org>2012-06-29 11:22:42 +0000
committerPeter Hancock <phancock@apache.org>2012-06-29 11:22:42 +0000
commit3e31e071ea47f37ef7f8749b324dfdfe76745d18 (patch)
tree7d3b646c521349634592b62556a8832ec082cc9c /src/java/org/apache/fop/afp/fonts/AFPFontCollection.java
parentae8a5035235e1262e412e1eacd0eb3adfaef83ef (diff)
parent015538e0f11f031e3d7bd05db8c29e2a40365678 (diff)
downloadxmlgraphics-fop-3e31e071ea47f37ef7f8749b324dfdfe76745d18.tar.gz
xmlgraphics-fop-3e31e071ea47f37ef7f8749b324dfdfe76745d18.zip
Merged trunk@1354651
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_RoundedCorners@1355321 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/afp/fonts/AFPFontCollection.java')
-rw-r--r--src/java/org/apache/fop/afp/fonts/AFPFontCollection.java36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/java/org/apache/fop/afp/fonts/AFPFontCollection.java b/src/java/org/apache/fop/afp/fonts/AFPFontCollection.java
index b7db6a74e..0854d04a1 100644
--- a/src/java/org/apache/fop/afp/fonts/AFPFontCollection.java
+++ b/src/java/org/apache/fop/afp/fonts/AFPFontCollection.java
@@ -19,7 +19,6 @@
package org.apache.fop.afp.fonts;
-import java.util.Iterator;
import java.util.List;
import org.apache.fop.afp.AFPEventProducer;
@@ -34,9 +33,9 @@ import org.apache.fop.fonts.FontTriplet;
*/
public class AFPFontCollection implements FontCollection {
- private final EventBroadcaster eventBroadcaster;
+ private final AFPEventProducer eventProducer;
- private final List/*<AFPFontInfo>*/ fontInfoList;
+ private final List<AFPFontInfo> fontInfoList;
/**
* Main constructor
@@ -44,49 +43,40 @@ public class AFPFontCollection implements FontCollection {
* @param eventBroadcaster the event broadcaster
* @param fontInfoList the font info list
*/
- public AFPFontCollection(EventBroadcaster eventBroadcaster,
- List/*<AFPFontInfo>*/ fontInfoList) {
- this.eventBroadcaster = eventBroadcaster;
+ public AFPFontCollection(EventBroadcaster eventBroadcaster, List<AFPFontInfo> fontInfoList) {
+ this.eventProducer = AFPEventProducer.Provider.get(eventBroadcaster);
this.fontInfoList = fontInfoList;
}
/** {@inheritDoc} */
public int setup(int start, FontInfo fontInfo) {
int num = 1;
- AFPEventProducer eventProducer = AFPEventProducer.Provider.get(eventBroadcaster);
if (fontInfoList != null && fontInfoList.size() > 0) {
- for (Iterator it = fontInfoList.iterator(); it.hasNext();) {
- AFPFontInfo afpFontInfo = (AFPFontInfo)it.next();
+ for (AFPFontInfo afpFontInfo : fontInfoList) {
AFPFont afpFont = afpFontInfo.getAFPFont();
- List/*<FontTriplet>*/ tripletList = afpFontInfo.getFontTriplets();
- for (Iterator it2 = tripletList.iterator(); it2.hasNext();) {
- FontTriplet triplet = (FontTriplet)it2.next();
+ List<FontTriplet> tripletList = afpFontInfo.getFontTriplets();
+ for (FontTriplet triplet : tripletList) {
fontInfo.addMetrics("F" + num, afpFont);
fontInfo.addFontProperties("F" + num,
triplet.getName(), triplet.getStyle(), triplet.getWeight());
num++;
}
}
- checkDefaultFontAvailable(fontInfo, eventProducer,
- Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
- checkDefaultFontAvailable(fontInfo, eventProducer,
- Font.STYLE_ITALIC, Font.WEIGHT_NORMAL);
- checkDefaultFontAvailable(fontInfo, eventProducer,
- Font.STYLE_NORMAL, Font.WEIGHT_BOLD);
- checkDefaultFontAvailable(fontInfo, eventProducer,
- Font.STYLE_ITALIC, Font.WEIGHT_BOLD);
+ checkDefaultFontAvailable(fontInfo, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
+ checkDefaultFontAvailable(fontInfo, Font.STYLE_ITALIC, Font.WEIGHT_NORMAL);
+ checkDefaultFontAvailable(fontInfo, Font.STYLE_NORMAL, Font.WEIGHT_BOLD);
+ checkDefaultFontAvailable(fontInfo, Font.STYLE_ITALIC, Font.WEIGHT_BOLD);
} else {
eventProducer.warnDefaultFontSetup(this);
// Go with a default base 12 configuration for AFP environments
- FontCollection base12FontCollection = new AFPBase12FontCollection();
+ FontCollection base12FontCollection = new AFPBase12FontCollection(eventProducer);
num = base12FontCollection.setup(num, fontInfo);
}
return num;
}
- private void checkDefaultFontAvailable(FontInfo fontInfo, AFPEventProducer eventProducer,
- String style, int weight) {
+ private void checkDefaultFontAvailable(FontInfo fontInfo, String style, int weight) {
if (!fontInfo.hasFont("any", style, weight)) {
eventProducer.warnMissingDefaultFont(this, style, weight);
}