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/05/12 10:58:23 UTC
svn commit: r655445 [1/4] - in
/xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./ src/codegen/fonts/
src/java/org/apache/fop/apps/ src/java/org/apache/fop/fo/
src/java/org/apache/fop/fo/properties/ src/java/org/apache/fop/fonts/
src/java/org/apache/fo...
Author: acumiskey
Date: Mon May 12 01:58:21 2008
New Revision: 655445
URL: http://svn.apache.org/viewvc?rev=655445&view=rev
Log:
Merged revisions 654783,654849,654869,654946,654982,655085,655093,655275,655281,655285,655309,655349,655370 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk
........
r654783 | vhennebert | 2008-05-09 13:30:40 +0100 (Fri, 09 May 2008) | 3 lines
Checkstyle and minor typo fixes
Set svn:keywords and svn:eol-style properties on new files
........
r654849 | acumiskey | 2008-05-09 16:14:37 +0100 (Fri, 09 May 2008) | 1 line
Unwanted list self concatenation :).
........
r654869 | acumiskey | 2008-05-09 17:13:47 +0100 (Fri, 09 May 2008) | 1 line
Moved the instantiation of the FontManager to the constructor along with all the other aggregated objects.
........
r654946 | adelmelle | 2008-05-09 22:40:14 +0100 (Fri, 09 May 2008) | 6 lines
Bugzilla 44794:
Added support for page-number-citation and page-number-citation-last of fo:inline.
Corrected behavior for page-number-citation-last of fo:block - forward references properly resolved.
(+ support for page-number-citation-last on list-related FOs)
........
r654982 | acumiskey | 2008-05-10 00:47:28 +0100 (Sat, 10 May 2008) | 1 line
Checkstyle cleanup and javadoc
........
r655085 | adelmelle | 2008-05-10 14:44:09 +0100 (Sat, 10 May 2008) | 5 lines
Tweaks:
-> remove split in CommonFont: font-size is resolved early, so no need anymore for CachedCommonFont
-> allow disabling the PropertyCache via a system property (just in case...)
........
r655093 | adelmelle | 2008-05-10 15:23:56 +0100 (Sat, 10 May 2008) | 1 line
Correction: set default to true...
........
r655275 | maxberger | 2008-05-11 08:30:55 +0100 (Sun, 11 May 2008) | 1 line
made sure warning for missing glyphs is emitted in all cases
........
r655281 | maxberger | 2008-05-11 10:01:31 +0100 (Sun, 11 May 2008) | 1 line
Support character-by-character font-selection strategy on fo:character element
........
r655285 | maxberger | 2008-05-11 10:17:07 +0100 (Sun, 11 May 2008) | 1 line
Forgot to update testcases
........
r655309 | adelmelle | 2008-05-11 13:22:22 +0100 (Sun, 11 May 2008) | 3 lines
Make the LM clean up on end-of-layout, if possible.
Added clearChildNodes() method to FObj to release the reference to the FO's children.
........
r655349 | spepping | 2008-05-11 19:05:51 +0100 (Sun, 11 May 2008) | 2 lines
The spec requires rounding, not truncating
........
r655370 | adelmelle | 2008-05-11 22:03:41 +0100 (Sun, 11 May 2008) | 1 line
Avoid creation of unnecessary dummy areas.
........
Added:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/page-number-citation_bugzilla44794.xml
- copied unchanged from r655370, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_bugzilla44794.xml
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/page-number-citation_list.xml
- copied unchanged from r655370, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_list.xml
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/ (props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/fonts/font-file.xsl
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOURIResolver.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOUserAgent.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactory.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactoryConfigurator.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/FObj.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/CommonFont.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/NumberProperty.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/PropertyCache.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/CustomFontCollection.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/EmbedFontInfo.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Font.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCache.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCollection.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontDescriptor.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 (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManagerConfigurator.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontSetup.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontTriplet.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontUtil.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/MultiByteFont.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/SingleByteFont.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Typeface.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/base14/Base14FontCollection.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/AttributeValue.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontQualifier.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitution.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutions.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontWeightRange.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.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/layoutmgr/inline/WrapperLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractRendererConfigurator.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/PrintRendererConfigurator.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/java2d/Base14FontCollection.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java (contents, props changed)
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/render/ps/AbstractPSTranscoder.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/NativeTextHandler.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/fotree/testcases/demo-test-success.fo
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/fotree/testcases/no_namespace_prefix.fo
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/config/BaseUserConfigTestCase.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java (contents, props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/render/pdf/BasePDFTestCase.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/disabled-testcases.xml
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon May 12 01:58:21 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk:1-654751
+/xmlgraphics/fop/trunk:1-655441
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/fonts/font-file.xsl
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/fonts/font-file.xsl?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/fonts/font-file.xsl (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/fonts/font-file.xsl Mon May 12 01:58:21 2008
@@ -42,6 +42,7 @@
import org.apache.fop.fonts.FontType;
import org.apache.fop.fonts.Base14Font;
import org.apache.fop.fonts.CodePointMapping;
+import org.apache.fop.fonts.Typeface;;
public class <xsl:value-of select="class-name"/> extends Base14Font {
private final static String fontName = "<xsl:value-of select="font-name"/>";
@@ -169,7 +170,8 @@
if (d != 0) {
return d;
} else {
- return '#';
+ this.warnMissingGlyph(c);
+ return Typeface.NOT_FOUND;
}
}
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=655445&r1=655444&r2=655445&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 Mon May 12 01:58:21 2008
@@ -52,7 +52,7 @@
/** URIResolver for RFC 2397 data URLs */
private URIResolver dataURIResolver = new DataURIResolver();
-
+
/** A user settable URI Resolver */
private URIResolver uriResolver = null;
@@ -77,7 +77,7 @@
}
File dir = new File(base);
try {
- base = (dir.isDirectory() ? dir.toURL() : new URL(base)).toExternalForm();
+ base = (dir.isDirectory() ? dir.toURL() : new URL(base)).toExternalForm();
} catch (MalformedURLException mfue) {
if (throwExceptions) {
throw mfue;
@@ -147,11 +147,11 @@
*/
public Source resolve(String href, String base) throws TransformerException {
Source source = null;
-
+
// data URLs can be quite long so evaluate early and don't try to build a File
// (can lead to problems)
source = dataURIResolver.resolve(href, base);
-
+
// Custom uri resolution
if (source == null && uriResolver != null) {
source = uriResolver.resolve(href, base);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOUserAgent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOUserAgent.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOUserAgent.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FOUserAgent.java Mon May 12 01:58:21 2008
@@ -76,7 +76,7 @@
private static Log log = LogFactory.getLog("FOP");
private FopFactory factory;
-
+
/**
* The base URL for all URL resolutions, especially for
* external-graphics.
@@ -88,7 +88,7 @@
/** A user settable URI Resolver */
private URIResolver uriResolver = null;
-
+
private float targetResolution = FopFactoryConfigurator.DEFAULT_TARGET_RESOLUTION;
private Map rendererOptions = new java.util.HashMap();
private File outputFile = null;
@@ -96,7 +96,7 @@
private FOEventHandler foEventHandlerOverride = null;
private boolean locatorEnabled = true; // true by default (for error messages).
private EventBroadcaster eventBroadcaster = new FOPEventBroadcaster();
-
+
/** Producer: Metadata element for the system/software that produces
* the document. (Some renderers can store this in the document.)
*/
@@ -107,18 +107,18 @@
*/
protected String creator = null;
- /** Creation Date: Override of the date the document was created.
+ /** Creation Date: Override of the date the document was created.
* (Some renderers can store this in the document.)
*/
protected Date creationDate = null;
-
+
/** Author of the content of the document. */
protected String author = null;
/** Title of the document. */
protected String title = null;
/** Set of keywords applicable to this document. */
protected String keywords = null;
-
+
private ImageSessionContext imageSessionContext = new AbstractImageSessionContext() {
public ImageContext getParentContext() {
@@ -132,11 +132,11 @@
public Source resolveURI(String uri) {
return FOUserAgent.this.resolveURI(uri);
}
-
+
};
-
+
/**
- * Main constructor. <b>This constructor should not be called directly. Please use the
+ * Main constructor. <b>This constructor should not be called directly. Please use the
* methods from FopFactory to construct FOUserAgent instances!</b>
* @param factory the factory that provides environment-level information
* @see org.apache.fop.apps.FopFactory
@@ -150,17 +150,17 @@
setFontBaseURL(factory.getFontManager().getFontBaseURL());
setTargetResolution(factory.getTargetResolution());
}
-
+
/** @return the associated FopFactory instance */
public FopFactory getFactory() {
return this.factory;
}
-
+
// ---------------------------------------------- rendering-run dependent stuff
-
+
/**
- * Sets an explicit renderer to use which overrides the one defined by the
- * render type setting.
+ * Sets an explicit renderer to use which overrides the one defined by the
+ * render type setting.
* @param renderer the Renderer instance to use
*/
public void setRendererOverride(Renderer renderer) {
@@ -177,7 +177,7 @@
/**
* Sets an explicit FOEventHandler instance which overrides the one
- * defined by the render type setting.
+ * defined by the render type setting.
* @param handler the FOEventHandler instance
*/
public void setFOEventHandlerOverride(FOEventHandler handler) {
@@ -193,7 +193,7 @@
}
/**
- * Sets the producer of the document.
+ * Sets the producer of the document.
* @param producer source of document
*/
public void setProducer(String producer) {
@@ -209,7 +209,7 @@
}
/**
- * Sets the creator of the document.
+ * Sets the creator of the document.
* @param creator of document
*/
public void setCreator(String creator) {
@@ -225,7 +225,7 @@
}
/**
- * Sets the creation date of the document.
+ * Sets the creation date of the document.
* @param creationDate date of document
*/
public void setCreationDate(Date creationDate) {
@@ -241,7 +241,7 @@
}
/**
- * Sets the author of the document.
+ * Sets the author of the document.
* @param author of document
*/
public void setAuthor(String author) {
@@ -258,7 +258,7 @@
/**
* Sets the title of the document. This will override any title coming from
- * an fo:title element.
+ * an fo:title element.
* @param title of document
*/
public void setTitle(String title) {
@@ -274,7 +274,7 @@
}
/**
- * Sets the keywords for the document.
+ * Sets the keywords for the document.
* @param keywords for the document
*/
public void setKeywords(String keywords) {
@@ -296,7 +296,7 @@
public Map getRendererOptions() {
return rendererOptions;
}
-
+
/**
* Sets the base URL.
* @param baseUrl base URL
@@ -343,7 +343,7 @@
* to the default resolver.
* @param uri URI to access
* @return A {@link javax.xml.transform.Source} object, or null if the URI
- * cannot be resolved.
+ * cannot be resolved.
* @see org.apache.fop.apps.FOURIResolver
*/
public Source resolveURI(String uri) {
@@ -357,7 +357,7 @@
* @param href URI to access
* @param base the base URI to resolve against
* @return A {@link javax.xml.transform.Source} object, or null if the URI
- * cannot be resolved.
+ * cannot be resolved.
* @see org.apache.fop.apps.FOURIResolver
*/
public Source resolveURI(String href, String base) {
@@ -402,9 +402,9 @@
* @see #getTargetResolution()
*/
public float getTargetPixelUnitToMillimeter() {
- return 25.4f / this.targetResolution;
+ return 25.4f / this.targetResolution;
}
-
+
/** @return the resolution for resolution-dependant output */
public float getTargetResolution() {
return this.targetResolution;
@@ -419,7 +419,7 @@
public void setTargetResolution(float dpi) {
this.targetResolution = dpi;
if (log.isDebugEnabled()) {
- log.debug("target-resolution set to: " + targetResolution
+ log.debug("target-resolution set to: " + targetResolution
+ "dpi (px2mm=" + getTargetPixelUnitToMillimeter() + ")");
}
}
@@ -433,7 +433,7 @@
public void setTargetResolution(int dpi) {
setTargetResolution((float)dpi);
}
-
+
/**
* Returns the image session context for the image package.
* @return the ImageSessionContext instance for this rendering run
@@ -441,7 +441,7 @@
public ImageSessionContext getImageSessionContext() {
return this.imageSessionContext;
}
-
+
// ---------------------------------------------- environment-level stuff
// (convenience access to FopFactory methods)
@@ -457,9 +457,9 @@
* @see #getSourceResolution()
*/
public float getSourcePixelUnitToMillimeter() {
- return getFactory().getSourcePixelUnitToMillimeter();
+ return getFactory().getSourcePixelUnitToMillimeter();
}
-
+
/** @return the resolution for resolution-dependant input */
public float getSourceResolution() {
return getFactory().getSourceResolution();
@@ -475,7 +475,7 @@
public String getPageHeight() {
return getFactory().getPageHeight();
}
-
+
/**
* Gets the default page-width to use as fallback,
* in case page-width="auto"
@@ -486,7 +486,7 @@
public String getPageWidth() {
return getFactory().getPageWidth();
}
-
+
/**
* Returns whether FOP is strictly validating input XSL
* @return true of strict validation turned on, false otherwise
@@ -497,7 +497,7 @@
}
/**
- * @return true if the indent inheritance should be broken when crossing reference area
+ * @return true if the indent inheritance should be broken when crossing reference area
* boundaries (for more info, see the javadoc for the relative member variable)
* @see FopFactory#isBreakIndentInheritanceOnReferenceAreaBoundary()
*/
@@ -518,7 +518,7 @@
public XMLHandlerRegistry getXMLHandlerRegistry() {
return getFactory().getXMLHandlerRegistry();
}
-
+
/**
* Controls the use of SAXLocators to provide location information in error
* messages.
@@ -550,7 +550,7 @@
private class FOPEventBroadcaster extends DefaultEventBroadcaster {
private EventListener rootListener;
-
+
public FOPEventBroadcaster() {
//Install a temporary event listener that catches the first event to
//do some initialization.
@@ -569,13 +569,13 @@
}
};
}
-
+
/** {@inheritDoc} */
public void broadcastEvent(Event event) {
rootListener.processEvent(event);
}
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactory.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactory.java Mon May 12 01:58:21 2008
@@ -59,37 +59,37 @@
* found and managed in the FOUserAgent.
*/
public class FopFactory implements ImageContext {
-
+
/** logger instance */
private static Log log = LogFactory.getLog(FopFactory.class);
-
+
/** Factory for Renderers and FOEventHandlers */
private RendererFactory rendererFactory;
-
+
/** Registry for XML handlers */
private XMLHandlerRegistry xmlHandlers;
-
+
/** The registry for ElementMapping instances */
private ElementMappingRegistry elementMappingRegistry;
- /** The registry for ContentHandlerFactory instance */
- private ContentHandlerFactoryRegistry contentHandlerFactoryRegistry
+ /** The registry for ContentHandlerFactory instance */
+ private ContentHandlerFactoryRegistry contentHandlerFactoryRegistry
= new ContentHandlerFactoryRegistry();
-
+
/** The resolver for user-supplied hyphenation patterns */
private HyphenationTreeResolver hyphResolver = null;
private ColorSpaceCache colorSpaceCache = null;
-
+
/** Image manager for loading and caching image objects */
private ImageManager imageManager;
/** Font manager for font substitution, autodetection and caching **/
private FontManager fontManager;
-
+
/** Configuration layer used to configure fop */
private FopFactoryConfigurator config = null;
-
+
/**
* The base URL for all URL resolutions, especially for
* external-graphics.
@@ -101,10 +101,10 @@
/**
* FOP has the ability, for some FO's, to continue processing even if the
- * input XSL violates that FO's content model. This is the default
+ * input XSL violates that FO's content model. This is the default
* behavior for FOP. However, this flag, if set, provides the user the
* ability for FOP to halt on all content model violations if desired.
- */
+ */
private boolean strictFOValidation = FopFactoryConfigurator.DEFAULT_STRICT_FO_VALIDATION;
/**
@@ -113,7 +113,7 @@
*/
private boolean strictUserConfigValidation
= FopFactoryConfigurator.DEFAULT_STRICT_USERCONFIG_VALIDATION;
-
+
/** Source resolution in dpi */
private float sourceResolution = FopFactoryConfigurator.DEFAULT_SOURCE_RESOLUTION;
@@ -122,7 +122,7 @@
/** Page height */
private String pageHeight = FopFactoryConfigurator.DEFAULT_PAGE_HEIGHT;
-
+
/** Page width */
private String pageWidth = FopFactoryConfigurator.DEFAULT_PAGE_WIDTH;
@@ -136,7 +136,7 @@
private Set ignoredNamespaces;
private FOURIResolver foURIResolver;
-
+
/**
* Main constructor.
*/
@@ -144,13 +144,21 @@
this.config = new FopFactoryConfigurator(this);
this.elementMappingRegistry = new ElementMappingRegistry(this);
this.foURIResolver = new FOURIResolver(validateUserConfigStrictly());
+ this.fontManager = new FontManager() {
+
+ /** {@inheritDoc} */
+ public void setFontBaseURL(String fontBase) throws MalformedURLException {
+ super.setFontBaseURL(getFOURIResolver().checkBaseURL(fontBase));
+ }
+
+ };
this.colorSpaceCache = new ColorSpaceCache(foURIResolver);
this.imageManager = new ImageManager(this);
this.rendererFactory = new RendererFactory();
this.xmlHandlers = new XMLHandlerRegistry();
this.ignoredNamespaces = new java.util.HashSet();
}
-
+
/**
* Returns a new FopFactory instance.
* @return the requested FopFactory instance.
@@ -158,13 +166,13 @@
public static FopFactory newInstance() {
return new FopFactory();
}
-
+
/**
* Returns a new FOUserAgent instance. Use the FOUserAgent to configure special values that
* are particular to a rendering run. Don't reuse instances over multiple rendering runs but
* instead create a new one each time and reuse the FopFactory.
* @return the newly created FOUserAgent instance initialized with default values
- * @throws FOPException
+ * @throws FOPException
*/
public FOUserAgent newFOUserAgent() {
FOUserAgent userAgent = new FOUserAgent(this);
@@ -172,12 +180,12 @@
}
/**
- * Returns a new {@link Fop} instance. FOP will be configured with a default user agent
+ * Returns a new {@link Fop} instance. FOP will be configured with a default user agent
* instance.
* <p>
* MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
* use the constants defined in {@link MimeConstants}.
- * @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
+ * @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
* @return the new Fop instance
* @throws FOPException when the constructor fails
*/
@@ -186,29 +194,29 @@
}
/**
- * Returns a new {@link Fop} instance. Use this factory method if you want to configure this
+ * Returns a new {@link Fop} instance. Use this factory method if you want to configure this
* very rendering run, i.e. if you want to set some metadata like the title and author of the
- * document you want to render. In that case, create a new {@link FOUserAgent}
+ * document you want to render. In that case, create a new {@link FOUserAgent}
* instance using {@link #newFOUserAgent()}.
* <p>
* MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
* use the constants defined in {@link MimeConstants}.
* @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
- * @param userAgent the user agent that will be used to control the rendering run
+ * @param userAgent the user agent that will be used to control the rendering run
* @return the new Fop instance
* @throws FOPException when the constructor fails
*/
public Fop newFop(String outputFormat, FOUserAgent userAgent) throws FOPException {
return newFop(outputFormat, userAgent, null);
}
-
+
/**
- * Returns a new {@link Fop} instance. FOP will be configured with a default user agent
+ * Returns a new {@link Fop} instance. FOP will be configured with a default user agent
* instance. Use this factory method if your output type requires an output stream.
* <p>
* MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
* use the constants defined in {@link MimeConstants}.
- * @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
+ * @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
* @param stream the output stream
* @return the new Fop instance
* @throws FOPException when the constructor fails
@@ -227,30 +235,30 @@
* MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
* use the constants defined in {@link MimeConstants}.
* @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
- * @param userAgent the user agent that will be used to control the rendering run
+ * @param userAgent the user agent that will be used to control the rendering run
* @param stream the output stream
* @return the new Fop instance
* @throws FOPException when the constructor fails
*/
- public Fop newFop(String outputFormat, FOUserAgent userAgent, OutputStream stream)
+ public Fop newFop(String outputFormat, FOUserAgent userAgent, OutputStream stream)
throws FOPException {
if (userAgent == null) {
throw new NullPointerException("The userAgent parameter must not be null!");
}
return new Fop(outputFormat, userAgent, stream);
}
-
+
/**
* Returns a new {@link Fop} instance. Use this factory method if you want to supply your
- * own {@link org.apache.fop.render.Renderer Renderer} or
- * {@link org.apache.fop.fo.FOEventHandler FOEventHandler}
+ * own {@link org.apache.fop.render.Renderer Renderer} or
+ * {@link org.apache.fop.fo.FOEventHandler FOEventHandler}
* instance instead of the default ones created internally by FOP.
- * @param userAgent the user agent that will be used to control the rendering run
+ * @param userAgent the user agent that will be used to control the rendering run
* @return the new Fop instance
* @throws FOPException when the constructor fails
*/
public Fop newFop(FOUserAgent userAgent) throws FOPException {
- if (userAgent.getRendererOverride() == null
+ if (userAgent.getRendererOverride() == null
&& userAgent.getFOEventHandlerOverride() == null) {
throw new IllegalStateException("Either the overriding renderer or the overriding"
+ " FOEventHandler must be set when this factory method is used!");
@@ -267,7 +275,7 @@
public XMLHandlerRegistry getXMLHandlerRegistry() {
return this.xmlHandlers;
}
-
+
/** @return the element mapping registry */
public ElementMappingRegistry getElementMappingRegistry() {
return this.elementMappingRegistry;
@@ -310,7 +318,7 @@
public LayoutManagerMaker getLayoutManagerMakerOverride() {
return this.lmMakerOverride;
}
-
+
/**
* Sets the base URL.
* @param base the base URL
@@ -327,7 +335,7 @@
public String getBaseURL() {
return this.base;
}
-
+
/**
* Sets the font base URL.
* @param fontBase font base URL
@@ -367,10 +375,10 @@
}
this.hyphenBase = foURIResolver.checkBaseURL(hyphenBase);
}
-
+
/**
* Sets the URI Resolver. It is used for resolving factory-level URIs like hyphenation
- * patterns and as backup for URI resolution performed during a rendering run.
+ * patterns and as backup for URI resolution performed during a rendering run.
* @param uriResolver the new URI resolver
*/
public void setURIResolver(URIResolver uriResolver) {
@@ -397,7 +405,7 @@
public HyphenationTreeResolver getHyphenationTreeResolver() {
return this.hyphResolver;
}
-
+
/**
* Sets the HyphenationTreeResolver to be used for resolving user-supplied hyphenation files.
* @param hyphResolver the HyphenationTreeResolver instance
@@ -424,7 +432,7 @@
}
/**
- * @return true if the indent inheritance should be broken when crossing reference area
+ * @return true if the indent inheritance should be broken when crossing reference area
* boundaries (for more info, see the javadoc for the relative member variable)
*/
public boolean isBreakIndentInheritanceOnReferenceAreaBoundary() {
@@ -447,7 +455,7 @@
public void setBreakIndentInheritanceOnReferenceAreaBoundary(boolean value) {
this.breakIndentInheritanceOnReferenceAreaBoundary = value;
}
-
+
/**
* @return true if kerning on base 14 fonts is enabled
* @deprecated use getFontManager().isBase14KerningEnabled() instead
@@ -455,7 +463,7 @@
public boolean isBase14KerningEnabled() {
return getFontManager().isBase14KerningEnabled();
}
-
+
/**
* Controls whether kerning is activated on base 14 fonts.
* @param value true if kerning should be activated
@@ -464,7 +472,7 @@
public void setBase14KerningEnabled(boolean value) {
getFontManager().setBase14KerningEnabled(value);
}
-
+
/** @return the resolution for resolution-dependant input */
public float getSourceResolution() {
return this.sourceResolution;
@@ -477,7 +485,7 @@
* @see #getSourceResolution()
*/
public float getSourcePixelUnitToMillimeter() {
- return 25.4f / getSourceResolution();
+ return 25.4f / getSourceResolution();
}
/**
@@ -488,7 +496,7 @@
public void setSourceResolution(float dpi) {
this.sourceResolution = dpi;
if (log.isDebugEnabled()) {
- log.debug("source-resolution set to: " + sourceResolution
+ log.debug("source-resolution set to: " + sourceResolution
+ "dpi (px2mm=" + getSourcePixelUnitToMillimeter() + ")");
}
}
@@ -505,7 +513,7 @@
* @see #getTargetResolution()
*/
public float getTargetPixelUnitToMillimeter() {
- return 25.4f / this.targetResolution;
+ return 25.4f / this.targetResolution;
}
/**
@@ -525,7 +533,7 @@
public void setSourceResolution(int dpi) {
setSourceResolution((float)dpi);
}
-
+
/**
* Gets the default page-height to use as fallback,
* in case page-height="auto"
@@ -535,7 +543,7 @@
public String getPageHeight() {
return this.pageHeight;
}
-
+
/**
* Sets the page-height to use as fallback, in case
* page-height="auto"
@@ -548,7 +556,7 @@
log.debug("Default page-height set to: " + pageHeight);
}
}
-
+
/**
* Gets the default page-width to use as fallback,
* in case page-width="auto"
@@ -558,7 +566,7 @@
public String getPageWidth() {
return this.pageWidth;
}
-
+
/**
* Sets the page-width to use as fallback, in case
* page-width="auto"
@@ -571,27 +579,27 @@
log.debug("Default page-width set to: " + pageWidth);
}
}
-
+
/**
* Adds a namespace to the set of ignored namespaces.
- * If FOP encounters a namespace which it cannot handle, it issues a warning except if this
+ * If FOP encounters a namespace which it cannot handle, it issues a warning except if this
* namespace is in the ignored set.
* @param namespaceURI the namespace URI
*/
public void ignoreNamespace(String namespaceURI) {
this.ignoredNamespaces.add(namespaceURI);
}
-
+
/**
* Adds a collection of namespaces to the set of ignored namespaces.
- * If FOP encounters a namespace which it cannot handle, it issues a warning except if this
+ * If FOP encounters a namespace which it cannot handle, it issues a warning except if this
* namespace is in the ignored set.
* @param namespaceURIs the namespace URIs
*/
public void ignoreNamespaces(Collection namespaceURIs) {
this.ignoredNamespaces.addAll(namespaceURIs);
}
-
+
/**
* Indicates whether a namespace URI is on the ignored list.
* @param namespaceURI the namespace URI
@@ -600,14 +608,14 @@
public boolean isNamespaceIgnored(String namespaceURI) {
return this.ignoredNamespaces.contains(namespaceURI);
}
-
+
/** @return the set of namespaces that are ignored by FOP */
public Set getIgnoredNamespace() {
return Collections.unmodifiableSet(this.ignoredNamespaces);
}
//------------------------------------------- Configuration stuff
-
+
/**
* Set the user configuration.
* @param userConfigFile the configuration file
@@ -627,11 +635,11 @@
public void setUserConfig(String uri) throws SAXException, IOException {
config.setUserConfig(uri);
}
-
+
/**
* Set the user configuration.
* @param userConfig configuration
- * @throws FOPException if a configuration problem occurs
+ * @throws FOPException if a configuration problem occurs
*/
public void setUserConfig(Configuration userConfig) throws FOPException {
config.setUserConfig(userConfig);
@@ -690,25 +698,15 @@
public FontCache getFontCache() {
return getFontManager().getFontCache();
}
-
+
/**
* Returns the font manager.
* @return the font manager
*/
public FontManager getFontManager() {
- if (fontManager == null) {
- this.fontManager = new FontManager() {
-
- /** {@inheritDoc} */
- public void setFontBaseURL(String fontBase) throws MalformedURLException {
- super.setFontBaseURL(getFOURIResolver().checkBaseURL(fontBase));
- }
-
- };
- }
return this.fontManager;
}
-
+
/**
* Attempts to resolve the given URI.
* Will use the configured resolver and if not successful fall back
@@ -716,7 +714,7 @@
* @param href URI to access
* @param baseUri the base URI to resolve against
* @return A {@link javax.xml.transform.Source} object, or null if the URI
- * cannot be resolved.
+ * cannot be resolved.
* @see org.apache.fop.apps.FOURIResolver
*/
public Source resolveURI(String href, String baseUri) {
@@ -728,19 +726,19 @@
}
return source;
}
-
+
/**
* Create (if needed) and return an ICC ColorSpace instance.
*
* The ICC profile source is taken from the src attribute of the color-profile FO element.
* If the ICC ColorSpace is not yet in the cache a new one is created and stored in the cache.
*
- * The FOP URI resolver is used to try and locate the ICC file.
+ * The FOP URI resolver is used to try and locate the ICC file.
* If that fails null is returned.
*
* @param baseUri a base URI to resolve relative URIs
* @param iccProfileSrc ICC Profile source to return a ColorSpace for
- * @return ICC ColorSpace object or null if ColorSpace could not be created
+ * @return ICC ColorSpace object or null if ColorSpace could not be created
*/
public ColorSpace getColorSpace(String baseUri, String iccProfileSrc) {
return colorSpaceCache.get(baseUri, iccProfileSrc);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactoryConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactoryConfigurator.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactoryConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/apps/FopFactoryConfigurator.java Mon May 12 01:58:21 2008
@@ -42,25 +42,25 @@
/** Defines if FOP should use an alternative rule to determine text indents */
public static final boolean DEFAULT_BREAK_INDENT_INHERITANCE = false;
-
+
/** Defines if FOP should validate the user config strictly */
public static final boolean DEFAULT_STRICT_USERCONFIG_VALIDATION = true;
-
+
/** Defines if FOP should use strict validation for FO and user config */
public static final boolean DEFAULT_STRICT_FO_VALIDATION = true;
-
+
/** Defines the default page-width */
public static final String DEFAULT_PAGE_WIDTH = "8.26in";
-
+
/** Defines the default page-height */
public static final String DEFAULT_PAGE_HEIGHT = "11in";
-
+
/** Defines the default source resolution (72dpi) for FOP */
public static final float DEFAULT_SOURCE_RESOLUTION = 72.0f; //dpi
-
+
/** Defines the default target resolution (72dpi) for FOP */
public static final float DEFAULT_TARGET_RESOLUTION = 72.0f; //dpi
-
+
/** logger instance */
private final Log log = LogFactory.getLog(FopFactoryConfigurator.class);
@@ -78,7 +78,7 @@
super();
this.factory = factory;
}
-
+
/**
* Initializes user agent settings from the user configuration
* file, if present: baseURL, resolution, default page size,...
@@ -87,7 +87,7 @@
*/
public void configure(FopFactory factory) throws FOPException {
if (log.isDebugEnabled()) {
- log.debug("Initializing FopFactory Configuration");
+ log.debug("Initializing FopFactory Configuration");
}
// strict configuration
@@ -98,9 +98,9 @@
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, false);
}
- }
+ }
boolean strict = factory.validateUserConfigStrictly();
-
+
// strict fo validation
if (cfg.getChild("strict-validation", false) != null) {
try {
@@ -128,14 +128,14 @@
LogUtil.handleException(log, mfue, strict);
}
}
-
+
// renderer options
if (cfg.getChild("source-resolution", false) != null) {
factory.setSourceResolution(
cfg.getChild("source-resolution").getValueAsFloat(
FopFactoryConfigurator.DEFAULT_SOURCE_RESOLUTION));
if (log.isDebugEnabled()) {
- log.debug("source-resolution set to: " + factory.getSourceResolution()
+ log.debug("source-resolution set to: " + factory.getSourceResolution()
+ "dpi (px2mm=" + factory.getSourcePixelUnitToMillimeter() + ")");
}
}
@@ -144,9 +144,9 @@
cfg.getChild("target-resolution").getValueAsFloat(
FopFactoryConfigurator.DEFAULT_TARGET_RESOLUTION));
if (log.isDebugEnabled()) {
- log.debug("target-resolution set to: " + factory.getTargetResolution()
+ log.debug("target-resolution set to: " + factory.getTargetResolution()
+ "dpi (px2mm=" + factory.getTargetPixelUnitToMillimeter()
- + ")");
+ + ")");
}
}
if (cfg.getChild("break-indent-inheritance", false) != null) {
@@ -156,13 +156,13 @@
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, strict);
}
- }
+ }
Configuration pageConfig = cfg.getChild("default-page-settings");
if (pageConfig.getAttribute("height", null) != null) {
factory.setPageHeight(
pageConfig.getAttribute("height", FopFactoryConfigurator.DEFAULT_PAGE_HEIGHT));
if (log.isInfoEnabled()) {
- log.info("Default page-height set to: " + factory.getPageHeight());
+ log.info("Default page-height set to: " + factory.getPageHeight());
}
}
if (pageConfig.getAttribute("width", null) != null) {
@@ -178,7 +178,7 @@
FontManagerConfigurator fontManagerConfigurator = new FontManagerConfigurator(cfg);
fontManagerConfigurator.configure(fontManager, strict);
}
-
+
/**
* Set the user configuration.
* @param userConfigFile the configuration file
@@ -193,7 +193,7 @@
throw new FOPException(e);
}
}
-
+
/**
* Set the user configuration from an URI.
* @param uri the URI to the configuration file
@@ -208,22 +208,22 @@
throw new FOPException(e);
}
}
-
+
/**
* Set the user configuration.
* @param cfg avalon configuration
- * @throws FOPException if a configuration problem occurs
+ * @throws FOPException if a configuration problem occurs
*/
public void setUserConfig(Configuration cfg) throws FOPException {
this.cfg = cfg;
configure(this.factory);
}
-
+
/**
* Get the avalon user configuration.
* @return the user configuration
*/
public Configuration getUserConfig() {
return this.cfg;
- }
+ }
}
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=655445&r1=655444&r2=655445&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 Mon May 12 01:58:21 2008
@@ -963,7 +963,7 @@
// font-family
m = new FontFamilyProperty.Maker(PR_FONT_FAMILY);
m.setInherited(true);
- m.setDefault("sans-serif");
+ m.setDefault("sans-serif,Symbol,ZapfDingbats");
m.addShorthand(s_generics[PR_FONT]);
addPropertyMaker("font-family", m);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FObj.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FObj.java Mon May 12 01:58:21 2008
@@ -515,6 +515,13 @@
return -1;
}
+ /**
+ * Clears the list of child nodes.
+ */
+ public void clearChildNodes() {
+ this.firstChild = null;
+ }
+
/** @return the "id" property. */
public String getId() {
return id;
@@ -598,7 +605,7 @@
return (super.toString() + "[@id=" + this.id + "]");
}
-
+ /** Basic {@link FONodeIterator} implementation */
public class FObjIterator implements FONodeIterator {
private static final int F_NONE_ALLOWED = 0;
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/CommonFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/CommonFont.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/CommonFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/CommonFont.java Mon May 12 01:58:21 2008
@@ -39,177 +39,60 @@
* absolute font-size and font-size-adjust) */
private static final PropertyCache cache = new PropertyCache(CommonFont.class);
- /**
- * Class holding canonical instances of bundles of the
- * cacheable (non-relative) CommonFont properties
- *
- */
- protected static final class CachedCommonFont {
-
- /** cache holding all canonical instances */
- private static final PropertyCache cache = new PropertyCache(CachedCommonFont.class);
-
- private int hash = 0;
-
- /**
- * The "font-family" property.
- */
- private final FontFamilyProperty fontFamily;
-
- /**
- * The "font-selection-strategy" property.
- */
- private final EnumProperty fontSelectionStrategy;
+ /** hashcode of this instance */
+ private int hash = 0;
- /**
- * The "font-stretch" property.
- */
- private final EnumProperty fontStretch;
-
- /**
- * The "font-style" property.
- */
- private final EnumProperty fontStyle;
-
- /**
- * The "font-variant" property.
- */
- private final EnumProperty fontVariant;
-
- /**
- * The "font-weight" property.
- */
- private final EnumProperty fontWeight;
-
- /**
- * Constructor
- *
- * @param fontFamily the font-family property
- * @param fontSelectionStrategy the font-selection-strategy property
- * @param fontStretch the font-stretch property
- * @param fontStyle the font-style property
- * @param fontVariant the font-variant property
- * @param fontWeight the font-weight property
- */
- private CachedCommonFont(FontFamilyProperty fontFamily,
- EnumProperty fontSelectionStrategy,
- EnumProperty fontStretch,
- EnumProperty fontStyle,
- EnumProperty fontVariant,
- EnumProperty fontWeight) {
- this.fontFamily = fontFamily;
- this.fontSelectionStrategy = fontSelectionStrategy;
- this.fontStretch = fontStretch;
- this.fontStyle = fontStyle;
- this.fontVariant = fontVariant;
- this.fontWeight = fontWeight;
- }
-
- /**
- * Returns the canonical instance corresponding to the given
- * properties
- *
- * @param fontFamily the font-family property
- * @param fontSelectionStrategy the font-selection-strategy property
- * @param fontStretch the font-stretch property
- * @param fontStyle the font-style property
- * @param fontVariant the font-variant property
- * @param fontWeight the font-weight property
- * @return the canonical instance
- */
- private static final CachedCommonFont getInstance(FontFamilyProperty fontFamily,
- EnumProperty fontSelectionStrategy,
- EnumProperty fontStretch,
- EnumProperty fontStyle,
- EnumProperty fontVariant,
- EnumProperty fontWeight) {
- return cache.fetch(new CachedCommonFont(
- fontFamily,
- fontSelectionStrategy,
- fontStretch,
- fontStyle,
- fontVariant,
- fontWeight));
- }
-
- /** @return the first font-family name in the list */
- private String getFirstFontFamily() {
- return ((Property) fontFamily.list.get(0)).getString();
- }
-
- /** @return an array with the font-family names */
- private String[] getFontFamily() {
- List lst = fontFamily.getList();
- String[] fontFamily = new String[lst.size()];
- for (int i = 0, c = lst.size(); i < c; i++) {
- fontFamily[i] = ((Property)lst.get(i)).getString();
- }
- return fontFamily;
- }
-
- /** {@inheritDoc} */
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (o instanceof CachedCommonFont) {
- CachedCommonFont ccf = (CachedCommonFont) o;
- return (ccf.fontFamily == this.fontFamily)
- && (ccf.fontSelectionStrategy == this.fontSelectionStrategy)
- && (ccf.fontStretch == this.fontStretch)
- && (ccf.fontStyle == this.fontStyle)
- && (ccf.fontVariant == this.fontVariant)
- && (ccf.fontWeight == this.fontWeight);
- }
- return false;
- }
-
- /** {@inheritDoc} */
- public int hashCode() {
- if (this.hash == 0) {
- int hash = 17;
- hash = 37 * hash + (fontFamily == null ? 0 : fontFamily.hashCode());
- hash = 37 * hash + (fontSelectionStrategy == null ? 0 : fontSelectionStrategy.hashCode());
- hash = 37 * hash + (fontStretch == null ? 0 : fontStretch.hashCode());
- hash = 37 * hash + (fontStyle == null ? 0 : fontStyle.hashCode());
- hash = 37 * hash + (fontVariant == null ? 0 : fontVariant.hashCode());
- hash = 37 * hash + (fontStretch == null ? 0 : fontStretch.hashCode());
- this.hash = hash;
- }
- return this.hash;
- }
-
- }
+ /** The "font-family" property. */
+ private final FontFamilyProperty fontFamily;
- /**
- * The cached CommonFont properties (access these through the getters)
- * The remaining properties, font-size and font-size-adjust,
- * will only be cached values if they are absolute.
- */
- private final CachedCommonFont cachedCommonFont;
+ /** The "font-selection-strategy" property. */
+ private final EnumProperty fontSelectionStrategy;
+
+ /** The "font-stretch" property. */
+ private final EnumProperty fontStretch;
+
+ /** The "font-style" property. */
+ private final EnumProperty fontStyle;
+
+ /** The "font-variant" property. */
+ private final EnumProperty fontVariant;
+
+ /** The "font-weight" property. */
+ private final EnumProperty fontWeight;
- /**
- * The "font-size" property.
- */
+ /** The "font-size" property. */
public final Length fontSize;
- /**
- * The "font-size-adjust" property.
- */
+ /** The "font-size-adjust" property. */
public final Numeric fontSizeAdjust;
+
/**
* Construct a CommonFont instance
*
- * @param ccf the cached CommonFont properties
+ * @param fontFamily the font-family property
+ * @param fontSelectionStrategy the font-selection-strategy property
+ * @param fontStretch the font-stretch property
+ * @param fontStyle the font-style property
+ * @param fontVariant the font-variant property
+ * @param fontWeight the font-weight property
* @param fontSize the font-size (possibly non-cached)
* @param fontSizeAdjust the font-size-adjust (possibly non-cached)
*/
- private CommonFont(CachedCommonFont ccf,
+ private CommonFont(FontFamilyProperty fontFamily,
+ EnumProperty fontSelectionStrategy,
+ EnumProperty fontStretch,
+ EnumProperty fontStyle,
+ EnumProperty fontVariant,
+ EnumProperty fontWeight,
Length fontSize,
Numeric fontSizeAdjust) {
- this.cachedCommonFont = ccf;
+ this.fontFamily = fontFamily;
+ this.fontSelectionStrategy = fontSelectionStrategy;
+ this.fontStretch = fontStretch;
+ this.fontStyle = fontStyle;
+ this.fontVariant = fontVariant;
+ this.fontWeight = fontWeight;
this.fontSize = fontSize;
this.fontSizeAdjust = fontSizeAdjust;
}
@@ -232,53 +115,59 @@
EnumProperty fontStyle = (EnumProperty) pList.get(Constants.PR_FONT_STYLE);
EnumProperty fontVariant = (EnumProperty) pList.get(Constants.PR_FONT_VARIANT);
EnumProperty fontWeight = (EnumProperty) pList.get(Constants.PR_FONT_WEIGHT);
- CachedCommonFont cachedCommonFont = CachedCommonFont.getInstance(
- fontFamily,
- fontSelectionStrategy,
- fontStretch,
- fontStyle,
- fontVariant,
- fontWeight);
-
Numeric fontSizeAdjust = pList.get(Constants.PR_FONT_SIZE_ADJUST).getNumeric();
Length fontSize = pList.get(Constants.PR_FONT_SIZE).getLength();
- CommonFont cf = new CommonFont(cachedCommonFont, fontSize, fontSizeAdjust);
- if (fontSize.isAbsolute() && fontSizeAdjust.isAbsolute()) {
- return cache.fetch(cf);
- } else {
- return cf;
- }
+ CommonFont commonFont = new CommonFont(fontFamily,
+ fontSelectionStrategy,
+ fontStretch,
+ fontStyle,
+ fontVariant,
+ fontWeight,
+ fontSize,
+ fontSizeAdjust);
+
+ return cache.fetch(commonFont);
+ }
+
+ /** @return an array with the font-family names */
+ private String[] getFontFamily() {
+ List lst = fontFamily.getList();
+ String[] fontFamily = new String[lst.size()];
+ for (int i = 0, c = lst.size(); i < c; i++) {
+ fontFamily[i] = ((Property)lst.get(i)).getString();
+ }
+ return fontFamily;
}
-
+
/** @return the first font-family name in the list */
public String getFirstFontFamily() {
- return cachedCommonFont.getFirstFontFamily();
+ return ((Property) fontFamily.list.get(0)).getString();
}
/** @return the "font-selection-strategy" property */
public int getFontSelectionStrategy() {
- return cachedCommonFont.fontSelectionStrategy.getEnum();
+ return fontSelectionStrategy.getEnum();
}
/** @return the "font-stretch" property */
public int getFontStretch() {
- return cachedCommonFont.fontStretch.getEnum();
+ return fontStretch.getEnum();
}
/** @return the "font-style" property */
public int getFontStyle() {
- return cachedCommonFont.fontStyle.getEnum();
+ return fontStyle.getEnum();
}
/** @return the "font-variant" property */
public int getFontVariant() {
- return cachedCommonFont.fontVariant.getEnum();
+ return fontVariant.getEnum();
}
/** @return the "font-weight" property */
public int getFontWeight() {
- return cachedCommonFont.fontWeight.getEnum();
+ return fontWeight.getEnum();
}
/**
@@ -290,7 +179,7 @@
*/
public FontTriplet[] getFontState(FontInfo fontInfo) {
int font_weight;
- switch (cachedCommonFont.fontWeight.getEnum()) {
+ switch (fontWeight.getEnum()) {
case Constants.EN_100: font_weight = 100; break;
case Constants.EN_200: font_weight = 200; break;
case Constants.EN_300: font_weight = 300; break;
@@ -304,7 +193,7 @@
}
String style;
- switch (cachedCommonFont.fontStyle.getEnum()) {
+ switch (fontStyle.getEnum()) {
case Constants.EN_ITALIC:
style = "italic";
break;
@@ -321,32 +210,53 @@
// various kinds of keywords too
//int fontVariant = propertyList.get("font-variant").getEnum();
FontTriplet[] triplets = fontInfo.fontLookup(
- cachedCommonFont.getFontFamily(),
+ getFontFamily(),
style, font_weight);
return triplets;
}
/** {@inheritDoc} */
public boolean equals(Object o) {
+
+ if (o == null) {
+ return false;
+ }
+
if (this == o) {
return true;
}
if (o instanceof CommonFont) {
CommonFont cf = (CommonFont) o;
- return (cf.cachedCommonFont == this.cachedCommonFont
- && cf.fontSize == this.fontSize
- && cf.fontSizeAdjust == this.fontSizeAdjust);
+ return (cf.fontFamily == this.fontFamily)
+ && (cf.fontSelectionStrategy == this.fontSelectionStrategy)
+ && (cf.fontStretch == this.fontStretch)
+ && (cf.fontStyle == this.fontStyle)
+ && (cf.fontVariant == this.fontVariant)
+ && (cf.fontWeight == this.fontWeight)
+ && (cf.fontSize == this.fontSize)
+ && (cf.fontSizeAdjust == this.fontSizeAdjust);
}
return false;
+
}
/** {@inheritDoc} */
public int hashCode() {
- int hash = 17;
- hash = 37 * hash + cachedCommonFont.hashCode();
- hash = 37 * hash + fontSize.hashCode();
- hash = 37 * hash + fontSizeAdjust.hashCode();
+
+ if (this.hash == -1) {
+ int hash = 17;
+ hash = 37 * hash + (fontSize == null ? 0 : fontSize.hashCode());
+ hash = 37 * hash + (fontSizeAdjust == null ? 0 : fontSizeAdjust.hashCode());
+ hash = 37 * hash + (fontFamily == null ? 0 : fontFamily.hashCode());
+ hash = 37 * hash + (fontSelectionStrategy == null ? 0 : fontSelectionStrategy.hashCode());
+ hash = 37 * hash + (fontStretch == null ? 0 : fontStretch.hashCode());
+ hash = 37 * hash + (fontStyle == null ? 0 : fontStyle.hashCode());
+ hash = 37 * hash + (fontVariant == null ? 0 : fontVariant.hashCode());
+ hash = 37 * hash + (fontStretch == null ? 0 : fontStretch.hashCode());
+ this.hash = hash;
+ }
return hash;
+
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/NumberProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/NumberProperty.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/NumberProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/NumberProperty.java Mon May 12 01:58:21 2008
@@ -91,7 +91,7 @@
}
Number val = p.getNumber();
if (val != null) {
- int i = val.intValue();
+ int i = Math.round(val.floatValue());
if (i <= 0) {
i = 1;
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/PropertyCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/PropertyCache.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/PropertyCache.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/properties/PropertyCache.java Mon May 12 01:58:21 2008
@@ -36,6 +36,12 @@
/** bitmask to apply to the hash to get to the
* corresponding cache segment */
private static final int SEGMENT_MASK = 0x1F;
+ /**
+ * Indicates whether the cache should be used at all
+ * Can be controlled by the system property:
+ * org.apache.fop.fo.properties.use-cache
+ */
+ private final boolean useCache;
/** the segments array (length = 32) */
private CacheSegment[] segments = new CacheSegment[SEGMENT_MASK + 1];
@@ -262,8 +268,13 @@
* @param c Runtime type of the objects that will be stored in the cache
*/
public PropertyCache(Class c) {
- for (int i = SEGMENT_MASK + 1; --i >= 0;) {
- segments[i] = new CacheSegment();
+ this.useCache = Boolean.valueOf(System.getProperty(
+ "org.apache.fop.fo.properties.use-cache", "true")
+ ).booleanValue();
+ if (useCache) {
+ for (int i = SEGMENT_MASK + 1; --i >= 0;) {
+ segments[i] = new CacheSegment();
+ }
}
this.runtimeType = c;
}
@@ -278,6 +289,10 @@
* @return the cached instance
*/
private Object fetch(Object obj) {
+ if (!this.useCache) {
+ return obj;
+ }
+
if (obj == null) {
return null;
}
@@ -291,7 +306,7 @@
}
/**
- * Checks if the given <code>Property</code> is present in the cache -
+ * Checks if the given {@link Property} is present in the cache -
* if so, returns a reference to the cached instance.
* Otherwise the given object is added to the cache and returned.
*
@@ -304,7 +319,7 @@
}
/**
- * Checks if the given <code>CommonHyphenation</code> is present in the cache -
+ * Checks if the given {@link CommonHyphenation} is present in the cache -
* if so, returns a reference to the cached instance.
* Otherwise the given object is added to the cache and returned.
*
@@ -317,20 +332,7 @@
}
/**
- * Checks if the given <code>CachedCommonFont</code> is present in the cache -
- * if so, returns a reference to the cached instance.
- * Otherwise the given object is added to the cache and returned.
- *
- * @param ccf the CachedCommonFont instance to check for
- * @return the cached instance
- */
- public final CommonFont.CachedCommonFont fetch(CommonFont.CachedCommonFont ccf) {
-
- return (CommonFont.CachedCommonFont) fetch((Object) ccf);
- }
-
- /**
- * Checks if the given <code>CommonFont</code> is present in the cache -
+ * Checks if the given {@link CommonFont} is present in the cache -
* if so, returns a reference to the cached instance.
* Otherwise the given object is added to the cache and returned.
*
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=655445&r1=655444&r2=655445&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 Mon May 12 01:58:21 2008
@@ -15,7 +15,8 @@
* limitations under the License.
*/
-/* $Id: $ */
+/* $Id$ */
+
package org.apache.fop.fonts;
import java.util.List;
@@ -26,7 +27,7 @@
* Sets up a set of custom (embedded) fonts
*/
public class CustomFontCollection implements FontCollection {
-
+
private PrintRenderer renderer = null;
/**
@@ -51,7 +52,7 @@
//Ensure that we have minimal font resolution capabilities
resolver = FontManager.createMinimalFontResolver();
}
-
+
String internalName = null;
//FontReader reader = null;
@@ -67,7 +68,7 @@
reader.setFontEmbedPath(configFontInfo.getEmbedFile());
fontInfo.addMetrics(internalName, reader.getFont());
*/
-
+
LazyFont font = new LazyFont(embedFontInfo, resolver);
fontInfo.addMetrics(internalName, font);
@@ -78,5 +79,5 @@
}
}
return num;
- }
-}
\ No newline at end of file
+ }
+}
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/CustomFontCollection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/CustomFontCollection.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/EmbedFontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/EmbedFontInfo.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/EmbedFontInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/EmbedFontInfo.java Mon May 12 01:58:21 2008
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.fonts;
import java.io.IOException;
@@ -27,17 +27,17 @@
* FontInfo contains meta information on fonts (where is the metrics file etc.)
*/
public class EmbedFontInfo implements Serializable {
-
+
/** Serialization Version UID */
private static final long serialVersionUID = 8755432068669997367L;
-
+
/** filename of the metrics file */
protected String metricsFile;
/** filename of the main font file */
protected String embedFile;
/** false, to disable kerning */
protected boolean kerning;
-
+
/** the PostScript name of the font */
protected String postScriptName = null;
/** the sub-fontname of the font (used for TrueType Collections, null otherwise) */
@@ -47,7 +47,7 @@
private List/*<FontTriplet>*/ fontTriplets = null;
private transient boolean embedded = true;
-
+
/**
* Main constructor
* @param metricsFile Path to the xml file containing font metrics
@@ -64,7 +64,7 @@
this.fontTriplets = fontTriplets;
this.subFontName = subFontName;
}
-
+
/**
* Returns the path to the metrics file
* @return the metrics file path
@@ -88,16 +88,16 @@
public boolean getKerning() {
return kerning;
}
-
+
/**
- * Returns the sub-font name name of the font. This is primarily used for TrueType Collections
- * to select one of the sub-fonts. For all other fonts, this is always null.
+ * Returns the sub-font name of the font. This is primarily used for TrueType Collections
+ * to select one of the sub-fonts. For all other fonts, this is always null.
* @return the sub-font name (or null)
*/
public String getSubFontName() {
return this.subFontName;
}
-
+
/**
* Returns the PostScript name of the font.
* @return the PostScript name
@@ -105,7 +105,7 @@
public String getPostScriptName() {
return postScriptName;
}
-
+
/**
* Sets the PostScript name of the font
* @param postScriptName the PostScript name
@@ -113,7 +113,7 @@
public void setPostScriptName(String postScriptName) {
this.postScriptName = postScriptName;
}
-
+
/**
* Returns the list of font triplets associated with this font.
* @return List of font triplets
@@ -121,7 +121,7 @@
public List/*<FontTriplet>*/ getFontTriplets() {
return fontTriplets;
}
-
+
/**
* Indicates whether the font is only referenced rather than embedded.
* @return true if the font is embedded, false if it is referenced.
@@ -133,7 +133,7 @@
return this.embedded;
}
}
-
+
/**
* Defines whether the font is embedded or not.
* @param value true to embed the font, false to reference it
@@ -141,19 +141,19 @@
public void setEmbedded(boolean value) {
this.embedded = value;
}
-
+
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
in.defaultReadObject();
this.embedded = true;
}
-
+
/** {@inheritDoc} */
public String toString() {
return "metrics-url=" + metricsFile + ",embed-url=" + embedFile
+ ", kerning=" + kerning + ", " + "font-triplet=" + fontTriplets
+ (getSubFontName() != null ? ", sub-font=" + getSubFontName() : "")
- + (isEmbedded() ? "" : ", NOT embedded");
+ + (isEmbedded() ? "" : ", NOT embedded");
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Font.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Font.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Font.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Font.java Mon May 12 01:58:21 2008
@@ -32,10 +32,10 @@
/** Extra Bold font weight */
public static final int WEIGHT_EXTRA_BOLD = 800;
-
+
/** Bold font weight */
public static final int WEIGHT_BOLD = 700;
-
+
/** Normal font weight */
public static final int WEIGHT_NORMAL = 400;
@@ -56,7 +56,7 @@
/** Default selection priority */
public static final int PRIORITY_DEFAULT = 0;
-
+
/** Default fallback key */
public static final FontTriplet DEFAULT_FONT = new FontTriplet(
"any", STYLE_NORMAL, WEIGHT_NORMAL, PRIORITY_DEFAULT);
@@ -96,7 +96,7 @@
public FontMetrics getFontMetrics() {
return this.metric;
}
-
+
/**
* Returns the font's ascender.
* @return the ascender
@@ -128,7 +128,7 @@
public String getFontName() {
return fontName;
}
-
+
/** @return the font triplet that selected this font */
public FontTriplet getFontTriplet() {
return this.triplet;
@@ -154,7 +154,7 @@
public boolean hasKerning() {
return metric.hasKerningInfo();
}
-
+
/**
* Returns the font's kerning table
* @return the kerning table
@@ -166,7 +166,7 @@
return java.util.Collections.EMPTY_MAP;
}
}
-
+
/**
* Returns the amount of kerning between two characters.
* @param ch1 first character
@@ -212,12 +212,12 @@
c = d;
} else {
log.warn("Glyph " + (int) c + " not available in font " + fontName);
- c = '#';
+ c = Typeface.NOT_FOUND;
}
return c;
}
-
+
/**
* Determines whether this font contains a particular character/glyph.
* @param c character to check
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCache.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCache.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCache.java Mon May 12 01:58:21 2008
@@ -43,7 +43,7 @@
* Fop cache (currently only used for font info caching)
*/
public final class FontCache implements Serializable {
-
+
/**
* Serialization Version UID. Change this value if you want to make sure the user's cache
* file is purged after an update.
@@ -59,13 +59,13 @@
/** font cache file path */
private static final String DEFAULT_CACHE_FILENAME = "fop-fonts.cache";
-
+
/** has this cache been changed since it was last read? */
private transient boolean changed = false;
-
+
/** change lock */
private transient Object changeLock = new Object();
-
+
/** master mapping of font url -> font info. This needs to be
* a list, since a TTC file may contain more than 1 font. */
private Map/*<String, CachedFontFile>*/ fontfileMap = null;
@@ -96,7 +96,7 @@
}
return null;
}
-
+
/**
* Returns the default font cache file.
* @param forWriting true if the user directory should be created
@@ -113,7 +113,7 @@
}
return new File(FOP_USER_DIR);
}
-
+
/**
* Reads the default font cache file and returns its contents.
* @return the font cache deserialized from the file (or null if no cache file exists or if
@@ -122,7 +122,7 @@
public static FontCache load() {
return loadFrom(getDefaultCacheFile(false));
}
-
+
/**
* Reads a font cache file and returns its contents.
* @param cacheFile the cache file
@@ -145,11 +145,11 @@
}
} catch (ClassNotFoundException e) {
//We don't really care about the exception since it's just a cache file
- log.warn("Could not read font cache. Discarding font cache file. Reason: "
+ log.warn("Could not read font cache. Discarding font cache file. Reason: "
+ e.getMessage());
} catch (IOException ioe) {
//We don't really care about the exception since it's just a cache file
- log.warn("I/O exception while reading font cache (" + ioe.getMessage()
+ log.warn("I/O exception while reading font cache (" + ioe.getMessage()
+ "). Discarding font cache file.");
try {
cacheFile.delete();
@@ -160,7 +160,7 @@
}
return null;
}
-
+
/**
* Writes the font cache to disk.
* @throws FOPException fop exception
@@ -168,10 +168,10 @@
public void save() throws FOPException {
saveTo(getDefaultCacheFile(true));
}
-
+
/**
* Writes the font cache to disk.
- * @param cacheFile the file to write to
+ * @param cacheFile the file to write to
* @throws FOPException fop exception
*/
public void saveTo(File cacheFile) throws FOPException {
@@ -219,7 +219,7 @@
public boolean hasChanged() {
return this.changed;
}
-
+
/**
* is this font in the cache?
* @param embedUrl font info
@@ -248,11 +248,11 @@
* Tries to identify a File instance from an array of URLs. If there's no file URL in the
* array, the method returns null.
* @param urls array of possible font urls
- * @return file font file
+ * @return file font file
*/
public static File getFileFromUrls(String[] urls) {
for (int i = 0; i < urls.length; i++) {
- String urlStr = urls[i];
+ String urlStr = urls[i];
if (urlStr != null) {
File fontFile = null;
if (urlStr.startsWith("file:")) {
@@ -270,7 +270,7 @@
return fontFile;
}
}
- }
+ }
return null;
}
@@ -280,7 +280,7 @@
}
return fontfileMap;
}
-
+
/**
* Adds a font info to cache
* @param fontInfo font info
@@ -313,7 +313,7 @@
/**
* Returns a font from the cache.
* @param embedUrl font info
- * @return CachedFontFile object
+ * @return CachedFontFile object
*/
public CachedFontFile getFontFile(String embedUrl) {
if (containsFont(embedUrl)) {
@@ -321,7 +321,7 @@
}
return null;
}
-
+
/**
* Returns the EmbedFontInfo instances belonging to a font file. If the font file was
* modified since it was cached the entry is removed and null is returned.
@@ -338,7 +338,7 @@
return null;
}
}
-
+
/**
* removes font from cache
* @param embedUrl embed url
@@ -354,7 +354,7 @@
}
}
}
-
+
/**
* has this font previously failed to load?
* @param embedUrl embed url
@@ -370,7 +370,7 @@
// from failed font map for now
getFailedFontMap().remove(embedUrl);
changed = true;
- }
+ }
}
return true;
}
@@ -397,7 +397,7 @@
}
return failedFontMap;
}
-
+
/**
* Clears font cache
*/
@@ -411,7 +411,7 @@
changed = true;
}
}
-
+
/**
* Retrieve the last modified date/time of a URL.
* @param url the URL
@@ -432,7 +432,7 @@
return 0;
}
}
-
+
private static class CachedFontFile implements Serializable {
private static final long serialVersionUID = 4524237324330578883L;
@@ -440,18 +440,18 @@
private long lastModified = -1;
private Map/*<String, EmbedFontInfo>*/ filefontsMap = null;
-
+
public CachedFontFile(long lastModified) {
setLastModified(lastModified);
}
private Map/*<String, EmbedFontInfo>*/ getFileFontsMap() {
if (filefontsMap == null) {
- filefontsMap = new java.util.HashMap/*<String, EmbedFontInfo>*/();
+ filefontsMap = new java.util.HashMap/*<String, EmbedFontInfo>*/();
}
return filefontsMap;
}
-
+
void put(EmbedFontInfo efi) {
getFileFontsMap().put(efi.getPostScriptName(), efi);
}
@@ -467,7 +467,7 @@
return (EmbedFontInfo[])getFileFontsMap().values().toArray(
new EmbedFontInfo[getFileFontsMap().size()]);
}
-
+
/**
* Gets the modified timestamp for font file (not always available)
* @return modified timestamp
@@ -478,15 +478,15 @@
/**
* Gets the modified timestamp for font file
- * (used for the purposes of font info caching)
+ * (used for the purposes of font info caching)
* @param lastModified modified font file timestamp
*/
public void setLastModified(long lastModified) {
this.lastModified = lastModified;
}
-
+
/**
- * @return string representation of this object
+ * @return string representation of this object
* {@inheritDoc}
*/
public String toString() {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCollection.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCollection.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCollection.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-/* $Id: $ */
+/* $Id$ */
package org.apache.fop.fonts;
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCollection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontCollection.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontDescriptor.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontDescriptor.java Mon May 12 01:58:21 2008
@@ -16,12 +16,12 @@
*/
/* $Id$ */
-
+
package org.apache.fop.fonts;
/**
* This interface enhances the font metrics interface with access methods to
- * value needed to register fonts in various target formats like PDF or
+ * value needed to register fonts in various target formats like PDF or
* PostScript.
*/
public interface FontDescriptor extends FontMetrics {
@@ -31,55 +31,55 @@
* @return the ascender
*/
int getAscender();
-
-
+
+
/**
* Returns the capital height of the font.
* @return the capital height
*/
int getCapHeight();
-
-
+
+
/**
* Returns the descender value of the font. (Descent in pdf spec)
* @return the descender value
*/
int getDescender();
-
-
+
+
/**
* Returns the flags for the font. (See pdf spec)
* @return the flags
*/
int getFlags();
-
-
+
+
/**
* Returns the font's bounding box.
* @return the bounding box
*/
int[] getFontBBox();
-
-
+
+
/**
* Returns the italic angle for the font.
* @return the italic angle
*/
int getItalicAngle();
-
-
+
+
/**
* Returns the vertical stem width for the font.
* @return the vertical stem width
*/
int getStemV();
-
+
/**
* Indicates if this font may be embedded.
* @return True, if embedding is possible/permitted
*/
boolean isEmbeddable();
-
-
+
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org