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 ga...@apache.org on 2012/07/05 22:29:58 UTC

svn commit: r1357883 [2/5] - in /xmlgraphics/fop/branches/fop-1_1: ./ examples/fo/ examples/fo/advanced/ examples/fo/basic/ examples/fo/svg/ examples/fo/tables/ lib/ src/documentation/content/xdocs/ src/documentation/content/xdocs/fo/ src/documentation...

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java Thu Jul  5 20:29:53 2012
@@ -23,6 +23,7 @@ import java.util.Stack;
 
 import org.xml.sax.SAXException;
 
+import org.apache.fop.accessibility.Accessibility;
 import org.apache.fop.accessibility.StructureTreeEventHandler;
 import org.apache.fop.fo.DelegatingFOEventHandler;
 import org.apache.fop.fo.FOEventHandler;
@@ -57,6 +58,8 @@ import org.apache.fop.fo.pagination.Flow
 import org.apache.fop.fo.pagination.PageSequence;
 import org.apache.fop.fo.pagination.Root;
 import org.apache.fop.fo.pagination.StaticContent;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
 
 /**
  * Allows to create the structure tree of an FO document, by converting FO
@@ -355,6 +358,7 @@ public class FO2StructureTreeConverter e
 
     @Override
     public void startStatic(StaticContent staticContent) {
+        handleStartArtifact(staticContent);
         converter.startStatic(staticContent);
         super.startStatic(staticContent);
     }
@@ -362,6 +366,7 @@ public class FO2StructureTreeConverter e
     @Override
     public void endStatic(StaticContent statisContent) {
         converter.endStatic(statisContent);
+        handleEndArtifact(statisContent);
         super.endStatic(statisContent);
     }
 
@@ -454,6 +459,7 @@ public class FO2StructureTreeConverter e
 
     @Override
     public void startWrapper(Wrapper wrapper) {
+        handleStartArtifact(wrapper);
         converter.startWrapper(wrapper);
         super.startWrapper(wrapper);
     }
@@ -461,6 +467,7 @@ public class FO2StructureTreeConverter e
     @Override
     public void endWrapper(Wrapper wrapper) {
         converter.endWrapper(wrapper);
+        handleEndArtifact(wrapper);
         super.endWrapper(wrapper);
     }
 
@@ -488,4 +495,22 @@ public class FO2StructureTreeConverter e
         super.endExternalDocument(document);
     }
 
+    private void handleStartArtifact(CommonAccessibilityHolder fobj) {
+        if (isArtifact(fobj)) {
+            converters.push(converter);
+            converter = eventSwallower;
+        }
+    }
+
+    private void handleEndArtifact(CommonAccessibilityHolder fobj) {
+        if (isArtifact(fobj)) {
+            converter = converters.pop();
+        }
+    }
+
+    private boolean isArtifact(CommonAccessibilityHolder fobj) {
+        CommonAccessibility accessibility = fobj.getCommonAccessibility();
+        return Accessibility.ROLE_ARTIFACT.equalsIgnoreCase(accessibility.getRole());
+    }
+
 }

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/AFPGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/AFPGraphics2D.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/AFPGraphics2D.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/AFPGraphics2D.java Thu Jul  5 20:29:53 2012
@@ -67,7 +67,7 @@ import org.apache.fop.svg.NativeImageHan
 
 /**
  * This is a concrete implementation of {@link AbstractGraphics2D} (and
- * therefore of {@link Graphics2D}) which is able to generate GOCA byte
+ * therefore of {@link java.awt.Graphics2D}) which is able to generate GOCA byte
  * codes.
  *
  * @see org.apache.xmlgraphics.java2d.AbstractGraphics2D
@@ -165,7 +165,7 @@ public class AFPGraphics2D extends Abstr
     }
 
     /**
-     * Returns the AFP resource manager associated with this {@link Graphics2D} instance.
+     * Returns the AFP resource manager associated with this {@link java.awt.Graphics2D} instance.
      * @return the resource manager
      */
     public AFPResourceManager getResourceManager() {

Propchange: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/apps/
            ('svn:mergeinfo' removed)

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/modca/ImageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/modca/ImageObject.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/modca/ImageObject.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/modca/ImageObject.java Thu Jul  5 20:29:53 2012
@@ -119,7 +119,8 @@ public class ImageObject extends Abstrac
      * Sets the image IDE color model.
      *
      * @param colorModel    the IDE color model.
-     * @deprecated Use {@link IDEStructureParameter#setColorModel(byte)} instead.
+     * @deprecated Use {@link org.apache.fop.afp.ioca.IDEStructureParameter#setColorModel(byte)}
+     * instead.
      */
     public void setIDEColorModel(byte colorModel) {
         getImageSegment().setIDEColorModel(colorModel);
@@ -128,7 +129,8 @@ public class ImageObject extends Abstrac
     /**
      * Set either additive or subtractive mode (used for ASFLAG).
      * @param subtractive true for subtractive mode, false for additive mode
-     * @deprecated Use {@link IDEStructureParameter#setSubtractive(boolean)} instead.
+     * @deprecated Use {@link org.apache.fop.afp.ioca.IDEStructureParameter#setSubtractive(boolean)}
+     * instead.
      */
     public void setSubtractive(boolean subtractive) {
         getImageSegment().setSubtractive(subtractive);

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/modca/PresentationTextData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/modca/PresentationTextData.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/modca/PresentationTextData.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/modca/PresentationTextData.java Thu Jul  5 20:29:53 2012
@@ -46,7 +46,7 @@ import org.apache.fop.afp.util.BinaryUti
  * which signal an alternate mode of processing for the content of the current
  * Presentation Text data.
  * <p>
- * The content for this object can be created using {@link PtocaBuilder}.
+ * The content for this object can be created using {@link org.apache.fop.afp.ptoca.PtocaBuilder}.
  */
 public class PresentationTextData extends AbstractAFPObject implements PtocaConstants {
 

Propchange: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/parser/
            ('svn:mergeinfo' removed)

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java Thu Jul  5 20:29:53 2012
@@ -44,7 +44,8 @@ public class DefaultFOPResourceAccessor 
      * Constructor for resource to be accessed via the {@link FOUserAgent}. This contructor
      * can take two base URIs: the category base URI is the one to use when differentiating between
      * normal resources (ex. images) and font resources. So, if fonts need to be accessed, you can
-     * set the {@link FontManager}'s base URI instead of the one on the {@link FopFactory}.
+     * set the {@link org.apache.fop.fonts.FontManager}'s base URI instead of the one on the
+     * {@link org.apache.fop.apps.FopFactory}.
      * @param userAgent the FO user agent
      * @param categoryBaseURI the category base URI (may be null)
      * @param baseURI the custom base URI to resolve relative URIs against (may be null)

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/apps/FOUserAgent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/apps/FOUserAgent.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/apps/FOUserAgent.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/apps/FOUserAgent.java Thu Jul  5 20:29:53 2012
@@ -355,7 +355,7 @@ public class FOUserAgent {
     /**
      * Sets font base URL.
      * @param fontBaseUrl font base URL
-     * @deprecated Use {@link FontManager#setFontBaseURL(String)} instead.
+     * @deprecated Use {@link org.apache.fop.fonts.FontManager#setFontBaseURL(String)} instead.
      */
     public void setFontBaseURL(String fontBaseUrl) {
         try {
@@ -500,7 +500,8 @@ public class FOUserAgent {
     /**
      * Returns the font base URL.
      * @return the font base URL
-     * @deprecated Use {@link FontManager#getFontBaseURL()} instead. This method is not used by FOP.
+     * @deprecated Use {@link org.apache.fop.fonts.FontManager#getFontBaseURL()} instead.
+     * This method is not used by FOP.
      */
     public String getFontBaseURL() {
         String fontBase = getFactory().getFontManager().getFontBaseURL();

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java Thu Jul  5 20:29:53 2012
@@ -1783,9 +1783,9 @@ public class GlyphPositioningTable exten
          * Find device adjustment.
          * @param fontSize the font size to search for
          * @return an adjustment if font size matches an entry
-         * @asf.todo at present, assumes that 1 device unit equals one point
          */
         public int findAdjustment ( int fontSize ) {
+            // [TODO] at present, assumes that 1 device unit equals one point
             int fs = fontSize / 1000;
             if ( fs < startSize ) {
                 return 0;

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java Thu Jul  5 20:29:53 2012
@@ -31,6 +31,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.fop.fonts.truetype.FontFileReader;
 import org.apache.fop.fonts.truetype.TTFDirTabEntry;
 import org.apache.fop.fonts.truetype.TTFFile;
+import org.apache.fop.fonts.truetype.TTFTableName;
 
 // CSOFF: AvoidNestedBlocksCheck
 // CSOFF: NoWhitespaceAfterCheck
@@ -126,7 +127,7 @@ public final class OTFAdvancedTypographi
         return gpos;
     }
 
-    private void readLangSysTable(String tableTag, long langSysTable, String langSysTag) throws IOException {
+    private void readLangSysTable(TTFTableName tableTag, long langSysTable, String langSysTag) throws IOException {
         in.seekSet(langSysTable);
         if (log.isDebugEnabled()) {
             log.debug(tableTag + " lang sys table: " + langSysTag );
@@ -168,7 +169,7 @@ public final class OTFAdvancedTypographi
 
     private static String defaultTag = "dflt";
 
-    private void readScriptTable(String tableTag, long scriptTable, String scriptTag) throws IOException {
+    private void readScriptTable(TTFTableName tableTag, long scriptTable, String scriptTag) throws IOException {
         in.seekSet(scriptTable);
         if (log.isDebugEnabled()) {
             log.debug(tableTag + " script table: " + scriptTag );
@@ -221,7 +222,7 @@ public final class OTFAdvancedTypographi
         seLanguages = null;
     }
 
-    private void readScriptList(String tableTag, long scriptList) throws IOException {
+    private void readScriptList(TTFTableName tableTag, long scriptList) throws IOException {
         in.seekSet(scriptList);
         // read script record count
         int ns = in.readTTFUShort();
@@ -250,7 +251,7 @@ public final class OTFAdvancedTypographi
         }
     }
 
-    private void readFeatureTable(String tableTag, long featureTable, String featureTag, int featureIndex) throws IOException {
+    private void readFeatureTable(TTFTableName tableTag, long featureTable, String featureTag, int featureIndex) throws IOException {
         in.seekSet(featureTable);
         if (log.isDebugEnabled()) {
             log.debug(tableTag + " feature table: " + featureTag );
@@ -278,7 +279,7 @@ public final class OTFAdvancedTypographi
         seFeatures.put ( "f" + featureIndex, new Object[] { featureTag, lul } );
     }
 
-    private void readFeatureList(String tableTag, long featureList) throws IOException {
+    private void readFeatureList(TTFTableName tableTag, long featureList) throws IOException {
         in.seekSet(featureList);
         // read feature record count
         int nf = in.readTTFUShort();
@@ -3144,9 +3145,9 @@ public final class OTFAdvancedTypographi
         resetATSubState();
     }
 
-    private void readLookupTable(String tableTag, int lookupSequence, long lookupTable) throws IOException {
-        boolean isGSUB = tableTag.equals ( "GSUB" );
-        boolean isGPOS = tableTag.equals ( "GPOS" );
+    private void readLookupTable(TTFTableName tableTag, int lookupSequence, long lookupTable) throws IOException {
+        boolean isGSUB = tableTag.equals ( TTFTableName.GSUB );
+        boolean isGPOS = tableTag.equals ( TTFTableName.GPOS );
         in.seekSet(lookupTable);
         // read lookup type
         int lt = in.readTTFUShort();
@@ -3197,7 +3198,7 @@ public final class OTFAdvancedTypographi
         }
     }
 
-    private void readLookupList(String tableTag, long lookupList) throws IOException {
+    private void readLookupList(TTFTableName tableTag, long lookupList) throws IOException {
         in.seekSet(lookupList);
         // read lookup record count
         int nl = in.readTTFUShort();
@@ -3232,7 +3233,7 @@ public final class OTFAdvancedTypographi
      * @param lookupList offset to lookup list from beginning of font file
      * @throws IOException In case of a I/O problem
      */
-    private void readCommonLayoutTables(String tableTag, long scriptList, long featureList, long lookupList) throws IOException {
+    private void readCommonLayoutTables(TTFTableName tableTag, long scriptList, long featureList, long lookupList) throws IOException {
         if ( scriptList > 0 ) {
             readScriptList ( tableTag, scriptList );
         }
@@ -3244,7 +3245,7 @@ public final class OTFAdvancedTypographi
         }
     }
 
-    private void readGDEFClassDefTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
+    private void readGDEFClassDefTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
         initATSubState();
         in.seekSet(subtableOffset);
         // subtable is a bare class definition table
@@ -3256,7 +3257,7 @@ public final class OTFAdvancedTypographi
         resetATSubState();
     }
 
-    private void readGDEFAttachmentTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
+    private void readGDEFAttachmentTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
         initATSubState();
         in.seekSet(subtableOffset);
         // read coverage offset
@@ -3274,7 +3275,7 @@ public final class OTFAdvancedTypographi
         resetATSubState();
     }
 
-    private void readGDEFLigatureCaretTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
+    private void readGDEFLigatureCaretTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
         initATSubState();
         in.seekSet(subtableOffset);
         // read coverage offset
@@ -3304,7 +3305,7 @@ public final class OTFAdvancedTypographi
         resetATSubState();
     }
 
-    private void readGDEFMarkAttachmentTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
+    private void readGDEFMarkAttachmentTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
         initATSubState();
         in.seekSet(subtableOffset);
         // subtable is a bare class definition table
@@ -3316,7 +3317,7 @@ public final class OTFAdvancedTypographi
         resetATSubState();
     }
 
-    private void readGDEFMarkGlyphsTableFormat1(String tableTag, int lookupSequence, long subtableOffset, int subtableFormat) throws IOException {
+    private void readGDEFMarkGlyphsTableFormat1(TTFTableName tableTag, int lookupSequence, long subtableOffset, int subtableFormat) throws IOException {
         initATSubState();
         in.seekSet(subtableOffset);
         // skip over format (already known)
@@ -3350,7 +3351,7 @@ public final class OTFAdvancedTypographi
         resetATSubState();
     }
 
-    private void readGDEFMarkGlyphsTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
+    private void readGDEFMarkGlyphsTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
         in.seekSet(subtableOffset);
         // read mark set subtable format
         int sf = in.readTTFUShort();
@@ -3366,11 +3367,11 @@ public final class OTFAdvancedTypographi
      * @throws IOException In case of a I/O problem
      */
     private void readGDEF() throws IOException {
-        String tableTag = "GDEF";
+        TTFTableName tableTag = TTFTableName.GDEF;
         // Initialize temporary state
         initATState();
         // Read glyph definition (GDEF) table
-        TTFDirTabEntry dirTab = ttf.getDirectoryEntry ( tableTag );
+        TTFDirTabEntry dirTab = ttf.getDirectoryEntry( tableTag );
         if ( gdef != null ) {
             if (log.isDebugEnabled()) {
                 log.debug(tableTag + ": ignoring duplicate table");
@@ -3439,7 +3440,7 @@ public final class OTFAdvancedTypographi
      * @throws IOException In case of a I/O problem
      */
     private void readGSUB() throws IOException {
-        String tableTag = "GSUB";
+        TTFTableName tableTag = TTFTableName.GSUB;
         // Initialize temporary state
         initATState();
         // Read glyph substitution (GSUB) table
@@ -3476,7 +3477,7 @@ public final class OTFAdvancedTypographi
      * @throws IOException In case of a I/O problem
      */
     private void readGPOS() throws IOException {
-        String tableTag = "GPOS";
+        TTFTableName tableTag = TTFTableName.GPOS;
         // Initialize temporary state
         initATState();
         // Read glyph positioning (GPOS) table

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java Thu Jul  5 20:29:53 2012
@@ -360,7 +360,7 @@ public class IndicScriptProcessor extend
     }
 
     /** Abstract syllabizer. */
-    protected abstract static class Syllabizer {
+    protected abstract static class Syllabizer implements Comparable {
         private String script;
         private String language;
         Syllabizer ( String script, String language ) {

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/FOEventHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/FOEventHandler.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/FOEventHandler.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/FOEventHandler.java Thu Jul  5 20:29:53 2012
@@ -123,11 +123,17 @@ public abstract class FOEventHandler {
     public void endDocument() throws SAXException {
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Called upon start of root element.
+     * @param root element
+     */
     public void startRoot(Root root) {
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Called upon end of root element.
+     * @param root element
+     */
     public void endRoot(Root root) {
     }
 
@@ -413,9 +419,9 @@ public abstract class FOEventHandler {
 
     /**
      * Process end of a Static.
-     * @param statisContent StaticContent that is ending
+     * @param staticContent StaticContent that is ending
      */
-    public void endStatic(StaticContent statisContent) {
+    public void endStatic(StaticContent staticContent) {
     }
 
 

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/flow/Wrapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/flow/Wrapper.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/flow/Wrapper.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/flow/Wrapper.java Thu Jul  5 20:29:53 2012
@@ -26,7 +26,10 @@ import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FOText;
 import org.apache.fop.fo.FObjMixed;
+import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
 
 /**
  * Class modelling the <a href=http://www.w3.org/TR/xsl/#fo_wrapper">
@@ -34,13 +37,13 @@ import org.apache.fop.fo.ValidationExcep
  * The <code>fo:wrapper</code> object serves as a property holder for
  * its child node objects.
  */
-public class Wrapper extends FObjMixed {
-    // The value of properties relevant for fo:wrapper.
-    // End of property values
+public class Wrapper extends FObjMixed implements CommonAccessibilityHolder {
 
     // used for FO validation
     private boolean blockOrInlineItemFound = false;
 
+    private CommonAccessibility commonAccessibility;
+
     /**
      * Create a Wrapper instance that is a child of the
      * given {@link FONode}
@@ -52,6 +55,12 @@ public class Wrapper extends FObjMixed {
     }
 
     @Override
+    public void bind(PropertyList pList) throws FOPException {
+        super.bind(pList);
+        commonAccessibility = CommonAccessibility.getInstance(pList);
+    }
+
+    @Override
     protected void startOfNode() throws FOPException {
         super.startOfNode();
         getFOEventHandler().startWrapper(this);
@@ -136,6 +145,10 @@ public class Wrapper extends FObjMixed {
         return FO_WRAPPER;
     }
 
+    public CommonAccessibility getCommonAccessibility() {
+        return commonAccessibility;
+    }
+
     @Override
     public boolean isDelimitedTextRangeBoundary ( int boundary ) {
         return false;

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/properties/CondLengthProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/properties/CondLengthProperty.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/properties/CondLengthProperty.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fo/properties/CondLengthProperty.java Thu Jul  5 20:29:53 2012
@@ -26,6 +26,7 @@ import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.util.CompareUtil;
 
 /**
  * Superclass for properties that have conditional lengths
@@ -192,8 +193,8 @@ public class CondLengthProperty extends 
 
         if (obj instanceof CondLengthProperty) {
             CondLengthProperty clp = (CondLengthProperty)obj;
-            return (this.length == clp.length
-                    && this.conditionality == clp.conditionality);
+            return (CompareUtil.equal(this.length, clp.length)
+                    && CompareUtil.equal(this.conditionality, clp.conditionality));
         }
         return false;
     }

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CIDFontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CIDFontType.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CIDFontType.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CIDFontType.java Thu Jul  5 20:29:53 2012
@@ -34,7 +34,7 @@ public class CIDFontType extends ValuedE
     /**
      * CID Font Type 2 (based on TrueType format)
      */
-    public static final CIDFontType CIDTYPE2 = new CIDFontType("CIDFontType2", 1);
+    public static final CIDFontType CIDTYPE2 = new CIDFontType("CIDFontType2", 2);
 
 
     /**

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CustomFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CustomFont.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CustomFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CustomFont.java Thu Jul  5 20:29:53 2012
@@ -42,6 +42,7 @@ public abstract class CustomFont extends
     private String embedFileName = null;
     private String embedResourceName = null;
     private FontResolver resolver = null;
+    private EmbeddingMode embeddingMode = EmbeddingMode.AUTO;
 
     private int capHeight = 0;
     private int xHeight = 0;
@@ -62,6 +63,9 @@ public abstract class CustomFont extends
     private boolean useKerning = true;
     private boolean useAdvanced = true;
 
+    /** the character map, mapping Unicode ranges to glyph indices. */
+    protected CMapSegment[] cmap;
+
     /** {@inheritDoc} */
     public String getFontName() {
         return fontName;
@@ -112,6 +116,14 @@ public abstract class CustomFont extends
     }
 
     /**
+     * Returns the embedding mode for this font.
+     * @return embedding mode
+     */
+    public EmbeddingMode getEmbeddingMode() {
+        return embeddingMode;
+    }
+
+    /**
      * Returns a Source representing an embeddable font file.
      * @return Source for an embeddable font file
      * @throws IOException if embedFileName is not null but Source is not found
@@ -337,6 +349,13 @@ public abstract class CustomFont extends
     /**
      * {@inheritDoc}
      */
+    public void setEmbeddingMode(EmbeddingMode embeddingMode) {
+        this.embeddingMode = embeddingMode;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public void setCapHeight(int capHeight) {
         this.capHeight = capHeight;
     }
@@ -473,4 +492,25 @@ public abstract class CustomFont extends
         }
     }
 
+    /**
+     * Sets the character map for this font. It maps all available Unicode characters
+     * to their glyph indices inside the font.
+     * @param cmap the character map
+     */
+    public void setCMap(CMapSegment[] cmap) {
+        this.cmap = new CMapSegment[cmap.length];
+        System.arraycopy(cmap, 0, this.cmap, 0, cmap.length);
+    }
+
+    /**
+     * Returns the character map for this font. It maps all available Unicode characters
+     * to their glyph indices inside the font.
+     * @return the character map
+     */
+    public CMapSegment[] getCMap() {
+        CMapSegment[] copy = new CMapSegment[cmap.length];
+        System.arraycopy(this.cmap, 0, copy, 0, this.cmap.length);
+        return copy;
+    }
+
 }

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CustomFontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CustomFontCollection.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CustomFontCollection.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/CustomFontCollection.java Thu Jul  5 20:29:53 2012
@@ -72,7 +72,7 @@ public class CustomFontCollection implem
 
             List<FontTriplet> triplets = embedFontInfo.getFontTriplets();
             for (int tripletIndex = 0; tripletIndex < triplets.size(); tripletIndex++) {
-                FontTriplet triplet = (FontTriplet) triplets.get(tripletIndex);
+                FontTriplet triplet = triplets.get(tripletIndex);
                 fontInfo.addFontProperties(internalName, triplet);
             }
         }

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/EmbedFontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/EmbedFontInfo.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/EmbedFontInfo.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/EmbedFontInfo.java Thu Jul  5 20:29:53 2012
@@ -25,6 +25,8 @@ import java.util.List;
 
 /**
  * FontInfo contains meta information on fonts (where is the metrics file etc.)
+ * TODO: We need to remove this class and think about more intelligent design patterns
+ * (Data classes => Procedural code)
  */
 public class EmbedFontInfo implements Serializable {
 
@@ -41,6 +43,8 @@ public class EmbedFontInfo implements Se
     protected boolean advanced;
     /** the requested encoding mode for the font */
     protected EncodingMode encodingMode = EncodingMode.AUTO;
+    /** the requested embedding mode for this font */
+    protected EmbeddingMode embeddingMode = EmbeddingMode.AUTO;
 
     /** the PostScript name of the font */
     protected String postScriptName = null;
@@ -149,6 +153,14 @@ public class EmbedFontInfo implements Se
     }
 
     /**
+     * Returns the embedding mode for this font.
+     * @return the embedding mode.
+     */
+    public EmbeddingMode getEmbeddingMode() {
+       return embeddingMode;
+    }
+
+    /**
      * Defines whether the font is embedded or not.
      * @param value true to embed the font, false to reference it
      */
@@ -175,6 +187,17 @@ public class EmbedFontInfo implements Se
         this.encodingMode = mode;
     }
 
+    /**
+     * Sets the embedding mode for this font, currently not supported for Type 1 fonts.
+     * @param embeddingMode the new embedding mode.
+     */
+    public void setEmbeddingMode(EmbeddingMode embeddingMode) {
+        if (embeddingMode == null) {
+            throw new NullPointerException("embeddingMode must not be null");
+        }
+        this.embeddingMode = embeddingMode;
+    }
+
     private void readObject(java.io.ObjectInputStream in)
                 throws IOException, ClassNotFoundException {
         in.defaultReadObject();

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/EncodingMode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/EncodingMode.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/EncodingMode.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/EncodingMode.java Thu Jul  5 20:29:53 2012
@@ -52,7 +52,7 @@ public enum EncodingMode {
      * @param name the name of the encoding mode to look up
      * @return the encoding mode constant
      */
-    public static EncodingMode getEncodingMode(String name) {
+    public static EncodingMode getValue(String name) {
         for (EncodingMode em : EncodingMode.values()) {
             if (name.equalsIgnoreCase(em.getName())) {
                 return em;

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontInfoConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontInfoConfigurator.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontInfoConfigurator.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontInfoConfigurator.java Thu Jul  5 20:29:53 2012
@@ -254,12 +254,16 @@ public class FontInfoConfigurator {
 
         boolean useKerning = fontCfg.getAttributeAsBoolean("kerning", true);
         boolean useAdvanced = fontCfg.getAttributeAsBoolean("advanced", true);
-        EncodingMode encodingMode = EncodingMode.getEncodingMode(
+        EncodingMode encodingMode = EncodingMode.getValue(
                 fontCfg.getAttribute("encoding-mode", EncodingMode.AUTO.getName()));
+        EmbeddingMode embeddingMode = EmbeddingMode.getValue(
+                fontCfg.getAttribute("embedding-mode", EmbeddingMode.AUTO.toString()));
         EmbedFontInfo embedFontInfo
             = new EmbedFontInfo(metricsUrl, useKerning, useAdvanced, tripletList, embedUrl,
                                 subFont);
         embedFontInfo.setEncodingMode(encodingMode);
+        embedFontInfo.setEmbeddingMode(embeddingMode);
+
         boolean skipCachedFont = false;
         if (fontCache != null) {
             if (!fontCache.containsFont(embedFontInfo)) {

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontLoader.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontLoader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontLoader.java Thu Jul  5 20:29:53 2012
@@ -85,15 +85,17 @@ public abstract class FontLoader {
      * @param fontFile the File representation of the font
      * @param subFontName the sub-fontname of a font (for TrueType Collections, null otherwise)
      * @param embedded indicates whether the font is embedded or referenced
+     * @param embeddingMode the embedding mode
      * @param encodingMode the requested encoding mode
      * @param resolver the font resolver to use when resolving URIs
      * @return the newly loaded font
      * @throws IOException In case of an I/O error
      */
     public static CustomFont loadFont(File fontFile, String subFontName,
-            boolean embedded, EncodingMode encodingMode, FontResolver resolver) throws IOException {
+            boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode,
+            FontResolver resolver) throws IOException {
         return loadFont(fontFile.toURI().toURL(), subFontName,
-                embedded, encodingMode, resolver);
+                embedded, embeddingMode, encodingMode, resolver);
     }
 
     /**
@@ -101,16 +103,17 @@ public abstract class FontLoader {
      * @param fontUrl the URL representation of the font
      * @param subFontName the sub-fontname of a font (for TrueType Collections, null otherwise)
      * @param embedded indicates whether the font is embedded or referenced
+     * @param embeddingMode the embedding mode of the font
      * @param encodingMode the requested encoding mode
      * @param resolver the font resolver to use when resolving URIs
      * @return the newly loaded font
      * @throws IOException In case of an I/O error
      */
     public static CustomFont loadFont(URL fontUrl, String subFontName,
-            boolean embedded, EncodingMode encodingMode,
+            boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode,
             FontResolver resolver) throws IOException {
         return loadFont(fontUrl.toExternalForm(), subFontName,
-                embedded, encodingMode, true, true,
+                embedded, embeddingMode, encodingMode, true, true,
                 resolver);
     }
 
@@ -119,6 +122,7 @@ public abstract class FontLoader {
      * @param fontFileURI the URI to the font
      * @param subFontName the sub-fontname of a font (for TrueType Collections, null otherwise)
      * @param embedded indicates whether the font is embedded or referenced
+     * @param embeddingMode the embedding mode of the font
      * @param encodingMode the requested encoding mode
      * @param useKerning indicates whether kerning information should be loaded if available
      * @param useAdvanced indicates whether advanced typographic information shall be loaded if
@@ -128,8 +132,8 @@ public abstract class FontLoader {
      * @throws IOException In case of an I/O error
      */
     public static CustomFont loadFont(String fontFileURI, String subFontName,
-            boolean embedded, EncodingMode encodingMode, boolean useKerning,
-            boolean useAdvanced, FontResolver resolver) throws IOException {
+            boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode,
+            boolean useKerning, boolean useAdvanced, FontResolver resolver) throws IOException {
         fontFileURI = fontFileURI.trim();
         boolean type1 = isType1(fontFileURI);
         FontLoader loader;
@@ -138,10 +142,14 @@ public abstract class FontLoader {
                 throw new IllegalArgumentException(
                         "CID encoding mode not supported for Type 1 fonts");
             }
+            if (embeddingMode == EmbeddingMode.SUBSET) {
+                throw new IllegalArgumentException(
+                        "Subset embedding for Type 1 fonts is not supported");
+            }
             loader = new Type1FontLoader(fontFileURI, embedded, useKerning, resolver);
         } else {
             loader = new TTFFontLoader(fontFileURI, subFontName,
-                    embedded, encodingMode, useKerning, useAdvanced, resolver);
+                    embedded, embeddingMode, encodingMode, useKerning, useAdvanced, resolver);
         }
         return loader.getFont();
     }

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontReader.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontReader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontReader.java Thu Jul  5 20:29:53 2012
@@ -64,7 +64,7 @@ public class FontReader extends DefaultH
 
     private Map<Integer, Integer> currentKerning = null;
 
-    private List<BFEntry> bfranges = null;
+    private List<CMapSegment> bfranges = null;
 
     private void createFont(InputSource source) throws FOPException {
         XMLReader parser = null;
@@ -154,12 +154,14 @@ public class FontReader extends DefaultH
     /**
      * {@inheritDoc}
      */
+    @Override
     public void startDocument() {
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setDocumentLocator(Locator locator) {
         // this.locator = locator; // not used at present
     }
@@ -167,6 +169,7 @@ public class FontReader extends DefaultH
     /**
      * {@inheritDoc}
      */
+    @Override
     public void startElement(String uri, String localName, String qName,
                              Attributes attributes) throws SAXException {
         if (localName.equals("font-metrics")) {
@@ -198,9 +201,9 @@ public class FontReader extends DefaultH
             returnFont.putKerningEntry(new Integer(attributes.getValue("kpx1")),
                                         currentKerning);
         } else if ("bfranges".equals(localName)) {
-            bfranges = new ArrayList<BFEntry>();
+            bfranges = new ArrayList<CMapSegment>();
         } else if ("bf".equals(localName)) {
-            BFEntry entry = new BFEntry(getInt(attributes.getValue("us")),
+            CMapSegment entry = new CMapSegment(getInt(attributes.getValue("us")),
                                         getInt(attributes.getValue("ue")),
                                         getInt(attributes.getValue("gi")));
             bfranges.add(entry);
@@ -236,6 +239,7 @@ public class FontReader extends DefaultH
     /**
      * {@inheritDoc}
      */
+    @Override
     public void endElement(String uri, String localName, String qName) throws SAXException {
         String content = text.toString().trim();
         if ("font-name".equals(localName)) {
@@ -303,7 +307,7 @@ public class FontReader extends DefaultH
             multiFont.setWidthArray(wds);
 
         } else if ("bfranges".equals(localName)) {
-            multiFont.setBFEntries(bfranges.toArray(new BFEntry[0]));
+            multiFont.setCMap(bfranges.toArray(new CMapSegment[0]));
         }
         text.setLength(0); //Reset text buffer (see characters())
     }
@@ -311,6 +315,7 @@ public class FontReader extends DefaultH
     /**
      * {@inheritDoc}
      */
+    @Override
     public void characters(char[] ch, int start, int length) {
         text.append(ch, start, length);
     }

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontType.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontType.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/FontType.java Thu Jul  5 20:29:53 2012
@@ -130,4 +130,9 @@ public class FontType {
         return value;
     }
 
+    @Override
+    public String toString() {
+        return name;
+    }
+
 }

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/LazyFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/LazyFont.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/LazyFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/LazyFont.java Thu Jul  5 20:29:53 2012
@@ -36,7 +36,6 @@ import org.apache.fop.apps.FOPException;
 import org.apache.fop.complexscripts.fonts.Positionable;
 import org.apache.fop.complexscripts.fonts.Substitutable;
 
-
 /**
  * This class is used to defer the loading of a font until it is really used.
  */
@@ -49,7 +48,8 @@ public class LazyFont extends Typeface i
     private boolean useKerning;
     private boolean useAdvanced;
     private EncodingMode encodingMode = EncodingMode.AUTO;
-    private boolean embedded;
+    private EmbeddingMode embeddingMode = EmbeddingMode.AUTO;
+    private boolean embedded = true;
     private String subFontName;
 
     private boolean isMetricsLoaded;
@@ -74,6 +74,7 @@ public class LazyFont extends Typeface i
             this.useAdvanced = fontInfo.getAdvanced();
         }
         this.encodingMode = fontInfo.getEncodingMode();
+        this.embeddingMode = fontInfo.getEmbeddingMode();
         this.subFontName = fontInfo.getSubFontName();
         this.embedded = fontInfo.isEmbedded();
         this.resolver = resolver;
@@ -147,8 +148,9 @@ public class LazyFont extends Typeface i
                     if (fontEmbedPath == null) {
                         throw new RuntimeException("Cannot load font. No font URIs available.");
                     }
-                    realFont = FontLoader.loadFont(fontEmbedPath, this.subFontName,
-                            this.embedded, this.encodingMode, useKerning, useAdvanced, resolver);
+                    realFont = FontLoader.loadFont(fontEmbedPath, subFontName,
+                            embedded, embeddingMode, encodingMode,
+                            useKerning, useAdvanced, resolver);
                 }
                 if (realFont instanceof FontDescriptor) {
                     realFontDescriptor = (FontDescriptor) realFont;

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/MultiByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/MultiByteFont.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/MultiByteFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/MultiByteFont.java Thu Jul  5 20:29:53 2012
@@ -51,14 +51,6 @@ public class MultiByteFont extends CIDFo
 
     private CIDSubset subset = new CIDSubset();
 
-    /**
-     * A map from Unicode indices to glyph indices. No assumption
-     * about ordering is made below. If lookup is changed to a binary
-     * search (from the current linear search), then addPrivateUseMapping()
-     * needs to be changed to perform ordered inserts.
-     */
-    private BFEntry[] bfentries = null;
-
     /* advanced typographic support */
     private GlyphDefinitionTable gdef;
     private GlyphSubstitutionTable gsub;
@@ -82,26 +74,31 @@ public class MultiByteFont extends CIDFo
     }
 
     /** {@inheritDoc} */
+    @Override
     public int getDefaultWidth() {
         return defaultWidth;
     }
 
     /** {@inheritDoc} */
+    @Override
     public String getRegistry() {
         return "Adobe";
     }
 
     /** {@inheritDoc} */
+    @Override
     public String getOrdering() {
         return "UCS";
     }
 
     /** {@inheritDoc} */
+    @Override
     public int getSupplement() {
         return 0;
     }
 
     /** {@inheritDoc} */
+    @Override
     public CIDFontType getCIDType() {
         return cidType;
     }
@@ -115,6 +112,7 @@ public class MultiByteFont extends CIDFo
     }
 
     /** {@inheritDoc} */
+    @Override
     public String getEmbedFontName() {
         if (isEmbeddable()) {
             return FontUtil.stripWhiteSpace(super.getFontName());
@@ -128,17 +126,18 @@ public class MultiByteFont extends CIDFo
         return !(getEmbedFileName() == null && getEmbedResourceName() == null);
     }
 
-    /** {@inheritDoc} */
     public boolean isSubsetEmbedded() {
         return true;
     }
 
     /** {@inheritDoc} */
+    @Override
     public CIDSubset getCIDSubset() {
         return this.subset;
     }
 
     /** {@inheritDoc} */
+    @Override
     public String getEncodingName() {
         return encoding;
     }
@@ -171,30 +170,30 @@ public class MultiByteFont extends CIDFo
         int idx = c;
         int retIdx = SingleByteEncoding.NOT_FOUND_CODE_POINT;
 
-        for (int i = 0; (i < bfentries.length) && retIdx == 0; i++) {
-            if (bfentries[i].getUnicodeStart() <= idx
-                && bfentries[i].getUnicodeEnd() >= idx) {
+        for (int i = 0; (i < cmap.length) && retIdx == 0; i++) {
+            if (cmap[i].getUnicodeStart() <= idx
+                    && cmap[i].getUnicodeEnd() >= idx) {
 
-                retIdx = bfentries[i].getGlyphStartIndex()
+                retIdx = cmap[i].getGlyphStartIndex()
                     + idx
-                    - bfentries[i].getUnicodeStart();
+                    - cmap[i].getUnicodeStart();
             }
         }
         return retIdx;
     }
 
     /**
-     * Add a private use mapping {PU,GI} to the existing BFENTRIES map.
+     * Add a private use mapping {PU,GI} to the existing character map.
      * N.B. Does not insert in order, merely appends to end of existing map.
      */
     private synchronized void addPrivateUseMapping ( int pu, int gi ) {
         assert findGlyphIndex ( pu ) == SingleByteEncoding.NOT_FOUND_CODE_POINT;
-        BFEntry[] bfeOld = bfentries;
-        int       bfeCnt = bfeOld.length;
-        BFEntry[] bfeNew = new BFEntry [ bfeCnt + 1 ];
-        System.arraycopy ( bfeOld, 0, bfeNew, 0, bfeCnt );
-        bfeNew [ bfeCnt ] = new BFEntry ( pu, pu, gi );
-        bfentries = bfeNew;
+        CMapSegment[] oldCmap = cmap;
+        int cmapLength = oldCmap.length;
+        CMapSegment[] newCmap = new CMapSegment [ cmapLength + 1 ];
+        System.arraycopy ( oldCmap, 0, newCmap, 0, cmapLength );
+        newCmap [ cmapLength ] = new CMapSegment ( pu, pu, gi );
+        cmap = newCmap;
     }
 
     /**
@@ -252,12 +251,12 @@ public class MultiByteFont extends CIDFo
     // [TBD] - needs optimization, i.e., change from linear search to binary search
     private int findCharacterFromGlyphIndex ( int gi, boolean augment ) {
         int cc = 0;
-        for ( int i = 0, n = bfentries.length; i < n; i++ ) {
-            BFEntry be = bfentries [ i ];
-            int s = be.getGlyphStartIndex();
-            int e = s + ( be.getUnicodeEnd() - be.getUnicodeStart() );
+        for ( int i = 0, n = cmap.length; i < n; i++ ) {
+            CMapSegment segment = cmap [ i ];
+            int s = segment.getGlyphStartIndex();
+            int e = s + ( segment.getUnicodeEnd() - segment.getUnicodeStart() );
             if ( ( gi >= s ) && ( gi <= e ) ) {
-                cc = be.getUnicodeStart() + ( gi - s );
+                cc = segment.getUnicodeStart() + ( gi - s );
                 break;
             }
         }
@@ -273,6 +272,7 @@ public class MultiByteFont extends CIDFo
 
 
     /** {@inheritDoc} */
+    @Override
     public char mapChar(char c) {
         notifyMapOperation();
         int glyphIndex = findGlyphIndex(c);
@@ -287,20 +287,12 @@ public class MultiByteFont extends CIDFo
     }
 
     /** {@inheritDoc} */
+    @Override
     public boolean hasChar(char c) {
         return (findGlyphIndex(c) != SingleByteEncoding.NOT_FOUND_CODE_POINT);
     }
 
     /**
-     * Sets the array of BFEntry instances which constitutes the Unicode to glyph index map for
-     * a font. ("BF" means "base font")
-     * @param entries the Unicode to glyph index map
-     */
-    public void setBFEntries(BFEntry[] entries) {
-        this.bfentries = entries;
-    }
-
-    /**
      * Sets the defaultWidth.
      * @param defaultWidth The defaultWidth to set
      */

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/MutableFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/MutableFont.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/MutableFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/MutableFont.java Thu Jul  5 20:29:53 2012
@@ -61,6 +61,12 @@ public interface MutableFont {
     void setEmbedResourceName(String name);
 
     /**
+     * Sets the embedding mode.
+     * @param embeddingMode the embedding mode
+     */
+    void setEmbeddingMode(EmbeddingMode embeddingMode);
+
+    /**
      * Sets the capital height value.
      * @param capHeight capital height
      */

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/SingleByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/SingleByteFont.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/SingleByteFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/SingleByteFont.java Thu Jul  5 20:29:53 2012
@@ -31,6 +31,8 @@ import org.apache.commons.logging.LogFac
 
 import org.apache.xmlgraphics.fonts.Glyphs;
 
+import org.apache.fop.fonts.truetype.TTFFile.PostScriptVersion;
+
 /**
  * Generic SingleByte font
  */
@@ -48,6 +50,7 @@ public class SingleByteFont extends Cust
     private List<SimpleSingleByteEncoding> additionalEncodings;
     private Map<Character, Character> alternativeCodes;
 
+    private PostScriptVersion ttPostScriptVersion;
 
     /**
      * Main constructor.
@@ -397,5 +400,26 @@ public class SingleByteFont extends Cust
         }
     }
 
+    /**
+     * Sets the version of the PostScript table stored in the TrueType font represented by
+     * this instance.
+     *
+     * @param version version of the <q>post</q> table
+     */
+    public void setTrueTypePostScriptVersion(PostScriptVersion version) {
+        ttPostScriptVersion = version;
+    }
+
+    /**
+     * Returns the version of the PostScript table stored in the TrueType font represented by
+     * this instance.
+     *
+     * @return the version of the <q>post</q> table
+     */
+    public PostScriptVersion getTrueTypePostScriptVersion() {
+        assert getFontType() == FontType.TRUETYPE;
+        return ttPostScriptVersion;
+    }
+
 }
 

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/apps/TTFReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/apps/TTFReader.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/apps/TTFReader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/apps/TTFReader.java Thu Jul  5 20:29:53 2012
@@ -20,7 +20,6 @@
 package org.apache.fop.fonts.apps;
 
 import java.io.IOException;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -34,9 +33,9 @@ import org.xml.sax.SAXException;
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.fop.Version;
+import org.apache.fop.fonts.CMapSegment;
 import org.apache.fop.fonts.FontUtil;
 import org.apache.fop.fonts.truetype.FontFileReader;
-import org.apache.fop.fonts.truetype.TTFCmapEntry;
 import org.apache.fop.fonts.truetype.TTFFile;
 import org.apache.fop.util.CommandLineLogger;
 
@@ -288,9 +287,9 @@ public class TTFReader extends AbstractF
             root.appendChild(el);
             el.appendChild(doc.createTextNode(ttf.getFullName()));
         }
-        Set familyNames = ttf.getFamilyNames();
+        Set<String> familyNames = ttf.getFamilyNames();
         if (familyNames.size() > 0) {
-            String familyName = (String)familyNames.iterator().next();
+            String familyName = familyNames.iterator().next();
             el = doc.createElement("family-name");
             root.appendChild(el);
             el.appendChild(doc.createTextNode(familyName));
@@ -386,9 +385,7 @@ public class TTFReader extends AbstractF
 
         el = doc.createElement("bfranges");
         mel.appendChild(el);
-        Iterator iter = ttf.getCMaps().listIterator();
-        while (iter.hasNext()) {
-            TTFCmapEntry ce = (TTFCmapEntry)iter.next();
+        for (CMapSegment ce : ttf.getCMaps()) {
             Element el2 = doc.createElement("bf");
             el.appendChild(el2);
             el2.setAttribute("us", String.valueOf(ce.getUnicodeStart()));
@@ -443,31 +440,28 @@ public class TTFReader extends AbstractF
         Document doc = parent.getOwnerDocument();
 
         // Get kerning
-        Iterator iter;
+        Set<Integer> kerningKeys;
         if (isCid) {
-            iter = ttf.getKerning().keySet().iterator();
+            kerningKeys = ttf.getKerning().keySet();
         } else {
-            iter = ttf.getAnsiKerning().keySet().iterator();
+            kerningKeys = ttf.getAnsiKerning().keySet();
         }
 
-        while (iter.hasNext()) {
-            Integer kpx1 = (Integer)iter.next();
+        for (Integer kpx1 : kerningKeys) {
 
             el = doc.createElement("kerning");
             el.setAttribute("kpx1", kpx1.toString());
             parent.appendChild(el);
             Element el2 = null;
 
-            Map h2;
+            Map<Integer, Integer> h2;
             if (isCid) {
-                h2 = (Map)ttf.getKerning().get(kpx1);
+                h2 = ttf.getKerning().get(kpx1);
             } else {
-                h2 = (Map)ttf.getAnsiKerning().get(kpx1);
+                h2 = ttf.getAnsiKerning().get(kpx1);
             }
 
-            Iterator iter2 = h2.keySet().iterator();
-            while (iter2.hasNext()) {
-                Integer kpx2 = (Integer)iter2.next();
+            for (Integer kpx2 : h2.keySet()) {
                 if (isCid || kpx2.intValue() < 256) {
                     el2 = doc.createElement("pair");
                     el2.setAttribute("kpx2", kpx2.toString());

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java Thu Jul  5 20:29:53 2012
@@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFac
 
 import org.apache.fop.fonts.CustomFont;
 import org.apache.fop.fonts.EmbedFontInfo;
+import org.apache.fop.fonts.EmbeddingMode;
 import org.apache.fop.fonts.EncodingMode;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontCache;
@@ -222,7 +223,7 @@ public class FontInfoFinder {
                 }
                 try {
                     TTFFontLoader ttfLoader = new TTFFontLoader(
-                            fontFileURL, fontName, true, EncodingMode.AUTO,
+                            fontFileURL, fontName, true, EmbeddingMode.AUTO, EncodingMode.AUTO,
                             useKerning, useAdvanced, resolver);
                     customFont = ttfLoader.getFont();
                     if (this.eventListener != null) {
@@ -247,7 +248,8 @@ public class FontInfoFinder {
         } else {
             // The normal case
             try {
-                customFont = FontLoader.loadFont(fontURL, null, true, EncodingMode.AUTO, resolver);
+                customFont = FontLoader.loadFont(fontURL, null, true, EmbeddingMode.AUTO,
+                        EncodingMode.AUTO, resolver);
                 if (this.eventListener != null) {
                     customFont.setEventListener(this.eventListener);
                 }

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/truetype/FontFileReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/truetype/FontFileReader.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/truetype/FontFileReader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/truetype/FontFileReader.java Thu Jul  5 20:29:53 2012
@@ -90,23 +90,13 @@ public class FontFileReader {
     }
 
     /**
-     * Set current file position to offset
-     *
-     * @param add The number of bytes to advance
-     * @throws IOException In case of an I/O problem
-     */
-    public void seekAdd(long add) throws IOException {
-        seekSet(current + add);
-    }
-
-    /**
      * Skip a given number of bytes.
      *
      * @param add The number of bytes to advance
      * @throws IOException In case of an I/O problem
      */
     public void skip(long add) throws IOException {
-        seekAdd(add);
+        seekSet(current + add);
     }
 
     /**
@@ -133,7 +123,7 @@ public class FontFileReader {
      * @return One byte
      * @throws IOException If EOF is reached
      */
-    public byte read() throws IOException {
+    private byte read() throws IOException {
         if (current >= fsize) {
             throw new java.io.EOFException("Reached EOF, file size=" + fsize);
         }
@@ -278,14 +268,14 @@ public class FontFileReader {
     public final String readTTFString() throws IOException {
         int i = current;
         while (file[i++] != 0) {
-            if (i > fsize) {
+            if (i >= fsize) {
                 throw new java.io.EOFException("Reached EOF, file size="
                                                + fsize);
             }
         }
 
-        byte[] tmp = new byte[i - current];
-        System.arraycopy(file, current, tmp, 0, i - current);
+        byte[] tmp = new byte[i - current - 1];
+        System.arraycopy(file, current, tmp, 0, i - current - 1);
         return new String(tmp, "ISO-8859-1");
     }
 
@@ -353,6 +343,11 @@ public class FontFileReader {
         System.arraycopy(file, offset, ret, 0, length);
         return ret;
     }
-
-
+    /**
+     * Returns the full byte array representation of the file.
+     * @return byte array.
+     */
+    public byte[] getAllBytes() {
+        return file;
+    }
 }

Modified: xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java?rev=1357883&r1=1357882&r2=1357883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java (original)
+++ xmlgraphics/fop/branches/fop-1_1/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java Thu Jul  5 20:29:53 2012
@@ -33,6 +33,14 @@ public class TTFDirTabEntry {
     private long offset;
     private long length;
 
+    public TTFDirTabEntry() {
+    }
+
+    public TTFDirTabEntry(long offset, long length) {
+        this.offset = offset;
+        this.length = length;
+    }
+
     /**
      * Read Dir Tab.
      * @param in font file reader



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