You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/07/17 20:14:02 UTC
svn commit: r677664 - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./
src/codegen/java/org/apache/fop/tools/ src/java/org/apache/fop/apps/
src/java/org/apache/fop/cli/ src/java/org/apache/fop/events/
src/java/org/apache/fop/events/model/ src/jav...
Author: acumiskey
Date: Thu Jul 17 11:14:01 2008
New Revision: 677664
URL: http://svn.apache.org/viewvc?rev=677664&view=rev
Log:
Merged revisions 676161,676297,676307,676397,676608,677404-677405,677543,677648-677652 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk
........
r676161 | jeremias | 2008-07-12 13:19:40 +0100 (Sat, 12 Jul 2008) | 1 line
Attempt to fix a potential build problem.
........
r676297 | adelmelle | 2008-07-13 11:26:48 +0100 (Sun, 13 Jul 2008) | 2 lines
Replace occurrences of File.toURL() by File.toURI().toURL() (recommended as of Java 6, where File.toURL() is deprecated)
........
r676307 | jeremias | 2008-07-13 13:11:17 +0100 (Sun, 13 Jul 2008) | 1 line
null is not correct here, an empty String needs to be used for the default namespace. Saxon 9 fails with a NullPointerException otherwise. Xalan is more tolerant.
........
r676397 | adelmelle | 2008-07-13 19:31:30 +0100 (Sun, 13 Jul 2008) | 1 line
Another attempt at avoiding build issues (?)
........
r676608 | cbowditch | 2008-07-14 15:44:53 +0100 (Mon, 14 Jul 2008) | 1 line
A nit: clarify message so its more meaningful to end user
........
r677404 | jeremias | 2008-07-16 21:16:51 +0100 (Wed, 16 Jul 2008) | 1 line
Worked around a bug in Xalan 2.4.0 (bundled with Sun Java 1.4.2_xx) where file URLs like file:/C:/.... got converted to file:\C:\.... on Windows causing a FileNotFoundException.
........
r677405 | jeremias | 2008-07-16 21:22:17 +0100 (Wed, 16 Jul 2008) | 1 line
Removed stray System.out.
........
r677543 | jeremias | 2008-07-17 10:11:09 +0100 (Thu, 17 Jul 2008) | 1 line
fonts package must not depend on the render package. Refactored to restore that rule.
........
r677648 | acumiskey | 2008-07-17 18:39:14 +0100 (Thu, 17 Jul 2008) | 2 lines
ZapfDingbats and Symbol is not always available on the AFPRenderer so we can't have these as default font family properties unfortunately.
........
r677649 | acumiskey | 2008-07-17 18:40:12 +0100 (Thu, 17 Jul 2008) | 2 lines
A minor optimization.
........
r677650 | acumiskey | 2008-07-17 18:41:27 +0100 (Thu, 17 Jul 2008) | 2 lines
An optimization and improved readability of fontLookup() call.
........
r677651 | acumiskey | 2008-07-17 18:44:08 +0100 (Thu, 17 Jul 2008) | 2 lines
Moved font setup stuff from setupFontInfo() in AFPRenderer and delegated this stuff to an AFPFontCollection class.
........
r677652 | acumiskey | 2008-07-17 18:47:04 +0100 (Thu, 17 Jul 2008) | 2 lines
Unused imports.
........
Added:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/AFPFontCollection.java
- copied unchanged from r677652, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontCollection.java
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/ (props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOURIResolver.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/InputHandler.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/Main.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/EventFormatter.xml
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventMethodModel.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventModel.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventProducerModel.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOPropertyMapping.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/CustomFontCollection.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/HyphenationTree.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/PatternParser.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRenderer.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLRenderer.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/TestConverter.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/Fop.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/RunTest.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jul 17 11:14:01 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk:1-676039
+/xmlgraphics/fop/trunk:1-677652
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java Thu Jul 17 11:14:01 2008
@@ -22,6 +22,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
@@ -38,6 +39,7 @@
import org.w3c.dom.Node;
+import org.apache.commons.io.IOUtils;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
@@ -95,7 +97,7 @@
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
//Generate fresh generated translation file as template
- Source src = new StreamSource(getModelFile());
+ Source src = new StreamSource(getModelFile().toURI().toURL().toExternalForm());
StreamSource xslt1 = new StreamSource(
getClass().getResourceAsStream(MODEL2TRANSLATION));
if (xslt1.getInputStream() == null) {
@@ -109,7 +111,7 @@
Node sourceDocument;
if (resultExists) {
//Load existing translation file into memory (because we overwrite it later)
- src = new StreamSource(getTranslationFile());
+ src = new StreamSource(getTranslationFile().toURI().toURL().toExternalForm());
domres = new DOMResult();
transformer = tFactory.newTransformer();
transformer.transform(src, domres);
@@ -121,29 +123,38 @@
//Generate translation file (with potentially new translations)
src = new DOMSource(sourceDocument);
- Result res = new StreamResult(getTranslationFile());
- StreamSource xslt2 = new StreamSource(
- getClass().getResourceAsStream(MERGETRANSLATION));
- if (xslt2.getInputStream() == null) {
- throw new FileNotFoundException(MERGETRANSLATION + " not found");
- }
- transformer = tFactory.newTransformer(xslt2);
- transformer.setURIResolver(new URIResolver() {
- public Source resolve(String href, String base) throws TransformerException {
- if ("my:dom".equals(href)) {
- return new DOMSource(generated);
+
+ //The following triggers a bug in older Xalan versions
+ //Result res = new StreamResult(getTranslationFile());
+ OutputStream out = new java.io.FileOutputStream(getTranslationFile());
+ out = new java.io.BufferedOutputStream(out);
+ Result res = new StreamResult(out);
+ try {
+ StreamSource xslt2 = new StreamSource(
+ getClass().getResourceAsStream(MERGETRANSLATION));
+ if (xslt2.getInputStream() == null) {
+ throw new FileNotFoundException(MERGETRANSLATION + " not found");
+ }
+ transformer = tFactory.newTransformer(xslt2);
+ transformer.setURIResolver(new URIResolver() {
+ public Source resolve(String href, String base) throws TransformerException {
+ if ("my:dom".equals(href)) {
+ return new DOMSource(generated);
+ }
+ return null;
}
- return null;
+ });
+ if (resultExists) {
+ transformer.setParameter("generated-url", "my:dom");
}
- });
- if (resultExists) {
- transformer.setParameter("generated-url", "my:dom");
- }
- transformer.transform(src, res);
- if (resultExists) {
- log("Translation file updated: " + getTranslationFile());
- } else {
- log("Translation file generated: " + getTranslationFile());
+ transformer.transform(src, res);
+ if (resultExists) {
+ log("Translation file updated: " + getTranslationFile());
+ } else {
+ log("Translation file generated: " + getTranslationFile());
+ }
+ } finally {
+ IOUtils.closeQuietly(out);
}
} catch (TransformerException te) {
throw new IOException(te.getMessage());
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOURIResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOURIResolver.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOURIResolver.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOURIResolver.java Thu Jul 17 11:14:01 2008
@@ -77,7 +77,7 @@
}
File dir = new File(base);
try {
- base = (dir.isDirectory() ? dir.toURL() : new URL(base)).toExternalForm();
+ base = (dir.isDirectory() ? dir.toURI().toURL() : new URL(base)).toExternalForm();
} catch (MalformedURLException mfue) {
if (throwExceptions) {
throw mfue;
@@ -173,9 +173,9 @@
if (file.canRead() && file.isFile()) {
try {
if (fragment != null) {
- absoluteURL = new URL(file.toURL().toExternalForm() + fragment);
+ absoluteURL = new URL(file.toURI().toURL().toExternalForm() + fragment);
} else {
- absoluteURL = file.toURL();
+ absoluteURL = file.toURI().toURL();
}
} catch (MalformedURLException mfue) {
handleException(mfue, "Could not convert filename '" + href
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/InputHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/InputHandler.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/InputHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/InputHandler.java Thu Jul 17 11:14:01 2008
@@ -115,7 +115,7 @@
try {
baseURL = new File(sourcefile.getAbsolutePath()).
- getParentFile().toURL().toExternalForm();
+ getParentFile().toURI().toURL().toExternalForm();
} catch (Exception e) {
baseURL = "";
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/Main.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/Main.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/Main.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/cli/Main.java Thu Jul 17 11:14:01 2008
@@ -66,7 +66,7 @@
+ baseDir.getAbsolutePath() + " (or below)");
}
List jars = new java.util.ArrayList();
- jars.add(fopJar.toURL());
+ jars.add(fopJar.toURI().toURL());
File[] files;
FileFilter filter = new FileFilter() {
public boolean accept(File pathname) {
@@ -80,7 +80,7 @@
files = libDir.listFiles(filter);
if (files != null) {
for (int i = 0, size = files.length; i < size; i++) {
- jars.add(files[i].toURL());
+ jars.add(files[i].toURI().toURL());
}
}
String optionalLib = System.getProperty("fop.optional.lib");
@@ -88,7 +88,7 @@
files = new File(optionalLib).listFiles(filter);
if (files != null) {
for (int i = 0, size = files.length; i < size; i++) {
- jars.add(files[i].toURL());
+ jars.add(files[i].toURI().toURL());
}
}
}
@@ -172,9 +172,9 @@
} else {
options.getInputHandler().transformTo(out);
}
- } finally {
- IOUtils.closeQuietly(out);
- }
+ } finally {
+ IOUtils.closeQuietly(out);
+ }
// System.exit(0) called to close AWT/SVG-created threads, if any.
// AWTRenderer closes with window shutdown, so exit() should not
@@ -185,9 +185,9 @@
} catch (Exception e) {
if (options != null) {
options.getLogger().error("Exception", e);
- }
- if (options.getOutputFile() != null) {
- options.getOutputFile().delete();
+ if (options.getOutputFile() != null) {
+ options.getOutputFile().delete();
+ }
}
System.exit(1);
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/EventFormatter.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/EventFormatter.xml?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/EventFormatter.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/EventFormatter.xml Thu Jul 17 11:14:01 2008
@@ -82,7 +82,7 @@
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.rowTooTall">The contents of table-row {row} are taller than they should be (there is a block-progression-dimension or height constraint on the indicated row). Due to its contents the row grows to {effCellBPD} millipoints, but the row shouldn't get any taller than {maxCellBPD} millipoints.{{locator}}</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.tableFixedAutoWidthNotSupported">table-layout="fixed" and width="auto", but auto-layout not supported => assuming width="100%".{{locator}}</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.objectTooWide">The extent in inline-progression-direction (width) of a {elementName} is bigger than the available space ({effIPD}mpt > {maxIPD}mpt).{{locator}}</message>
- <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.overconstrainedAdjustEndIndent">Adjusting end-indent based on overconstrained geometry rules for {elementName}.{{locator}}</message>
+ <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.overconstrainedAdjustEndIndent">An {elementName} {{locator}} is wider than the available room in inline-progression-dimension. Adjusting end-indent based on overconstrained geometry rules (XSL 1.1, ch. 5.3.4)</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.viewportOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.regionOverflow">Content overflows the viewport of the {elementName} on page {page} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.flowNotMappingToRegionBody">Flow "{flowName}" does not map to the region-body in page-master "{masterName}". FOP presently does not support this.{{locator}}</message>
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventMethodModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventMethodModel.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventMethodModel.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventMethodModel.java Thu Jul 17 11:14:01 2008
@@ -37,12 +37,12 @@
public class EventMethodModel implements Serializable, XMLizable {
private static final long serialVersionUID = -7548882973341444354L;
-
+
private String methodName;
private EventSeverity severity;
private List params = new java.util.ArrayList();
private String exceptionClass;
-
+
/**
* Creates an new instance.
* @param methodName the event method's name
@@ -52,7 +52,7 @@
this.methodName = methodName;
this.severity = severity;
}
-
+
/**
* Adds a method parameter.
* @param param the method parameter
@@ -60,7 +60,7 @@
public void addParameter(Parameter param) {
this.params.add(param);
}
-
+
/**
* Adds a method parameter.
* @param type the type of the parameter
@@ -68,11 +68,11 @@
* @return the resulting Parameter instance
*/
public Parameter addParameter(Class type, String name) {
- Parameter param = new Parameter(type, name);
+ Parameter param = new Parameter(type, name);
addParameter(param);
return param;
}
-
+
/**
* Sets the event method name.
* @param name the event name
@@ -80,7 +80,7 @@
public void setMethodName(String name) {
this.methodName = name;
}
-
+
/**
* Returns the event method name
* @return the event name
@@ -88,7 +88,7 @@
public String getMethodName() {
return this.methodName;
}
-
+
/**
* Sets the event's severity level.
* @param severity the severity
@@ -96,7 +96,7 @@
public void setSeverity(EventSeverity severity) {
this.severity = severity;
}
-
+
/**
* Returns the event's severity level.
* @return the severity
@@ -104,7 +104,7 @@
public EventSeverity getSeverity() {
return this.severity;
}
-
+
/**
* Returns an unmodifiable list of parameters for this event method.
* @return the list of parameters
@@ -112,7 +112,7 @@
public List getParameters() {
return Collections.unmodifiableList(this.params);
}
-
+
/**
* Sets the primary exception class for this event method. Note: Not all event methods throw
* exceptions!
@@ -121,7 +121,7 @@
public void setExceptionClass(String exceptionClass) {
this.exceptionClass = exceptionClass;
}
-
+
/**
* Returns the primary exception class for this event method. This method returns null if
* the event is only informational or just a warning.
@@ -130,34 +130,34 @@
public String getExceptionClass() {
return this.exceptionClass;
}
-
+
/** {@inheritDoc} */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
- atts.addAttribute(null, "name", "name", "CDATA", getMethodName());
- atts.addAttribute(null, "severity", "severity", "CDATA", getSeverity().getName());
+ atts.addAttribute("", "name", "name", "CDATA", getMethodName());
+ atts.addAttribute("", "severity", "severity", "CDATA", getSeverity().getName());
if (getExceptionClass() != null) {
- atts.addAttribute(null, "exception", "exception", "CDATA", getExceptionClass());
+ atts.addAttribute("", "exception", "exception", "CDATA", getExceptionClass());
}
String elName = "method";
- handler.startElement(null, elName, elName, atts);
+ handler.startElement("", elName, elName, atts);
Iterator iter = this.params.iterator();
while (iter.hasNext()) {
((XMLizable)iter.next()).toSAX(handler);
}
- handler.endElement(null, elName, elName);
+ handler.endElement("", elName, elName);
}
-
+
/**
* Represents an event parameter.
*/
public static class Parameter implements Serializable, XMLizable {
-
+
private static final long serialVersionUID = 6062500277953887099L;
-
+
private Class type;
private String name;
-
+
/**
* Creates a new event parameter.
* @param type the parameter type
@@ -167,7 +167,7 @@
this.type = type;
this.name = name;
}
-
+
/**
* Returns the parameter type.
* @return the parameter type
@@ -175,7 +175,7 @@
public Class getType() {
return this.type;
}
-
+
/**
* Returns the parameter name.
* @return the parameter name
@@ -187,12 +187,12 @@
/** {@inheritDoc} */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
- atts.addAttribute(null, "type", "type", "CDATA", getType().getName());
- atts.addAttribute(null, "name", "name", "CDATA", getName());
+ atts.addAttribute("", "type", "type", "CDATA", getType().getName());
+ atts.addAttribute("", "name", "name", "CDATA", getName());
String elName = "parameter";
- handler.startElement(null, elName, elName, atts);
- handler.endElement(null, elName, elName);
+ handler.startElement("", elName, elName, atts);
+ handler.endElement("", elName, elName);
}
-
+
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventModel.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventModel.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventModel.java Thu Jul 17 11:14:01 2008
@@ -21,6 +21,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.OutputStream;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
@@ -38,6 +39,8 @@
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
+import org.apache.commons.io.IOUtils;
+
import org.apache.xmlgraphics.util.XMLizable;
/**
@@ -46,15 +49,15 @@
public class EventModel implements Serializable, XMLizable {
private static final long serialVersionUID = 7468592614934605082L;
-
+
private Map producers = new java.util.LinkedHashMap();
-
+
/**
* Creates a new, empty event model
*/
public EventModel() {
}
-
+
/**
* Adds the model of an event producer to the event model.
* @param producer the event producer model
@@ -62,7 +65,7 @@
public void addProducer(EventProducerModel producer) {
this.producers.put(producer.getInterfaceName(), producer);
}
-
+
/**
* Returns an iterator over the contained event producer models.
* @return an iterator (Iterator<EventProducerModel>)
@@ -79,7 +82,7 @@
public EventProducerModel getProducer(String interfaceName) {
return (EventProducerModel)this.producers.get(interfaceName);
}
-
+
/**
* Returns the model of an event producer with the given interface.
* @param clazz the interface of the event producer
@@ -88,22 +91,28 @@
public EventProducerModel getProducer(Class clazz) {
return getProducer(clazz.getName());
}
-
+
/** {@inheritDoc} */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
String elName = "event-model";
- handler.startElement(null, elName, elName, atts);
+ handler.startElement("", elName, elName, atts);
Iterator iter = getProducers();
while (iter.hasNext()) {
((XMLizable)iter.next()).toSAX(handler);
}
- handler.endElement(null, elName, elName);
+ handler.endElement("", elName, elName);
}
private void writeXMLizable(XMLizable object, File outputFile) throws IOException {
- Result res = new StreamResult(outputFile);
-
+ //These two approaches do not seem to work in all environments:
+ //Result res = new StreamResult(outputFile);
+ //Result res = new StreamResult(outputFile.toURI().toURL().toExternalForm());
+ //With an old Xalan version: file:/C:/.... --> file:\C:\.....
+ OutputStream out = new java.io.FileOutputStream(outputFile);
+ out = new java.io.BufferedOutputStream(out);
+ Result res = new StreamResult(out);
+
try {
SAXTransformerFactory tFactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
@@ -120,6 +129,8 @@
throw new IOException(e.getMessage());
} catch (SAXException e) {
throw new IOException(e.getMessage());
+ } finally {
+ IOUtils.closeQuietly(out);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventProducerModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventProducerModel.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventProducerModel.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/events/model/EventProducerModel.java Thu Jul 17 11:14:01 2008
@@ -35,18 +35,18 @@
public class EventProducerModel implements Serializable, XMLizable {
private static final long serialVersionUID = 122267104123721902L;
-
+
private String interfaceName;
private Map methods = new java.util.LinkedHashMap();
-
+
/**
* Creates a new instance.
- * @param interfaceName the fully qualified interface name of the event producer
+ * @param interfaceName the fully qualified interface name of the event producer
*/
public EventProducerModel(String interfaceName) {
this.interfaceName = interfaceName;
}
-
+
/**
* Returns the fully qualified interface name of the event producer.
* @return the fully qualified interface name
@@ -54,7 +54,7 @@
public String getInterfaceName() {
return this.interfaceName;
}
-
+
/**
* Sets the fully qualified interface name of the event producer.
* @param name the fully qualified interface name
@@ -62,7 +62,7 @@
public void setInterfaceName(String name) {
this.interfaceName = name;
}
-
+
/**
* Adds a model instance of an event method.
* @param method the event method model
@@ -70,7 +70,7 @@
public void addMethod(EventMethodModel method) {
this.methods.put(method.getMethodName(), method);
}
-
+
/**
* Returns the model instance of an event method for the given method name.
* @param methodName the method name
@@ -79,7 +79,7 @@
public EventMethodModel getMethod(String methodName) {
return (EventMethodModel)this.methods.get(methodName);
}
-
+
/**
* Returns an iterator over the contained event producer methods.
* @return an iterator (Iterator<EventMethodModel>)
@@ -91,15 +91,15 @@
/** {@inheritDoc} */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
- atts.addAttribute(null, "name", "name", "CDATA", getInterfaceName());
+ atts.addAttribute("", "name", "name", "CDATA", getInterfaceName());
String elName = "producer";
- handler.startElement(null, elName, elName, atts);
+ handler.startElement("", elName, elName, atts);
Iterator iter = getMethods();
while (iter.hasNext()) {
((XMLizable)iter.next()).toSAX(handler);
}
- handler.endElement(null, elName, elName);
+ handler.endElement("", elName, elName);
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOPropertyMapping.java Thu Jul 17 11:14:01 2008
@@ -963,7 +963,7 @@
// font-family
m = new FontFamilyProperty.Maker(PR_FONT_FAMILY);
m.setInherited(true);
- m.setDefault("sans-serif,Symbol,ZapfDingbats");
+ m.setDefault("sans-serif");
m.addShorthand(s_generics[PR_FONT]);
addPropertyMaker("font-family", m);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java Thu Jul 17 11:14:01 2008
@@ -92,7 +92,7 @@
try {
URL baseURL = new URL(getUserAgent().getBaseURL() == null
- ? new java.io.File("").toURL().toExternalForm()
+ ? new java.io.File("").toURI().toURL().toExternalForm()
: getUserAgent().getBaseURL());
if (baseURL != null) {
SVGOMDocument svgdoc = (SVGOMDocument)doc;
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/CustomFontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/CustomFontCollection.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/CustomFontCollection.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/CustomFontCollection.java Thu Jul 17 11:14:01 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,38 +21,35 @@
import java.util.List;
-import org.apache.fop.render.PrintRenderer;
-
/**
* Sets up a set of custom (embedded) fonts
*/
public class CustomFontCollection implements FontCollection {
- private PrintRenderer renderer = null;
+ private FontResolver fontResolver;
+ private List/*<EmbedFontInfo>*/ embedFontInfoList;
/**
- * A print renderer to configure
- * @param renderer a print renderer
+ * Main constructor.
+ * @param fontResolver a font resolver
+ * @param customFonts the list of custom fonts
*/
- public CustomFontCollection(PrintRenderer renderer) {
- this.renderer = renderer;
+ public CustomFontCollection(FontResolver fontResolver,
+ List/*<EmbedFontInfo>*/ customFonts) {
+ this.fontResolver = fontResolver;
+ if (this.fontResolver == null) {
+ //Ensure that we have minimal font resolution capabilities
+ this.fontResolver = FontManager.createMinimalFontResolver();
+ }
+ this.embedFontInfoList = customFonts;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int setup(int num, FontInfo fontInfo) {
- List/*<EmbedFontInfo>*/ embedFontInfoList = renderer.getFontList();
if (embedFontInfoList == null) {
return num; //No fonts to process
}
- FontResolver resolver = renderer.getFontResolver();
- if (resolver == null) {
- //Ensure that we have minimal font resolution capabilities
- resolver = FontManager.createMinimalFontResolver();
- }
-
String internalName = null;
//FontReader reader = null;
@@ -69,7 +66,7 @@
fontInfo.addMetrics(internalName, reader.getFont());
*/
- LazyFont font = new LazyFont(embedFontInfo, resolver);
+ LazyFont font = new LazyFont(embedFontInfo, this.fontResolver);
fontInfo.addMetrics(internalName, font);
List triplets = embedFontInfo.getFontTriplets();
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java Thu Jul 17 11:14:01 2008
@@ -219,7 +219,7 @@
private FontTriplet fuzzyFontLookup(String family, String style,
int weight, FontTriplet startKey, boolean substFont) {
FontTriplet key;
- String internalFontKey;
+ String internalFontKey = null;
if (!family.equals(startKey.getName())) {
key = createFontKey(family, style, weight);
internalFontKey = getInternalFontKey(key);
@@ -230,8 +230,10 @@
// adjust weight, favouring normal or bold
key = findAdjustWeight(family, style, weight);
- internalFontKey = getInternalFontKey(key);
-
+ if (key != null) {
+ internalFontKey = getInternalFontKey(key);
+ }
+
if (!substFont && internalFontKey == null) {
return null;
}
@@ -364,7 +366,8 @@
FontTriplet triplet;
List tmpTriplets = new java.util.ArrayList();
for (int i = 0, c = families.length; i < c; i++) {
- triplet = fontLookup(families[i], style, weight, (i >= families.length - 1));
+ boolean substitutable = (i >= families.length - 1);
+ triplet = fontLookup(families[i], style, weight, substitutable);
if (triplet != null) {
tmpTriplets.add(triplet);
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java Thu Jul 17 11:14:01 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,7 +19,6 @@
package org.apache.fop.fonts;
-import java.awt.Graphics2D;
import java.net.MalformedURLException;
import javax.xml.transform.Source;
@@ -27,7 +26,6 @@
import org.apache.fop.fonts.FontTriplet.Matcher;
import org.apache.fop.fonts.substitute.FontSubstitutions;
-import org.apache.fop.render.PrintRenderer;
// TODO: Refactor fonts package so major font activities (autodetection etc)
// are all centrally managed and delegated from this class, also remove dependency on FopFactory
@@ -144,55 +142,17 @@
}
/**
- * Sets up the fonts on a given PrintRenderer
- * @param renderer a print renderer
+ * Sets up the fonts on a given FontInfo object. The fonts to setup are defined by an
+ * array of {@code FontCollection} objects.
+ * @param fontInfo the FontInfo object to set up
+ * @param fontCollections the array of font collections/sources
*/
- public void setupRenderer(PrintRenderer renderer) {
- FontInfo fontInfo = renderer.getFontInfo();
-
+ public void setup(FontInfo fontInfo, FontCollection[] fontCollections) {
int startNum = 1;
- // Configure base 14 fonts
- org.apache.fop.fonts.base14.Base14FontCollection base14FontCollection
- = new org.apache.fop.fonts.base14.Base14FontCollection(this.enableBase14Kerning);
- startNum = base14FontCollection.setup(startNum, fontInfo);
-
- // Configure any custom font collection
- org.apache.fop.fonts.CustomFontCollection customFontCollection
- = new org.apache.fop.fonts.CustomFontCollection(renderer);
- startNum = customFontCollection.setup(startNum, fontInfo);
-
- // Make any defined substitutions in the font info
- getFontSubstitutions().adjustFontInfo(fontInfo);
- }
-
- /**
- * Sets up the fonts on a given PrintRenderer with Graphics2D
- * @param renderer a print renderer
- * @param graphics2D a graphics 2D
- */
- public void setupRenderer(PrintRenderer renderer, Graphics2D graphics2D) {
- FontInfo fontInfo = renderer.getFontInfo();
-
- int startNum = 1;
-
- // setup base 14 fonts
- org.apache.fop.render.java2d.Base14FontCollection base14FontCollection
- = new org.apache.fop.render.java2d.Base14FontCollection(graphics2D);
-
- // setup any custom font collection
- startNum = base14FontCollection.setup(startNum, fontInfo);
-
- // setup any installed fonts
- org.apache.fop.render.java2d.InstalledFontCollection installedFontCollection
- = new org.apache.fop.render.java2d.InstalledFontCollection(graphics2D);
- startNum = installedFontCollection.setup(startNum, fontInfo);
-
- // setup any configured fonts
- org.apache.fop.render.java2d.ConfiguredFontCollection configuredFontCollection
- = new org.apache.fop.render.java2d.ConfiguredFontCollection(renderer);
- startNum = configuredFontCollection.setup(startNum, fontInfo);
-
+ for (int i = 0, c = fontCollections.length; i < c; i++) {
+ startNum = fontCollections[i].setup(startNum, fontInfo);
+ }
// Make any defined substitutions in the font info
getFontSubstitutions().adjustFontInfo(fontInfo);
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/HyphenationTree.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/HyphenationTree.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/HyphenationTree.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/HyphenationTree.java Thu Jul 17 11:14:01 2008
@@ -125,7 +125,7 @@
public void loadPatterns(String filename) throws HyphenationException {
File f = new File(filename);
try {
- InputSource src = new InputSource(f.toURL().toExternalForm());
+ InputSource src = new InputSource(f.toURI().toURL().toExternalForm());
loadPatterns(src);
} catch (MalformedURLException e) {
throw new HyphenationException("Error converting the File '" + f + "' to a URL: "
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/PatternParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/PatternParser.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/PatternParser.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/hyphenation/PatternParser.java Thu Jul 17 11:14:01 2008
@@ -92,7 +92,7 @@
*/
public void parse(File file) throws HyphenationException {
try {
- InputSource src = new InputSource(file.toURL().toExternalForm());
+ InputSource src = new InputSource(file.toURI().toURL().toExternalForm());
parse(src);
} catch (MalformedURLException e) {
throw new HyphenationException("Error converting the File '" + file + "' to a URL: "
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Thu Jul 17 11:14:01 2008
@@ -36,6 +36,7 @@
import org.apache.fop.fo.flow.Leader;
import org.apache.fop.fo.pagination.Title;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
+import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.fonts.Font;
@@ -115,9 +116,12 @@
InlineLevel fobj = (InlineLevel) this.fobj;
int padding = 0;
+
FontInfo fi = fobj.getFOEventHandler().getFontInfo();
- FontTriplet[] fontkeys = fobj.getCommonFont().getFontState(fi);
- font = fi.getFontInstance(fontkeys[0], fobj.getCommonFont().fontSize.getValue(this));
+ CommonFont commonFont = fobj.getCommonFont();
+ FontTriplet[] fontkeys = commonFont.getFontState(fi);
+ font = fi.getFontInstance(fontkeys[0], commonFont.fontSize.getValue(this));
+
lineHeight = fobj.getLineHeight();
borderProps = fobj.getCommonBorderPaddingBackground();
inlineProps = fobj.getCommonMarginInline();
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRenderer.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRenderer.java Thu Jul 17 11:14:01 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,19 +20,23 @@
package org.apache.fop.render;
// FOP
+import java.awt.Color;
+import java.awt.geom.Rectangle2D;
+import java.util.List;
+import java.util.Map;
+
+import org.w3c.dom.Document;
+
import org.apache.fop.area.Area;
import org.apache.fop.area.Trait;
+import org.apache.fop.fonts.CustomFontCollection;
import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.FontCollection;
import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.fonts.FontManager;
import org.apache.fop.fonts.FontResolver;
import org.apache.fop.fonts.FontTriplet;
-import org.w3c.dom.Document;
-
-// Java
-import java.awt.Color;
-import java.awt.geom.Rectangle2D;
-import java.util.List;
-import java.util.Map;
+import org.apache.fop.fonts.base14.Base14FontCollection;
/** Abstract base class of "Print" type renderers. */
public abstract class PrintRenderer extends AbstractRenderer {
@@ -79,7 +83,12 @@
*/
public void setupFontInfo(FontInfo inFontInfo) {
this.fontInfo = inFontInfo;
- userAgent.getFactory().getFontManager().setupRenderer(this);
+ FontManager fontManager = userAgent.getFactory().getFontManager();
+ FontCollection[] fontCollections = new FontCollection[] {
+ new Base14FontCollection(fontManager.isBase14KerningEnabled()),
+ new CustomFontCollection(getFontResolver(), getFontList())
+ };
+ fontManager.setup(getFontInfo(), fontCollections);
}
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java Thu Jul 17 11:14:01 2008
@@ -65,11 +65,9 @@
import org.apache.fop.events.ResourceEventProducer;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.extensions.ExtensionAttachment;
+import org.apache.fop.fonts.FontCollection;
import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.fonts.FontTriplet;
-import org.apache.fop.fonts.base14.Courier;
-import org.apache.fop.fonts.base14.Helvetica;
-import org.apache.fop.fonts.base14.TimesRoman;
+import org.apache.fop.fonts.FontManager;
import org.apache.fop.render.AbstractPathOrientedRenderer;
import org.apache.fop.render.AbstractState;
import org.apache.fop.render.Graphics2DAdapter;
@@ -77,10 +75,7 @@
import org.apache.fop.render.afp.extensions.AFPElementMapping;
import org.apache.fop.render.afp.extensions.AFPPageSetup;
import org.apache.fop.render.afp.fonts.AFPFont;
-import org.apache.fop.render.afp.fonts.AFPFontInfo;
-import org.apache.fop.render.afp.fonts.CharacterSet;
-import org.apache.fop.render.afp.fonts.FopCharacterSet;
-import org.apache.fop.render.afp.fonts.OutlineFont;
+import org.apache.fop.render.afp.fonts.AFPFontCollection;
import org.apache.fop.render.afp.modca.AFPConstants;
import org.apache.fop.render.afp.modca.AFPDataStream;
import org.apache.fop.render.afp.modca.PageObject;
@@ -183,57 +178,11 @@
/** {@inheritDoc} */
public void setupFontInfo(FontInfo inFontInfo) {
this.fontInfo = inFontInfo;
- int num = 1;
- if (super.embedFontInfoList != null
- && super.embedFontInfoList.size() > 0) {
- for (Iterator it = super.embedFontInfoList.iterator(); it.hasNext();) {
- AFPFontInfo afi = (AFPFontInfo) it.next();
- AFPFont bf = (AFPFont) afi.getAFPFont();
- for (Iterator it2 = afi.getFontTriplets().iterator(); it2.hasNext();) {
- FontTriplet ft = (FontTriplet) it2.next();
- this.fontInfo.addFontProperties("F" + num, ft.getName(), ft
- .getStyle(), ft.getWeight());
- this.fontInfo.addMetrics("F" + num, bf);
- num++;
- }
- }
- } else {
- AFPEventProducer eventProducer = AFPEventProducer.Provider
- .get(getUserAgent().getEventBroadcaster());
- eventProducer.warnDefaultFontSetup(this);
- }
- if (this.fontInfo.fontLookup("sans-serif", "normal", 400) == null) {
- CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500",
- "CZH200 ", 1, new Helvetica());
- AFPFont bf = new OutlineFont("Helvetica", cs);
- this.fontInfo.addFontProperties("F" + num, "sans-serif", "normal",
- 400);
- this.fontInfo.addMetrics("F" + num, bf);
- num++;
- }
- if (this.fontInfo.fontLookup("serif", "normal", 400) == null) {
- CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500",
- "CZN200 ", 1, new TimesRoman());
- AFPFont bf = new OutlineFont("Helvetica", cs);
- this.fontInfo.addFontProperties("F" + num, "serif", "normal", 400);
- this.fontInfo.addMetrics("F" + num, bf);
- num++;
- }
- if (this.fontInfo.fontLookup("monospace", "normal", 400) == null) {
- CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500",
- "CZ4200 ", 1, new Courier());
- AFPFont bf = new OutlineFont("Helvetica", cs);
- this.fontInfo.addFontProperties("F" + num, "monospace", "normal",
- 400);
- this.fontInfo.addMetrics("F" + num, bf);
- num++;
- }
- if (this.fontInfo.fontLookup("any", "normal", 400) == null) {
- FontTriplet ft = this.fontInfo.fontLookup("sans-serif", "normal",
- 400);
- this.fontInfo.addFontProperties(this.fontInfo
- .getInternalFontKey(ft), "any", "normal", 400);
- }
+ FontManager fontManager = userAgent.getFactory().getFontManager();
+ FontCollection[] fontCollections = new FontCollection[] {
+ new AFPFontCollection(userAgent.getEventBroadcaster(), getFontList())
+ };
+ fontManager.setup(getFontInfo(), fontCollections);
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java Thu Jul 17 11:14:01 2008
@@ -157,7 +157,7 @@
if (url == null) {
try {
File file = new File(path);
- url = file.toURL();
+ url = file.toURI().toURL();
if (url == null) {
String msg = "CharacterSet file not found for "
+ characterset + " in classpath: " + path;
@@ -194,7 +194,7 @@
log.warn(msg);
}
- inputStream = csfont[0].toURL().openStream();
+ inputStream = csfont[0].toURI().toURL().openStream();
if (inputStream == null) {
String msg = "Failed to open character set resource "
+ characterset;
@@ -258,7 +258,7 @@
if (url == null) {
try {
File file = new File(path);
- url = file.toURL();
+ url = file.toURI().toURL();
if (url == null) {
String msg = "CodePage file not found for " + codePage
+ " in classpath: " + path;
@@ -300,7 +300,7 @@
log.warn(msg);
}
- InputStream is = codepage[0].toURL().openStream();
+ InputStream is = codepage[0].toURI().toURL().openStream();
if (is == null) {
String msg = "AFPFontReader:: loadCodePage(String):: code page file not found for "
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java Thu Jul 17 11:14:01 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,6 @@
import org.apache.fop.fonts.FontResolver;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.fonts.LazyFont;
-import org.apache.fop.render.PrintRenderer;
/**
* A java2d configured font collection
@@ -44,37 +43,36 @@
private static Log log = LogFactory.getLog(ConfiguredFontCollection.class);
- private PrintRenderer renderer = null;
+ private FontResolver fontResolver;
+ private List/*<EmbedFontInfo>*/ embedFontInfoList;
/**
* Main constructor
- *
- * @param renderer a print renderer
+ * @param fontResolver a font resolver
+ * @param customFonts the list of custom fonts
*/
- public ConfiguredFontCollection(PrintRenderer renderer) {
- this.renderer = renderer;
+ public ConfiguredFontCollection(FontResolver fontResolver,
+ List/*<EmbedFontInfo>*/ customFonts) {
+ this.fontResolver = fontResolver;
+ if (this.fontResolver == null) {
+ //Ensure that we have minimal font resolution capabilities
+ this.fontResolver = FontManager.createMinimalFontResolver();
+ }
+ this.embedFontInfoList = customFonts;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int setup(int start, FontInfo fontInfo) {
- List/*<EmbedFontInfo>*/ fontList = renderer.getFontList();
- FontResolver resolver = renderer.getFontResolver();
int num = start;
- if (fontList == null || fontList.size() < 1) {
+ if (embedFontInfoList == null || embedFontInfoList.size() < 1) {
log.debug("No user configured fonts found.");
return num;
}
- if (resolver == null) {
- // Ensure that we have minimal font resolution capabilities
- resolver = FontManager.createMinimalFontResolver();
- }
String internalName = null;
- for (int i = 0; i < fontList.size(); i++) {
+ for (int i = 0; i < embedFontInfoList.size(); i++) {
- EmbedFontInfo configFontInfo = (EmbedFontInfo) fontList.get(i);
+ EmbedFontInfo configFontInfo = (EmbedFontInfo) embedFontInfoList.get(i);
String fontFile = configFontInfo.getEmbedFile();
internalName = "F" + num;
num++;
@@ -84,11 +82,12 @@
// If the user specified an XML-based metrics file, we'll use it
// Otherwise, calculate metrics directly from the font file.
if (metricsUrl != null) {
- LazyFont fontMetrics = new LazyFont(configFontInfo, resolver);
- Source fontSource = resolver.resolve(configFontInfo.getEmbedFile());
+ LazyFont fontMetrics = new LazyFont(configFontInfo, fontResolver);
+ Source fontSource = fontResolver.resolve(configFontInfo.getEmbedFile());
font = new CustomFontMetricsMapper(fontMetrics, fontSource);
} else {
- CustomFont fontMetrics = FontLoader.loadFont(fontFile, null, true, resolver);
+ CustomFont fontMetrics = FontLoader.loadFont(
+ fontFile, null, true, fontResolver);
font = new CustomFontMetricsMapper(fontMetrics);
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRenderer.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRenderer.java Thu Jul 17 11:14:01 2008
@@ -69,6 +69,7 @@
import org.apache.fop.events.ResourceEventProducer;
import org.apache.fop.fo.Constants;
import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.FontCollection;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.Typeface;
import org.apache.fop.render.AbstractPathOrientedRenderer;
@@ -172,7 +173,13 @@
graphics2D.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
- userAgent.getFactory().getFontManager().setupRenderer(this, graphics2D);
+ FontCollection[] fontCollections = new FontCollection[] {
+ new Base14FontCollection(graphics2D),
+ new InstalledFontCollection(graphics2D),
+ new ConfiguredFontCollection(getFontResolver(), getFontList())
+ };
+ userAgent.getFactory().getFontManager().setup(
+ getFontInfo(), fontCollections);
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLRenderer.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLRenderer.java Thu Jul 17 11:14:01 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -82,6 +82,7 @@
import org.apache.fop.events.ResourceEventProducer;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.FontCollection;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontMetrics;
import org.apache.fop.render.Graphics2DAdapter;
@@ -89,7 +90,10 @@
import org.apache.fop.render.RendererContext;
import org.apache.fop.render.RendererContextConstants;
import org.apache.fop.render.RendererEventProducer;
+import org.apache.fop.render.java2d.Base14FontCollection;
+import org.apache.fop.render.java2d.ConfiguredFontCollection;
import org.apache.fop.render.java2d.FontMetricsMapper;
+import org.apache.fop.render.java2d.InstalledFontCollection;
import org.apache.fop.render.java2d.Java2DRenderer;
import org.apache.fop.render.pcl.extensions.PCLElementMapping;
import org.apache.fop.traits.BorderProps;
@@ -207,7 +211,13 @@
graphics2D.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
- userAgent.getFactory().getFontManager().setupRenderer(this, graphics2D);
+ FontCollection[] fontCollections = new FontCollection[] {
+ new Base14FontCollection(graphics2D),
+ new InstalledFontCollection(graphics2D),
+ new ConfiguredFontCollection(getFontResolver(), getFontList())
+ };
+ userAgent.getFactory().getFontManager().setup(
+ getFontInfo(), fontCollections);
}
/**
@@ -1035,7 +1045,7 @@
//So there's some optimization potential but not otherwise PCLRenderer is a little
//difficult to derive from AbstractPathOrientedRenderer. Maybe an additional layer
//between PrintRenderer and AbstractPathOrientedRenderer is necessary.
-
+
// save position and offset
int saveIP = currentIPPosition;
int saveBP = currentBPPosition;
@@ -1045,7 +1055,7 @@
at.translate(currentIPPosition, currentBPPosition);
at.translate(block.getXOffset(), block.getYOffset());
at.translate(0, block.getSpaceBefore());
-
+
if (!at.isIdentity()) {
saveGraphicsState();
concatenateTransformationMatrix(mptToPt(at));
@@ -1063,12 +1073,12 @@
if (!at.isIdentity()) {
restoreGraphicsState();
}
-
+
// stacked and relative blocks effect stacking
currentIPPosition = saveIP;
currentBPPosition = saveBP;
}
-
+
/** {@inheritDoc} */
protected void renderFlow(NormalFlow flow) {
//TODO This is the same code as in AbstractPathOrientedRenderer
@@ -1083,7 +1093,7 @@
//Establish a new coordinate system
AffineTransform at = new AffineTransform();
at.translate(currentIPPosition, currentBPPosition);
-
+
if (!at.isIdentity()) {
saveGraphicsState();
concatenateTransformationMatrix(mptToPt(at));
@@ -1092,16 +1102,16 @@
currentIPPosition = 0;
currentBPPosition = 0;
super.renderFlow(flow);
-
+
if (!at.isIdentity()) {
restoreGraphicsState();
}
-
+
// stacked and relative blocks effect stacking
currentIPPosition = saveIP;
currentBPPosition = saveBP;
}
-
+
/**
* Concatenates the current transformation matrix with the given one, therefore establishing
* a new coordinate system.
@@ -1225,7 +1235,7 @@
renderDocument(doc, ns, pos, fo.getForeignAttributes());
}
- /**
+ /**
* Common method to render the background and borders for any inline area.
* The all borders and padding are drawn outside the specified area.
* @param area the inline area for which the background, border and padding is to be
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/TestConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/TestConverter.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/TestConverter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/TestConverter.java Thu Jul 17 11:14:01 2008
@@ -274,7 +274,7 @@
File xmlFile = new File(baseDir + "/" + xml);
String baseURL = null;
try {
- baseURL = xmlFile.getParentFile().toURL().toExternalForm();
+ baseURL = xmlFile.getParentFile().toURI().toURL().toExternalForm();
} catch (Exception e) {
logger.error("Error setting base directory");
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/Fop.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/Fop.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/Fop.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/Fop.java Thu Jul 17 11:14:01 2008
@@ -444,14 +444,14 @@
//Set base directory
if (task.getBasedir() != null) {
try {
- this.baseURL = task.getBasedir().toURL().toExternalForm();
+ this.baseURL = task.getBasedir().toURI().toURL().toExternalForm();
} catch (MalformedURLException mfue) {
logger.error("Error creating base URL from base directory", mfue);
}
} else {
try {
if (task.getFofile() != null) {
- this.baseURL = task.getFofile().getParentFile().toURL().
+ this.baseURL = task.getFofile().getParentFile().toURI().toURL().
toExternalForm();
}
} catch (MalformedURLException mfue) {
@@ -519,11 +519,11 @@
try {
if (task.getRelativebase()) {
- this.baseURL = f.getParentFile().toURL().
+ this.baseURL = f.getParentFile().toURI().toURL().
toExternalForm();
}
if (this.baseURL == null) {
- this.baseURL = fs.getDir(task.getProject()).toURL().
+ this.baseURL = fs.getDir(task.getProject()).toURI().toURL().
toExternalForm();
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/RunTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/RunTest.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/RunTest.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/tools/anttasks/RunTest.java Thu Jul 17 11:14:01 2008
@@ -224,11 +224,11 @@
*/
private URL[] createUrls(String mainJar) throws MalformedURLException {
ArrayList urls = new ArrayList();
- urls.add(new File(mainJar).toURL());
+ urls.add(new File(mainJar).toURI().toURL());
File[] libFiles = new File("lib").listFiles();
for (int i = 0; i < libFiles.length; i++) {
if (libFiles[i].getPath().endsWith(".jar")) {
- urls.add(libFiles[i].toURL());
+ urls.add(libFiles[i].toURI().toURL());
}
}
return (URL[]) urls.toArray(new URL[urls.size()]);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java?rev=677664&r1=677663&r2=677664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java Thu Jul 17 11:14:01 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,10 +23,13 @@
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.fonts.CustomFontCollection;
import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.FontCollection;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontManager;
import org.apache.fop.fonts.FontTriplet;
+import org.apache.fop.fonts.base14.Base14FontCollection;
import org.apache.fop.render.PrintRenderer;
/**
@@ -53,7 +56,11 @@
FontInfo fontInfo = new FontInfo();
renderer.setupFontInfo(fontInfo);
FontManager fontManager = ua.getFactory().getFontManager();
- fontManager.setupRenderer(renderer);
+ FontCollection[] fontCollections = new FontCollection[] {
+ new Base14FontCollection(fontManager.isBase14KerningEnabled()),
+ new CustomFontCollection(renderer.getFontResolver(), renderer.getFontList())
+ };
+ fontManager.setup(fontInfo, fontCollections);
FontTriplet triplet = new FontTriplet("Times", "italic",
Font.WEIGHT_NORMAL);
String internalFontKey = fontInfo.getInternalFontKey(triplet);
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org