/**
* 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;
+++ /dev/null
-/*
- * $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;
- }
-
-}
-
* Get the generated font object
* @return the font
*/
- public Font getFont() {
+ public Typeface getFont() {
return returnFont;
}
/**
* 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;
/**
* Gets the real font.
* @return the real font
*/
- public Font getRealFont() {
+ public Typeface getRealFont() {
load();
return realFont;
}
--- /dev/null
+/*
+ * $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;
+ }
+
+}
+
*/
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
// 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;
+ 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(
// 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;
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;
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;
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" : "(";
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;
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");
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!
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;
* @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");
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;
// 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;