From 7de2ca0a5e1d448e74afab46104f96f419d8da87 Mon Sep 17 00:00:00 2001 From: William Victor Mote Date: Thu, 14 Aug 2003 19:16:41 +0000 Subject: [PATCH] move font constants from control.Document to fonts.Font git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196802 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/control/Document.java | 38 ++--- src/java/org/apache/fop/fonts/Font.java | 29 ++-- .../org/apache/fop/render/awt/FontSetup.java | 139 ++++++++--------- .../org/apache/fop/render/pdf/FontSetup.java | 141 +++++++++--------- .../apache/fop/render/ps/PSTextPainter.java | 8 +- .../org/apache/fop/svg/PDFGraphics2D.java | 2 +- .../org/apache/fop/svg/PDFTextPainter.java | 8 +- .../org/apache/fop/tools/AreaTreeBuilder.java | 4 +- 8 files changed, 186 insertions(+), 183 deletions(-) diff --git a/src/java/org/apache/fop/control/Document.java b/src/java/org/apache/fop/control/Document.java index 396ab1cc9..364ba559d 100644 --- a/src/java/org/apache/fop/control/Document.java +++ b/src/java/org/apache/fop/control/Document.java @@ -3,34 +3,34 @@ * ============================================================================ * 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 @@ -42,18 +42,19 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.control; // Java import java.util.Map; // FOP +import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontMetrics; /** @@ -66,20 +67,13 @@ import org.apache.fop.fonts.FontMetrics; * implemented. */ public class Document { - - /** Default fallback key */ - public static final String DEFAULT_FONT = "any,normal,400"; - /** Normal font weight */ - public static final int NORMAL = 400; - /** Bold font weight */ - public static final int BOLD = 700; /** Map containing fonts that have been used */ private Map usedFonts; - + /** look up a font-triplet to find a font-name */ private Map triplets; - + /** look up a font-name to get a font (that implements FontMetrics at least) */ private Map fonts; @@ -93,12 +87,12 @@ public class Document { } /** - * Checks if the font setup is valid (At least the ultimate fallback font + * Checks if the font setup is valid (At least the ultimate fallback font * must be registered.) * @return True if valid */ public boolean isSetupValid() { - return triplets.containsKey(DEFAULT_FONT); + return triplets.containsKey(Font.DEFAULT_FONT); } /** @@ -165,7 +159,7 @@ public class Document { // then use default if (f == null) { - f = (String)triplets.get(DEFAULT_FONT); + f = (String)triplets.get(Font.DEFAULT_FONT); } } diff --git a/src/java/org/apache/fop/fonts/Font.java b/src/java/org/apache/fop/fonts/Font.java index a304be560..b23b58f72 100644 --- a/src/java/org/apache/fop/fonts/Font.java +++ b/src/java/org/apache/fop/fonts/Font.java @@ -3,34 +3,34 @@ * ============================================================================ * 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 @@ -42,12 +42,12 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fonts; import java.util.Map; @@ -56,11 +56,18 @@ import java.util.Map; /** - * This class holds font state information and provides access to the font + * This class holds font state information and provides access to the font * metrics. */ public class Font { + /** Default fallback key */ + public static final String DEFAULT_FONT = "any,normal,400"; + /** Normal font weight */ + public static final int NORMAL = 400; + /** Bold font weight */ + public static final int BOLD = 700; + private String fontName; private int fontSize; //private String fontFamily; diff --git a/src/java/org/apache/fop/render/awt/FontSetup.java b/src/java/org/apache/fop/render/awt/FontSetup.java index 5e4ec99aa..0bc24424d 100644 --- a/src/java/org/apache/fop/render/awt/FontSetup.java +++ b/src/java/org/apache/fop/render/awt/FontSetup.java @@ -3,34 +3,34 @@ * ============================================================================ * 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 @@ -42,16 +42,17 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.render.awt; // FOP import org.apache.fop.control.Document; +import org.apache.fop.fonts.Font; // Java import java.awt.Graphics2D; @@ -140,52 +141,52 @@ public class FontSetup { // fontInfo.addMetrics("F17", new BauerBodoniBoldItalic()); /* any is treated as serif */ - fontInfo.addFontProperties("F5", "any", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "any", "italic", Document.NORMAL); - fontInfo.addFontProperties("F6", "any", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F7", "any", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "any", "italic", Document.BOLD); - fontInfo.addFontProperties("F8", "any", "oblique", Document.BOLD); - - fontInfo.addFontProperties("F1", "sans-serif", "normal", Document.NORMAL); - fontInfo.addFontProperties("F2", "sans-serif", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F2", "sans-serif", "italic", Document.NORMAL); - fontInfo.addFontProperties("F3", "sans-serif", "normal", Document.BOLD); - fontInfo.addFontProperties("F4", "sans-serif", "oblique", Document.BOLD); - fontInfo.addFontProperties("F4", "sans-serif", "italic", Document.BOLD); - fontInfo.addFontProperties("F5", "serif", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "serif", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F6", "serif", "italic", Document.NORMAL); - fontInfo.addFontProperties("F7", "serif", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "serif", "oblique", Document.BOLD); - fontInfo.addFontProperties("F8", "serif", "italic", Document.BOLD); - fontInfo.addFontProperties("F9", "monospace", "normal", Document.NORMAL); - fontInfo.addFontProperties("F10", "monospace", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F10", "monospace", "italic", Document.NORMAL); - fontInfo.addFontProperties("F11", "monospace", "normal", Document.BOLD); - fontInfo.addFontProperties("F12", "monospace", "oblique", Document.BOLD); - fontInfo.addFontProperties("F12", "monospace", "italic", Document.BOLD); - - fontInfo.addFontProperties("F1", "Helvetica", "normal", Document.NORMAL); - fontInfo.addFontProperties("F2", "Helvetica", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F2", "Helvetica", "italic", Document.NORMAL); - fontInfo.addFontProperties("F3", "Helvetica", "normal", Document.BOLD); - fontInfo.addFontProperties("F4", "Helvetica", "oblique", Document.BOLD); - fontInfo.addFontProperties("F4", "Helvetica", "italic", Document.BOLD); - fontInfo.addFontProperties("F5", "Times", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times", "italic", Document.NORMAL); - fontInfo.addFontProperties("F7", "Times", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "Times", "oblique", Document.BOLD); - fontInfo.addFontProperties("F8", "Times", "italic", Document.BOLD); - fontInfo.addFontProperties("F9", "Courier", "normal", Document.NORMAL); - fontInfo.addFontProperties("F10", "Courier", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F10", "Courier", "italic", Document.NORMAL); - fontInfo.addFontProperties("F11", "Courier", "normal", Document.BOLD); - fontInfo.addFontProperties("F12", "Courier", "oblique", Document.BOLD); - fontInfo.addFontProperties("F12", "Courier", "italic", Document.BOLD); - fontInfo.addFontProperties("F13", "Symbol", "normal", Document.NORMAL); - fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Document.NORMAL); + fontInfo.addFontProperties("F5", "any", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "any", "italic", Font.NORMAL); + fontInfo.addFontProperties("F6", "any", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F7", "any", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "any", "italic", Font.BOLD); + fontInfo.addFontProperties("F8", "any", "oblique", Font.BOLD); + + fontInfo.addFontProperties("F1", "sans-serif", "normal", Font.NORMAL); + fontInfo.addFontProperties("F2", "sans-serif", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F2", "sans-serif", "italic", Font.NORMAL); + fontInfo.addFontProperties("F3", "sans-serif", "normal", Font.BOLD); + fontInfo.addFontProperties("F4", "sans-serif", "oblique", Font.BOLD); + fontInfo.addFontProperties("F4", "sans-serif", "italic", Font.BOLD); + fontInfo.addFontProperties("F5", "serif", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "serif", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F6", "serif", "italic", Font.NORMAL); + fontInfo.addFontProperties("F7", "serif", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "serif", "oblique", Font.BOLD); + fontInfo.addFontProperties("F8", "serif", "italic", Font.BOLD); + fontInfo.addFontProperties("F9", "monospace", "normal", Font.NORMAL); + fontInfo.addFontProperties("F10", "monospace", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F10", "monospace", "italic", Font.NORMAL); + fontInfo.addFontProperties("F11", "monospace", "normal", Font.BOLD); + fontInfo.addFontProperties("F12", "monospace", "oblique", Font.BOLD); + fontInfo.addFontProperties("F12", "monospace", "italic", Font.BOLD); + + fontInfo.addFontProperties("F1", "Helvetica", "normal", Font.NORMAL); + fontInfo.addFontProperties("F2", "Helvetica", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F2", "Helvetica", "italic", Font.NORMAL); + fontInfo.addFontProperties("F3", "Helvetica", "normal", Font.BOLD); + fontInfo.addFontProperties("F4", "Helvetica", "oblique", Font.BOLD); + fontInfo.addFontProperties("F4", "Helvetica", "italic", Font.BOLD); + fontInfo.addFontProperties("F5", "Times", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times", "italic", Font.NORMAL); + fontInfo.addFontProperties("F7", "Times", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "Times", "oblique", Font.BOLD); + fontInfo.addFontProperties("F8", "Times", "italic", Font.BOLD); + fontInfo.addFontProperties("F9", "Courier", "normal", Font.NORMAL); + fontInfo.addFontProperties("F10", "Courier", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F10", "Courier", "italic", Font.NORMAL); + fontInfo.addFontProperties("F11", "Courier", "normal", Font.BOLD); + fontInfo.addFontProperties("F12", "Courier", "oblique", Font.BOLD); + fontInfo.addFontProperties("F12", "Courier", "italic", Font.BOLD); + fontInfo.addFontProperties("F13", "Symbol", "normal", Font.NORMAL); + fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Font.NORMAL); // Custom type 1 fonts step 2/2 // fontInfo.addFontProperties("F15", "OMEP", "normal", FontInfo.NORMAL); @@ -193,20 +194,20 @@ public class FontSetup { // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", FontInfo.BOLD); /* for compatibility with PassiveTex */ - fontInfo.addFontProperties("F5", "Times-Roman", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times-Roman", "italic", Document.NORMAL); - fontInfo.addFontProperties("F7", "Times-Roman", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Document.BOLD); - fontInfo.addFontProperties("F8", "Times-Roman", "italic", Document.BOLD); - fontInfo.addFontProperties("F5", "Times Roman", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times Roman", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times Roman", "italic", Document.NORMAL); - fontInfo.addFontProperties("F7", "Times Roman", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "Times Roman", "oblique", Document.BOLD); - fontInfo.addFontProperties("F8", "Times Roman", "italic", Document.BOLD); + fontInfo.addFontProperties("F5", "Times-Roman", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times-Roman", "italic", Font.NORMAL); + fontInfo.addFontProperties("F7", "Times-Roman", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Font.BOLD); + fontInfo.addFontProperties("F8", "Times-Roman", "italic", Font.BOLD); + fontInfo.addFontProperties("F5", "Times Roman", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times Roman", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times Roman", "italic", Font.NORMAL); + fontInfo.addFontProperties("F7", "Times Roman", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "Times Roman", "oblique", Font.BOLD); + fontInfo.addFontProperties("F8", "Times Roman", "italic", Font.BOLD); fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter", - "normal", Document.NORMAL); + "normal", Font.NORMAL); } } diff --git a/src/java/org/apache/fop/render/pdf/FontSetup.java b/src/java/org/apache/fop/render/pdf/FontSetup.java index 3d30f6c8c..7d2239e3f 100644 --- a/src/java/org/apache/fop/render/pdf/FontSetup.java +++ b/src/java/org/apache/fop/render/pdf/FontSetup.java @@ -3,34 +3,34 @@ * ============================================================================ * 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 @@ -42,17 +42,18 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ 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; @@ -121,52 +122,52 @@ public class FontSetup { // fontInfo.addMetrics("F17", new BauerBodoniBoldItalic()); /* any is treated as serif */ - fontInfo.addFontProperties("F5", "any", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "any", "italic", Document.NORMAL); - fontInfo.addFontProperties("F6", "any", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F7", "any", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "any", "italic", Document.BOLD); - fontInfo.addFontProperties("F8", "any", "oblique", Document.BOLD); + fontInfo.addFontProperties("F5", "any", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "any", "italic", Font.NORMAL); + fontInfo.addFontProperties("F6", "any", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F7", "any", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "any", "italic", Font.BOLD); + fontInfo.addFontProperties("F8", "any", "oblique", Font.BOLD); - fontInfo.addFontProperties("F1", "sans-serif", "normal", Document.NORMAL); - fontInfo.addFontProperties("F2", "sans-serif", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F2", "sans-serif", "italic", Document.NORMAL); - fontInfo.addFontProperties("F3", "sans-serif", "normal", Document.BOLD); - fontInfo.addFontProperties("F4", "sans-serif", "oblique", Document.BOLD); - fontInfo.addFontProperties("F4", "sans-serif", "italic", Document.BOLD); - fontInfo.addFontProperties("F5", "serif", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "serif", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F6", "serif", "italic", Document.NORMAL); - fontInfo.addFontProperties("F7", "serif", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "serif", "oblique", Document.BOLD); - fontInfo.addFontProperties("F8", "serif", "italic", Document.BOLD); - fontInfo.addFontProperties("F9", "monospace", "normal", Document.NORMAL); - fontInfo.addFontProperties("F10", "monospace", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F10", "monospace", "italic", Document.NORMAL); - fontInfo.addFontProperties("F11", "monospace", "normal", Document.BOLD); - fontInfo.addFontProperties("F12", "monospace", "oblique", Document.BOLD); - fontInfo.addFontProperties("F12", "monospace", "italic", Document.BOLD); + fontInfo.addFontProperties("F1", "sans-serif", "normal", Font.NORMAL); + fontInfo.addFontProperties("F2", "sans-serif", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F2", "sans-serif", "italic", Font.NORMAL); + fontInfo.addFontProperties("F3", "sans-serif", "normal", Font.BOLD); + fontInfo.addFontProperties("F4", "sans-serif", "oblique", Font.BOLD); + fontInfo.addFontProperties("F4", "sans-serif", "italic", Font.BOLD); + fontInfo.addFontProperties("F5", "serif", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "serif", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F6", "serif", "italic", Font.NORMAL); + fontInfo.addFontProperties("F7", "serif", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "serif", "oblique", Font.BOLD); + fontInfo.addFontProperties("F8", "serif", "italic", Font.BOLD); + fontInfo.addFontProperties("F9", "monospace", "normal", Font.NORMAL); + fontInfo.addFontProperties("F10", "monospace", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F10", "monospace", "italic", Font.NORMAL); + fontInfo.addFontProperties("F11", "monospace", "normal", Font.BOLD); + fontInfo.addFontProperties("F12", "monospace", "oblique", Font.BOLD); + fontInfo.addFontProperties("F12", "monospace", "italic", Font.BOLD); - fontInfo.addFontProperties("F1", "Helvetica", "normal", Document.NORMAL); - fontInfo.addFontProperties("F2", "Helvetica", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F2", "Helvetica", "italic", Document.NORMAL); - fontInfo.addFontProperties("F3", "Helvetica", "normal", Document.BOLD); - fontInfo.addFontProperties("F4", "Helvetica", "oblique", Document.BOLD); - fontInfo.addFontProperties("F4", "Helvetica", "italic", Document.BOLD); - fontInfo.addFontProperties("F5", "Times", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times", "italic", Document.NORMAL); - fontInfo.addFontProperties("F7", "Times", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "Times", "oblique", Document.BOLD); - fontInfo.addFontProperties("F8", "Times", "italic", Document.BOLD); - fontInfo.addFontProperties("F9", "Courier", "normal", Document.NORMAL); - fontInfo.addFontProperties("F10", "Courier", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F10", "Courier", "italic", Document.NORMAL); - fontInfo.addFontProperties("F11", "Courier", "normal", Document.BOLD); - fontInfo.addFontProperties("F12", "Courier", "oblique", Document.BOLD); - fontInfo.addFontProperties("F12", "Courier", "italic", Document.BOLD); - fontInfo.addFontProperties("F13", "Symbol", "normal", Document.NORMAL); - fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Document.NORMAL); + fontInfo.addFontProperties("F1", "Helvetica", "normal", Font.NORMAL); + fontInfo.addFontProperties("F2", "Helvetica", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F2", "Helvetica", "italic", Font.NORMAL); + fontInfo.addFontProperties("F3", "Helvetica", "normal", Font.BOLD); + fontInfo.addFontProperties("F4", "Helvetica", "oblique", Font.BOLD); + fontInfo.addFontProperties("F4", "Helvetica", "italic", Font.BOLD); + fontInfo.addFontProperties("F5", "Times", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times", "italic", Font.NORMAL); + fontInfo.addFontProperties("F7", "Times", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "Times", "oblique", Font.BOLD); + fontInfo.addFontProperties("F8", "Times", "italic", Font.BOLD); + fontInfo.addFontProperties("F9", "Courier", "normal", Font.NORMAL); + fontInfo.addFontProperties("F10", "Courier", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F10", "Courier", "italic", Font.NORMAL); + fontInfo.addFontProperties("F11", "Courier", "normal", Font.BOLD); + fontInfo.addFontProperties("F12", "Courier", "oblique", Font.BOLD); + fontInfo.addFontProperties("F12", "Courier", "italic", Font.BOLD); + fontInfo.addFontProperties("F13", "Symbol", "normal", Font.NORMAL); + fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Font.NORMAL); // Custom type 1 fonts step 2/2 // fontInfo.addFontProperties("F15", "OMEP", "normal", FontInfo.NORMAL); @@ -174,20 +175,20 @@ public class FontSetup { // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", FontInfo.BOLD); /* for compatibility with PassiveTex */ - fontInfo.addFontProperties("F5", "Times-Roman", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times-Roman", "italic", Document.NORMAL); - fontInfo.addFontProperties("F7", "Times-Roman", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Document.BOLD); - fontInfo.addFontProperties("F8", "Times-Roman", "italic", Document.BOLD); - fontInfo.addFontProperties("F5", "Times Roman", "normal", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times Roman", "oblique", Document.NORMAL); - fontInfo.addFontProperties("F6", "Times Roman", "italic", Document.NORMAL); - fontInfo.addFontProperties("F7", "Times Roman", "normal", Document.BOLD); - fontInfo.addFontProperties("F8", "Times Roman", "oblique", Document.BOLD); - fontInfo.addFontProperties("F8", "Times Roman", "italic", Document.BOLD); + fontInfo.addFontProperties("F5", "Times-Roman", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times-Roman", "italic", Font.NORMAL); + fontInfo.addFontProperties("F7", "Times-Roman", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Font.BOLD); + fontInfo.addFontProperties("F8", "Times-Roman", "italic", Font.BOLD); + fontInfo.addFontProperties("F5", "Times Roman", "normal", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times Roman", "oblique", Font.NORMAL); + fontInfo.addFontProperties("F6", "Times Roman", "italic", Font.NORMAL); + fontInfo.addFontProperties("F7", "Times Roman", "normal", Font.BOLD); + fontInfo.addFontProperties("F8", "Times Roman", "oblique", Font.BOLD); + fontInfo.addFontProperties("F8", "Times Roman", "italic", Font.BOLD); fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter", - "normal", Document.NORMAL); + "normal", Font.NORMAL); /* Add configured fonts */ addConfiguredFonts(fontInfo, embedList, 15); @@ -262,15 +263,15 @@ public class FontSetup { f, font.getFontName(), font.getEncoding(), font, desc)); } } - - + + /** * Builds a list of EmbedFontInfo objects for use with the setup() method. * @param cfg Configuration object * @return List the newly created list of fonts * @throws ConfigurationException if something's wrong with the config data */ - public static List buildFontListFromConfiguration(Configuration cfg) + public static List buildFontListFromConfiguration(Configuration cfg) throws ConfigurationException { List fontList = new java.util.ArrayList(); Configuration[] font = cfg.getChildren("font"); diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java index bb52fef6e..76b1696de 100644 --- a/src/java/org/apache/fop/render/ps/PSTextPainter.java +++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java @@ -187,8 +187,8 @@ public class PSTextPainter implements TextPainter { String style = ((posture != null) && (posture.floatValue() > 0.0)) ? "italic" : "normal"; int weight = ((taWeight != null) - && (taWeight.floatValue() > 1.0)) ? Document.BOLD - : Document.NORMAL; + && (taWeight.floatValue() > 1.0)) ? Font.BOLD + : Font.NORMAL; Font fontState = null; Document fi = fontInfo; @@ -216,7 +216,7 @@ public class PSTextPainter implements TextPainter { } if (!found) { String fname = - fontInfo.fontLookup("any", style, Document.NORMAL); + fontInfo.fontLookup("any", style, Font.NORMAL); FontMetrics metrics = fontInfo.getMetricsFor(fname); int fsize = (int)(size.floatValue() * 1000); fontState = new Font(fname, metrics, fsize); @@ -226,7 +226,7 @@ public class PSTextPainter implements TextPainter { } } int fStyle = java.awt.Font.PLAIN; - if (weight == Document.BOLD) { + if (weight == Font.BOLD) { if (style.equals("italic")) { fStyle = java.awt.Font.BOLD | java.awt.Font.ITALIC; } else { diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index e4e4a2f37..c992d51aa 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -1208,7 +1208,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { } int siz = gFont.getSize(); String style = gFont.isItalic() ? "italic" : "normal"; - int weight = gFont.isBold() ? Document.BOLD : Document.NORMAL; + int weight = gFont.isBold() ? Font.BOLD : Font.NORMAL; String fname = fontInfo.fontLookup(n, style, weight); FontMetrics metrics = fontInfo.getMetricsFor(fname); fontState = new Font(fname, metrics, siz * 1000); diff --git a/src/java/org/apache/fop/svg/PDFTextPainter.java b/src/java/org/apache/fop/svg/PDFTextPainter.java index 247b98bb9..cfbdc60ef 100644 --- a/src/java/org/apache/fop/svg/PDFTextPainter.java +++ b/src/java/org/apache/fop/svg/PDFTextPainter.java @@ -186,8 +186,8 @@ public class PDFTextPainter implements TextPainter { String style = ((posture != null) && (posture.floatValue() > 0.0)) ? "italic" : "normal"; int weight = ((taWeight != null) - && (taWeight.floatValue() > 1.0)) ? Document.BOLD - : Document.NORMAL; + && (taWeight.floatValue() > 1.0)) ? Font.BOLD + : Font.NORMAL; Font fontState = null; Document fi = fontInfo; @@ -215,7 +215,7 @@ public class PDFTextPainter implements TextPainter { } if (!found) { String fname = - fontInfo.fontLookup("any", style, Document.NORMAL); + fontInfo.fontLookup("any", style, Font.NORMAL); FontMetrics metrics = fontInfo.getMetricsFor(fname); int fsize = (int)(size.floatValue() * 1000); fontState = new Font(fname, metrics, fsize); @@ -225,7 +225,7 @@ public class PDFTextPainter implements TextPainter { } } int fStyle = java.awt.Font.PLAIN; - if (weight == Document.BOLD) { + if (weight == Font.BOLD) { if (style.equals("italic")) { fStyle = java.awt.Font.BOLD | java.awt.Font.ITALIC; } else { diff --git a/src/java/org/apache/fop/tools/AreaTreeBuilder.java b/src/java/org/apache/fop/tools/AreaTreeBuilder.java index 16b720db2..0c64bbd1a 100644 --- a/src/java/org/apache/fop/tools/AreaTreeBuilder.java +++ b/src/java/org/apache/fop/tools/AreaTreeBuilder.java @@ -559,7 +559,7 @@ class TreeLoader extends AbstractLogEnabled { Character ch = new Character(getString((Element) obj).charAt(0)); addTraits((Element) obj, ch); - String fname = fontInfo.fontLookup("sans-serif", "normal", Document.NORMAL); + String fname = fontInfo.fontLookup("sans-serif", "normal", Font.NORMAL); FontMetrics metrics = fontInfo.getMetricsFor(fname); currentFontState = new Font(fname, metrics, 12000); @@ -584,7 +584,7 @@ class TreeLoader extends AbstractLogEnabled { list.add(leader); } } else if (obj.getNodeName().equals("word")) { - String fname = fontInfo.fontLookup("sans-serif", "normal", Document.NORMAL); + String fname = fontInfo.fontLookup("sans-serif", "normal", Font.NORMAL); FontMetrics metrics = fontInfo.getMetricsFor(fname); currentFontState = new Font(fname, metrics, 12000); -- 2.39.5