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 sp...@apache.org on 2011/06/15 13:44:45 UTC

svn commit: r1136002 [1/3] - in /xmlgraphics/fop/branches/Temp_ComplexScripts: ./ src/documentation/ src/documentation/content/xdocs/ src/documentation/content/xdocs/trunk/ src/documentation/intermediate-format-ng/ src/java/org/apache/fop/afp/ src/java...

Author: spepping
Date: Wed Jun 15 11:44:43 2011
New Revision: 1136002

URL: http://svn.apache.org/viewvc?rev=1136002&view=rev
Log:
Merged /xmlgraphics/fop/trunk:r1094917-1135999

Added:
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/xml.xsd
      - copied unchanged from r1135999, xmlgraphics/fop/trunk/src/documentation/intermediate-format-ng/xml.xsd
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsEndProlog.java
      - copied unchanged from r1135999, xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/goca/GraphicsEndProlog.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java
      - copied unchanged from r1135999, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java
      - copied unchanged from r1135999, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/ps/PSRenderingMode.java
      - copied unchanged from r1135999, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSRenderingMode.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/afp/
      - copied from r1135999, xmlgraphics/fop/trunk/test/java/org/apache/fop/afp/
    xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/afp/parser/
      - copied from r1135999, xmlgraphics/fop/trunk/test/java/org/apache/fop/afp/parser/
    xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/afp/parser/MODCAParserTestCase.java
      - copied unchanged from r1135999, xmlgraphics/fop/trunk/test/java/org/apache/fop/afp/parser/MODCAParserTestCase.java
Modified:
    xmlgraphics/fop/branches/Temp_ComplexScripts/   (props changed)
    xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/team.xml
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/extensions.xml
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/output.xml
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/upgrading.xml
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng-datatypes.xsd
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/skinconf.xml
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPGraphics2D.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPPaintingState.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/apps/   (props changed)
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsData.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/modca/GraphicsObject.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/   (props changed)
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/MODCAParser.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPTextHandler.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/util/AFPResourceUtil.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/NamedColorFunction.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/properties/PropertyMaker.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fonts/CIDSubset.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fonts/FontInfo.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fonts/MultiByteFont.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/pdf/PDFTextUtil.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/afp/AFPCustomizable.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/afp/AFPImageHandlerSVG.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/ps/PSBorderPainter.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/ps/PSPainter.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/ps/PSRenderingUtil.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/rtf/RTFHandler.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/ACIUtils.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/NativeTextPainter.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFGraphics2D.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFTextPainter.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/ColorExt.java   (props changed)
    xmlgraphics/fop/branches/Temp_ComplexScripts/status.xml
    xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/StandardTestSuite.java
    xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/intermediate/AbstractIFTestCase.java

Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 15 11:44:43 2011
@@ -2,4 +2,4 @@
 /xmlgraphics/fop/branches/Temp_Color:956535-1069429
 /xmlgraphics/fop/branches/fop-0_95:684572,688085,688696
 /xmlgraphics/fop/branches/fop-1_0:959975-964707
-/xmlgraphics/fop/trunk:981451-1094916
+/xmlgraphics/fop/trunk:981451-1135999

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml Wed Jun 15 11:44:43 2011
@@ -454,6 +454,29 @@
       <Bug pattern="NM_CONFUSING"/>
    </Match>
    <!-- /The names of public methods will not be modified -->
+   <!-- These casts are checked in the code -->
+   <Match>
+	 <Class name="org.apache.fop.render.afp.AFPImageHandlerGraphics2D"/>
+	 <Method name="isCompatible"/>
+	 <Bug pattern="BC_UNCONFIRMED_CAST"/>
+   </Match>
+   <Match>
+	 <Class name="org.apache.fop.render.afp.AFPImageHandlerSVG"/>
+	 <Method name="isCompatible"/>
+	 <Bug pattern="BC_UNCONFIRMED_CAST"/>
+   </Match>
+   <Match>
+	 <Class name="org.apache.fop.render.afp.AbstractPDFImageHandler"/>
+	 <Method name="handleImage"/>
+	 <Bug pattern="BC_UNCONFIRMED_CAST"/>
+   </Match>
+   <!-- /These casts are checked in the code -->
+   <!-- return null is OK -->
+   <Match>
+	 <Class name="org.apache.fop.svg.ACIUtils"/>
+	 <Method name="findFontsForBatikACI"/>
+	 <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+   </Match>
    <!-- Automatically generated list of exclusions -->
    <Match>
       <Class name="org.apache.fop.area.BodyRegion"/>

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/team.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/team.xml?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/team.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/team.xml Wed Jun 15 11:44:43 2011
@@ -37,6 +37,8 @@
             is an XP/Agile practitioner with interests in open source content management and electronic
             document generation.  He is a UK expat now residing in Singapore.</li>
         <li id="ad"><link href="mailto:adelmelle@apache.org">Andreas Delmelle</link> (AD)</li>
+        <li id="pjfh"> <a href="mailto:phancock.at.apache.org">Peter Hancock</a>
+          (PH) is a Java developer from England.</li>
         <li id="vh"><link href="mailto:vhennebert@apache.org">Vincent Hennebert</link>
           (VH), a Java developer from France; with an interest in typography, and in using
           Fop as a pdf renderer for book-like documents.</li>
@@ -55,6 +57,10 @@
             from the TeX/LaTeX world. See his <fork href="http://www.leverkruid.eu">home
             page</fork> for some of his private projects.</li>
         <li id="jp"><link href="mailto:pietsch@apache.org">J&#x00F6;rg Pietschmann</link> (JP)</li>
+        <li id="ps"><link href="mailto:tcho@club-internet.fr">Pascal Sancho</link> (PS)
+	        is an XML developper from Aix-en-Provence (France). He works on software solutions for 	 
+	        rendering various kind of documents on various supports, more specifically taking care 	 
+	        of PDF generation with FOP.</li> 	 
       </ul>
     </section>
     <section id="contribute-active">
@@ -101,7 +107,7 @@
         <li id="lf"><link href="mailto:lfurini AT cs.unibo.it">Luca Furini</link> (LF)</li>
         <li id="cg"><link href="mailto:chrisg@apache.org">Christian Geisert</link> (CG)</li>
         <li id="sg"><link href="mailto:stanislav@apache.org">Stanislav Gorkhover</link></li>
-        <li id="ph"><link href="mailto:pherweg@web.de">Peter Herweg</link> (PH)</li>
+        <li id="ph"><link href="mailto:pherweg@web.de">Peter Herweg</link></li>
         <li id="fj"><link href="mailto:fotis@apache.org">Fotis Jannidis</link></li>
         <li id="kl"><link href="mailto:klease@apache.org">Karen Lease</link></li>
         <li id="kll"><link href="mailto:keiron@apache.org">Keiron Liddle</link></li>
@@ -109,7 +115,6 @@
         <li id="gm"><link href="mailto:gmazza@apache.org">Glen Mazza</link></li>
         <li id="wvm"><link href="mailto:vmote@apache.org">Victor Mote</link></li>
         <li id="jn"><link href="mailto:jordan@apache.org">Jordan Naftolin</link></li>
-        <li id="ps"><link href="mailto:tcho@club-internet.fr">Pascal Sancho</link> (PS)</li>
         <li id="as"><link href="mailto:arved@apache.org">Arved Sandstrom</link></li>
         <li id="es"><link href="mailto:eschaeffer@apache.org">Eric Schaeffer</link></li>
         <li id="ot"><link href="mailto:olegt@apache.org">Oleg Tkachenko</link> (OT)</li>

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/extensions.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/extensions.xml?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/extensions.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/extensions.xml Wed Jun 15 11:44:43 2011
@@ -24,14 +24,14 @@
   </header>
   <body>
     <p>
-      By "extension", we mean any data that can be placed in the input XML document that 
+      By "extension", we mean any data that can be placed in the input XML document that
       is not addressed by the XSL-FO standard.
-      By having a mechanism for supporting extensions, FOP is able to add features that 
+      By having a mechanism for supporting extensions, FOP is able to add features that
       are not covered in the specification.
     </p>
     <p>
-      The extensions documented here are included with FOP, and are automatically available 
-      to you. If you wish to add an extension of your own to FOP, please see the 
+      The extensions documented here are included with FOP, and are automatically available
+      to you. If you wish to add an extension of your own to FOP, please see the
       <a href="../dev/extensions.html">Developers' Extension Page</a>.
     </p>
     <note>All extensions require the correct use of an appropriate namespace in your input document.</note>
@@ -47,7 +47,7 @@
         <title>Namespace</title>
         <p>
           By convention, FO extensions in FOP use the "fox" namespace prefix.
-          To use any of the FO extensions, add a namespace entry for 
+          To use any of the FO extensions, add a namespace entry for
           <code>http://xmlgraphics.apache.org/fop/extensions</code> to the root element:
         </p>
         <source><![CDATA[<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
@@ -56,9 +56,9 @@
       <section id="bookmarks">
         <title>PDF Bookmarks</title>
         <p>
-          In previous versions of Apache FOP there was a <code>fox:outline</code> element
+          In old versions of Apache FOP there was a <code>fox:outline</code> element
           which was used to create outlines in PDF files. The redesigned code makes use
-          of the new <a href="http://www.w3.org/TR/xsl11/#fo_bookmark-tree">bookmark feature defined in the latest XSL 1.1 working draft</a>.
+          of the <a href="http://www.w3.org/TR/xsl11/#fo_bookmark-tree">bookmark feature defined in the W3C XSL 1.1 standard</a>.
         </p>
       </section>
       <section id="named-destinations">
@@ -131,7 +131,7 @@ to following pages. Here is an example o
           The <code>fox:external-document</code> element is structurally a peer to
           <code>fo:page-sequence</code>, so wherever you can put an <code>fo:page-sequence</code>
           you could also place a <code>fox:external-document</code>.
-          Therefore, the specified contents for <code>fo:root</code> change to: 
+          Therefore, the specified contents for <code>fo:root</code> change to:
         </p>
         <p>
           <code>
@@ -246,7 +246,7 @@ to following pages. Here is an example o
       </section>
       <section id="prepress">
         <title>Prepress Support</title>
-        
+
         <p>
           This section defines a number of extensions related to
           <a href="http://en.wikipedia.org/wiki/Prepress">prepress</a> support.
@@ -260,15 +260,15 @@ to following pages. Here is an example o
         <note>
           Those extensions have been implemented in the PDF and Java2D renderers only.
         </note>
-        
+
         <section id="scale">
           <title>fox:scale</title>
           <p>Value: &lt;number&gt;{1,2}</p>
           <p>Initial: 1</p>
           <p>Applies to: fo:simple-page-master</p>
           <p>
-            This property specifies a scale factor along resp. the x and y axes. If only one number 
-            is provided it is used for both the x and y scales. A scale factor smaller than 1 
+            This property specifies a scale factor along resp. the x and y axes. If only one number
+            is provided it is used for both the x and y scales. A scale factor smaller than 1
             shrinks the page. A scale factor greater than 1 enlarges the page.
           </p>
         </section>
@@ -287,7 +287,7 @@ to following pages. Here is an example o
               If there are three values, the top is set to the first value, the left and right are set to the second,
               and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and
               left, respectively.
-              (Corresponds to <a href="http://www.w3.org/TR/xsl11/#padding">the definition of 
+              (Corresponds to <a href="http://www.w3.org/TR/xsl11/#padding">the definition of
                 padding</a>).
           </p>
           <p>
@@ -305,12 +305,12 @@ to following pages. Here is an example o
           </p>
           <p>Applies to: fo:simple-page-master</p>
           <p>
-            Same behaviour as with fox:bleed. The initial value is set to the same values as the 
+            Same behaviour as with fox:bleed. The initial value is set to the same values as the
             fox:bleed property.
           </p>
           <p>
             This extension indirectly defines the MediaBox and is calculated by expanding
-            the TrimBox by the crop offsets. The lengths must be non-negative. 
+            the TrimBox by the crop offsets. The lengths must be non-negative.
           </p>
         </section>
         <section id="cropBox">
@@ -326,7 +326,7 @@ to following pages. Here is an example o
             The crop box controls how Acrobat displays the page (CropBox in PDF) or how the Java2DRenderer sizes
             the output media. The PDF specification defines that the CropBox defaults to the MediaBox. This extension
             follows that definition. To simplify usage and cover most use cases, the three supported enumeration
-            values "trim-box", "bleed-box" and "media-box" set the CropBox to one of those three other boxes. 
+            values "trim-box", "bleed-box" and "media-box" set the CropBox to one of those three other boxes.
           </p>
           <p>
             If requested in the future, we could offer to specify the CropBox in absolute coordinates rather

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/output.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/output.xml?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/output.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/output.xml Wed Jun 15 11:44:43 2011
@@ -287,6 +287,7 @@ out = proc.getOutputStream();]]></source
   <optimize-resources>false</optimize-resources>
   <safe-set-page-device>false</safe-set-page-device>
   <dsc-compliant>true</dsc-compliant>
+  <rendering>quality</rendering>
 </renderer>]]></source>
       <p>
         The default value for the "auto-rotate-landscape" setting is "false". Setting it
@@ -319,6 +320,12 @@ out = proc.getOutputStream();]]></source
         the particular postscript implementation issuing unwanted postscript subsystem
         initgraphics/erasepage calls on each setpagedevice call.
       </p>
+      <p>
+        The default value for the "rendering" setting is "quality". Setting it to "size"
+        optimizes rendering for smaller file sizes which can involve minor compromises in
+        rendering quality. For example, solid borders are then painted as plain rectangles
+        instead of the elaborate painting instructions required for mixed-color borders.
+      </p>
     </section>
   <section id="ps-limitations">
     <title>Limitations</title>
@@ -784,6 +791,29 @@ Note that the value of the encoding attr
         <source><![CDATA[
       <images mode="b+w" bits-per-pixel="1" dithering-quality="maximum"/>]]></source>
       </section>
+      <section id="afp-goca-config">
+        <title>GOCA (Vector Graphics)</title>
+        <p>
+          Not all AFP implementations support GOCA. Some also have bugs related to GOCA. Therefore,
+          it is desirable to have some control over the generation of GOCA graphics.
+        </p>
+        <p>
+          GOCA is enabled by default. You can disable GOCA entirely in which case the AFP support
+          falls back to generating bitmaps for vector graphics. Example:
+        </p>
+        <source><![CDATA[
+      <goca enabled="false"/>]]></source>
+        <p>
+          Some AFP implementations have trouble rendering text in GOCA. You can instruct the AFP
+          support to render text as shapes (i.e. use vector graphics to paint text). Example: 
+        </p>
+        <source><![CDATA[
+      <goca enabled="true" text="shapes"/>]]></source>
+        <p>
+          If you disable GOCA or let text render as shapes, the size of the generated AFP usually
+          increases considerably.
+        </p>
+      </section>
       <section id="afp-shading-config">
         <title>Shading</title>
         <p>
@@ -932,14 +962,19 @@ Note that the value of the encoding attr
       </fo:layout-master-set>
 ]]></source>
         <p>The no-operation extension element can appear as child of
-        simple-page-master (appears after "Begin Page" BPG),
-        page-sequence (appears after "Begin Named Page Group" BNG
-        and declarations (appears after "Begin Document" BDT).
+        <code>simple-page-master</code> (appears after "Begin Page" BPG),
+        <code>page-sequence</code> (appears after "Begin Named Page Group" BNG
+        and <code>declarations</code> (appears after "Begin Document" BDT).
         Multiple no-operation extension elements inside the same formatting object are allowed.
         Each NOP will appear right after the respective "Begin" field indicated above even if it
-        is specified as the last child under its parent. However, the order inside the parent
+        is specified as the last child under its parent. The order inside the parent
         will be maintained.
-        The name attribute is mandatory but will not appear inside the AFP stream.
+        The "placement" attribute can be used to have the NOP appear before
+        the "End" field of the object rather than after the "Begin" field. Specify
+        <code>placement="before-end"</code> to do that. Please note that, at the moment, this only
+        has an effect for NOPs that are children of the <code>page-sequence</code> formatting
+        object.
+        The "name" attribute is mandatory but will not appear inside the AFP stream.
         </p>
       </section>
       <section id="afp-invoke-medium-map">

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/upgrading.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/upgrading.xml?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/upgrading.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/content/xdocs/trunk/upgrading.xml Wed Jun 15 11:44:43 2011
@@ -31,12 +31,6 @@
       </p>
       <ul>
         <li>
-          More than half of the codebase has been rewritten over the
-          last three years. With version 0.93 the code has reached
-          <strong>production level</strong>, and continues to improve with
-          version 0.94.
-        </li>
-        <li>
           The API of FOP has changed considerably and is not
           backwards-compatible with versions 0.20.5 and
           0.91beta. Version 0.92 introduced the <strong>new stable

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng-datatypes.xsd
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng-datatypes.xsd?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng-datatypes.xsd (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng-datatypes.xsd Wed Jun 15 11:44:43 2011
@@ -92,7 +92,7 @@
       <!-- TODO refine me: \w+ will not be good enough for CMYK color, for example
       <xs:pattern value="\((solid|dotted|dashed|double|groove|ridge|inset|outset),\w+,\d+(,collapse-(inner|outer))?"/>
       -->
-      <xs:pattern value="\((solid|dotted|dashed|double|groove|ridge|inset|outset),.+)"/>
+      <xs:pattern value="\((solid|dotted|dashed|double|groove|ridge|inset|outset),.+\)"/>
     </xs:restriction>
   </xs:simpleType>
   <xs:simpleType name="lengthListType">

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd Wed Jun 15 11:44:43 2011
@@ -21,7 +21,7 @@
   xmlns:mf="http://xmlgraphics.apache.org/fop/intermediate"
   xmlns:nav="http://xmlgraphics.apache.org/fop/intermediate/document-navigation">
   <xs:import namespace="http://www.w3.org/XML/1998/namespace"
-    schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+    schemaLocation="xml.xsd"/>
   <xs:import namespace="http://xmlgraphics.apache.org/fop/intermediate/document-navigation"
     schemaLocation="fop-intermediate-format-ng-nav.xsd"/>
   <xs:import namespace="adobe:ns:meta/" schemaLocation="xmp-metadata.xsd"/>

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/skinconf.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/skinconf.xml?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/skinconf.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/documentation/skinconf.xml Wed Jun 15 11:44:43 2011
@@ -103,9 +103,8 @@ which will be used to configure the chos
     For some skins just set the attributes to blank.
   -->
   <trail location="alt">
-    <link1 name="apache.org" href="http://www.apache.org/"/>
-    <link2 name="XML Federation" href="http://xml.apache.org/"/>
-    <link3 name="xmlgraphics.apache.org" href="http://xmlgraphics.apache.org/"/>
+    <link1 name="The Apache Software Foundation" href="http://www.apache.org/"/>
+    <link2 name="Apache XML Graphics Project" href="http://xmlgraphics.apache.org/"/>
   </trail>
 
   <!-- Configure the TOC, i.e. the Table of Contents.

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPGraphics2D.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPGraphics2D.java Wed Jun 15 11:44:43 2011
@@ -166,6 +166,14 @@ public class AFPGraphics2D extends Abstr
     }
 
     /**
+     * Returns the AFP resource manager associated with this {@link Graphics2D} instance.
+     * @return the resource manager
+     */
+    public AFPResourceManager getResourceManager() {
+        return this.resourceManager;
+    }
+
+    /**
      * Sets the AFP resource info
      *
      * @param resourceInfo the AFP resource info
@@ -497,12 +505,14 @@ public class AFPGraphics2D extends Abstr
     }
 
     /** {@inheritDoc} */
+    @Override
     public void draw(Shape shape) {
         LOG.debug("draw() shape=" + shape);
         doDrawing(shape, false);
     }
 
     /** {@inheritDoc} */
+    @Override
     public void fill(Shape shape) {
         LOG.debug("fill() shape=" + shape);
         doDrawing(shape, true);
@@ -521,6 +531,7 @@ public class AFPGraphics2D extends Abstr
     }
 
     /** {@inheritDoc} */
+    @Override
     public void drawString(String str, float x, float y) {
         try {
             if (customTextHandler != null && !textAsShapes) {
@@ -534,21 +545,25 @@ public class AFPGraphics2D extends Abstr
     }
 
     /** {@inheritDoc} */
+    @Override
     public GraphicsConfiguration getDeviceConfiguration() {
         return graphicsConfig;
     }
 
     /** {@inheritDoc} */
+    @Override
     public Graphics create() {
         return new AFPGraphics2D(this);
     }
 
     /** {@inheritDoc} */
+    @Override
     public void dispose() {
         this.graphicsObj = null;
     }
 
     /** {@inheritDoc} */
+    @Override
     public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
         return drawImage(img, x, y, img.getWidth(observer), img.getHeight(observer), observer);
     }
@@ -595,6 +610,7 @@ public class AFPGraphics2D extends Abstr
     }
 
     /** {@inheritDoc} */
+    @Override
     public boolean drawImage(Image img, int x, int y, int width, int height,
             ImageObserver observer) {
         // draw with AWT Graphics2D
@@ -609,6 +625,7 @@ public class AFPGraphics2D extends Abstr
     }
 
     /** {@inheritDoc} */
+    @Override
     public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
         int imgWidth = img.getWidth();
         int imgHeight = img.getHeight();
@@ -658,17 +675,20 @@ public class AFPGraphics2D extends Abstr
     }
 
     /** {@inheritDoc} */
+    @Override
     public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
         LOG.debug("drawRenderableImage() NYI: img=" + img + ", xform=" + xform);
     }
 
     /** {@inheritDoc} */
+    @Override
     public FontMetrics getFontMetrics(Font f) {
         LOG.debug("getFontMetrics() NYI: f=" + f);
         return null;
     }
 
     /** {@inheritDoc} */
+    @Override
     public void setXORMode(Color col) {
         LOG.debug("setXORMode() NYI: col=" + col);
     }
@@ -681,6 +701,7 @@ public class AFPGraphics2D extends Abstr
     }
 
     /** {@inheritDoc} */
+    @Override
     public void copyArea(int x, int y, int width, int height, int dx, int dy) {
         LOG.debug("copyArea() NYI: ");
     }

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPPaintingState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPPaintingState.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPPaintingState.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/AFPPaintingState.java Wed Jun 15 11:44:43 2011
@@ -73,6 +73,11 @@ public class AFPPaintingState extends or
     /** the output resolution */
     private int resolution = 240; // 240 dpi
 
+    /** determines whether GOCA is enabled or disabled  */
+    private boolean gocaEnabled = true;
+    /** determines whether to stroke text in GOCA mode or to use text operators where possible */
+    private boolean strokeGocaText = false;
+
     /** the current page */
     private transient AFPPagePaintingState pagePaintingState = new AFPPagePaintingState();
 
@@ -276,12 +281,46 @@ public class AFPPaintingState extends or
         return this.resolution;
     }
 
+    /**
+     * Controls whether GOCA is enabled or disabled.
+     * @param enabled true if GOCA is enabled, false if it is disabled
+     */
+    public void setGOCAEnabled(boolean enabled) {
+        this.gocaEnabled = enabled;
+    }
+
+    /**
+     * Indicates whether GOCA is enabled or disabled.
+     * @return true if GOCA is enabled, false if GOCA is disabled
+     */
+    public boolean isGOCAEnabled() {
+        return this.gocaEnabled;
+    }
+
+    /**
+     * Controls whether to stroke text in GOCA mode or to use text operators where possible.
+     * @param stroke true to stroke, false to paint with text operators where possible
+     */
+    public void setStrokeGOCAText(boolean stroke) {
+        this.strokeGocaText = stroke;
+    }
+
+    /**
+     * Indicates whether to stroke text in GOCA mode or to use text operators where possible.
+     * @return true to stroke, false to paint with text operators where possible
+     */
+    public boolean isStrokeGOCAText() {
+        return this.strokeGocaText;
+    }
+
     /** {@inheritDoc} */
+    @Override
     protected AbstractData instantiateData() {
         return new AFPData();
     }
 
     /** {@inheritDoc} */
+    @Override
     protected AbstractPaintingState instantiate() {
         return new AFPPaintingState();
     }
@@ -423,6 +462,7 @@ public class AFPPaintingState extends or
     }
 
     /** {@inheritDoc} */
+    @Override
     public Object clone() {
         AFPPaintingState paintingState = (AFPPaintingState) super.clone();
         paintingState.pagePaintingState = (AFPPagePaintingState) this.pagePaintingState.clone();
@@ -436,6 +476,7 @@ public class AFPPaintingState extends or
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
         return "AFPPaintingState{" + "portraitRotation=" + portraitRotation
                 + ", landscapeRotation=" + landscapeRotation + ", colorImages=" + colorImages
@@ -548,6 +589,7 @@ public class AFPPaintingState extends or
         }
 
         /** {@inheritDoc} */
+        @Override
         public Object clone() {
             AFPPagePaintingState state = new AFPPagePaintingState();
             state.width = this.width;
@@ -559,6 +601,7 @@ public class AFPPaintingState extends or
         }
 
         /** {@inheritDoc} */
+        @Override
         public String toString() {
             return "AFPPagePaintingState{width=" + width + ", height=" + height + ", orientation="
                     + orientation + ", fonts=" + fonts + ", fontCount=" + fontCount + "}";
@@ -577,6 +620,7 @@ public class AFPPaintingState extends or
         private String imageUri = null;
 
         /** {@inheritDoc} */
+        @Override
         public Object clone() {
             AFPData obj = (AFPData) super.clone();
             obj.filled = this.filled;
@@ -585,12 +629,14 @@ public class AFPPaintingState extends or
         }
 
         /** {@inheritDoc} */
+        @Override
         public String toString() {
             return "AFPData{" + super.toString() + ", filled=" + filled + ", imageUri=" + imageUri
                     + "}";
         }
 
         /** {@inheritDoc} */
+        @Override
         protected AbstractData instantiate() {
             return new AFPData();
         }

Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/apps/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 15 11:44:43 2011
@@ -3,4 +3,4 @@
 /xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/apps:956535-1069429
 /xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/afp/apps:684572,688085,688696
 /xmlgraphics/fop/branches/fop-1_0/src/java/org/apache/fop/afp/apps:959975-964707
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/apps:959946-1094916
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/apps:959946-1135999

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java Wed Jun 15 11:44:43 2011
@@ -55,9 +55,10 @@ public class FontPatternExtractor {
             UnparsedStructuredField strucField;
             while ((strucField = parser.readNextStructuredField()) != null) {
                 if (strucField.getSfTypeID() == 0xD3EE89) {
+                    byte[] sfData = strucField.getData();
                     println(strucField.toString());
-                    HexDump.dump(strucField.getData(), 0, printStream, 0);
-                    baout.write(strucField.getData());
+                    HexDump.dump(sfData, 0, printStream, 0);
+                    baout.write(sfData);
                 }
             }
 

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java Wed Jun 15 11:44:43 2011
@@ -33,6 +33,8 @@ public final class GraphicsChainedSegmen
     protected static final int MAX_DATA_LEN = 8192;
 
     private byte[] predecessorNameBytes;
+    private boolean appended;
+    private boolean prologPresent;
 
     /**
      * Main constructor
@@ -41,7 +43,7 @@ public final class GraphicsChainedSegmen
      *            the name of this graphics segment
      */
     public GraphicsChainedSegment(String name) {
-        super(name);
+        this(name, null, false, false);
     }
 
     /**
@@ -51,24 +53,35 @@ public final class GraphicsChainedSegmen
      *            the name of this graphics segment
      * @param predecessorNameBytes
      *            the name of the predecessor in this chain
+     * @param appended true if this segment is appended to the previous one
+     * @param prologPresent true if this segment starts with a prolog
      */
-    public GraphicsChainedSegment(String name, byte[] predecessorNameBytes) {
+    public GraphicsChainedSegment(String name, byte[] predecessorNameBytes,
+            boolean appended, boolean prologPresent) {
         super(name);
-        this.predecessorNameBytes = predecessorNameBytes;
+        if (predecessorNameBytes != null) {
+            this.predecessorNameBytes = new byte[predecessorNameBytes.length];
+            System.arraycopy(predecessorNameBytes, 0,
+                    this.predecessorNameBytes, 0, predecessorNameBytes.length);
+        }
+        this.appended = appended;
+        this.prologPresent = prologPresent;
     }
 
     /** {@inheritDoc} */
+    @Override
     public int getDataLength() {
         return 14 + super.getDataLength();
     }
 
     private static final byte APPEND_NEW_SEGMENT = 0;
-//    private static final byte PROLOG = 4;
-//    private static final byte APPEND_TO_EXISING = 48;
+    private static final byte APPEND_TO_EXISING = 6;
+    private static final byte PROLOG = 0x10;
 
     private static final int NAME_LENGTH = 4;
 
     /** {@inheritDoc} */
+    @Override
     protected int getNameLength() {
         return NAME_LENGTH;
     }
@@ -78,6 +91,7 @@ public final class GraphicsChainedSegmen
     }
 
     /** {@inheritDoc} */
+    @Override
     public void writeToStream(OutputStream os) throws IOException {
         byte[] data = new byte[14];
         data[0] = getOrderCode(); // BEGIN_SEGMENT
@@ -88,7 +102,12 @@ public final class GraphicsChainedSegmen
         System.arraycopy(nameBytes, 0, data, 2, NAME_LENGTH);
 
         data[6] = 0x00; // FLAG1 (ignored)
-        data[7] = APPEND_NEW_SEGMENT;
+
+        //FLAG2
+        data[7] |= this.appended ? APPEND_TO_EXISING : APPEND_NEW_SEGMENT;
+        if (this.prologPresent) {
+            data[7] |= PROLOG;
+        }
 
         int dataLength = super.getDataLength();
         byte[] len = BinaryUtils.convert(dataLength, 2);
@@ -105,7 +124,8 @@ public final class GraphicsChainedSegmen
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
-        return "GraphicsChainedSegment(name=" + super.getName() + ")";
+        return "GraphicsChainedSegment(name=" + super.getName() + ", len: " + getDataLength() + ")";
     }
 }
\ No newline at end of file

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsData.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsData.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/goca/GraphicsData.java Wed Jun 15 11:44:43 2011
@@ -32,11 +32,14 @@ import org.apache.fop.afp.util.StringUti
 public final class GraphicsData extends AbstractGraphicsDrawingOrderContainer {
 
     /** the maximum graphics data length */
-    public static final int MAX_DATA_LEN = 8192;
+    public static final int MAX_DATA_LEN = GraphicsChainedSegment.MAX_DATA_LEN + 16;
+    //+16 to avoid unnecessary, practically empty GraphicsData instances.
 
     /** the graphics segment */
     private GraphicsChainedSegment currentSegment = null;
 
+    private boolean segmentedData;
+
     /**
      * Main constructor
      */
@@ -44,11 +47,21 @@ public final class GraphicsData extends 
     }
 
     /** {@inheritDoc} */
+    @Override
     public int getDataLength() {
         return 8 + super.getDataLength();
     }
 
     /**
+     * Sets the indicator that this instance is a part of a series of segmented data chunks.
+     * This indirectly sets the SegFlag on the SFI header.
+     * @param segmented true if this data object is not the last of the series
+     */
+    public void setSegmentedData(boolean segmented) {
+        this.segmentedData = segmented;
+    }
+
+    /**
      * Returns a new segment name
      *
      * @return a new segment name
@@ -60,28 +73,40 @@ public final class GraphicsData extends 
     }
 
     /**
-     * Creates a new graphics segment
+     * Creates a new graphics segment.
      *
      * @return a newly created graphics segment
      */
     public GraphicsChainedSegment newSegment() {
+        return newSegment(false, false);
+    }
+
+    /**
+     * Creates a new graphics segment.
+     * @param appended true if this segment is appended to the previous one
+     * @param prologPresent true if started with a prolog
+     * @return a newly created graphics segment
+     */
+    public GraphicsChainedSegment newSegment(boolean appended, boolean prologPresent) {
         String segmentName = createSegmentName();
         if (currentSegment == null) {
             currentSegment = new GraphicsChainedSegment(segmentName);
         } else {
             currentSegment.setComplete(true);
-            currentSegment = new GraphicsChainedSegment(segmentName, currentSegment.getNameBytes());
+            currentSegment = new GraphicsChainedSegment(segmentName,
+                    currentSegment.getNameBytes(), appended, prologPresent);
         }
         super.addObject(currentSegment);
         return currentSegment;
     }
 
     /** {@inheritDoc} */
+    @Override
     public void addObject(StructuredData object) {
         if (currentSegment == null
                 || (currentSegment.getDataLength() + object.getDataLength())
                 >= GraphicsChainedSegment.MAX_DATA_LEN) {
-            newSegment();
+            newSegment(true, false);
         }
         currentSegment.addObject(object);
     }
@@ -97,6 +122,7 @@ public final class GraphicsData extends 
     }
 
     /** {@inheritDoc} */
+    @Override
     public void writeToStream(OutputStream os) throws IOException {
         byte[] data = new byte[9];
         copySF(data, SF_CLASS, Type.DATA, Category.GRAPHICS);
@@ -104,14 +130,18 @@ public final class GraphicsData extends 
         byte[] len = BinaryUtils.convert(dataLength, 2);
         data[1] = len[0]; // Length byte 1
         data[2] = len[1]; // Length byte 2
+        if (this.segmentedData) {
+            data[6] |= 32; //Data is segmented
+        }
         os.write(data);
 
         writeObjects(objects, os);
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
-        return "GraphicsData";
+        return "GraphicsData(len: " + getDataLength() + ")";
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/modca/GraphicsObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/modca/GraphicsObject.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/modca/GraphicsObject.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/modca/GraphicsObject.java Wed Jun 15 11:44:43 2011
@@ -39,6 +39,7 @@ import org.apache.fop.afp.goca.GraphicsB
 import org.apache.fop.afp.goca.GraphicsChainedSegment;
 import org.apache.fop.afp.goca.GraphicsCharacterString;
 import org.apache.fop.afp.goca.GraphicsData;
+import org.apache.fop.afp.goca.GraphicsEndProlog;
 import org.apache.fop.afp.goca.GraphicsFillet;
 import org.apache.fop.afp.goca.GraphicsFullArc;
 import org.apache.fop.afp.goca.GraphicsImage;
@@ -62,8 +63,8 @@ public class GraphicsObject extends Abst
     private GraphicsData currentData = null;
 
     /** list of objects contained within this container */
-    protected List/*<GraphicsData>*/ objects
-        = new java.util.ArrayList/*<GraphicsData>*/();
+    protected List<GraphicsData> objects
+        = new java.util.ArrayList<GraphicsData>();
 
     /** the graphics state */
     private final GraphicsState graphicsState = new GraphicsState();
@@ -325,6 +326,10 @@ public class GraphicsObject extends Abst
      * @param y the y coordinate
      */
     public void addString(String str, int x, int y) {
+        //Work-around for InfoPrint's AFP which loses character set state over Graphics Data
+        //boundaries.
+        addObject(new GraphicsSetCharacterSet(graphicsState.characterSet));
+
         addObject(new GraphicsCharacterString(str, x, y));
     }
 
@@ -342,6 +347,13 @@ public class GraphicsObject extends Abst
         addObject(new GraphicsAreaEnd());
     }
 
+    /**
+     * Ends the prolog.
+     */
+    public void endProlog() {
+        addObject(new GraphicsEndProlog());
+    }
+
     /** {@inheritDoc} */
     @Override
     public String toString() {
@@ -359,9 +371,9 @@ public class GraphicsObject extends Abst
     /** {@inheritDoc} */
     @Override
     public void setComplete(boolean complete) {
-        Iterator it = objects.iterator();
+        Iterator<GraphicsData> it = objects.iterator();
         while (it.hasNext()) {
-            Completable completedObject = (Completable)it.next();
+            Completable completedObject = it.next();
             completedObject.setComplete(true);
         }
         super.setComplete(complete);

Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 15 11:44:43 2011
@@ -3,4 +3,4 @@
 /xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/parser:956535-1069429
 /xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/afp/parser:684572,688085,688696
 /xmlgraphics/fop/branches/fop-1_0/src/java/org/apache/fop/afp/parser:959975-964707
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/parser:959946-1094916
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/parser:959946-1135999

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/MODCAParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/MODCAParser.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/MODCAParser.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/MODCAParser.java Wed Jun 15 11:44:43 2011
@@ -20,15 +20,23 @@
 package org.apache.fop.afp.parser;
 
 import java.io.DataInputStream;
-import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.fop.afp.parser.UnparsedStructuredField.Introducer;
+
 /**
  * An simple MO:DCA/AFP parser.
  */
 public class MODCAParser {
 
+    private static final Log LOG = LogFactory.getLog(MODCAParser.class);
+
+    private static final int INTRODUCER_LENGTH = 8;
+
     /** The carriage control character (0x5A) used to indicate the start of a structured field. */
     public static final byte CARRIAGE_CONTROL_CHAR = (byte)(0x5A & 0xFF);
 
@@ -39,19 +47,9 @@ public class MODCAParser {
      * @param in the {@link InputStream} to read the AFP file from.
      */
     public MODCAParser(InputStream in) {
-        if (!in.markSupported()) {
-            in = new java.io.BufferedInputStream(in);
-        }
         this.din = new DataInputStream(in);
     }
 
-    /**
-     * Returns the {@link DataInputStream} used for parsing structured fields.
-     * @return the data input stream
-     */
-    public DataInputStream getDataInputStream() {
-        return this.din;
-    }
 
     /**
      * Reads the next structured field from the input stream.
@@ -61,20 +59,46 @@ public class MODCAParser {
      * @throws IOException if an I/O error occurs
      */
     public UnparsedStructuredField readNextStructuredField() throws IOException {
-        try {
-            while (true) {
-                byte b = din.readByte(); //Skip 0x5A character if necessary (ex. AFP)
-                if (b == 0x0D || b == 0x0A) {
-                    //CR and LF may be used as field delimiters
-                    continue;
-                } else if (b == CARRIAGE_CONTROL_CHAR) {
-                    break; //Signals the start of a new structured field
-                }
+
+        //Find the SF delimiter
+        do {
+            //Exhausted streams and so no next SF
+            //  - null return represents this case
+            //  TODO should this happen?
+            if (din.available() == 0) {
+                return null;
+            }
+        } while (din.readByte() != CARRIAGE_CONTROL_CHAR);
+
+        //Read introducer as byte array to preserve any data not parsed below
+        byte[] introducerData = new byte[INTRODUCER_LENGTH]; //Length of introducer
+        din.readFully(introducerData);
+
+        Introducer introducer = new Introducer(introducerData);
+
+        int dataLength = introducer.getLength() - INTRODUCER_LENGTH;
+
+        //Handle optional extension
+        byte[] extData = null;
+        if (introducer.isExtensionPresent()) {
+            short extLength = 0;
+            extLength = (short)((din.readByte()) & 0xFF);
+            if (extLength > 0) {
+                extData = new byte[extLength - 1];
+                din.readFully(extData);
+                dataLength -= extLength;
             }
-        } catch (EOFException eof) {
-            return null;
         }
-        return UnparsedStructuredField.readStructuredField(getDataInputStream());
-    }
+        //Read payload
+        byte[] data = new byte[dataLength];
+        din.readFully(data);
 
+        UnparsedStructuredField sf = new UnparsedStructuredField(introducer, data, extData);
+
+        if (LOG.isTraceEnabled()) {
+            LOG.trace(sf);
+        }
+
+        return sf;
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java Wed Jun 15 11:44:43 2011
@@ -19,337 +19,331 @@
 
 package org.apache.fop.afp.parser;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
-import java.io.EOFException;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.PrintStream;
 import java.text.DecimalFormat;
 
-import org.apache.commons.io.HexDump;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 /**
- * Represents an unparsed (generic) AFP structured field.
- */
-public class UnparsedStructuredField {
-
-    private static final Log LOG = LogFactory.getLog(UnparsedStructuredField.class);
-
-    private static final int INTRODUCER_LENGTH = 8;
-
-    private short sfLength;
-    private byte sfClassCode;
-    private byte sfTypeCode;
-    private byte sfCategoryCode;
-    private boolean sfiExtensionPresent;
-    private boolean sfiSegmentedData;
-    private boolean sfiPaddingPresent;
-    private short extLength;
-    private byte[] introducerData;
-    private byte[] extData;
-    private byte[] data;
-
-    /**
-     * Default constructor.
-     */
-    public UnparsedStructuredField() {
-        //nop
-    }
-
-    /**
-     * Reads a structured field from a {@link DataInputStream}. The resulting object can be
-     * further interpreted be follow-up code.
-     * @param din the stream to read from
-     * @return the generic structured field
-     * @throws IOException if an I/O error occurs
-     */
-    public static UnparsedStructuredField readStructuredField(DataInputStream din)
-            throws IOException {
-        UnparsedStructuredField sf = new UnparsedStructuredField();
-
-        //Read introducer as byte array to preserve any data not parsed below
-        din.mark(INTRODUCER_LENGTH);
-        sf.introducerData = new byte[INTRODUCER_LENGTH]; //Length of introducer
-        din.readFully(sf.introducerData);
-        din.reset();
-
-        //Parse the introducer
-        short len;
-        try {
-            len = din.readShort();
-        } catch (EOFException eof) {
-            return null;
-        }
-        sf.sfLength = len;
-        sf.sfClassCode = din.readByte();
-        sf.sfTypeCode = din.readByte();
-        sf.sfCategoryCode = din.readByte();
-
-        //Flags
-        byte f = din.readByte();
-        sf.sfiExtensionPresent = (f & 0x01) != 0;
-        sf.sfiSegmentedData = (f & 0x04) != 0;
-        sf.sfiPaddingPresent = (f & 0x10) != 0;
-        din.skip(2); //Reserved
-
-        int dataLength = sf.sfLength - INTRODUCER_LENGTH;
-
-        //Handle optional extension
-        if (sf.sfiExtensionPresent) {
-            sf.extLength = (short)(((short)din.readByte()) & 0xFF);
-            if (sf.extLength > 0) {
-                sf.extData = new byte[sf.extLength - 1];
-                din.readFully(sf.extData);
-                dataLength -= sf.extLength;
-            }
-        }
-
-        //Read payload
-        sf.data = new byte[dataLength];
-        din.readFully(sf.data);
-
-        if (LOG.isTraceEnabled()) {
-            LOG.trace(sf);
-        }
-
-        return sf;
-    }
-
-    /** {@inheritDoc} */
-    public String toString() {
-        StringBuffer sb = new StringBuffer("Structured Field: ");
-        sb.append(Integer.toHexString(getSfTypeID()).toUpperCase());
-        sb.append(", len=");
-        sb.append(new DecimalFormat("00000").format(getSfLength()));
-        sb.append(" ").append(getTypeCodeAsString());
-        sb.append(" ").append(getCategoryCodeAsString());
-        if (isSfiExtensionPresent()) {
-            sb.append(", SFI extension present");
-        }
-        if (isSfiSegmentedData()) {
-            sb.append(", segmented data");
-        }
-        if (isSfiPaddingPresent()) {
-            sb.append(", with padding");
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Dump the structured field as hex data to the given {@link PrintStream}.
-     * @param out the {@link PrintStream} to dump to
-     * @throws IOException if an I/O error occurs
-     */
-    public void dump(PrintStream out) throws IOException {
-        out.println(toString());
-        HexDump.dump(getData(), 0, out, 0);
-    }
-
-    /**
-     * Dump the structured field as hex data to <code>System.out</code>.
-     * @throws IOException if an I/O error occurs
-     */
-    public void dump() throws IOException {
-        dump(System.out);
-    }
-
-    /**
-     * Returns type code function name for this field.
-     * @return the type code function name
-     */
-    public String getTypeCodeAsString() {
-        switch ((int)getSfTypeCode() & 0xFF) {
-        case 0xA0: return "Attribute";
-        case 0xA2: return "CopyCount";
-        case 0xA6: return "Descriptor";
-        case 0xA7: return "Control";
-        case 0xA8: return "Begin";
-        case 0xA9: return "End";
-        case 0xAB: return "Map";
-        case 0xAC: return "Position";
-        case 0xAD: return "Process";
-        case 0xAF: return "Include";
-        case 0xB0: return "Table";
-        case 0xB1: return "Migration";
-        case 0xB2: return "Variable";
-        case 0xB4: return "Link";
-        case 0xEE: return "Data";
-        default: return "Unknown:" + Integer.toHexString((int)getSfTypeCode()).toUpperCase();
-        }
-    }
-
-    /**
-     * Returns category code function name for this field.
-     * @return the category code function name
-     */
-    public String getCategoryCodeAsString() {
-        switch ((int)getSfCategoryCode() & 0xFF) {
-        case 0x5F: return "Page Segment";
-        case 0x6B: return "Object Area";
-        case 0x77: return "Color Attribute Table";
-        case 0x7B: return "IM Image";
-        case 0x88: return "Medium";
-        case 0x89: return "Font";
-        case 0x8A: return "Coded Font";
-        case 0x90: return "Process Element";
-        case 0x92: return "Object Container";
-        case 0x9B: return "Presentation Text";
-        case 0xA7: return "Index";
-        case 0xA8: return "Document";
-        case 0xAD: return "Page Group";
-        case 0xAF: return "Page";
-        case 0xBB: return "Graphics";
-        case 0xC3: return "Data Resource";
-        case 0xC4: return "Document Environment Group (DEG)";
-        case 0xC6: return "Resource Group";
-        case 0xC7: return "Object Environment Group (OEG)";
-        case 0xC9: return "Active Environment Group (AEG)";
-        case 0xCC: return "Medium Map";
-        case 0xCD: return "Form Map";
-        case 0xCE: return "Name Resource";
-        case 0xD8: return "Page Overlay";
-        case 0xD9: return "Resource Environment Group (REG)";
-        case 0xDF: return "Overlay";
-        case 0xEA: return "Data Supression";
-        case 0xEB: return "Bar Code";
-        case 0xEE: return "No Operation";
-        case 0xFB: return "Image";
-        default: return "Unknown:" + Integer.toHexString((int)getSfTypeCode()).toUpperCase();
-        }
-    }
-
-    /**
-     * Returns the structured field's length.
-     * @return the field length
-     */
-    public short getSfLength() {
-        return this.sfLength;
-    }
-
-    /**
-     * Returns the structured field's identifier.
-     * @return the field identifier
-     */
-    public int getSfTypeID() {
-        return ((getSfClassCode() & 0xFF) << 16)
-                | ((getSfTypeCode() & 0xFF) << 8)
-                | (getSfCategoryCode() & 0xFF);
-    }
-
-    /**
-     * Returns the structured field's class code.
-     * @return the field class code
-     */
-    public byte getSfClassCode() {
-        return this.sfClassCode;
-    }
-
-    /**
-     * Returns the structured field's type code.
-     * @return the type code
-     */
-    public byte getSfTypeCode() {
-        return this.sfTypeCode;
-    }
-
-    /**
-     * Returns the structured field's category code.
-     * @return the sfCategoryCode
-     */
-    public byte getSfCategoryCode() {
-        return this.sfCategoryCode;
-    }
-
-    /**
-     * Indicates whether an field introducer extension is present.
-     * @return true if an field introducer extension is present
-     */
-    public boolean isSfiExtensionPresent() {
-        return this.sfiExtensionPresent && (this.extData != null);
-    }
-
-    /**
-     * Indicates whether segmented data is present.
-     * @return true if the data is segmented
-     */
-    public boolean isSfiSegmentedData() {
-        return this.sfiSegmentedData;
-    }
-
-    /**
-     * Indicates whether the data is padded.
-     * @return true if the data is padded
-     */
-    public boolean isSfiPaddingPresent() {
-        return this.sfiPaddingPresent;
-    }
-
-    /**
-     * Returns the length of the extension if present.
-     * @return the length of the extension (or 0 if no extension is present)
-     */
-    public short getExtLength() {
-        return this.extLength;
-    }
-
-    /**
-     * Returns the extension data if present.
-     * @return the extension data (or null if no extension is present)
-     */
-    public byte[] getExtData() {
-        return this.extData;
-    }
-
-    /**
-     * Returns the structured field's payload.
-     * @return the field's data
-     */
-    public byte[] getData() {
-        return this.data;
-    }
-
-    /**
-     * Returns the structured field's introducer data.
-     * @return the introducer data
-     */
-    public byte[] getIntroducerData() {
-        return this.introducerData;
-    }
-
-    /**
-     * Returns the complete structured field as a byte array.
-     * @return the complete field data
-     */
-    public byte[] getCompleteFieldAsBytes() {
-        int len = INTRODUCER_LENGTH;
-        if (isSfiExtensionPresent()) {
-            len += getExtLength();
-        }
-        len += getData().length;
-        byte[] bytes = new byte[len];
-        int pos = 0;
-        System.arraycopy(getIntroducerData(), 0, bytes, pos, INTRODUCER_LENGTH);
-        pos += INTRODUCER_LENGTH;
-        if (isSfiExtensionPresent()) {
-            System.arraycopy(getExtData(), 0, bytes, pos, getExtLength());
-            pos += getExtLength();
-        }
-        System.arraycopy(getData(), 0, bytes, pos, getData().length);
-        return bytes;
-    }
-
-    /**
-     * Writes this structured field to the given {@link OutputStream}.
-     * @param out the output stream
-     * @throws IOException if an I/O error occurs
-     */
-    public void writeTo(OutputStream out) throws IOException {
-        out.write(this.introducerData);
-        if (isSfiExtensionPresent()) {
-            out.write(this.extData);
-        }
-        out.write(this.data);
-    }
+* Represents an unparsed (generic) AFP structured field.
+*/
+public final class UnparsedStructuredField {
+
+   private final Introducer introducer;
+   private final byte[] extData;
+   private final byte[] data;
+
+   /**
+    *
+    * @param Structured field introducer
+    * @param data Structured field data
+    * @param extData Structured field extension data
+    */
+   UnparsedStructuredField(Introducer introducer,
+           byte[] data, byte[] extData) {
+       this.introducer = introducer;
+       this.data = data;
+       if (extData != null) {
+           this.extData = extData;
+       } else {
+           this.extData = null;
+       }
+   }
+
+   @Override
+   public String toString() {
+       StringBuffer sb = new StringBuffer("Structured Field: ");
+       sb.append(Integer.toHexString(getSfTypeID()).toUpperCase());
+       sb.append(", len=");
+       sb.append(new DecimalFormat("00000").format(getSfLength()));
+       sb.append(" ").append(getTypeCodeAsString());
+       sb.append(" ").append(getCategoryCodeAsString());
+       if (isSfiExtensionPresent()) {
+           sb.append(", SFI extension present");
+       }
+       if (isSfiSegmentedData()) {
+           sb.append(", segmented data");
+       }
+       if (isSfiPaddingPresent()) {
+           sb.append(", with padding");
+       }
+       return sb.toString();
+   }
+
+
+   /**
+    * Returns type code function name for this field.
+    * @return the type code function name
+    */
+   private String getTypeCodeAsString() {
+       switch (getSfTypeCode() & 0xFF) {
+       case 0xA0: return "Attribute";
+       case 0xA2: return "CopyCount";
+       case 0xA6: return "Descriptor";
+       case 0xA7: return "Control";
+       case 0xA8: return "Begin";
+       case 0xA9: return "End";
+       case 0xAB: return "Map";
+       case 0xAC: return "Position";
+       case 0xAD: return "Process";
+       case 0xAF: return "Include";
+       case 0xB0: return "Table";
+       case 0xB1: return "Migration";
+       case 0xB2: return "Variable";
+       case 0xB4: return "Link";
+       case 0xEE: return "Data";
+       default: return "Unknown:" + Integer.toHexString(getSfTypeCode()).toUpperCase();
+       }
+   }
+
+   /**
+    * Returns category code function name for this field.
+    * @return the category code function name
+    */
+   private String getCategoryCodeAsString() {
+       switch (getSfCategoryCode() & 0xFF) {
+       case 0x5F: return "Page Segment";
+       case 0x6B: return "Object Area";
+       case 0x77: return "Color Attribute Table";
+       case 0x7B: return "IM Image";
+       case 0x88: return "Medium";
+       case 0x89: return "Font";
+       case 0x8A: return "Coded Font";
+       case 0x90: return "Process Element";
+       case 0x92: return "Object Container";
+       case 0x9B: return "Presentation Text";
+       case 0xA7: return "Index";
+       case 0xA8: return "Document";
+       case 0xAD: return "Page Group";
+       case 0xAF: return "Page";
+       case 0xBB: return "Graphics";
+       case 0xC3: return "Data Resource";
+       case 0xC4: return "Document Environment Group (DEG)";
+       case 0xC6: return "Resource Group";
+       case 0xC7: return "Object Environment Group (OEG)";
+       case 0xC9: return "Active Environment Group (AEG)";
+       case 0xCC: return "Medium Map";
+       case 0xCD: return "Form Map";
+       case 0xCE: return "Name Resource";
+       case 0xD8: return "Page Overlay";
+       case 0xD9: return "Resource Environment Group (REG)";
+       case 0xDF: return "Overlay";
+       case 0xEA: return "Data Supression";
+       case 0xEB: return "Bar Code";
+       case 0xEE: return "No Operation";
+       case 0xFB: return "Image";
+       default: return "Unknown:" + Integer.toHexString(getSfTypeCode()).toUpperCase();
+       }
+   }
+
+   /**
+    * Returns the structured field's length.
+    * @return the field length
+    */
+   public short getSfLength() {
+       return introducer.length;
+   }
+
+   /**
+    * Returns the structured field's identifier.
+    * @return the field identifier
+    */
+   public int getSfTypeID() {
+       return ((getSfClassCode() & 0xFF) << 16)
+       | ((getSfTypeCode() & 0xFF) << 8)
+       | (getSfCategoryCode() & 0xFF);
+   }
+
+   /**
+    * Returns the structured field's class code.
+    * @return the field class code
+    */
+   public byte getSfClassCode() {
+       return introducer.classCode;
+   }
+
+   /**
+    * Returns the structured field's type code.
+    * @return the type code
+    */
+   public byte getSfTypeCode() {
+       return introducer.typeCode;
+   }
+
+   /**
+    * Returns the structured field's category code.
+    * @return the sfCategoryCode
+    */
+   public byte getSfCategoryCode() {
+       return introducer.categoryCode;
+   }
+
+   /**
+    * Indicates whether an field introducer extension is present.
+    * @return true if an field introducer extension is present
+    */
+   public boolean isSfiExtensionPresent() {
+       return introducer.extensionPresent && (this.extData != null);
+   }
+
+   /**
+    * Indicates whether segmented data is present.
+    * @return true if the data is segmented
+    */
+   public boolean isSfiSegmentedData() {
+       return introducer.segmentedData;
+   }
+
+   /**
+    * Indicates whether the data is padded.
+    * @return true if the data is padded
+    */
+   public boolean isSfiPaddingPresent() {
+       return introducer.paddingPresent;
+   }
+
+   /**
+    * Returns the length of the extension if present.
+    * @return the length of the extension (or 0 if no extension is present)
+    */
+   public short getExtLength() {
+       return (extData != null) ? (short)(extData.length + 1) : 0;
+
+   }
+
+   /**
+    * Returns the extension data if present.
+    * @return the extension data (or null if no extension is present)
+    */
+   byte[] getExtData() {
+       if (this.extData == null) {
+           return new byte[0];
+       }
+       byte[] rtn = new byte[this.extData.length];
+       System.arraycopy(this.extData, 0, rtn, 0, rtn.length);
+       return rtn;
+   }
+
+   /**
+    * Returns the structured field's payload.
+    * @return the field's data
+    */
+   public byte[] getData() {
+       if (this.data == null) {
+           return new byte[0];
+       }
+       byte[] rtn = new byte[this.data.length];
+       System.arraycopy(this.data, 0, rtn, 0, rtn.length);
+       return rtn;
+   }
+
+   //For unit testing
+   byte[] getIntroducerData() {
+       return introducer.getIntroducerData();
+   }
+
+   /**
+    * Returns the complete structured field as a byte array.
+    * @return the complete field data
+    */
+   public byte[] getCompleteFieldAsBytes() {
+
+       ByteArrayOutputStream baos = new ByteArrayOutputStream(getSfLength());
+       try {
+           writeTo(baos);
+       } catch (IOException ioe) {
+           //nop
+       }
+       return baos.toByteArray();
+
+   }
+
+   /**
+    * Writes this structured field to the given {@link OutputStream}.
+    * @param out the output stream
+    * @throws IOException if an I/O error occurs
+    */
+   public void writeTo(OutputStream out) throws IOException {
+       out.write(introducer.introducerData);
+       if (isSfiExtensionPresent()) {
+           out.write(this.extData.length + 1);
+           out.write(this.extData);
+       }
+       out.write(this.data);
+   }
+
+   static final class Introducer {
+
+       private final short length;
+       private final byte classCode;
+       private final byte typeCode;
+       private final byte categoryCode;
+       private final boolean extensionPresent;
+       private final boolean segmentedData;
+       private final boolean paddingPresent;
+       private final byte[] introducerData;
+
+       Introducer(byte[] introducerData) throws IOException {
+
+           this.introducerData = introducerData;
+
+           // Parse the introducer; the 8 bytes have already been read from the stream just
+           // before, so we parse the introducer from the byte array
+           DataInputStream iis = new DataInputStream(
+                   new ByteArrayInputStream(introducerData));
+
+           length = iis.readShort();
+
+           classCode = iis.readByte();
+           typeCode = iis.readByte();
+           categoryCode = iis.readByte();
+
+           //Flags
+           byte f = iis.readByte();
+
+           extensionPresent = (f & 0x01) != 0;
+           segmentedData = (f & 0x04) != 0;
+           paddingPresent = (f & 0x10) != 0;
+
+       }
+
+
+       public short getLength() {
+           return length;
+       }
+
+       public byte getClassCode() {
+           return classCode;
+       }
+
+       public byte getTypeCode() {
+           return typeCode;
+       }
+
+       public byte getCategoryCode() {
+           return categoryCode;
+       }
+
+       public boolean isExtensionPresent() {
+           return extensionPresent;
+       }
+
+
+       public boolean isSegmentedData() {
+           return segmentedData;
+       }
+
+       public boolean isPaddingPresent() {
+           return paddingPresent;
+       }
+
+       public byte[] getIntroducerData() {
+           byte[] rtn = new byte[introducerData.length];
+           System.arraycopy(introducerData, 0, rtn, 0, rtn.length);
+           return rtn;
+       }
+   }
+
 }

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java Wed Jun 15 11:44:43 2011
@@ -25,11 +25,13 @@ import org.apache.batik.bridge.BridgeCon
 import org.apache.batik.bridge.DocumentLoader;
 import org.apache.batik.bridge.UserAgent;
 import org.apache.batik.gvt.TextPainter;
+
+import org.apache.xmlgraphics.image.loader.ImageManager;
+import org.apache.xmlgraphics.image.loader.ImageSessionContext;
+
 import org.apache.fop.afp.AFPGraphics2D;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.svg.AbstractFOPBridgeContext;
-import org.apache.xmlgraphics.image.loader.ImageManager;
-import org.apache.xmlgraphics.image.loader.ImageSessionContext;
 
 /**
  * An AFP specific implementation of a Batik BridgeContext
@@ -79,11 +81,12 @@ public class AFPBridgeContext extends Ab
     }
 
     /** {@inheritDoc} */
+    @Override
     public void registerSVGBridges() {
         super.registerSVGBridges();
 
         if (fontInfo != null) {
-            AFPTextHandler textHandler = new AFPTextHandler(fontInfo);
+            AFPTextHandler textHandler = new AFPTextHandler(fontInfo, g2d.getResourceManager());
             g2d.setCustomTextHandler(textHandler);
 
             TextPainter textPainter = new AFPTextPainter(textHandler);
@@ -96,6 +99,7 @@ public class AFPBridgeContext extends Ab
     }
 
     /** {@inheritDoc} */
+    @Override
     public BridgeContext createBridgeContext() {
         return new AFPBridgeContext(getUserAgent(), getDocumentLoader(),
                 fontInfo,

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPTextHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPTextHandler.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPTextHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/svg/AFPTextHandler.java Wed Jun 15 11:44:43 2011
@@ -21,15 +21,18 @@ package org.apache.fop.afp.svg;
 
 import java.awt.Color;
 import java.awt.Graphics2D;
+import java.io.IOException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.fop.afp.AFPGraphics2D;
 import org.apache.fop.afp.AFPPaintingState;
+import org.apache.fop.afp.AFPResourceManager;
 import org.apache.fop.afp.fonts.AFPFont;
 import org.apache.fop.afp.fonts.AFPFontAttributes;
 import org.apache.fop.afp.fonts.AFPPageFonts;
+import org.apache.fop.afp.fonts.CharacterSet;
 import org.apache.fop.afp.modca.GraphicsObject;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
@@ -50,13 +53,18 @@ public class AFPTextHandler extends FOPT
     /** Font information */
     private final FontInfo fontInfo;
 
+    /** the resource manager */
+    private AFPResourceManager resourceManager;
+
     /**
      * Main constructor.
      *
      * @param fontInfo the AFPGraphics2D instance
+     * @param resourceManager the AFPResourceManager instance
      */
-    public AFPTextHandler(FontInfo fontInfo) {
+    public AFPTextHandler(FontInfo fontInfo, AFPResourceManager resourceManager) {
         this.fontInfo = fontInfo;
+        this.resourceManager = resourceManager;
     }
 
     /**
@@ -83,6 +91,14 @@ public class AFPTextHandler extends FOPT
                 afpFont,
                 fontSize
         );
+        if (afpFont.isEmbeddable()) {
+            try {
+                final CharacterSet charSet = afpFont.getCharacterSet(fontSize);
+                this.resourceManager.embedFont(afpFont, charSet);
+            } catch (IOException ioe) {
+                throw new RuntimeException("Error while embedding font resources", ioe);
+            }
+        }
         return afpFontAttributes.getFontReference();
     }
 
@@ -92,6 +108,7 @@ public class AFPTextHandler extends FOPT
      *
      * {@inheritDoc}
      */
+    @Override
     public void drawString(Graphics2D g, String str, float x, float y) {
         if (log.isDebugEnabled()) {
             log.debug("drawString() str=" + str + ", x=" + x + ", y=" + y);
@@ -115,9 +132,15 @@ public class AFPTextHandler extends FOPT
             if (overrideFont != null) {
                 internalFontName = overrideFont.getFontName();
                 fontSize = overrideFont.getFontSize();
+                if (log.isDebugEnabled()) {
+                    log.debug("  with overriding font: " + internalFontName + ", " + fontSize);
+                }
             } else {
                 java.awt.Font awtFont = g2d.getFont();
                 Font fopFont = fontInfo.getFontInstanceForAWTFont(awtFont);
+                if (log.isDebugEnabled()) {
+                    log.debug("  with font: " + fopFont);
+                }
                 internalFontName = fopFont.getFontName();
                 fontSize = fopFont.getFontSize();
             }

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/util/AFPResourceUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/util/AFPResourceUtil.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/util/AFPResourceUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/util/AFPResourceUtil.java Wed Jun 15 11:44:43 2011
@@ -29,8 +29,8 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.fop.afp.AFPConstants;
-import org.apache.fop.afp.modca.ResourceObject;
 import org.apache.fop.afp.modca.AbstractAFPObject.Category;
+import org.apache.fop.afp.modca.ResourceObject;
 import org.apache.fop.afp.parser.MODCAParser;
 import org.apache.fop.afp.parser.UnparsedStructuredField;
 

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/ICCColorFunction.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/ICCColorFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/ICCColorFunction.java Wed Jun 15 11:44:43 2011
@@ -41,6 +41,7 @@ class ICCColorFunction extends FunctionB
     }
 
     /** {@inheritDoc} */
+    @Override
     public PercentBase getPercentBase() {
         return new ICCPercentBase();
     }
@@ -50,7 +51,9 @@ class ICCColorFunction extends FunctionB
                          PropertyInfo pInfo) throws PropertyException {
         // Map color profile NCNAME to src from declarations/color-profile element
         String colorProfileName = args[3].getString();
-        Declarations decls = pInfo.getFO().getRoot().getDeclarations();
+        Declarations decls = (pInfo.getFO() != null
+                ? pInfo.getFO().getRoot().getDeclarations()
+                : null);
         ColorProfile cp = null;
         if (decls == null) {
             //function used in a color-specification

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/NamedColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/NamedColorFunction.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/NamedColorFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/expr/NamedColorFunction.java Wed Jun 15 11:44:43 2011
@@ -40,6 +40,7 @@ class NamedColorFunction extends Functio
     }
 
     /** {@inheritDoc} */
+    @Override
     public PercentBase getPercentBase() {
         return new NamedPercentBase();
     }
@@ -51,7 +52,9 @@ class NamedColorFunction extends Functio
         String colorProfileName = args[3].getString();
         String colorName = args[4].getString();
 
-        Declarations decls = pInfo.getFO().getRoot().getDeclarations();
+        Declarations decls = (pInfo.getFO() != null
+                ? pInfo.getFO().getRoot().getDeclarations()
+                : null);
         ColorProfile cp = null;
         if (decls != null) {
             cp = decls.getColorProfile(colorProfileName);

Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/properties/PropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/properties/PropertyMaker.java?rev=1136002&r1=1136001&r2=1136002&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/properties/PropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/properties/PropertyMaker.java Wed Jun 15 11:44:43 2011
@@ -445,7 +445,9 @@ public class PropertyMaker implements Cl
             }
             return newProp;
         } catch (PropertyException propEx) {
-            propEx.setLocator(fo.getLocator());
+            if (fo != null) {
+                propEx.setLocator(fo.getLocator());
+            }
             propEx.setPropertyName(getName());
             throw propEx;
         }
@@ -653,6 +655,7 @@ public class PropertyMaker implements Cl
      * subproperty makers of the generic compound makers.
      * {@inheritDoc}
      */
+    @Override
     public Object clone() {
         try {
             return super.clone();



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org