Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/xml/XMLXMLHandler.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/xml/XMLXMLHandler.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/xml/XMLXMLHandler.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/xml/XMLXMLHandler.java Mon May 28 15:30:46 2012 @@ -19,13 +19,13 @@ package org.apache.fop.render.xml; +import org.xml.sax.ContentHandler; + import org.apache.fop.render.Renderer; -import org.apache.fop.render.XMLHandler; import org.apache.fop.render.RendererContext; +import org.apache.fop.render.XMLHandler; import org.apache.fop.util.DOM2SAX; -import org.xml.sax.ContentHandler; - /** * XML handler for the XML renderer. */
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/servlet/FopPrintServlet.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/servlet/FopPrintServlet.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/servlet/FopPrintServlet.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/servlet/FopPrintServlet.java Mon May 28 15:30:46 2012 @@ -24,10 +24,10 @@ import java.io.PrintWriter; import javax.servlet.http.HttpServletResponse; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; import javax.xml.transform.Result; import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; import javax.xml.transform.sax.SAXResult; import org.apache.fop.apps.FOPException; @@ -55,9 +55,6 @@ import org.apache.fop.apps.MimeConstants * <br/> * <b>Note:</b> This servlet is derived from FopServlet. Most methods are inherited from the * superclass. Only the differences to the base class are necessary. - * - * @author <a href="mailto:[email protected]">Apache FOP Development Team</a> - * @version $Id$ */ public class FopPrintServlet extends FopServlet { Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/servlet/FopServlet.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/servlet/FopServlet.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/servlet/FopServlet.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/servlet/FopServlet.java Mon May 28 15:30:46 2012 @@ -63,9 +63,6 @@ import org.apache.fop.apps.MimeConstants * <br/> * For this to work with Internet Explorer, you might need to append "&ext=.pdf" * to the URL. - * - * @author <a href="mailto:[email protected]">Apache FOP Development Team</a> - * @version $Id$ * (todo) Ev. add caching mechanism for Templates objects */ public class FopServlet extends HttpServlet { Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/ACIUtils.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/ACIUtils.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/ACIUtils.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/ACIUtils.java Mon May 28 15:30:46 2012 @@ -21,19 +21,20 @@ package org.apache.fop.svg; import java.awt.font.TextAttribute; import java.text.AttributedCharacterIterator; -import java.text.CharacterIterator; import java.text.AttributedCharacterIterator.Attribute; +import java.text.CharacterIterator; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.batik.bridge.SVGFontFamily; import org.apache.batik.gvt.font.GVTFont; import org.apache.batik.gvt.font.GVTFontFamily; import org.apache.batik.gvt.text.GVTAttributedCharacterIterator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; @@ -95,9 +96,10 @@ public final class ACIUtils { } if (gvtFonts != null) { + boolean haveInstanceOfSVGFontFamily = false; for (GVTFontFamily fam : gvtFonts) { if (fam instanceof SVGFontFamily) { - return null; //Let Batik paint this text! + haveInstanceOfSVGFontFamily = true; } String fontFamily = fam.getFamilyName(); if (fontInfo.hasFont(fontFamily, style, weight)) { @@ -115,6 +117,14 @@ public final class ACIUtils { firstFontFamily = fontFamily; } } + // SVG fonts are embedded fonts in the SVG document and are rarely used; however if they + // are used but the fonts also exists in the system and are known to FOP then FOP should + // use them; then the decision whether Batik should stroke the text should be made after + // no matching fonts are found + if (fonts.isEmpty() && haveInstanceOfSVGFontFamily) { + fontInfo.notifyStrokingSVGTextAsShapes(firstFontFamily); + return null; // Let Batik paint this text! + } } if (fonts.isEmpty()) { if (firstFontFamily == null) { Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java Mon May 28 15:30:46 2012 @@ -47,9 +47,9 @@ import org.apache.xmlgraphics.java2d.Gra import org.apache.fop.image.loader.batik.BatikUtil; /** - * Bridge class for the <image> element when jpeg images. + * <p>Bridge class for the <image> element when jpeg images.</p> * - * @author <a href="mailto:[email protected]">Keiron Liddle</a> + * <p>This work was authored by Keiron Liddle ([email protected]).</p> */ public abstract class AbstractFOPImageElementBridge extends SVGImageElementBridge { Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTextElementBridge.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTextElementBridge.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTextElementBridge.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTextElementBridge.java Mon May 28 15:30:46 2012 @@ -28,11 +28,11 @@ import org.apache.batik.gvt.TextNode; import org.apache.batik.gvt.TextPainter; /** - * Bridge class for the <text> element. + * <p>Bridge class for the <text> element. * This bridge will use the direct text painter if the text - * for the element is simple. + * for the element is simple.</p> * - * @author <a href="mailto:[email protected]">Keiron Liddle</a> + * <p>This work was authored by Keiron Liddle ([email protected]).</p> */ public abstract class AbstractFOPTextElementBridge extends SVGTextElementBridge { Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java Mon May 28 15:30:46 2012 @@ -33,6 +33,9 @@ import java.text.CharacterIterator; import java.util.Iterator; import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.apache.batik.dom.svg.SVGOMTextElement; import org.apache.batik.gvt.TextNode; import org.apache.batik.gvt.TextPainter; @@ -40,8 +43,6 @@ import org.apache.batik.gvt.renderer.Str import org.apache.batik.gvt.text.GVTAttributedCharacterIterator; import org.apache.batik.gvt.text.Mark; import org.apache.batik.gvt.text.TextPaintInfo; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.fop.afp.AFPGraphics2D; import org.apache.fop.fonts.Font; Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java Mon May 28 15:30:46 2012 @@ -32,6 +32,10 @@ import org.apache.avalon.framework.confi import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.configuration.DefaultConfiguration; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.impl.SimpleLog; + import org.apache.batik.bridge.UserAgent; import org.apache.batik.dom.svg.SVGDOMImplementation; import org.apache.batik.dom.util.DocumentFactory; @@ -44,8 +48,6 @@ import org.apache.batik.transcoder.keys. import org.apache.batik.transcoder.keys.FloatKey; import org.apache.batik.util.ParsedURL; import org.apache.batik.util.SVGConstants; -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; Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/NativeTextPainter.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/NativeTextPainter.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/NativeTextPainter.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/NativeTextPainter.java Mon May 28 15:30:46 2012 @@ -24,11 +24,12 @@ import java.io.IOException; import java.text.AttributedCharacterIterator; import java.util.List; -import org.apache.batik.gvt.renderer.StrokingTextPainter; -import org.apache.batik.gvt.text.TextSpanLayout; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.batik.gvt.renderer.StrokingTextPainter; +import org.apache.batik.gvt.text.TextSpanLayout; + import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; import org.apache.fop.util.CharUtilities; Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFAElementBridge.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFAElementBridge.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFAElementBridge.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFAElementBridge.java Mon May 28 15:30:46 2012 @@ -26,13 +26,12 @@ import org.w3c.dom.svg.SVGAElement; import org.apache.batik.bridge.AbstractGraphicsNodeBridge; import org.apache.batik.bridge.BridgeContext; -import org.apache.batik.gvt.CompositeGraphicsNode; import org.apache.batik.gvt.GraphicsNode; /** - * Bridge class for the <a> element. + * <p>Bridge class for the <a> element.</p> * - * @author <a href="mailto:[email protected]">Keiron Liddle</a> + * <p>This work was authored by Keiron Liddle ([email protected]).</p> */ public class PDFAElementBridge extends AbstractGraphicsNodeBridge { private AffineTransform transform; Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFANode.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFANode.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFANode.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFANode.java Mon May 28 15:30:46 2012 @@ -28,9 +28,9 @@ import java.util.StringTokenizer; import org.apache.batik.gvt.CompositeGraphicsNode; /** - * A graphics node that represents an image described as a graphics node. + * <p>A graphics node that represents an image described as a graphics node.</p> * - * @author <a href="mailto:[email protected]">Keiron Liddle</a> + * <p>This work was authored by Keiron Liddle ([email protected]).</p> */ public class PDFANode extends CompositeGraphicsNode { private String destination; Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFBatikFlowTextElementBridge.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFBatikFlowTextElementBridge.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFBatikFlowTextElementBridge.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFBatikFlowTextElementBridge.java Mon May 28 15:30:46 2012 @@ -23,6 +23,7 @@ import org.apache.batik.extension.svg.Ba import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.gvt.TextNode; import org.apache.batik.gvt.TextPainter; + import org.apache.fop.fonts.FontInfo; /** Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java Mon May 28 15:30:46 2012 @@ -159,7 +159,8 @@ public class PDFDocumentGraphics2D exten if (fontInfo == null) { //Default minimal fonts FontInfo fontInfo = new FontInfo(); - FontSetup.setup(fontInfo); + boolean base14Kerning = false; + FontSetup.setup(fontInfo, base14Kerning); setFontInfo(fontInfo); } } Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java Mon May 28 15:30:46 2012 @@ -46,9 +46,11 @@ public class PDFDocumentGraphics2DConfig * Configures a PDFDocumentGraphics2D instance using an Avalon Configuration object. * @param graphics the PDFDocumentGraphics2D instance * @param cfg the configuration + * @param useComplexScriptFeatures true if complex script features enabled * @throws ConfigurationException if an error occurs while configuring the object */ - public void configure(PDFDocumentGraphics2D graphics, Configuration cfg) + public void configure(PDFDocumentGraphics2D graphics, Configuration cfg, + boolean useComplexScriptFeatures ) throws ConfigurationException { PDFDocument pdfDoc = graphics.getPDFDocument(); @@ -58,7 +60,7 @@ public class PDFDocumentGraphics2DConfig //Fonts try { - FontInfo fontInfo = createFontInfo(cfg); + FontInfo fontInfo = createFontInfo(cfg, useComplexScriptFeatures); graphics.setFontInfo(fontInfo); } catch (FOPException e) { throw new ConfigurationException("Error while setting up fonts", e); @@ -68,13 +70,15 @@ public class PDFDocumentGraphics2DConfig /** * Creates the {@link FontInfo} instance for the given configuration. * @param cfg the configuration + * @param useComplexScriptFeatures true if complex script features enabled * @return the font collection * @throws FOPException if an error occurs while setting up the fonts */ - public static FontInfo createFontInfo(Configuration cfg) throws FOPException { + public static FontInfo createFontInfo(Configuration cfg, boolean useComplexScriptFeatures) + throws FOPException { FontInfo fontInfo = new FontInfo(); final boolean strict = false; - FontResolver fontResolver = FontManager.createMinimalFontResolver(); + FontResolver fontResolver = FontManager.createMinimalFontResolver(useComplexScriptFeatures); //TODO The following could be optimized by retaining the FontManager somewhere FontManager fontManager = new FontManager(); if (cfg != null) { @@ -92,7 +96,8 @@ public class PDFDocumentGraphics2DConfig = new FontInfoConfigurator(cfg, fontManager, fontResolver, listener, strict); List/*<EmbedFontInfo>*/ fontInfoList = new java.util.ArrayList/*<EmbedFontInfo>*/(); fontInfoConfigurator.configure(fontInfoList); - fontCollections.add(new CustomFontCollection(fontResolver, fontInfoList)); + fontCollections.add(new CustomFontCollection(fontResolver, fontInfoList, + fontResolver.isComplexScriptFeaturesEnabled())); } fontManager.setup(fontInfo, (FontCollection[])fontCollections.toArray( Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFFlowExtTextPainter.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFFlowExtTextPainter.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFFlowExtTextPainter.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFFlowExtTextPainter.java Mon May 28 15:30:46 2012 @@ -24,6 +24,7 @@ import java.util.List; import org.apache.batik.extension.svg.FlowExtTextPainter; import org.apache.batik.gvt.TextNode; + import org.apache.fop.fonts.FontInfo; /** Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFFlowTextPainter.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFFlowTextPainter.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFFlowTextPainter.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFFlowTextPainter.java Mon May 28 15:30:46 2012 @@ -24,6 +24,7 @@ import java.util.List; import org.apache.batik.gvt.TextNode; import org.apache.batik.gvt.flow.FlowTextPainter; + import org.apache.fop.fonts.FontInfo; /** Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFGraphics2D.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFGraphics2D.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFGraphics2D.java Mon May 28 15:30:46 2012 @@ -95,12 +95,12 @@ import org.apache.fop.render.pdf.ImageRa import org.apache.fop.render.pdf.ImageRenderedAdapter; /** - * PDF Graphics 2D. + * <p>PDF Graphics 2D. * Used for drawing into a pdf document as if it is a graphics object. - * This takes a pdf document and draws into it. + * This takes a pdf document and draws into it.</p> + * + * <p>This work was authored by Keiron Liddle ([email protected]).</p> * - * @author <a href="mailto:[email protected]">Keiron Liddle</a> - * @version $Id$ * @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D */ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHandler { @@ -965,7 +965,8 @@ public class PDFGraphics2D extends Abstr preparePainting(); FontInfo specialFontInfo = new FontInfo(); - FontSetup.setup(specialFontInfo); + boolean base14Kerning = false; + FontSetup.setup(specialFontInfo, base14Kerning); PDFResources res = pdfDoc.getFactory().makeResources(); PDFResourceContext context = new PDFResourceContext(res); @@ -1063,7 +1064,8 @@ public class PDFGraphics2D extends Abstr preparePainting(); Shape clip = getClip(); - Rectangle2D usrClipBounds, usrBounds; + Rectangle2D usrClipBounds; + Rectangle2D usrBounds; usrBounds = shape.getBounds2D(); if (clip != null) { usrClipBounds = clip.getBounds2D(); @@ -1077,7 +1079,9 @@ public class PDFGraphics2D extends Abstr double usrW = usrBounds.getWidth(); double usrH = usrBounds.getHeight(); - Rectangle devShapeBounds, devClipBounds, devBounds; + Rectangle devShapeBounds; + Rectangle devClipBounds; + Rectangle devBounds; AffineTransform at = getTransform(); devShapeBounds = at.createTransformedShape(shape).getBounds(); if (clip != null) { @@ -1116,7 +1120,10 @@ public class PDFGraphics2D extends Abstr final byte[] rgb = new byte[devW * devH * 3]; final int[] line = new int[devW]; final byte[] mask; - int x, y, val, rgbIdx = 0; + int x; + int y; + int val; + int rgbIdx = 0; if (pcm.hasAlpha()) { mask = new byte[devW * devH]; @@ -1164,8 +1171,8 @@ public class PDFGraphics2D extends Abstr currentStream.write("q\n"); writeClip(shape); - currentStream.write("" + usrW + " 0 0 " + (-usrH) + " " + usrX - + " " + (usrY + usrH) + " cm\n" + currentStream.write("" + PDFNumber.doubleOut(usrW) + " 0 0 " + PDFNumber.doubleOut(-usrH) + " " + + PDFNumber.doubleOut(usrX) + " " + PDFNumber.doubleOut(usrY + usrH) + " cm\n" + imageInfo.getName() + " Do\nQ\n"); return true; } Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFGraphicsDevice.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFGraphicsDevice.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFGraphicsDevice.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFGraphicsDevice.java Mon May 28 15:30:46 2012 @@ -19,9 +19,9 @@ package org.apache.fop.svg; -import java.awt.GraphicsDevice; -import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfigTemplate; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; /** * This implements the GraphicsDevice interface as appropriate for Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFImageElementBridge.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFImageElementBridge.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFImageElementBridge.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFImageElementBridge.java Mon May 28 15:30:46 2012 @@ -24,9 +24,9 @@ import org.apache.xmlgraphics.image.load import org.apache.fop.image.loader.batik.BatikImageFlavors; /** - * PDF Image Element Bridge class for the <image> element when jpeg images. + * <p>PDF Image Element Bridge class for the <image> element when jpeg images.</p> * - * @author <a href="mailto:[email protected]">Keiron Liddle</a> + * <p>This work was authored by Keiron Liddle ([email protected]).</p> */ public class PDFImageElementBridge extends AbstractFOPImageElementBridge { Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFSVGFlowRootElementBridge.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFSVGFlowRootElementBridge.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFSVGFlowRootElementBridge.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFSVGFlowRootElementBridge.java Mon May 28 15:30:46 2012 @@ -23,6 +23,7 @@ import org.apache.batik.bridge.svg12.SVG import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.gvt.TextNode; import org.apache.batik.gvt.TextPainter; + import org.apache.fop.fonts.FontInfo; /** Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextElementBridge.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextElementBridge.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextElementBridge.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextElementBridge.java Mon May 28 15:30:46 2012 @@ -22,11 +22,11 @@ package org.apache.fop.svg; import org.apache.batik.gvt.TextPainter; /** - * Bridge class for the <text> element. + * <p>Bridge class for the <text> element. * This bridge will use the direct text painter if the text - * for the element is simple. + * for the element is simple.</p> * - * @author <a href="mailto:[email protected]">Keiron Liddle</a> + * <p>This work was authored by Keiron Liddle ([email protected]).</p> */ public class PDFTextElementBridge extends AbstractFOPTextElementBridge { Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextPainter.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextPainter.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextPainter.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextPainter.java Mon May 28 15:30:46 2012 @@ -186,14 +186,24 @@ class PDFTextPainter extends NativeTextP } } Font f = textUtil.selectFontForChar(ch); - if (f != textUtil.getCurrentFont()) { + char paintChar = (CharUtilities.isAnySpace(ch) ? ' ' : ch); + char mappedChar = f.mapChar(paintChar); + boolean encodingChanging = false; // used for single byte + if (!textUtil.isMultiByteFont(f.getFontName())) { + int encoding = mappedChar / 256; + mappedChar = (char) (mappedChar % 256); + if (textUtil.getCurrentEncoding() != encoding) { + textUtil.setCurrentEncoding(encoding); + encodingChanging = true; + } + } + if (f != textUtil.getCurrentFont() || encodingChanging) { textUtil.writeTJ(); textUtil.setCurrentFont(f); textUtil.writeTf(f); textUtil.writeTextMatrix(localTransform); } - char paintChar = (CharUtilities.isAnySpace(ch) ? ' ' : ch); - textUtil.writeTJChar(paintChar); + textUtil.writeTJMappedChar(mappedChar); //Update last position prevPos = glyphPos; @@ -231,4 +241,4 @@ class PDFTextPainter extends NativeTextP pdf.applyAlpha(fillAlpha, PDFGraphics2D.OPAQUE); } -} \ No newline at end of file +} Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextUtil.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextUtil.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextUtil.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTextUtil.java Mon May 28 15:30:46 2012 @@ -32,6 +32,7 @@ public abstract class PDFTextUtil extend private FontInfo fontInfo; private Font[] fonts; private Font font; + private int encoding; /** * Main constructor. @@ -74,6 +75,14 @@ public abstract class PDFTextUtil extend } /** + * Returns the current encoding. + * @return the current encoding + */ + public int getCurrentEncoding() { + return this.encoding; + } + + /** * Sets the current font. * @param f the new font to use */ @@ -82,6 +91,14 @@ public abstract class PDFTextUtil extend } /** + * Sets the current encoding. + * @param encoding the new encoding + */ + public void setCurrentEncoding(int encoding) { + this.encoding = encoding; + } + + /** * Determines whether the font with the given name is a multi-byte font. * @param name the name of the font * @return true if it's a multi-byte font @@ -98,7 +115,12 @@ public abstract class PDFTextUtil extend public void writeTf(Font f) { String fontName = f.getFontName(); float fontSize = (float)f.getFontSize() / 1000f; - updateTf(fontName, fontSize, isMultiByteFont(fontName)); + boolean isMultiByte = isMultiByteFont(fontName); + if (!isMultiByte && encoding != 0) { + updateTf(fontName + "_" + Integer.toString(encoding), fontSize, isMultiByte); + } else { + updateTf(fontName, fontSize, isMultiByte); + } } /** Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTranscoder.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTranscoder.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTranscoder.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFTranscoder.java Mon May 28 15:30:46 2012 @@ -28,6 +28,7 @@ import org.w3c.dom.Document; import org.w3c.dom.svg.SVGLength; import org.apache.avalon.framework.configuration.Configuration; + import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.UnitProcessor; import org.apache.batik.bridge.UserAgent; @@ -40,7 +41,7 @@ import org.apache.fop.Version; import org.apache.fop.fonts.FontInfo; /** - * This class enables to transcode an input to a pdf document. + * <p>This class enables to transcode an input to a PDF document.</p> * * <p>Two transcoding hints (<code>KEY_WIDTH</code> and * <code>KEY_HEIGHT</code>) can be used to respectively specify the image @@ -69,8 +70,7 @@ import org.apache.fop.fonts.FontInfo; * of the other transcoders, but this may be associated with a price in the form of a small * performance penalty. If font auto-detection is not desired, it can be disable using this key. * - * @author <a href="mailto:[email protected]">Keiron Liddle</a> - * @version $Id$ + * <p>This work was authored by Keiron Liddle ([email protected]).</p> */ public class PDFTranscoder extends AbstractFOPTranscoder { @@ -126,7 +126,8 @@ public class PDFTranscoder extends Abstr if (effCfg != null) { PDFDocumentGraphics2DConfigurator configurator = new PDFDocumentGraphics2DConfigurator(); - configurator.configure(graphics, effCfg); + boolean useComplexScriptFeatures = false; //TODO - FIX ME + configurator.configure(graphics, effCfg, useComplexScriptFeatures); } else { graphics.setupDefaultFontInfo(); } Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/SVGUserAgent.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/SVGUserAgent.java?rev=1343285&r1=1343284&r2=1343285&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/SVGUserAgent.java (original) +++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/SVGUserAgent.java Mon May 28 15:30:46 2012 @@ -91,4 +91,4 @@ public class SVGUserAgent extends Simple this.eventProducer.alert(this, message); } -} \ No newline at end of file +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
