]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
* Provide warning message if no "any" font family is configured.
authorAdrian Cumiskey <acumiskey@apache.org>
Tue, 29 Jul 2008 17:14:25 +0000 (17:14 +0000)
committerAdrian Cumiskey <acumiskey@apache.org>
Tue, 29 Jul 2008 17:14:25 +0000 (17:14 +0000)
* When no configuration is provided, the fallback "any" base 12 font mapping is to "Times" (so as to be consistent) with the base 14 fonts and not Helvetica (as previously).

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@680777 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/afp/AFPEventProducer.java
src/java/org/apache/fop/render/afp/AFPEventProducer.xml
src/java/org/apache/fop/render/afp/fonts/AFPBase12FontCollection.java
src/java/org/apache/fop/render/afp/fonts/AFPFontCollection.java

index 08641b20e58dee69431fa3f2c1d52e4dae5b0106..28d93cf6566b80ff2b2697ac3ed3129ef5113c1c 100644 (file)
@@ -60,4 +60,12 @@ public interface AFPEventProducer extends EventProducer {
      */
     void warnDefaultFontSetup(Object source);
 
+    /**
+     * Warn about a missing default "any" font configuration.
+     * @param source the event source
+     * @param style the font style
+     * @param weight the font weight
+     * @event.severity WARN
+     */
+    void warnMissingDefaultFont(Object source, String style, int weight);
 }
index 8eec9b6567f5f6c985b3ede2db492e1c8e468174..31ce19a658b555d04acc947b9940ba2e338e1539 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <catalogue xml:lang="en">
   <message key="org.apache.fop.render.afp.AFPEventProducer.warnDefaultFontSetup">No AFP fonts configured. Using default setup.</message>
+  <message key="org.apache.fop.render.afp.AFPEventProducer.warnMissingDefaultFont">No AFP default "any", {style}, {weight} font configured.</message>
 </catalogue>
index e0d56f31bed7557452262a5d8ccedc96d3a8ba32..9157b9083238587bb71190429f2c3a9aeac0df26 100644 (file)
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id$ */
+/* $Id$ */
 
 package org.apache.fop.render.afp.fonts;
 
@@ -79,13 +79,12 @@ public class AFPBase12FontCollection implements FontCollection {
         RasterFont font = null;
 
         /** standard font family reference names for Helvetica font */
-        final String[] helveticaNamesPlusAny = {"Helvetica", "Arial", "sans-serif", "any"};
+        final String[] helveticaNames = {"Helvetica", "Arial", "sans-serif"};
         font = new RasterFont("Helvetica");
         addCharacterSet(font, "C0H200", new Helvetica());
-        num = addFontProperties(fontInfo, font, helveticaNamesPlusAny,
+        num = addFontProperties(fontInfo, font, helveticaNames,
                 Font.STYLE_NORMAL, Font.WEIGHT_NORMAL, num);
 
-        final String[] helveticaNames = {"Helvetica", "Arial", "sans-serif"};
         font = new RasterFont("Helvetica Italic");
         addCharacterSet(font, "C0H300", new HelveticaOblique());
         num = addFontProperties(fontInfo, font, helveticaNames,
@@ -102,8 +101,11 @@ public class AFPBase12FontCollection implements FontCollection {
                 Font.STYLE_ITALIC, Font.WEIGHT_BOLD, num);
 
 
+        /** standard font family reference names for Times font */
+
+        /** any is treated as serif */
         final String[] timesNames = {"Times", "TimesRoman", "Times Roman", "Times-Roman",
-                "Times New Roman", "TimesNewRoman", "serif"};
+                "Times New Roman", "TimesNewRoman", "serif", "any"};
 
         font = new RasterFont("Times Roman");
         addCharacterSet(font, "CON200", new TimesRoman());
index 9b8c52cdb43dfa364304d53f8f070c268b99c92c..540ee3b49ad308ad8c66fc6ce3c75a055b75509d 100644 (file)
@@ -23,6 +23,7 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.fop.events.EventBroadcaster;
+import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontCollection;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontTriplet;
@@ -52,6 +53,7 @@ public class AFPFontCollection implements FontCollection {
     /** {@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();
@@ -65,8 +67,19 @@ public class AFPFontCollection implements FontCollection {
                     num++;
                 }
             }
+            if (fontInfo.fontLookup("any", Font.STYLE_NORMAL, Font.WEIGHT_NORMAL) == null) {
+                eventProducer.warnMissingDefaultFont(this, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
+            }
+            if (fontInfo.fontLookup("any", Font.STYLE_ITALIC, Font.WEIGHT_NORMAL) == null) {
+                eventProducer.warnMissingDefaultFont(this, Font.STYLE_ITALIC, Font.WEIGHT_NORMAL);
+            }
+            if (fontInfo.fontLookup("any", Font.STYLE_NORMAL, Font.WEIGHT_BOLD) == null) {
+                eventProducer.warnMissingDefaultFont(this, Font.STYLE_ITALIC, Font.WEIGHT_BOLD);
+            }
+            if (fontInfo.fontLookup("any", Font.STYLE_ITALIC, Font.WEIGHT_BOLD) == null) {
+                eventProducer.warnMissingDefaultFont(this, Font.STYLE_ITALIC, Font.WEIGHT_BOLD);
+            }
         } else {
-            AFPEventProducer eventProducer = AFPEventProducer.Provider.get(eventBroadcaster);
             eventProducer.warnDefaultFontSetup(this);
 
             // Go with a default base 12 configuration for AFP environments