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 je...@apache.org on 2011/01/18 09:54:26 UTC
svn commit: r1060241 [18/21] - in /xmlgraphics/fop/branches/Temp_Color: ./
examples/plan/src/org/apache/fop/plan/ lib/ lib/build/
src/codegen/java/org/apache/fop/tools/ src/codegen/unicode/data/
src/codegen/unicode/java/org/apache/fop/hyphenation/ src/...
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/txt/TXTRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/txt/TXTRenderer.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/txt/TXTRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/txt/TXTRenderer.java Tue Jan 18 08:54:08 2011
@@ -494,7 +494,8 @@ public class TXTRenderer extends Abstrac
/**
* {@inheritDoc}
*/
- protected void drawBorderLine(float x1, float y1, float x2, float y2,
+ protected void drawBorderLine( // CSOK: ParameterNumber
+ float x1, float y1, float x2, float y2,
boolean horz, boolean startOrBefore, int style, Color col) {
int borderHeight = bm.getHeight();
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/txt/TXTStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/txt/TXTStream.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/txt/TXTStream.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/txt/TXTStream.java Tue Jan 18 08:54:08 2011
@@ -71,10 +71,11 @@ public class TXTStream {
* @param encoding the encoding, if null, "UTF-8" is chosen as default
*/
public void setEncoding(String encoding) {
- if (encoding != null)
+ if (encoding != null) {
this.encoding = encoding;
- else
+ } else {
this.encoding = DEFAULT_ENCODING;
+ }
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java Tue Jan 18 08:54:08 2011
@@ -43,7 +43,9 @@ import org.xml.sax.SAXException;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.AttributesImpl;
+/** Abstract xml renderer base class. */
public abstract class AbstractXMLRenderer extends PrintRenderer {
+
/** Main namespace in use. */
public static final String NS = "";
@@ -62,6 +64,7 @@ public abstract class AbstractXMLRendere
/** The OutputStream to write the generated XML to. */
protected OutputStream out;
+ /** The renderer context. */
protected RendererContext context;
/** A list of ExtensionAttachements received through processOffDocumentItem() */
@@ -237,7 +240,7 @@ public abstract class AbstractXMLRendere
}
}
- /** {@inheritDoc} */
+ /** Handle document extension attachments. */
protected void handleDocumentExtensionAttachments() {
if (extensionAttachments != null && extensionAttachments.size() > 0) {
handleExtensionAttachments(extensionAttachments);
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/servlet/FopPrintServlet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/servlet/FopPrintServlet.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/servlet/FopPrintServlet.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/servlet/FopPrintServlet.java Tue Jan 18 08:54:08 2011
@@ -61,6 +61,8 @@ import org.apache.fop.apps.MimeConstants
*/
public class FopPrintServlet extends FopServlet {
+ private static final long serialVersionUID = 1645706757391617935L;
+
/**
* {@inheritDoc}
*/
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/servlet/FopServlet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/servlet/FopServlet.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/servlet/FopServlet.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/servlet/FopServlet.java Tue Jan 18 08:54:08 2011
@@ -70,6 +70,8 @@ import org.apache.fop.apps.MimeConstants
*/
public class FopServlet extends HttpServlet {
+ private static final long serialVersionUID = -908918093488215264L;
+
/** Name of the parameter used for the XSL-FO file */
protected static final String FO_REQUEST_PARAM = "fo";
/** Name of the parameter used for the XML file */
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java Tue Jan 18 08:54:08 2011
@@ -37,12 +37,13 @@ import org.apache.fop.fonts.FontInfo;
*/
public abstract class AbstractFOPBridgeContext extends BridgeContext {
- /** The font list. */
+ /** the font list */
protected final FontInfo fontInfo;
-
+ /** image manager */
protected final ImageManager imageManager;
+ /** image session context */
protected final ImageSessionContext imageSessionContext;
-
+ /** link transform */
protected final AffineTransform linkTransform;
/**
@@ -122,6 +123,10 @@ public abstract class AbstractFOPBridgeC
return this.imageSessionContext;
}
+ /**
+ * @param className name of bridge class to load and construct
+ * @param testFor class name to test for presence
+ */
protected void putElementBridgeConditional(String className, String testFor) {
try {
Class.forName(testFor);
@@ -137,6 +142,7 @@ public abstract class AbstractFOPBridgeC
// Make sure any 'sub bridge contexts' also have our bridges.
//TODO There's no matching method in the super-class here
+ /** @return new bridge context */
public abstract BridgeContext createBridgeContext();
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java Tue Jan 18 08:54:08 2011
@@ -160,10 +160,15 @@ public abstract class AbstractFOPImageEl
*/
public class LoaderImageNode extends AbstractGraphicsNode {
+ /** image */
protected final Image image;
+ /** bridge context */
protected final BridgeContext ctx;
+ /** image element */
protected final Element imageElement;
+ /** parsed url */
protected final ParsedURL purl;
+ /** original graphics mode */
protected GraphicsNode origGraphicsNode = null;
/**
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java Tue Jan 18 08:54:08 2011
@@ -26,9 +26,9 @@ import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import org.w3c.dom.DOMImplementation;
-
import org.xml.sax.EntityResolver;
+import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
@@ -47,15 +47,17 @@ import org.apache.batik.util.SVGConstant
import org.apache.commons.logging.Log;
import org.apache.commons.logging.impl.SimpleLog;
+import org.apache.xmlgraphics.image.GraphicsConstants;
import org.apache.xmlgraphics.image.loader.ImageContext;
import org.apache.xmlgraphics.image.loader.ImageManager;
import org.apache.xmlgraphics.image.loader.ImageSessionContext;
import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext;
+import org.apache.xmlgraphics.util.UnitConv;
/**
* This is the common base class of all of FOP's transcoders.
*/
-public abstract class AbstractFOPTranscoder extends SVGAbstractTranscoder {
+public abstract class AbstractFOPTranscoder extends SVGAbstractTranscoder implements Configurable {
/**
* The key is used to specify the resolution for on-the-fly images generated
@@ -129,7 +131,10 @@ public abstract class AbstractFOPTransco
this.resolver = resolver;
}
- /** {@inheritDoc} */
+ /**
+ * @param cfg the configuration
+ * @throws ConfigurationException if not caught
+ */
public void configure(Configuration cfg) throws ConfigurationException {
this.cfg = cfg;
}
@@ -222,7 +227,7 @@ public abstract class AbstractFOPTransco
if (hints.containsKey(KEY_DEVICE_RESOLUTION)) {
return ((Float)hints.get(KEY_DEVICE_RESOLUTION)).floatValue();
} else {
- return 72;
+ return GraphicsConstants.DEFAULT_DPI;
}
}
@@ -249,7 +254,7 @@ public abstract class AbstractFOPTransco
protected void setupImageInfrastructure(final String baseURI) {
final ImageContext imageContext = new ImageContext() {
public float getSourceResolution() {
- return 25.4f / userAgent.getPixelUnitToMillimeter();
+ return UnitConv.IN2MM / userAgent.getPixelUnitToMillimeter();
}
};
this.imageManager = new ImageManager(imageContext);
@@ -368,7 +373,7 @@ public abstract class AbstractFOPTransco
return ((Float)getTranscodingHints().get(key)).floatValue();
} else {
// return 0.3528f; // 72 dpi
- return 25.4f / 96; //96dpi = 0.2645833333333333333f;
+ return UnitConv.IN2MM / 96; //96dpi = 0.2645833333333333333f;
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/FOPTextHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/FOPTextHandler.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/FOPTextHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/FOPTextHandler.java Tue Jan 18 08:54:08 2011
@@ -19,9 +19,12 @@
package org.apache.fop.svg;
+/** an fop extension to text handler */
public interface FOPTextHandler extends org.apache.xmlgraphics.java2d.TextHandler {
+ /** @param font override font */
void setOverrideFont(org.apache.fop.fonts.Font font);
+ /** @return font info */
org.apache.fop.fonts.FontInfo getFontInfo();
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/GraphicsConfiguration.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/GraphicsConfiguration.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/GraphicsConfiguration.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/GraphicsConfiguration.java Tue Jan 18 08:54:08 2011
@@ -29,9 +29,12 @@ import java.awt.image.VolatileImage;
* for JDK 1.3 because there is no VolatileImage there.
*
*/
-abstract public class GraphicsConfiguration extends java.awt.GraphicsConfiguration {
+public abstract class GraphicsConfiguration extends java.awt.GraphicsConfiguration {
/**
+ * @param width of image
+ * @param height of image
+ * @return new volatile image
* @see java.awt.GraphicsConfiguration#createCompatibleVolatileImage(int, int)
* @since JDK 1.4
*/
@@ -40,6 +43,10 @@ abstract public class GraphicsConfigurat
}
/**
+ * @param width of image
+ * @param height of image
+ * @param transparency of image
+ * @return new volatile image
* @see java.awt.GraphicsConfiguration#createCompatibleVolatileImage(int, int, int)
* @since JDK 1.5
*/
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/NativeImageHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/NativeImageHandler.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/NativeImageHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/NativeImageHandler.java Tue Jan 18 08:54:08 2011
@@ -19,6 +19,7 @@
package org.apache.fop.svg;
+/** native image handler */
public interface NativeImageHandler {
/**
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/NativeTextPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/NativeTextPainter.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/NativeTextPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/NativeTextPainter.java Tue Jan 18 08:54:08 2011
@@ -111,9 +111,9 @@ public abstract class NativeTextPainter
String style = ((posture != null) && (posture.floatValue() > 0.0))
? Font.STYLE_ITALIC : Font.STYLE_NORMAL;
- int weight = ((taWeight != null)
- && (taWeight.floatValue() > 1.0)) ? Font.WEIGHT_BOLD
- : Font.WEIGHT_NORMAL;
+ int weight = toCSSWeight(taWeight != null
+ ? taWeight.floatValue()
+ : TextAttribute.WEIGHT_REGULAR.floatValue());
String firstFontFamily = null;
@@ -176,6 +176,28 @@ public abstract class NativeTextPainter
return (Font[])fonts.toArray(new Font[fonts.size()]);
}
+ private int toCSSWeight(float weight) {
+ if (weight <= TextAttribute.WEIGHT_EXTRA_LIGHT.floatValue()) {
+ return 100;
+ } else if (weight <= TextAttribute.WEIGHT_LIGHT.floatValue()) {
+ return 200;
+ } else if (weight <= TextAttribute.WEIGHT_DEMILIGHT.floatValue()) {
+ return 300;
+ } else if (weight <= TextAttribute.WEIGHT_REGULAR.floatValue()) {
+ return 400;
+ } else if (weight <= TextAttribute.WEIGHT_SEMIBOLD.floatValue()) {
+ return 500;
+ } else if (weight <= TextAttribute.WEIGHT_BOLD.floatValue()) {
+ return 600;
+ } else if (weight <= TextAttribute.WEIGHT_HEAVY.floatValue()) {
+ return 700;
+ } else if (weight <= TextAttribute.WEIGHT_EXTRABOLD.floatValue()) {
+ return 800;
+ } else {
+ return 900;
+ }
+ }
+
/**
* Collects all characters from an {@link AttributedCharacterIterator}.
* @param runaci the character iterator
@@ -190,6 +212,10 @@ public abstract class NativeTextPainter
return chars;
}
+ /**
+ * @param runaci an attributed character iterator
+ * @param layout a text span layout
+ */
protected final void logTextRun(AttributedCharacterIterator runaci, TextSpanLayout layout) {
if (log.isTraceEnabled()) {
int charCount = runaci.getEndIndex() - runaci.getBeginIndex();
@@ -202,6 +228,12 @@ public abstract class NativeTextPainter
}
}
+ /**
+ * @param ch a character
+ * @param layout a text span layout
+ * @param index an index
+ * @param visibleChar visible character flag
+ */
protected final void logCharacter(char ch, TextSpanLayout layout, int index,
boolean visibleChar) {
if (log.isTraceEnabled()) {
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFBridgeContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFBridgeContext.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFBridgeContext.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFBridgeContext.java Tue Jan 18 08:54:08 2011
@@ -125,6 +125,7 @@ public class PDFBridgeContext extends Ab
// Make sure any 'sub bridge contexts' also have our bridges.
//TODO There's no matching method in the super-class here
+ /** @return the new bridge context */
public BridgeContext createBridgeContext() {
return new PDFBridgeContext(getUserAgent(), getDocumentLoader(),
fontInfo,
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java Tue Jan 18 08:54:08 2011
@@ -30,6 +30,8 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.StringWriter;
+import org.apache.xmlgraphics.image.GraphicsConstants;
+
import org.apache.fop.Version;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontSetup;
@@ -64,7 +66,7 @@ public class PDFDocumentGraphics2D exten
/** Normal PDF resolution (72dpi) */
public static final int NORMAL_PDF_RESOLUTION = 72;
/** Default device resolution (300dpi is a resonable quality for most purposes) */
- public static final int DEFAULT_NATIVE_DPI = 300;
+ public static final int DEFAULT_NATIVE_DPI = GraphicsConstants.DEFAULT_SAMPLE_DPI;
/**
* The device resolution may be different from the normal target resolution. See
@@ -257,6 +259,7 @@ public class PDFDocumentGraphics2D exten
if (!pdfContext.isPagePending()) {
return; //ignore
}
+ currentStream.write("Q\n");
//Finish page
PDFStream pdfStream = this.pdfDoc.getFactory().makeStream(
PDFFilterList.CONTENT_FILTER, false);
@@ -322,6 +325,7 @@ public class PDFDocumentGraphics2D exten
pdfContext.setCurrentPage(page);
pageRef = page.referencePDF();
+ currentStream.write("q\n");
AffineTransform at = new AffineTransform(1.0, 0.0, 0.0, -1.0,
0.0, height);
currentStream.write("1 0 0 -1 0 " + height + " cm\n");
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java Tue Jan 18 08:54:08 2011
@@ -25,12 +25,15 @@ import org.apache.avalon.framework.confi
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.CustomFontCollection;
+import org.apache.fop.fonts.FontCollection;
import org.apache.fop.fonts.FontEventListener;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontInfoConfigurator;
import org.apache.fop.fonts.FontManager;
+import org.apache.fop.fonts.FontManagerConfigurator;
import org.apache.fop.fonts.FontResolver;
-import org.apache.fop.fonts.FontSetup;
+import org.apache.fop.fonts.base14.Base14FontCollection;
import org.apache.fop.pdf.PDFDocument;
import org.apache.fop.render.pdf.PDFRendererConfigurator;
@@ -70,29 +73,30 @@ public class PDFDocumentGraphics2DConfig
*/
public static FontInfo createFontInfo(Configuration cfg) throws FOPException {
FontInfo fontInfo = new FontInfo();
+ final boolean strict = false;
+ FontResolver fontResolver = FontManager.createMinimalFontResolver();
+ //TODO The following could be optimized by retaining the FontManager somewhere
+ FontManager fontManager = new FontManager();
if (cfg != null) {
- FontResolver fontResolver = FontManager.createMinimalFontResolver();
- //TODO The following could be optimized by retaining the FontManager somewhere
- FontManager fontManager = new FontManager();
+ FontManagerConfigurator fmConfigurator = new FontManagerConfigurator(cfg);
+ fmConfigurator.configure(fontManager, strict);
+ }
- //TODO Make use of fontBaseURL, font substitution and referencing configuration
- //Requires a change to the expected configuration layout
+ List fontCollections = new java.util.ArrayList();
+ fontCollections.add(new Base14FontCollection(fontManager.isBase14KerningEnabled()));
+ if (cfg != null) {
//TODO Wire in the FontEventListener
- final FontEventListener listener = null;
- final boolean strict = false;
+ FontEventListener listener = null; //new FontEventAdapter(eventBroadcaster);
FontInfoConfigurator fontInfoConfigurator
= new FontInfoConfigurator(cfg, fontManager, fontResolver, listener, strict);
List/*<EmbedFontInfo>*/ fontInfoList = new java.util.ArrayList/*<EmbedFontInfo>*/();
fontInfoConfigurator.configure(fontInfoList);
-
- if (fontManager.useCache()) {
- fontManager.getFontCache().save();
- }
- FontSetup.setup(fontInfo, fontInfoList, fontResolver);
- } else {
- FontSetup.setup(fontInfo);
+ fontCollections.add(new CustomFontCollection(fontResolver, fontInfoList));
}
+ fontManager.setup(fontInfo,
+ (FontCollection[])fontCollections.toArray(
+ new FontCollection[fontCollections.size()]));
return fontInfo;
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphics2D.java Tue Jan 18 08:54:08 2011
@@ -60,6 +60,7 @@ import org.apache.batik.ext.awt.Renderin
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.gvt.PatternPaint;
+import org.apache.xmlgraphics.image.GraphicsConstants;
import org.apache.xmlgraphics.image.loader.ImageInfo;
import org.apache.xmlgraphics.image.loader.ImageSize;
import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
@@ -762,7 +763,7 @@ public class PDFGraphics2D extends Abstr
* @param fill true if the paint should be set for filling
* @return true if the paint is handled natively, false if the paint should be rasterized
*/
- protected boolean applyPaint(Paint paint, boolean fill) {
+ protected boolean applyPaint(Paint paint, boolean fill) { // CSOK: MethodLength
preparePainting();
if (paint instanceof Color) {
@@ -1039,6 +1040,11 @@ public class PDFGraphics2D extends Abstr
return true;
}
+ /**
+ * @param paint some paint
+ * @param shape a shape
+ * @return true (always)
+ */
protected boolean applyUnknownPaint(Paint paint, Shape shape) {
preparePainting();
@@ -1186,6 +1192,8 @@ public class PDFGraphics2D extends Abstr
case BasicStroke.CAP_SQUARE:
currentStream.write(2 + " J\n");
break;
+ default:
+ break;
}
int lj = bs.getLineJoin();
@@ -1199,6 +1207,8 @@ public class PDFGraphics2D extends Abstr
case BasicStroke.JOIN_BEVEL:
currentStream.write(2 + " j\n");
break;
+ default:
+ break;
}
float lw = bs.getLineWidth();
currentStream.write(PDFNumber.doubleOut(lw) + " w\n");
@@ -1214,7 +1224,11 @@ public class PDFGraphics2D extends Abstr
drawInnerRenderedImage(key, img, xform);
}
- /** {@inheritDoc} */
+ /**
+ * @param key a key
+ * @param img an image
+ * @param xform a transform
+ */
public void drawInnerRenderedImage(String key, RenderedImage img, AffineTransform xform) {
preparePainting();
PDFXObject xObject = pdfDoc.getXObject(key);
@@ -1243,7 +1257,8 @@ public class PDFGraphics2D extends Abstr
private PDFXObject addRenderedImage(String key, RenderedImage img) {
ImageInfo info = new ImageInfo(null, "image/unknown");
- ImageSize size = new ImageSize(img.getWidth(), img.getHeight(), 72);
+ ImageSize size = new ImageSize(img.getWidth(), img.getHeight(),
+ GraphicsConstants.DEFAULT_DPI);
info.setSize(size);
ImageRendered imgRend = new ImageRendered(info, img, null);
ImageRenderedAdapter adapter = new ImageRenderedAdapter(imgRend, key);
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java Tue Jan 18 08:54:08 2011
@@ -33,11 +33,11 @@ import java.awt.image.ColorModel;
*/
class PDFGraphicsConfiguration extends GraphicsConfiguration {
// We use this to get a good colormodel..
- private static final BufferedImage BI_WITH_ALPHA =
- new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
+ private static final BufferedImage BI_WITH_ALPHA
+ = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
// We use this to get a good colormodel..
- private static final BufferedImage BI_WITHOUT_ALPHA =
- new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
+ private static final BufferedImage BI_WITHOUT_ALPHA
+ = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
/**
* Construct a buffered image with an alpha channel, unless
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphicsDevice.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphicsDevice.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphicsDevice.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFGraphicsDevice.java Tue Jan 18 08:54:08 2011
@@ -39,7 +39,7 @@ class PDFGraphicsDevice extends Graphics
/**
* Create a new PDF graphics device.
*
- * @param The gc we should reference
+ * @param gc The graphics configuration we should reference
*/
PDFGraphicsDevice(PDFGraphicsConfiguration gc) {
this.gc = gc;
@@ -62,7 +62,7 @@ class PDFGraphicsDevice extends Graphics
* @return an array containing the one graphics configuration
*/
public GraphicsConfiguration[] getConfigurations() {
- return new GraphicsConfiguration[]{ gc };
+ return new GraphicsConfiguration[] {gc};
}
/**
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFTextPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFTextPainter.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFTextPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFTextPainter.java Tue Jan 18 08:54:08 2011
@@ -40,7 +40,7 @@ import org.apache.fop.fonts.FontInfo;
import org.apache.fop.util.CharUtilities;
/**
- * Renders the attributed character iterator of a {@link TextNode}.
+ * Renders the attributed character iterator of a {@link org.apache.batik.gvt.TextNode}.
* This class draws the text directly into the PDFGraphics2D so that
* the text is not drawn using shapes which makes the PDF files larger.
* If the text is simple enough to draw then it sets the font and calls
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFTranscoder.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFTranscoder.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/PDFTranscoder.java Tue Jan 18 08:54:08 2011
@@ -27,7 +27,6 @@ import java.io.OutputStream;
import org.w3c.dom.Document;
import org.w3c.dom.svg.SVGLength;
-import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.UnitProcessor;
@@ -73,8 +72,7 @@ import org.apache.fop.fonts.FontInfo;
* @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a>
* @version $Id$
*/
-public class PDFTranscoder extends AbstractFOPTranscoder
- implements Configurable {
+public class PDFTranscoder extends AbstractFOPTranscoder {
/** Graphics2D instance that is used to paint to */
protected PDFDocumentGraphics2D graphics = null;
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/SVGEventProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/SVGEventProducer.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/SVGEventProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/SVGEventProducer.java Tue Jan 18 08:54:08 2011
@@ -30,7 +30,10 @@ public interface SVGEventProducer extend
/**
* Provider class for the event producer.
*/
- class Provider {
+ final class Provider {
+
+ private Provider() {
+ }
/**
* Returns an event producer.
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/SVGUtilities.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/SVGUtilities.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/SVGUtilities.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/svg/SVGUtilities.java Tue Jan 18 08:54:08 2011
@@ -34,7 +34,11 @@ import org.apache.batik.util.XMLConstant
/**
* Some utilities for creating svg DOM documents and elements.
*/
-public class SVGUtilities {
+public final class SVGUtilities {
+
+ private SVGUtilities() {
+ }
+
private static final String SVG_NS = SVGDOMImplementation.SVG_NAMESPACE_URI;
/**
@@ -43,7 +47,7 @@ public class SVGUtilities {
* @param height the height of the root svg element
* @return a new SVG Document
*/
- public static final Document createSVGDocument(float width,
+ public static Document createSVGDocument(float width,
float height) {
DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
Document doc = impl.createDocument(SVG_NS, "svg", null);
@@ -60,9 +64,9 @@ public class SVGUtilities {
* @param font the font
* @return the width of the string in the given font
*/
- public static final float getStringWidth(String str, java.awt.Font font) {
- Rectangle2D rect =
- font.getStringBounds(str, 0, str.length(),
+ public static float getStringWidth(String str, java.awt.Font font) {
+ Rectangle2D rect
+ = font.getStringBounds(str, 0, str.length(),
new FontRenderContext(new AffineTransform(),
true, true));
return (float)rect.getWidth();
@@ -74,10 +78,10 @@ public class SVGUtilities {
* @param font the font
* @return the height of the string in the given font
*/
- public static final float getStringHeight(String str,
+ public static float getStringHeight(String str,
java.awt.Font font) {
- Rectangle2D rect =
- font.getStringBounds(str, 0, str.length(),
+ Rectangle2D rect
+ = font.getStringBounds(str, 0, str.length(),
new FontRenderContext(new AffineTransform(),
true, true));
return (float)rect.getHeight();
@@ -89,7 +93,7 @@ public class SVGUtilities {
* @param font the font
* @return the bounds of the string
*/
- public static final Rectangle2D getStringBounds(String str,
+ public static Rectangle2D getStringBounds(String str,
java.awt.Font font) {
return font.getStringBounds(str, 0, str.length(),
new FontRenderContext(new AffineTransform(),
@@ -105,7 +109,7 @@ public class SVGUtilities {
* @param y2 the end y position
* @return the new line element
*/
- public static final Element createLine(Document doc, float x, float y,
+ public static Element createLine(Document doc, float x, float y,
float x2, float y2) {
Element ellipse = doc.createElementNS(SVG_NS, "line");
ellipse.setAttributeNS(null, "x1", "" + x);
@@ -124,7 +128,7 @@ public class SVGUtilities {
* @param ry the y axis radius
* @return the new ellipse element
*/
- public static final Element createEllipse(Document doc, float cx,
+ public static Element createEllipse(Document doc, float cx,
float cy, float rx, float ry) {
Element ellipse = doc.createElementNS(SVG_NS, "ellipse");
ellipse.setAttributeNS(null, "cx", "" + cx);
@@ -140,7 +144,7 @@ public class SVGUtilities {
* @param str the string for the d attribute on the path
* @return the new path element
*/
- public static final Element createPath(Document doc, String str) {
+ public static Element createPath(Document doc, String str) {
Element path = doc.createElementNS(SVG_NS, "path");
path.setAttributeNS(null, "d", str);
return path;
@@ -154,7 +158,7 @@ public class SVGUtilities {
* @param str the string
* @return the new text element
*/
- public static final Element createText(Document doc, float x, float y,
+ public static Element createText(Document doc, float x, float y,
String str) {
Element textGraph = doc.createElementNS(SVG_NS, "text");
textGraph.setAttributeNS(null, "x", "" + x);
@@ -173,7 +177,7 @@ public class SVGUtilities {
* @param height the height of the rectangle
* @return the new rectangle element
*/
- public static final Element createRect(Document doc, float x, float y,
+ public static Element createRect(Document doc, float x, float y,
float width, float height) {
Element border = doc.createElementNS(SVG_NS, "rect");
border.setAttributeNS(null, "x", "" + x);
@@ -188,7 +192,7 @@ public class SVGUtilities {
* @param doc the document to create the element
* @return the new g element
*/
- public static final Element createG(Document doc) {
+ public static Element createG(Document doc) {
Element border = doc.createElementNS(SVG_NS, "g");
return border;
}
@@ -200,7 +204,7 @@ public class SVGUtilities {
* @param id the id of the clipping path
* @return the new clip element
*/
- public static final Element createClip(Document doc, Element els,
+ public static Element createClip(Document doc, Element els,
String id) {
Element border = doc.createElementNS(SVG_NS, "clipPath");
border.setAttributeNS(null, "id", id);
@@ -216,7 +220,7 @@ public class SVGUtilities {
* @param height the height to set on the image
* @return a new image element
*/
- public static final Element createImage(Document doc, String ref,
+ public static Element createImage(Document doc, String ref,
float width, float height) {
Element border = doc.createElementNS(SVG_NS, "image");
border.setAttributeNS(XMLConstants.XLINK_NAMESPACE_URI, "href",
@@ -234,7 +238,7 @@ public class SVGUtilities {
* @param width the width to wrap
* @return the new element containing the wrapped text
*/
- public static final Element wrapText(Document doc, String str,
+ public static Element wrapText(Document doc, String str,
java.awt.Font font, float width) {
Element g = createG(doc);
Element text;
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java Tue Jan 18 08:54:08 2011
@@ -62,8 +62,9 @@ public class LineBreakStatus {
/**
* Check whether a line break may happen according to the rules described in
- * the <a href="http://unicode.org/reports/tr14/#Algorithm">Unicode Line Breaking Algorithm</a>.
- * The function returns the line breaking status of the point <em>before</em> the given character.
+ * the <a href="http://unicode.org/reports/tr14/#Algorithm">Unicode Line Breaking
+ * Algorithm</a>. The function returns the line breaking status of the point
+ * <em>before</em> the given character.
* The algorithm is the table-driven algorithm, as described in
* <a href="http://unicode.org/reports/tr14/#PairBasedImplementation">
* Unicode Technical Report #14</a>.
@@ -86,6 +87,7 @@ public class LineBreakStatus {
/* Initial conversions */
switch (currentClass) {
+ case 0: // Unassigned codepoint: same treatment as AI
case LineBreakUtils.LINE_BREAK_PROPERTY_AI:
case LineBreakUtils.LINE_BREAK_PROPERTY_SG:
case LineBreakUtils.LINE_BREAK_PROPERTY_XX:
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org