diff options
author | Glen Mazza <gmazza@apache.org> | 2004-04-22 21:38:41 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2004-04-22 21:38:41 +0000 |
commit | 5f10d185607e02344e132f258cad975e0e0b2d06 (patch) | |
tree | 747d7ce01542f00167bc3e8cd0117b9a2358b24e /src | |
parent | 480a7d7c4949203e119c2b07f53ef333cbba2f69 (diff) | |
download | xmlgraphics-fop-5f10d185607e02344e132f258cad975e0e0b2d06.tar.gz xmlgraphics-fop-5f10d185607e02344e132f258cad975e0e0b2d06.zip |
PR:
Obtained from:
Submitted by:
Reviewed by:
Patch #28525 applied -- new FontInfo class.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197531 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
33 files changed, 122 insertions, 347 deletions
diff --git a/src/java/org/apache/fop/apps/Document.java b/src/java/org/apache/fop/apps/Document.java index 9868fafb9..520552cad 100644 --- a/src/java/org/apache/fop/apps/Document.java +++ b/src/java/org/apache/fop/apps/Document.java @@ -38,34 +38,27 @@ import org.apache.fop.fo.FOTreeControl; import org.apache.fop.fo.FOTreeEvent; import org.apache.fop.fo.FOTreeListener; import org.apache.fop.fo.pagination.PageSequence; -import org.apache.fop.fonts.Font; -import org.apache.fop.fonts.FontMetrics; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.layout.LayoutStrategy; +import org.apache.commons.logging.Log; + // SAX import org.xml.sax.SAXException; -import org.apache.commons.logging.Log; - /** * Class storing information for the FOP Document being processed, and managing * the processing of it. */ public class Document implements FOTreeControl, FOTreeListener, AreaTreeControl { - + /** The parent Driver object */ private Driver driver; - /** 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; - + /** The Font information relevant for this document */ + private FontInfo fontInfo; + /** * the LayoutStrategy to be used to process this document * TODO: this actually belongs in the RenderContext class, when it is @@ -75,6 +68,7 @@ public class Document implements FOTreeControl, FOTreeListener, /** The current AreaTree for the PageSequence being rendered. */ public AreaTree areaTree; + /** The AreaTreeModel for the PageSequence being rendered. */ public AreaTreeModel atModel; @@ -98,186 +92,15 @@ public class Document implements FOTreeControl, FOTreeListener, */ public Document(Driver driver) { this.driver = driver; - this.triplets = new java.util.HashMap(); - this.fonts = new java.util.HashMap(); - this.usedFonts = new java.util.HashMap(); - } - - /** - * 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(Font.DEFAULT_FONT); - } - - /** - * Adds a new font triplet. - * @param name internal key - * @param family font family name - * @param style font style (normal, italic, oblique...) - * @param weight font weight - */ - public void addFontProperties(String name, String family, String style, - int weight) { - /* - * add the given family, style and weight as a lookup for the font - * with the given name - */ - - String key = createFontKey(family, style, weight); - this.triplets.put(key, name); - } - - /** - * Adds font metrics for a specific font. - * @param name internal key - * @param metrics metrics to register - */ - public void addMetrics(String name, FontMetrics metrics) { - // add the given metrics as a font with the given name - - this.fonts.put(name, metrics); - } - - /** - * Lookup a font. - * <br> - * Locate the font name for a given family, style and weight. - * The font name can then be used as a key as it is unique for - * the associated document. - * This also adds the font to the list of used fonts. - * @param family font family - * @param style font style - * @param weight font weight - * @return internal key - */ - public String fontLookup(String family, String style, - int weight) { - String key; - // first try given parameters - key = createFontKey(family, style, weight); - String f = (String)triplets.get(key); - if (f == null) { - // then adjust weight, favouring normal or bold - f = findAdjustWeight(family, style, weight); - - // then try any family with orig weight - if (f == null) { - key = createFontKey("any", style, weight); - f = (String)triplets.get(key); - } - - // then try any family with adjusted weight - if (f == null) { - f = findAdjustWeight(family, style, weight); - } - - // then use default - if (f == null) { - f = (String)triplets.get(Font.DEFAULT_FONT); - } - - } - - usedFonts.put(f, fonts.get(f)); - return f; - } - - /** - * Find a font with a given family and style by trying - * different font weights according to the spec. - * @param family font family - * @param style font style - * @param weight font weight - * @return internal key - */ - public String findAdjustWeight(String family, String style, - int weight) { - String key; - String f = null; - int newWeight = weight; - if (newWeight < 400) { - while (f == null && newWeight > 0) { - newWeight -= 100; - key = createFontKey(family, style, newWeight); - f = (String)triplets.get(key); - } - } else if (newWeight == 500) { - key = createFontKey(family, style, 400); - f = (String)triplets.get(key); - } else if (newWeight > 500) { - while (f == null && newWeight < 1000) { - newWeight += 100; - key = createFontKey(family, style, newWeight); - f = (String)triplets.get(key); - } - newWeight = weight; - while (f == null && newWeight > 400) { - newWeight -= 100; - key = createFontKey(family, style, newWeight); - f = (String)triplets.get(key); - } - } - if (f == null) { - key = createFontKey(family, style, 400); - f = (String)triplets.get(key); - } - - return f; - } - - /** - * Determines if a particular font is available. - * @param family font family - * @param style font style - * @param weight font weight - * @return True if available - */ - public boolean hasFont(String family, String style, int weight) { - String key = createFontKey(family, style, weight); - return this.triplets.containsKey(key); - } - - /** - * Creates a key from the given strings. - * @param family font family - * @param style font style - * @param weight font weight - * @return internal key - */ - public static String createFontKey(String family, String style, - int weight) { - return family + "," + style + "," + weight; + this.fontInfo = new FontInfo(); } /** - * Gets a Map of all registred fonts. - * @return a read-only Map with font key/FontMetrics pairs + * Retrieve the font information for this document + * @return the FontInfo instance for this document */ - public Map getFonts() { - return java.util.Collections.unmodifiableMap(this.fonts); - } - - /** - * This is used by the renderers to retrieve all the - * fonts used in the document. - * This is for embedded font or creating a list of used fonts. - * @return a read-only Map with font key/FontMetrics pairs - */ - public Map getUsedFonts() { - return this.usedFonts; - } - - /** - * Returns the FontMetrics for a particular font - * @param fontName internal key - * @return font metrics - */ - public FontMetrics getMetricsFor(String fontName) { - usedFonts.put(fontName, fonts.get(fontName)); - return (FontMetrics)fonts.get(fontName); + public FontInfo getFontInfo() { + return this.fontInfo; } /** @@ -372,18 +195,4 @@ public class Document implements FOTreeControl, FOTreeListener, return foInputHandler; } - /** - * @return the Logger to be used for processing this Document - */ - public Log getLogger() { - return getDriver().getLogger(); - } - - /** - * @return the FOUserAgent used for processing this document - */ - public FOUserAgent getUserAgent() { - return getDriver().getUserAgent(); - } - } diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 3795ba8f9..6145186db 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -242,7 +242,7 @@ public class Driver { userAgent = agent; } - protected FOUserAgent getUserAgent() { + public FOUserAgent getUserAgent() { if (userAgent == null) { userAgent = new FOUserAgent(); userAgent.setLogger(getLogger()); @@ -498,9 +498,9 @@ public class Driver { //this.atModel = new CachedRenderPagesModel(renderer); currentDocument.areaTree.setTreeModel(currentDocument.atModel); try { - renderer.setupFontInfo(currentDocument); + renderer.setupFontInfo(currentDocument.getFontInfo()); // check that the "any,normal,400" font exists - if (!currentDocument.isSetupValid()) { + if (!currentDocument.getFontInfo().isSetupValid()) { throw new FOPException( "No default font defined by OutputConverter"); } diff --git a/src/java/org/apache/fop/area/AreaTree.java b/src/java/org/apache/fop/area/AreaTree.java index 8c527aff1..ce0c2f6ca 100644 --- a/src/java/org/apache/fop/area/AreaTree.java +++ b/src/java/org/apache/fop/area/AreaTree.java @@ -222,7 +222,7 @@ public class AreaTree { if (atControl.getBookmarks() == null) { return; } - atControl.getLogger().debug("adding bookmarks to area tree"); + atControl.getDriver().getLogger().debug("adding bookmarks to area tree"); BookmarkData data = new BookmarkData(); for (int count = 0; count < atControl.getBookmarks().getOutlines().size(); count++) { Outline out = (Outline)(atControl.getBookmarks().getOutlines()).get(count); diff --git a/src/java/org/apache/fop/area/AreaTreeControl.java b/src/java/org/apache/fop/area/AreaTreeControl.java index 154548770..13ad510ba 100644 --- a/src/java/org/apache/fop/area/AreaTreeControl.java +++ b/src/java/org/apache/fop/area/AreaTreeControl.java @@ -21,8 +21,7 @@ package org.apache.fop.area; // FOP import org.apache.fop.fo.extensions.Bookmarks; - -import org.apache.commons.logging.Log; +import org.apache.fop.apps.Driver; // Java import java.util.Set; @@ -42,9 +41,9 @@ public interface AreaTreeControl { Bookmarks getBookmarks(); /** - * @return the Logger being used with this FO Tree + * @return the Driver instance being used with this FO Tree */ - Log getLogger(); + Driver getDriver(); /** * The current set of IDs in the document. diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index 661b8758e..70f709ab5 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -71,7 +71,7 @@ public abstract class FONode { * @return the logger */ public Log getLogger() { - return getFOTreeControl().getLogger(); + return getFOTreeControl().getDriver().getLogger(); } /** @@ -79,7 +79,7 @@ public abstract class FONode { * @return FOUserAgent */ public FOUserAgent getUserAgent() { - return getFOTreeControl().getUserAgent(); + return getFOTreeControl().getDriver().getUserAgent(); } /** diff --git a/src/java/org/apache/fop/fo/FOTreeControl.java b/src/java/org/apache/fop/fo/FOTreeControl.java index b69c49a27..2b3c436b6 100644 --- a/src/java/org/apache/fop/fo/FOTreeControl.java +++ b/src/java/org/apache/fop/fo/FOTreeControl.java @@ -24,11 +24,10 @@ import java.util.Map; import java.util.Set; // FOP -import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Driver; import org.apache.fop.fo.extensions.Bookmarks; import org.apache.fop.fonts.FontMetrics; - -import org.apache.commons.logging.Log; +import org.apache.fop.fonts.FontInfo; /** * An interface for classes that are conceptually the parent class of the @@ -41,32 +40,6 @@ import org.apache.commons.logging.Log; public interface FOTreeControl { /** - * @param family the font family - * @param style the font style - * @param weight the font weight - * @return the String font name matching the parameters - */ - String fontLookup(String family, String style, - int weight); - - /** - * @param fontName the String containing the font name for which a - * FontMetrics object is desired - * @return the FontMetrics object matching the fontName parameter - */ - FontMetrics getMetricsFor(String fontName); - - /** - * @return true if the default font has been properly setup - */ - boolean isSetupValid(); - - /** - * @return a Map containing the Fonts used in this FO Tree - */ - Map getFonts(); - - /** * Sets the Bookmark object which encapsulates the bookmarks for the FO * Tree. * @param bookmarks the Bookmark object encapsulating the bookmarks for this @@ -91,13 +64,13 @@ public interface FOTreeControl { FOInputHandler getFOInputHandler(); /** - * @return the Logger being used with this FO Tree + * @return the Driver associated with this FO Tree */ - Log getLogger(); - + Driver getDriver(); + /** - * @return the FOUserAgent used for processing this FO Tree + * @return the FontInfo object associated with this FOTree */ - FOUserAgent getUserAgent(); + FontInfo getFontInfo(); } diff --git a/src/java/org/apache/fop/fo/PropertyManager.java b/src/java/org/apache/fop/fo/PropertyManager.java index 4eb7618c4..26ce0eedd 100644 --- a/src/java/org/apache/fop/fo/PropertyManager.java +++ b/src/java/org/apache/fop/fo/PropertyManager.java @@ -127,9 +127,9 @@ public class PropertyManager implements Constants { // various kinds of keywords too int fontSize = propertyList.get(PR_FONT_SIZE).getLength().getValue(); //int fontVariant = propertyList.get("font-variant").getEnum(); - String fname = foTreeControl.fontLookup(fontFamily, fontStyle, + String fname = foTreeControl.getFontInfo().fontLookup(fontFamily, fontStyle, fontWeight); - FontMetrics metrics = foTreeControl.getMetricsFor(fname); + FontMetrics metrics = foTreeControl.getFontInfo().getMetricsFor(fname); fontState = new Font(fname, metrics, fontSize); } return fontState; diff --git a/src/java/org/apache/fop/fonts/FontSetup.java b/src/java/org/apache/fop/fonts/FontSetup.java index 9c0c1e6f6..186b71bf1 100644 --- a/src/java/org/apache/fop/fonts/FontSetup.java +++ b/src/java/org/apache/fop/fonts/FontSetup.java @@ -61,7 +61,7 @@ public class FontSetup { * @param fontInfo the font info object to set up * @param embedList ??? */ - public static void setup(Document fontInfo, List embedList) { + public static void setup(FontInfo fontInfo, List embedList) { fontInfo.addMetrics("F1", new Helvetica()); fontInfo.addMetrics("F2", new HelveticaOblique()); @@ -163,16 +163,16 @@ public class FontSetup { * @param fontInfos ??? * @param num starting index for internal font numbering */ - public static void addConfiguredFonts(Document fontInfo, List fontInfos, int num) { - if (fontInfos == null) { + public static void addConfiguredFonts(FontInfo fontInfo, List fontInfoList, int num) { + if (fontInfoList == null) { return; //No fonts to process } String internalName = null; //FontReader reader = null; - for (int i = 0; i < fontInfos.size(); i++) { - EmbedFontInfo configFontInfo = (EmbedFontInfo)fontInfos.get(i); + for (int i = 0; i < fontInfoList.size(); i++) { + EmbedFontInfo configFontInfo = (EmbedFontInfo) fontInfoList.get(i); String metricsFile = configFontInfo.getMetricsFile(); if (metricsFile != null) { @@ -191,7 +191,7 @@ public class FontSetup { List triplets = configFontInfo.getFontTriplets(); for (int c = 0; c < triplets.size(); c++) { - FontTriplet triplet = (FontTriplet)triplets.get(c); + FontTriplet triplet = (FontTriplet) triplets.get(c); int weight = FontUtil.parseCSS2FontWeight(triplet.getWeight()); //System.out.println("Registering: "+triplet+" weight="+weight); diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java index 80833b164..93066498b 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/java/org/apache/fop/pdf/PDFFactory.java @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; // Apache libs -import org.apache.avalon.framework.container.ContainerUtil; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/java/org/apache/fop/pdf/PDFResources.java b/src/java/org/apache/fop/pdf/PDFResources.java index e9c73f9e3..0945634dd 100644 --- a/src/java/org/apache/fop/pdf/PDFResources.java +++ b/src/java/org/apache/fop/pdf/PDFResources.java @@ -18,7 +18,7 @@ package org.apache.fop.pdf; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.Typeface; import org.apache.fop.fonts.FontDescriptor; @@ -88,7 +88,7 @@ public class PDFResources extends PDFObject { * @param doc PDF document to add fonts to * @param fontInfo font info object to get font information from */ - public void addFonts(PDFDocument doc, Document fontInfo) { + public void addFonts(PDFDocument doc, FontInfo fontInfo) { Map fonts = fontInfo.getUsedFonts(); Iterator e = fonts.keySet().iterator(); while (e.hasNext()) { diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index cc4781649..c76b8f3b6 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -61,7 +61,7 @@ import org.apache.fop.area.inline.TextArea; import org.apache.fop.area.inline.Character; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.Constants; -import org.apache.fop.fo.FOTreeControl; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.fo.pagination.Region; import org.apache.commons.logging.Log; @@ -170,7 +170,7 @@ public abstract class AbstractRenderer /** * @see org.apache.fop.render.Renderer */ - public abstract void setupFontInfo(FOTreeControl foTreeControl); + public abstract void setupFontInfo(FontInfo fontInfo); /** * @see org.apache.fop.render.Renderer diff --git a/src/java/org/apache/fop/render/PrintRenderer.java b/src/java/org/apache/fop/render/PrintRenderer.java index edeb1b542..c12d52465 100644 --- a/src/java/org/apache/fop/render/PrintRenderer.java +++ b/src/java/org/apache/fop/render/PrintRenderer.java @@ -20,7 +20,7 @@ package org.apache.fop.render; // FOP import org.apache.fop.apps.Document; -import org.apache.fop.fo.FOTreeControl; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontSetup; // Java @@ -30,7 +30,7 @@ import java.util.List; public abstract class PrintRenderer extends AbstractRenderer { /** Font configuration */ - protected FOTreeControl fontInfo; + protected FontInfo fontInfo; /** list of fonts */ protected List fontList = null; @@ -40,9 +40,9 @@ public abstract class PrintRenderer extends AbstractRenderer { * * @param fontInfo font info to set up */ - public void setupFontInfo(FOTreeControl foTreeControl) { - this.fontInfo = foTreeControl; - FontSetup.setup((Document)fontInfo, fontList); + public void setupFontInfo(FontInfo inFontInfo) { + this.fontInfo = inFontInfo; + FontSetup.setup(fontInfo, fontList); } } diff --git a/src/java/org/apache/fop/render/Renderer.java b/src/java/org/apache/fop/render/Renderer.java index 62446bf0b..d977e6a40 100644 --- a/src/java/org/apache/fop/render/Renderer.java +++ b/src/java/org/apache/fop/render/Renderer.java @@ -35,7 +35,7 @@ import org.apache.fop.area.inline.Leader; import org.apache.fop.area.inline.Space; import org.apache.fop.area.inline.Viewport; import org.apache.fop.area.inline.TextArea; -import org.apache.fop.fo.FOTreeControl; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.apps.FOUserAgent; import org.apache.commons.logging.Log; @@ -92,9 +92,9 @@ public interface Renderer { /** * Set up the given FontInfo. * - * @param fontInfo The fonts + * @param fontInfo The font information */ - void setupFontInfo(FOTreeControl foTreeControl); + void setupFontInfo(FontInfo fontInfo); /** * Set up renderer options. diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java index 684c2a549..552e59bcf 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java @@ -45,7 +45,7 @@ import java.io.OutputStream; import java.util.Map; import java.util.Vector; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.InputHandler; import org.apache.fop.area.Area; @@ -79,7 +79,7 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable private BufferedImage currentPageImage = null; /** Font configuration */ - protected Document fontInfo; + protected FontInfo fontInfo; /** The InputHandler associated with this Renderer. @@ -125,9 +125,9 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable return translator; } - public void setupFontInfo(FOTreeControl foTreeControl) { + public void setupFontInfo(FontInfo inFontInfo) { // create a temp Image to test font metrics on - fontInfo = (Document) foTreeControl; + fontInfo = inFontInfo; BufferedImage fontImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); FontSetup.setup(fontInfo, fontImage.createGraphics()); diff --git a/src/java/org/apache/fop/render/awt/FontSetup.java b/src/java/org/apache/fop/render/awt/FontSetup.java index cdac2ddb8..0c7811003 100644 --- a/src/java/org/apache/fop/render/awt/FontSetup.java +++ b/src/java/org/apache/fop/render/awt/FontSetup.java @@ -19,7 +19,7 @@ package org.apache.fop.render.awt; // FOP -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.Font; // Java @@ -43,7 +43,7 @@ public class FontSetup { * @param fontInfo the font info object to set up * @param graphics needed for acces to font metrics */ - public static void setup(Document fontInfo, Graphics2D graphics) { + public static void setup(FontInfo fontInfo, Graphics2D graphics) { FontMetricsMapper metric; int normal, bold, bolditalic, italic; diff --git a/src/java/org/apache/fop/render/mif/MIFHandler.java b/src/java/org/apache/fop/render/mif/MIFHandler.java index f8814d77d..c4283f566 100644 --- a/src/java/org/apache/fop/render/mif/MIFHandler.java +++ b/src/java/org/apache/fop/render/mif/MIFHandler.java @@ -75,7 +75,7 @@ public class MIFHandler extends FOInputHandler { public MIFHandler(Document doc, OutputStream os) { super(doc); outStream = os; - FontSetup.setup(doc, null); + FontSetup.setup(doc.getFontInfo(), null); } /** diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 52ded5175..c8729ee05 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -262,8 +262,7 @@ public class PDFRenderer extends PrintRenderer { * @see org.apache.fop.render.Renderer#stopRenderer() */ public void stopRenderer() throws IOException { - pdfDoc.getResources().addFonts(pdfDoc, - (org.apache.fop.apps.Document) fontInfo); + pdfDoc.getResources().addFonts(pdfDoc, fontInfo); pdfDoc.outputTrailer(ostream); this.pdfDoc = null; diff --git a/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java b/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java index 04d38ecf0..38d28e90b 100644 --- a/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java @@ -30,7 +30,7 @@ import org.apache.fop.svg.PDFTextElementBridge; import org.apache.fop.svg.PDFAElementBridge; import org.apache.fop.svg.PDFGraphics2D; import org.apache.fop.svg.SVGUserAgent; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; /* org.w3c.dom.Document is not imported to avoid conflict with org.apache.fop.control.Document */ @@ -163,7 +163,7 @@ public class PDFXMLHandler implements XMLHandler { pdfi.currentStream = (PDFStream)context.getProperty(PDF_STREAM); pdfi.width = ((Integer)context.getProperty(PDF_WIDTH)).intValue(); pdfi.height = ((Integer)context.getProperty(PDF_HEIGHT)).intValue(); - pdfi.fi = (Document)context.getProperty(PDF_FONT_INFO); + pdfi.fi = (FontInfo) context.getProperty(PDF_FONT_INFO); pdfi.currentFontName = (String)context.getProperty(PDF_FONT_NAME); pdfi.currentFontSize = ((Integer)context.getProperty(PDF_FONT_SIZE)).intValue(); pdfi.currentXPosition = ((Integer)context.getProperty(PDF_XPOS)).intValue(); @@ -192,7 +192,7 @@ public class PDFXMLHandler implements XMLHandler { /** see PDF_HEIGHT */ public int height; /** see PDF_FONT_INFO */ - public Document fi; + public FontInfo fi; /** see PDF_FONT_NAME */ public String currentFontName; /** see PDF_FONT_SIZE */ diff --git a/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java b/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java index ed3e57385..f8ffd9938 100644 --- a/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java @@ -69,7 +69,7 @@ public abstract class AbstractPSDocumentGraphics2D extends PSGraphics2D { if (!textAsShapes) { this.document = new Document(null); - FontSetup.setup(this.document, null); + FontSetup.setup(this.document.getFontInfo(), null); } } diff --git a/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java b/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java index 340ac85de..73f7b3fac 100644 --- a/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java @@ -70,7 +70,7 @@ public class EPSDocumentGraphics2D extends AbstractPSDocumentGraphics2D { PSProcSets.writeFOPStdProcSet(gen); PSProcSets.writeFOPEPSProcSet(gen); if (document != null) { - PSProcSets.writeFontDict(gen, document); + PSProcSets.writeFontDict(gen, document.getFontInfo()); } gen.writeDSCComment(DSCConstants.END_PROLOG); } diff --git a/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java b/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java index ce419f722..73da1b243 100644 --- a/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java @@ -57,7 +57,7 @@ public class PSDocumentGraphics2D extends AbstractPSDocumentGraphics2D { if (!textAsShapes) { this.document = new Document(null); - FontSetup.setup(this.document, null); + FontSetup.setup(this.document.getFontInfo(), null); } } @@ -114,7 +114,7 @@ public class PSDocumentGraphics2D extends AbstractPSDocumentGraphics2D { PSProcSets.writeFOPStdProcSet(gen); PSProcSets.writeFOPEPSProcSet(gen); if (document != null) { - PSProcSets.writeFontDict(gen, document); + PSProcSets.writeFontDict(gen, document.getFontInfo()); } gen.writeDSCComment(DSCConstants.END_SETUP); } diff --git a/src/java/org/apache/fop/render/ps/PSGraphics2D.java b/src/java/org/apache/fop/render/ps/PSGraphics2D.java index e527450d7..587cf2acf 100644 --- a/src/java/org/apache/fop/render/ps/PSGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/PSGraphics2D.java @@ -873,12 +873,12 @@ public class PSGraphics2D extends AbstractGraphics2D { String style = f.isItalic() ? "italic" : "normal"; int weight = f.isBold() ? Font.BOLD : Font.NORMAL; - String fontKey = this.document.findAdjustWeight(fontFamily, style, weight); + String fontKey = this.document.getFontInfo().findAdjustWeight(fontFamily, style, weight); if (fontKey == null) { - fontKey = this.document.findAdjustWeight("sans-serif", style, weight); + fontKey = this.document.getFontInfo().findAdjustWeight("sans-serif", style, weight); } return new Font(fontKey, - this.document.getMetricsFor(fontKey), + this.document.getFontInfo().getMetricsFor(fontKey), fontSize); } diff --git a/src/java/org/apache/fop/render/ps/PSProcSets.java b/src/java/org/apache/fop/render/ps/PSProcSets.java index b6f6916d8..604239da1 100644 --- a/src/java/org/apache/fop/render/ps/PSProcSets.java +++ b/src/java/org/apache/fop/render/ps/PSProcSets.java @@ -24,7 +24,7 @@ import java.util.Map; import org.apache.fop.fonts.Typeface; import org.apache.fop.fonts.Glyphs; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; /** * This class defines the basic resources (procsets) used by FOP's PostScript @@ -185,7 +185,7 @@ public final class PSProcSets { * @param fontInfo available fonts * @throws IOException in case of an I/O problem */ - public static void writeFontDict(PSGenerator gen, Document fontInfo) + public static void writeFontDict(PSGenerator gen, FontInfo fontInfo) throws IOException { gen.writeln("%%BeginResource: procset FOPFonts"); gen.writeln("%%Title: Font setup (shortcuts) for this file"); diff --git a/src/java/org/apache/fop/render/ps/PSRenderer.java b/src/java/org/apache/fop/render/ps/PSRenderer.java index ef39dcc5f..caf6654ea 100644 --- a/src/java/org/apache/fop/render/ps/PSRenderer.java +++ b/src/java/org/apache/fop/render/ps/PSRenderer.java @@ -41,7 +41,7 @@ import org.apache.fop.datatypes.ColorType; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fonts.FontSetup; import org.apache.fop.fonts.Typeface; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.render.AbstractRenderer; import org.apache.fop.render.RendererContext; import org.apache.fop.fo.FOTreeControl; @@ -50,8 +50,7 @@ import org.apache.fop.image.FopImage; import org.apache.fop.image.ImageFactory; import org.apache.fop.traits.BorderProps; -/* org.w3c.dom.Document is not imported to avoid conflict with - org.apache.fop.control.Document */ +import org.w3c.dom.Document; /** * Renderer that renders to PostScript. @@ -93,7 +92,7 @@ public class PSRenderer extends AbstractRenderer { private float currGreen; private float currBlue; - private Document fontInfo; + private FontInfo fontInfo; /** * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration) @@ -229,9 +228,9 @@ public class PSRenderer extends AbstractRenderer { * * @param foTreeControl the font info object to set up */ - public void setupFontInfo(FOTreeControl foTreeControl) { - FontSetup.setup((Document) foTreeControl, null); - this.fontInfo = (Document) foTreeControl; + public void setupFontInfo(FontInfo inFontInfo) { + this.fontInfo = inFontInfo; + FontSetup.setup(fontInfo, null); } /** @@ -451,7 +450,7 @@ public class PSRenderer extends AbstractRenderer { int fontsize = area.getTraitAsInteger(Trait.FONT_SIZE); // This assumes that *all* CIDFonts use a /ToUnicode mapping - Typeface f = (Typeface)fontInfo.getFonts().get(fontname); + Typeface f = (Typeface) fontInfo.getFonts().get(fontname); //Determine position int rx = currentBlockIPPosition; @@ -809,7 +808,7 @@ public class PSRenderer extends AbstractRenderer { * @see org.apache.fop.render.AbstractRenderer#renderForeignObject(ForeignObject, Rectangle2D) */ public void renderForeignObject(ForeignObject fo, Rectangle2D pos) { - org.w3c.dom.Document doc = fo.getDocument(); + Document doc = fo.getDocument(); String ns = fo.getNameSpace(); renderDocument(doc, ns, pos); } @@ -820,7 +819,7 @@ public class PSRenderer extends AbstractRenderer { * @param ns Namespace for the XML document * @param pos Position for the generated graphic/image */ - public void renderDocument(org.w3c.dom.Document doc, String ns, Rectangle2D pos) { + public void renderDocument(Document doc, String ns, Rectangle2D pos) { RendererContext context; context = new RendererContext(MIME_TYPE); context.setUserAgent(userAgent); diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java index 2c58813cc..89cb0cfae 100644 --- a/src/java/org/apache/fop/render/ps/PSTextPainter.java +++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java @@ -386,18 +386,18 @@ public class PSTextPainter implements TextPainter { return; }*/ fontFamily = fam.getFamilyName(); - if (document.hasFont(fontFamily, style, weight)) { - String fname = document.fontLookup( + if (document.getFontInfo().hasFont(fontFamily, style, weight)) { + String fname = document.getFontInfo().fontLookup( fontFamily, style, weight); - FontMetrics metrics = document.getMetricsFor(fname); + FontMetrics metrics = document.getFontInfo().getMetricsFor(fname); int fsize = (int)(fontSize.floatValue() * 1000); return new Font(fname, metrics, fsize); } } } - String fname = document.fontLookup( + String fname = document.getFontInfo().fontLookup( "any", style, Font.NORMAL); - FontMetrics metrics = document.getMetricsFor(fname); + FontMetrics metrics = document.getFontInfo().getMetricsFor(fname); int fsize = (int)(fontSize.floatValue() * 1000); return new Font(fname, metrics, fsize); } diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index a5d9c4796..f0b89f709 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -131,7 +131,7 @@ public class RTFHandler extends FOInputHandler { bDefer = false; bDeferredExecution = false; iNestCount=0; - FontSetup.setup(doc, null); + FontSetup.setup(doc.getFontInfo(), null); log.warn(ALPHA_WARNING); } diff --git a/src/java/org/apache/fop/render/svg/SVGRenderer.java b/src/java/org/apache/fop/render/svg/SVGRenderer.java index 4929d3166..3473a0087 100644 --- a/src/java/org/apache/fop/render/svg/SVGRenderer.java +++ b/src/java/org/apache/fop/render/svg/SVGRenderer.java @@ -25,7 +25,7 @@ import org.apache.fop.area.inline.ForeignObject; import org.apache.fop.area.inline.Leader; import org.apache.fop.area.inline.TextArea; import org.apache.fop.svg.SVGUtilities; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.FOTreeControl; @@ -134,11 +134,11 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { /** * @see org.apache.fop.render.Renderer#setupFontInfo(FOTreeControl) */ - public void setupFontInfo(FOTreeControl foTreeControl) { + public void setupFontInfo(FontInfo fontInfo) { // create a temp Image to test font metrics on BufferedImage fontImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); - org.apache.fop.render.awt.FontSetup.setup((Document)foTreeControl, + org.apache.fop.render.awt.FontSetup.setup(fontInfo, fontImage.createGraphics()); } diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index bb5805284..c50bf4398 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -27,16 +27,13 @@ import java.util.Map; import java.util.Iterator; import java.awt.geom.Rectangle2D; -// XML -/* org.w3c.dom.Document is not imported to avoid conflict with - org.apache.fop.control.Document */ +import org.w3c.dom.Document; // FOP import org.apache.fop.render.AbstractRenderer; import org.apache.fop.render.RendererContext; import org.apache.fop.render.XMLHandler; import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.Document; import org.apache.fop.apps.FOPException; import org.apache.fop.area.BeforeFloat; import org.apache.fop.area.Block; @@ -61,6 +58,7 @@ import org.apache.fop.area.inline.Space; import org.apache.fop.area.inline.Viewport; import org.apache.fop.area.inline.TextArea; import org.apache.fop.fonts.FontSetup; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.fo.FOTreeControl; import org.apache.fop.fo.pagination.Region; @@ -178,8 +176,8 @@ public class XMLRenderer extends AbstractRenderer { * * @param fontInfo the font info object to set up */ - public void setupFontInfo(FOTreeControl foTreeControl) { - FontSetup.setup((Document) foTreeControl, null); + public void setupFontInfo(FontInfo fontInfo) { + FontSetup.setup(fontInfo, null); } private boolean isCoarseXml() { @@ -393,7 +391,7 @@ public class XMLRenderer extends AbstractRenderer { */ public void renderForeignObject(ForeignObject fo) { writeStartTag("<foreignObject>"); - org.w3c.dom.Document doc = fo.getDocument(); + Document doc = fo.getDocument(); String ns = fo.getNameSpace(); context.setProperty(XMLXMLHandler.WRITER, writer); renderXML(userAgent, context, doc, ns); diff --git a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java index da881ba72..4eccb87a5 100644 --- a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java @@ -28,6 +28,7 @@ import org.apache.fop.pdf.PDFResources; import org.apache.fop.pdf.PDFColor; import org.apache.fop.pdf.PDFAnnotList; import org.apache.fop.fonts.FontSetup; +import org.apache.fop.fonts.FontInfo; import org.apache.avalon.framework.CascadingRuntimeException; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.configuration.Configurable; @@ -35,7 +36,6 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.logging.impl.SimpleLog; import org.apache.commons.logging.Log; -import org.apache.fop.apps.Document; import java.awt.Graphics; import java.awt.Font; @@ -86,7 +86,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D super(textAsShapes); if (!textAsShapes) { - fontInfo = new Document(null); + fontInfo = new FontInfo(); FontSetup.setup(fontInfo, null); //FontState fontState = new FontState("Helvetica", "normal", // FontInfo.NORMAL, 12, 0); @@ -160,7 +160,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D */ public void initialize() throws Exception { if (this.fontInfo == null) { - fontInfo = new Document(null); + fontInfo = new FontInfo(); FontSetup.setup(fontInfo, this.fontList); //FontState fontState = new FontState("Helvetica", "normal", // FontInfo.NORMAL, 12, 0); @@ -209,7 +209,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D * Get the font info for this pdf document. * @return the font information */ - public Document getFontInfo() { + public FontInfo getFontInfo() { return fontInfo; } diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index 48d2352b8..5514149d7 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -32,7 +32,7 @@ import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFLink; import org.apache.fop.pdf.PDFAnnotList; import org.apache.fop.pdf.BitmapImage; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontSetup; import org.apache.fop.fonts.FontMetrics; @@ -128,7 +128,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { /** * The current font information. */ - protected Document fontInfo; + protected FontInfo fontInfo; /** * The override font state used when drawing text and the font cannot be @@ -172,7 +172,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { * @param font the current font name * @param size the current font size */ - public PDFGraphics2D(boolean textAsShapes, Document fi, PDFDocument doc, + public PDFGraphics2D(boolean textAsShapes, FontInfo fi, PDFDocument doc, PDFResourceContext page, String pref, String font, float size) { super(textAsShapes); pdfDoc = doc; @@ -943,7 +943,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { private void createPattern(PatternPaint pp, boolean fill) { Rectangle2D rect = pp.getPatternRect(); - Document fontInfo = new Document(null); + FontInfo fontInfo = new FontInfo(); FontSetup.setup(fontInfo, null); PDFResources res = pdfDoc.getFactory().makeResources(); diff --git a/src/java/org/apache/fop/svg/PDFTextElementBridge.java b/src/java/org/apache/fop/svg/PDFTextElementBridge.java index a5a23db57..398260d35 100644 --- a/src/java/org/apache/fop/svg/PDFTextElementBridge.java +++ b/src/java/org/apache/fop/svg/PDFTextElementBridge.java @@ -24,7 +24,7 @@ import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.TextUtilities; import org.apache.batik.gvt.GraphicsNode; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -43,7 +43,7 @@ public class PDFTextElementBridge extends SVGTextElementBridge { * Constructs a new bridge for the <text> element. * @param fi the font infomration */ - public PDFTextElementBridge(Document fi) { + public PDFTextElementBridge(FontInfo fi) { pdfTextPainter = new PDFTextPainter(fi); } diff --git a/src/java/org/apache/fop/svg/PDFTextPainter.java b/src/java/org/apache/fop/svg/PDFTextPainter.java index d229e24ef..5c8c42a47 100644 --- a/src/java/org/apache/fop/svg/PDFTextPainter.java +++ b/src/java/org/apache/fop/svg/PDFTextPainter.java @@ -43,7 +43,7 @@ import org.apache.batik.gvt.renderer.StrokingTextPainter; import org.apache.fop.fonts.FontMetrics; import org.apache.fop.fonts.Font; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; /** * Renders the attributed character iterator of a <tt>TextNode</tt>. @@ -60,7 +60,7 @@ import org.apache.fop.apps.Document; * @version $Id: PDFTextPainter.java,v 1.16 2003/03/07 09:51:25 jeremias Exp $ */ public class PDFTextPainter implements TextPainter { - private Document fontInfo; + private FontInfo fontInfo; /** * Use the stroking text painter to get the bounds and shape. @@ -73,7 +73,7 @@ public class PDFTextPainter implements TextPainter { * Create a new PDF text painter with the given font information. * @param fi the fint info */ - public PDFTextPainter(Document fi) { + public PDFTextPainter(FontInfo fi) { fontInfo = fi; } @@ -164,7 +164,7 @@ public class PDFTextPainter implements TextPainter { : Font.NORMAL; Font fontState = null; - Document fi = fontInfo; + FontInfo fi = fontInfo; boolean found = false; String fontFamily = null; if (gvtFonts != null) { diff --git a/src/java/org/apache/fop/tools/AreaTreeBuilder.java b/src/java/org/apache/fop/tools/AreaTreeBuilder.java index 288a89db2..74ab65ecd 100644 --- a/src/java/org/apache/fop/tools/AreaTreeBuilder.java +++ b/src/java/org/apache/fop/tools/AreaTreeBuilder.java @@ -33,8 +33,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Element; -/* org.w3c.dom.Document is not imported to avoid conflict with - org.apache.fop.control.Document */ +import org.w3c.dom.Document; // Batik import org.apache.batik.dom.svg.SVGDOMImplementation; @@ -68,8 +67,8 @@ import org.apache.fop.area.inline.Leader; import org.apache.fop.area.inline.Space; import org.apache.fop.area.inline.Viewport; import org.apache.fop.area.inline.TextArea; -import org.apache.fop.apps.Document; import org.apache.fop.fonts.Font; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.render.Renderer; import org.apache.fop.render.pdf.PDFRenderer; import org.apache.fop.render.svg.SVGRenderer; @@ -161,14 +160,14 @@ public class AreaTreeBuilder { } rend.setLogger(logger); - Document fi = new Document(null); - rend.setupFontInfo(fi); + org.apache.fop.apps.Document doc = new org.apache.fop.apps.Document(null); + rend.setupFontInfo(doc.getFontInfo()); FOUserAgent ua = new FOUserAgent(); ua.setLogger(logger); rend.setUserAgent(ua); StorePagesModel sm = AreaTree.createStorePagesModel(); - TreeLoader tl = new TreeLoader(fi); + TreeLoader tl = new TreeLoader(doc); tl.setLogger(logger); tl.setTreeModel(sm); try { @@ -240,12 +239,12 @@ public class AreaTreeBuilder { class TreeLoader { private AreaTree areaTree; private AreaTreeModel model; - private Document fontInfo; + private org.apache.fop.apps.Document document; private Font currentFontState; private Log logger = null; - TreeLoader(Document fi) { - fontInfo = fi; + TreeLoader(org.apache.fop.apps.Document doc) { + document = doc; } /** @@ -261,7 +260,7 @@ class TreeLoader { } public void buildAreaTree(InputStream is) { - org.w3c.dom.Document doc = null; + Document doc = null; try { DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); @@ -273,7 +272,7 @@ class TreeLoader { Element root = null; root = doc.getDocumentElement(); - areaTree = new AreaTree(fontInfo); + areaTree = new AreaTree(document); areaTree.setTreeModel(model); readAreaTree(root); @@ -533,7 +532,7 @@ class TreeLoader { // error } LineArea line = new LineArea(); - addTraits((Element) obj, line); + addTraits((Element) obj, line); String height = ((Element) obj).getAttribute("height"); int h = Integer.parseInt(height); line.setHeight(h); @@ -560,8 +559,8 @@ class TreeLoader { Character ch = new Character(getString((Element) obj).charAt(0)); addTraits((Element) obj, ch); - String fname = fontInfo.fontLookup("sans-serif", "normal", Font.NORMAL); - FontMetrics metrics = fontInfo.getMetricsFor(fname); + String fname = document.getFontInfo().fontLookup("sans-serif", "normal", Font.NORMAL); + FontMetrics metrics = document.getFontInfo().getMetricsFor(fname); currentFontState = new Font(fname, metrics, 12000); @@ -585,8 +584,8 @@ class TreeLoader { list.add(leader); } } else if (obj.getNodeName().equals("word")) { - String fname = fontInfo.fontLookup("sans-serif", "normal", Font.NORMAL); - FontMetrics metrics = fontInfo.getMetricsFor(fname); + String fname = document.getFontInfo().fontLookup("sans-serif", "normal", Font.NORMAL); + FontMetrics metrics = document.getFontInfo().getMetricsFor(fname); currentFontState = new Font(fname, metrics, 12000); TextArea text = getText((Element) obj); @@ -639,7 +638,7 @@ class TreeLoader { } ForeignObject getForeignObject(Element root) { - org.w3c.dom.Document doc; + Document doc; String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; NodeList childs = root.getChildNodes(); |