]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
move fonts.Font to fonts.Typeface (in preparation for moving layout.FontState to...
authorWilliam Victor Mote <vmote@apache.org>
Thu, 14 Aug 2003 14:59:56 +0000 (14:59 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Thu, 14 Aug 2003 14:59:56 +0000 (14:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196799 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
src/java/org/apache/fop/fonts/CustomFont.java
src/java/org/apache/fop/fonts/Font.java [deleted file]
src/java/org/apache/fop/fonts/FontReader.java
src/java/org/apache/fop/fonts/LazyFont.java
src/java/org/apache/fop/fonts/Typeface.java [new file with mode: 0644]
src/java/org/apache/fop/layout/FontState.java
src/java/org/apache/fop/pdf/PDFFactory.java
src/java/org/apache/fop/render/pdf/FontSetup.java
src/java/org/apache/fop/render/pdf/PDFRenderer.java
src/java/org/apache/fop/render/ps/PSProcSets.java
src/java/org/apache/fop/render/ps/PSRenderer.java
src/java/org/apache/fop/svg/PDFGraphics2D.java

index 80863b373e02def219f12250da9edd6cc18661c9..959bcfd91d4cff61933565c625736f2695e762fb 100644 (file)
@@ -56,7 +56,7 @@ import java.util.Map;
 /**
  * Abstract base class for custom fonts loaded from files, for example.
  */
-public abstract class CustomFont extends Font
+public abstract class CustomFont extends Typeface
             implements FontDescriptor, MutableFont {
 
     private String fontName = null;
diff --git a/src/java/org/apache/fop/fonts/Font.java b/src/java/org/apache/fop/fonts/Font.java
deleted file mode 100644 (file)
index 3d0b2ed..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * $Id: Font.java,v 1.2 2003/03/06 17:43:05 jeremias Exp $
- * ============================================================================
- *                    The Apache Software License, Version 1.1
- * ============================================================================
- * 
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modifica-
- * tion, are permitted provided that the following conditions are met:
- * 
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 
- * 3. The end-user documentation included with the redistribution, if any, must
- *    include the following acknowledgment: "This product includes software
- *    developed by the Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself, if
- *    and wherever such third-party acknowledgments normally appear.
- * 
- * 4. The names "FOP" and "Apache Software Foundation" must not be used to
- *    endorse or promote products derived from this software without prior
- *    written permission. For written permission, please contact
- *    apache@apache.org.
- * 
- * 5. Products derived from this software may not be called "Apache", nor may
- *    "Apache" appear in their name, without prior written permission of the
- *    Apache Software Foundation.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * ============================================================================
- * 
- * This software consists of voluntary contributions made by many individuals
- * on behalf of the Apache Software Foundation and was originally created by
- * James Tauber <jtauber@jtauber.com>. For more information on the Apache
- * Software Foundation, please see <http://www.apache.org/>.
- */ 
-package org.apache.fop.fonts;
-
-// FOP
-
-
-/**
- * Base class for PDF font classes
- */
-public abstract class Font implements FontMetrics {
-
-    /**
-     * Get the encoding of the font.
-     * @return the encoding
-     */
-    public abstract String getEncoding();
-
-    /**
-     * Map a Unicode character to a code point in the font.
-     * @param c character to map
-     * @return the mapped character
-     */
-    public abstract char mapChar(char c);
-
-    /**
-     * Determines whether the font is a multibyte font.
-     * @return True if it is multibyte
-     */
-    public boolean isMultiByte() {
-        return false;
-    }
-
-}
-
index 6af3e9523219675517ab160447beea23142c9032..f6df614185a1eab7c348d7ea0e2da0abfc3fe12c 100644 (file)
@@ -148,7 +148,7 @@ public class FontReader extends DefaultHandler {
      * Get the generated font object
      * @return the font
      */
-    public Font getFont() {
+    public Typeface getFont() {
         return returnFont;
     }
 
index b18af07dcda4a8285fec60a35441d392fb52ae3e..f37aa75ecdf716a89a6e1ce45b545023e79ac2c2 100644 (file)
@@ -59,14 +59,14 @@ import java.util.Map;
 /**
  * This class is used to defer the loading of a font until it is really used.
  */
-public class LazyFont extends Font implements FontDescriptor {
+public class LazyFont extends Typeface implements FontDescriptor {
 
     private String metricsFileName = null;
     private String fontEmbedPath = null;
     private boolean useKerning = false;
 
     private boolean isMetricsLoaded = false;
-    private Font realFont = null;
+    private Typeface realFont = null;
     private FontDescriptor realFontDescriptor = null;
 
     /**
@@ -109,7 +109,7 @@ public class LazyFont extends Font implements FontDescriptor {
      * Gets the real font.
      * @return the real font
      */
-    public Font getRealFont() {
+    public Typeface getRealFont() {
         load();
         return realFont;
     }
diff --git a/src/java/org/apache/fop/fonts/Typeface.java b/src/java/org/apache/fop/fonts/Typeface.java
new file mode 100644 (file)
index 0000000..1e4f2af
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * $Id$
+ * ============================================================================
+ *                    The Apache Software License, Version 1.1
+ * ============================================================================
+ * 
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ * 
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 
+ * 3. The end-user documentation included with the redistribution, if any, must
+ *    include the following acknowledgment: "This product includes software
+ *    developed by the Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself, if
+ *    and wherever such third-party acknowledgments normally appear.
+ * 
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ *    endorse or promote products derived from this software without prior
+ *    written permission. For written permission, please contact
+ *    apache@apache.org.
+ * 
+ * 5. Products derived from this software may not be called "Apache", nor may
+ *    "Apache" appear in their name, without prior written permission of the
+ *    Apache Software Foundation.
+ * 
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ * 
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */ 
+package org.apache.fop.fonts;
+
+// FOP
+
+
+/**
+ * Base class for PDF font classes
+ */
+public abstract class Typeface implements FontMetrics {
+
+    /**
+     * Get the encoding of the font.
+     * @return the encoding
+     */
+    public abstract String getEncoding();
+
+    /**
+     * Map a Unicode character to a code point in the font.
+     * @param c character to map
+     * @return the mapped character
+     */
+    public abstract char mapChar(char c);
+
+    /**
+     * Determines whether the font is a multibyte font.
+     * @return True if it is multibyte
+     */
+    public boolean isMultiByte() {
+        return false;
+    }
+
+}
+
index 316675ca8eba021bcc4589abf63cf8a98aeb4005..2414a2a2567bce64b79203ed004f8a1bbec127e2 100644 (file)
@@ -165,8 +165,8 @@ public class FontState {
      */
     public char mapChar(char c) {
 
-        if (metric instanceof org.apache.fop.fonts.Font) {
-            return ((org.apache.fop.fonts.Font)metric).mapChar(c);
+        if (metric instanceof org.apache.fop.fonts.Typeface) {
+            return ((org.apache.fop.fonts.Typeface)metric).mapChar(c);
         }
 
         // Use default CodePointMapping
index cab819d760326b739631fb310d27ae2d4f7a30c4..45791a5493ebc5ecd7b559d4fbd1ec579a9c4663 100644 (file)
@@ -64,7 +64,7 @@ import org.apache.commons.io.IOUtil;
 // FOP
 import org.apache.fop.fonts.CIDFont;
 import org.apache.fop.fonts.CustomFont;
-import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.Typeface;
 import org.apache.fop.fonts.FontDescriptor;
 import org.apache.fop.fonts.FontMetrics;
 import org.apache.fop.fonts.FontType;
@@ -1102,11 +1102,11 @@ public class PDFFactory {
                                                 + desc.getFontType());
         } 
         
-        Font tempFont;
+        Typeface tempFont;
         if (desc instanceof LazyFont) {
             tempFont = ((LazyFont)desc).getRealFont();
         } else {
-            tempFont = (Font)desc;
+            tempFont = (Typeface)desc;
         }
         if (!(tempFont instanceof CustomFont)) {
             throw new IllegalArgumentException(
index 7687328d9387e3f6b514d59b745243b37614fedc..3d30f6c8cb0902cb11b8653689cb7f057ba8da60 100644 (file)
@@ -53,7 +53,7 @@ package org.apache.fop.render.pdf;
 // FOP
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.Typeface;
 import org.apache.fop.fonts.FontDescriptor;
 import org.apache.fop.fonts.FontUtil;
 import org.apache.fop.fonts.LazyFont;
@@ -253,7 +253,7 @@ public class FontSetup {
         Iterator e = fonts.keySet().iterator();
         while (e.hasNext()) {
             String f = (String)e.next();
-            Font font = (Font)fonts.get(f);
+            Typeface font = (Typeface)fonts.get(f);
             FontDescriptor desc = null;
             if (font instanceof FontDescriptor) {
                 desc = (FontDescriptor)font;
index 2850be8c64645b2684f791def54f5b6f9b27d70d..8b469f6e23a92de25c7ef90f23df1e57e9577635 100644 (file)
@@ -77,7 +77,7 @@ import org.apache.fop.apps.FOPException;
 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.Font;
+import org.apache.fop.fonts.Typeface;
 import org.apache.fop.fonts.FontMetrics;
 import org.apache.fop.pdf.PDFEncryptionManager;
 import org.apache.fop.pdf.PDFFilterList;
@@ -867,7 +867,7 @@ public class PDFRenderer extends PrintRenderer {
         int size = ((Integer) word.getTrait(Trait.FONT_SIZE)).intValue();
 
         // This assumes that *all* CIDFonts use a /ToUnicode mapping
-        Font f = (Font) fontInfo.getFonts().get(name);
+        Typeface f = (Typeface) fontInfo.getFonts().get(name);
         boolean useMultiByte = f.isMultiByte();
 
         // String startText = useMultiByte ? "<FEFF" : "(";
index dadfaae199821d3e697aa426f57d9ae68f432307..b5f19267caf7470af503f7309e2cd5e33548e6a1 100644 (file)
@@ -54,7 +54,7 @@ import java.io.IOException;
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.Typeface;
 import org.apache.fop.fonts.Glyphs;
 import org.apache.fop.control.Document;
 
@@ -221,7 +221,7 @@ public final class PSProcSets {
         Iterator enum = fonts.keySet().iterator();
         while (enum.hasNext()) {
             String key = (String)enum.next();
-            Font fm = (Font)fonts.get(key);
+            Typeface fm = (Typeface)fonts.get(key);
             gen.writeln("/" + key + " /" + fm.getFontName() + " def");
         }
         gen.writeln("end def");
@@ -232,7 +232,7 @@ public final class PSProcSets {
         enum = fonts.keySet().iterator();
         while (enum.hasNext()) {
             String key = (String)enum.next();
-            Font fm = (Font)fonts.get(key);
+            Typeface fm = (Typeface)fonts.get(key);
             if (null == fm.getEncoding()) {
                 //ignore (ZapfDingbats and Symbol run through here
                 //TODO: ZapfDingbats and Symbol should get getEncoding() fixed!
index 180bb766f3a0ae4deed53520e3ec776b283d4059..5182bcfcca329eb6b30cb0f2f63d8128cede4139 100644 (file)
@@ -72,7 +72,7 @@ import org.apache.fop.area.inline.ForeignObject;
 import org.apache.fop.area.inline.Word;
 import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.fo.FOUserAgent;
-import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.Typeface;
 import org.apache.fop.control.Document;
 import org.apache.fop.render.AbstractRenderer;
 import org.apache.fop.render.RendererContext;
@@ -445,7 +445,7 @@ public class PSRenderer extends AbstractRenderer {
      * @param text Text to paint
      * @param font Font to use
      */
-    protected void paintText(int rx, int bl, String text, Font font) {
+    protected void paintText(int rx, int bl, String text, Typeface font) {
         saveGraphicsState();
         writeln("1 0 0 -1 " + rx + " " + bl + " Tm");
 
@@ -471,7 +471,7 @@ public class PSRenderer extends AbstractRenderer {
         int fontsize = area.getTraitAsInteger(Trait.FONT_SIZE);
 
         // This assumes that *all* CIDFonts use a /ToUnicode mapping
-        Font f = (Font)fontInfo.getFonts().get(fontname);
+        Typeface f = (Typeface)fontInfo.getFonts().get(fontname);
 
         //Determine position
         int rx = currentBlockIPPosition;
index 94329d619185de019ba6cacb691d410e8e1680b1..7a7bcf364638d74e6db4d97738e9f1d528ac8e1a 100644 (file)
@@ -1259,8 +1259,8 @@ public class PDFGraphics2D extends AbstractGraphics2D {
 
         // This assumes that *all* CIDFonts use a /ToUnicode mapping
         boolean useMultiByte = false;
-        org.apache.fop.fonts.Font f =
-            (org.apache.fop.fonts.Font)fontInfo.getFonts().get(name);
+        org.apache.fop.fonts.Typeface f =
+            (org.apache.fop.fonts.Typeface)fontInfo.getFonts().get(name);
         if (f instanceof LazyFont) {
             if (((LazyFont) f).getRealFont() instanceof CIDFont) {
                 useMultiByte = true;