xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vhenneb...@apache.org
Subject svn commit: r1562866 [4/13] - in /xmlgraphics/fop/branches/Temp_FopFontsForSVG: ./ examples/fo/basic/ lib/ src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/ src/documentation/intermediate-format-ng/ src/java/META-INF/services/ src/java/org/a...
Date Thu, 30 Jan 2014 15:51:11 GMT
Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/CharScript.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/CharScript.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/CharScript.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/CharScript.java Thu Jan 30 15:51:03 2014
@@ -28,12 +28,6 @@ import java.util.Set;
 
 import org.apache.fop.util.CharUtilities;
 
-// CSOFF: AvoidNestedBlocksCheck
-// CSOFF: InnerAssignmentCheck
-// CSOFF: LineLengthCheck
-// CSOFF: SimplifyBooleanReturnCheck
-// CSOFF: WhitespaceAfterCheck
-
 /**
  * <p>Script related utilities.</p>
  *
@@ -41,6 +35,8 @@ import org.apache.fop.util.CharUtilities
  */
 public final class CharScript {
 
+    // CSOFF: LineLength
+
     //
     // The following script codes are based on ISO 15924. Codes less than 1000 are
     // official assignments from 15924; those equal to or greater than 1000 are FOP
@@ -754,16 +750,14 @@ public final class CharScript {
             case SCRIPT_UNCODED:
                 break;
             default:
-                {
-                    Integer v = (Integer) e.getValue();
-                    assert v != null;
-                    int c = v.intValue();
-                    if (c > cMax) {
-                        cMax = c;
-                        sMax = s;
-                    }
-                    break;
+                Integer v = (Integer) e.getValue();
+                assert v != null;
+                int c = v.intValue();
+                if (c > cMax) {
+                    cMax = c;
+                    sMax = s;
                 }
+                break;
             }
         }
         if (sMax < 0) {
@@ -823,7 +817,7 @@ public final class CharScript {
      * @return a  script tag
      */
     public static String scriptTagFromCode(int code) {
-        Map<Integer,String> m = getScriptTagsMap();
+        Map<Integer, String> m = getScriptTagsMap();
         if (m != null) {
             String tag;
             if ((tag = m.get(Integer.valueOf(code))) != null) {
@@ -842,7 +836,7 @@ public final class CharScript {
      * @return a script code
      */
     public static int scriptCodeFromTag(String tag) {
-        Map<String,Integer> m = getScriptCodeMap();
+        Map<String, Integer> m = getScriptCodeMap();
         if (m != null) {
             Integer c;
             if ((c = m.get(tag)) != null) {
@@ -855,8 +849,8 @@ public final class CharScript {
         }
     }
 
-    private static Map<Integer,String> scriptTagsMap = null;
-    private static Map<String,Integer> scriptCodeMap = null;
+    private static Map<Integer, String> scriptTagsMap = null;
+    private static Map<String, Integer> scriptCodeMap = null;
 
     private static void putScriptTag(Map tm, Map cm, int code, String tag) {
         assert tag != null;
@@ -868,8 +862,8 @@ public final class CharScript {
     }
 
     private static void makeScriptMaps() {
-        HashMap<Integer,String> tm = new HashMap<Integer,String>();
-        HashMap<String,Integer> cm = new HashMap<String,Integer>();
+        HashMap<Integer, String> tm = new HashMap<Integer, String>();
+        HashMap<String, Integer> cm = new HashMap<String, Integer>();
         putScriptTag(tm, cm, SCRIPT_HEBREW, "hebr");
         putScriptTag(tm, cm, SCRIPT_MONGOLIAN, "mong");
         putScriptTag(tm, cm, SCRIPT_ARABIC, "arab");
@@ -915,14 +909,14 @@ public final class CharScript {
         scriptCodeMap = cm;
     }
 
-    private static Map<Integer,String> getScriptTagsMap() {
+    private static Map<Integer, String> getScriptTagsMap() {
         if (scriptTagsMap == null) {
             makeScriptMaps();
         }
         return scriptTagsMap;
     }
 
-    private static Map<String,Integer> getScriptCodeMap() {
+    private static Map<String, Integer> getScriptCodeMap() {
         if (scriptCodeMap == null) {
             makeScriptMaps();
         }

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java Thu Jan 30 15:51:03 2014
@@ -26,10 +26,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-// CSOFF: InnerAssignmentCheck
 // CSOFF: LineLengthCheck
-// CSOFF: WhitespaceAfterCheck
-// CSOFF: NoWhitespaceAfterCheck
 
 /**
  * <p>A GlyphSequence encapsulates a sequence of character codes, a sequence of glyph codes,
@@ -639,10 +636,10 @@ public class GlyphSequence implements Cl
         private final int offset;
         private final int count;
         private final int[] subIntervals;
-        private Map<String,Object> predications;
+        private Map<String, Object> predications;
 
         // class state
-        private static volatile Map<String,PredicationMerger> predicationMergers;
+        private static volatile Map<String, PredicationMerger> predicationMergers;
 
         interface PredicationMerger {
             Object merge(String key, Object v1, Object v2);
@@ -724,7 +721,7 @@ public class GlyphSequence implements Cl
         public boolean contained(int offset, int count) {
             int s = offset;
             int e = offset + count;
-            if (! isDisjoint()) {
+            if (!isDisjoint()) {
                 int s0 = getStart();
                 int e0 = getEnd();
                 return (s0 >= s) && (e0 <= e);
@@ -748,7 +745,7 @@ public class GlyphSequence implements Cl
          */
         public void setPredication(String key, Object value) {
             if (predications == null) {
-                predications = new HashMap<String,Object>();
+                predications = new HashMap<String, Object>();
             }
             if (predications != null) {
                 predications.put(key, value);
@@ -775,7 +772,7 @@ public class GlyphSequence implements Cl
          */
         public void mergePredication(String key, Object value) {
             if (predications == null) {
-                predications = new HashMap<String,Object>();
+                predications = new HashMap<String, Object>();
             }
             if (predications != null) {
                 if (predications.containsKey(key)) {
@@ -813,7 +810,7 @@ public class GlyphSequence implements Cl
          */
         public void mergePredications(CharAssociation ca) {
             if (ca.predications != null) {
-                for (Map.Entry<String,Object> e : ca.predications.entrySet()) {
+                for (Map.Entry<String, Object> e : ca.predications.entrySet()) {
                     mergePredication(e.getKey(), e.getValue());
                 }
             }
@@ -824,7 +821,7 @@ public class GlyphSequence implements Cl
             try {
                 CharAssociation ca = (CharAssociation) super.clone();
                 if (predications != null) {
-                    ca.predications = new HashMap<String,Object>(predications);
+                    ca.predications = new HashMap<String, Object>(predications);
                 }
                 return ca;
             } catch (CloneNotSupportedException e) {
@@ -839,7 +836,7 @@ public class GlyphSequence implements Cl
          */
         public static void setPredicationMerger(String key, PredicationMerger pm) {
             if (predicationMergers == null) {
-                predicationMergers = new HashMap<String,PredicationMerger>();
+                predicationMergers = new HashMap<String, PredicationMerger>();
             }
             if (predicationMergers != null) {
                 predicationMergers.put(key, pm);

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/NumberConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/NumberConverter.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/NumberConverter.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/NumberConverter.java Thu Jan 30 15:51:03 2014
@@ -23,9 +23,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 // CSOFF: LineLengthCheck
-// CSOFF: InnerAssignmentCheck
-// CSOFF: NoWhitespaceAfterCheck
-// CSOFF: AvoidNestedBlocksCheck
 
 /**
  * <p>Implementation of Number to String Conversion algorithm specified by
@@ -186,10 +183,10 @@ public class NumberConverter {
                 separators.add(token.toArray(new Integer [ token.size() ]));
             }
         }
-        if (! separators.isEmpty()) {
+        if (!separators.isEmpty()) {
             this.prefix = separators.remove(0);
         }
-        if (! separators.isEmpty()) {
+        if (!separators.isEmpty()) {
             this.suffix = separators.remove(separators.size() - 1);
         }
         this.separators = separators.toArray(new Integer [ separators.size() ] []);
@@ -260,33 +257,27 @@ public class NumberConverter {
             int s = token[0].intValue();
             switch (s) {
             case (int) '1':
-                {
-                    fn = formatNumberAsDecimal(number, (int) '1', 1);
-                    break;
-                }
+                fn = formatNumberAsDecimal(number, (int) '1', 1);
+            break;
             case (int) 'W':
             case (int) 'w':
-                {
-                    fn = formatNumberAsWord(number, (s == (int) 'W') ? Character.UPPERCASE_LETTER : Character.LOWERCASE_LETTER);
-                    break;
-                }
+                fn = formatNumberAsWord(number, (s == (int) 'W') ? Character.UPPERCASE_LETTER : Character.LOWERCASE_LETTER);
+            break;
             case (int) 'A': // handled as numeric sequence
             case (int) 'a': // handled as numeric sequence
             case (int) 'I': // handled as numeric special
             case (int) 'i': // handled as numeric special
             default:
-                {
-                    if (isStartOfDecimalSequence(s)) {
-                        fn = formatNumberAsDecimal(number, s, 1);
-                    } else if (isStartOfAlphabeticSequence(s)) {
-                        fn = formatNumberAsSequence(number, s, getSequenceBase(s), null);
-                    } else if (isStartOfNumericSpecial(s)) {
-                        fn = formatNumberAsSpecial(number, s);
-                    } else {
-                        fn = null;
-                    }
-                    break;
+                if (isStartOfDecimalSequence(s)) {
+                    fn = formatNumberAsDecimal(number, s, 1);
+                } else if (isStartOfAlphabeticSequence(s)) {
+                    fn = formatNumberAsSequence(number, s, getSequenceBase(s), null);
+                } else if (isStartOfNumericSpecial(s)) {
+                    fn = formatNumberAsSpecial(number, s);
+                } else {
+                    fn = null;
                 }
+                break;
             }
         } else if ((token.length == 2) && (token[0] == (int) 'W') && (token[1] == (int) 'w')) {
             fn = formatNumberAsWord(number, Character.TITLECASE_LETTER);

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/UTF32.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/UTF32.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/UTF32.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/complexscripts/util/UTF32.java Thu Jan 30 15:51:03 2014
@@ -21,7 +21,6 @@ package org.apache.fop.complexscripts.ut
 
 import org.apache.fop.util.CharUtilities;
 
-// CSOFF: InnerAssignmentCheck
 
 /**
  * <p>UTF32 related utilities.</p>

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/Constants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/Constants.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/Constants.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/Constants.java Thu Jan 30 15:51:03 2014
@@ -816,8 +816,11 @@ public interface Constants {
     /** Scope for table header */
     int PR_X_HEADER_COLUMN = 290;
 
+    /** For specifying PDF optional content group (layer) binding. */
+    int PR_X_LAYER = 291;
+
     /** Number of property constants defined */
-    int PROPERTY_COUNT = 290;
+    int PROPERTY_COUNT = 291;
 
     // compound property constants
 

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/FOPropertyMapping.java Thu Jan 30 15:51:03 2014
@@ -2721,6 +2721,13 @@ public final class FOPropertyMapping imp
         m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
         m.setDefault("auto");
         addPropertyMaker("z-index", m);
+
+        // fox:layer
+        m  = new StringProperty.Maker(PR_X_LAYER);
+        m.setInherited(false);
+        m.setDefault("");
+        addPropertyMaker("fox:layer", m);
+
     }
 
     private void createShorthandProperties() {

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/FObj.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/FObj.java Thu Jan 30 15:51:03 2014
@@ -74,7 +74,8 @@ public abstract class FObj extends FONod
     private int bidiLevel = -1;
 
     // The value of properties relevant for all fo objects
-    private String id = null;
+    private String id;
+    private String layer;
     // End of property values
 
     /**
@@ -148,7 +149,7 @@ public abstract class FObj extends FONod
             String attributeName = attList.getQName(i);
             String attributeValue = attList.getValue(i);
             Property prop = propertyList.getPropertyForAttribute(attList, attributeName, attributeValue);
-            if (prop.equals(value)) {
+            if (prop != null && prop.equals(value)) {
                 return attributeName;
             }
         }
@@ -173,6 +174,7 @@ public abstract class FObj extends FONod
      */
     public void bind(PropertyList pList) throws FOPException {
         id = pList.get(PR_ID).getString();
+        layer = pList.get(PR_X_LAYER).getString();
     }
 
     /**
@@ -583,6 +585,16 @@ public abstract class FObj extends FONod
         return (id != null && id.length() > 0);
     }
 
+    /** @return the "layer" property. */
+    public String getLayer() {
+        return layer;
+    }
+
+    /** @return whether this object has an layer set */
+    public boolean hasLayer() {
+        return (layer != null && layer.length() > 0);
+    }
+
     /** {@inheritDoc} */
     public String getNamespaceURI() {
         return FOElementMapping.URI;
@@ -611,7 +623,7 @@ public abstract class FObj extends FONod
         if (bidiLevel >= 0) {
             if ((this.bidiLevel < 0) || (bidiLevel < this.bidiLevel)) {
                 this.bidiLevel = bidiLevel;
-                if (parent != null) {
+                if ((parent != null) && !isBidiPropagationBoundary()) {
                     FObj foParent = (FObj) parent;
                     int parentBidiLevel = foParent.getBidiLevel();
                     if ((parentBidiLevel < 0) || (bidiLevel < parentBidiLevel)) {
@@ -646,10 +658,25 @@ public abstract class FObj extends FONod
                     return level;
                 }
             }
+            if (isBidiInheritanceBoundary()) {
+                break;
+            }
         }
         return -1;
     }
 
+    protected boolean isBidiBoundary(boolean propagate) {
+        return false;
+    }
+
+    private boolean isBidiInheritanceBoundary() {
+        return isBidiBoundary(false);
+    }
+
+    private boolean isBidiPropagationBoundary() {
+        return isBidiBoundary(true);
+    }
+
     /**
      * Add a new extension attachment to this FObj.
      * (see org.apache.fop.fo.FONode for details)

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/expr/FunctionBase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/expr/FunctionBase.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/expr/FunctionBase.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/expr/FunctionBase.java Thu Jan 30 15:51:03 2014
@@ -36,7 +36,8 @@ public abstract class FunctionBase imple
     /** {@inheritDoc} */
     public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
         if (index >= getOptionalArgsCount()) {
-            PropertyException e = new PropertyException(new IndexOutOfBoundsException("illegal optional argument index"));
+            PropertyException e = new PropertyException(
+                    new IndexOutOfBoundsException("illegal optional argument index"));
             e.setPropertyInfo(pi);
             throw e;
         } else {

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/expr/PropertyParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/expr/PropertyParser.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/expr/PropertyParser.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/expr/PropertyParser.java Thu Jan 30 15:51:03 2014
@@ -385,7 +385,8 @@ public final class PropertyParser extend
         }
         int numArgs = args.size();
         if (numArgs < numReq) {
-            throw new PropertyException("Expected " + numReq + " required arguments, but only " + numArgs + " specified");
+            throw new PropertyException("Expected " + numReq + " required arguments, but only "
+                    + numArgs + " specified");
         } else {
             for (int i = 0; i < numOpt; i++) {
                 if (args.size() < (numReq + i + 1)) {

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java Thu Jan 30 15:51:03 2014
@@ -66,6 +66,8 @@ public class ExtensionElementMapping ext
         PROPERTY_ATTRIBUTES.add("border-before-end-radius");
         PROPERTY_ATTRIBUTES.add("border-after-start-radius");
         PROPERTY_ATTRIBUTES.add("border-after-end-radius");
+        //Optional content groups (layers)
+        PROPERTY_ATTRIBUTES.add("layer");
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/BlockContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/BlockContainer.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/BlockContainer.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/BlockContainer.java Thu Jan 30 15:51:03 2014
@@ -98,7 +98,8 @@ public class BlockContainer extends FObj
         referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric();
         span = pList.get(PR_SPAN).getEnum();
         writingModeTraits = new WritingModeTraits(
-            WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()));
+            WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()),
+            pList.getExplicit(PR_WRITING_MODE) != null);
         disableColumnBalancing = pList.get(PR_X_DISABLE_COLUMN_BALANCING).getEnum();
     }
 
@@ -280,6 +281,14 @@ public class BlockContainer extends FObj
         return writingModeTraits.getWritingMode();
     }
 
+    /**
+     * Obtain writing mode explicit indicator.
+     * @return the writing mode explicit indicator
+     */
+    public boolean getExplicitWritingMode() {
+        return writingModeTraits.getExplicitWritingMode();
+    }
+
     /** {@inheritDoc} */
     public String getLocalName() {
         return "block-container";
@@ -292,5 +301,10 @@ public class BlockContainer extends FObj
     public int getNameId() {
         return FO_BLOCK_CONTAINER;
     }
-}
 
+    @Override
+    protected boolean isBidiBoundary(boolean propagate) {
+        return getExplicitWritingMode();
+    }
+
+}

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/InlineContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/InlineContainer.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/InlineContainer.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/InlineContainer.java Thu Jan 30 15:51:03 2014
@@ -37,49 +37,38 @@ import org.apache.fop.traits.Direction;
 import org.apache.fop.traits.WritingMode;
 import org.apache.fop.traits.WritingModeTraits;
 
-/**
- * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_inline-container">
- * <code>fo:inline-container</code></a> object.
- */
 public class InlineContainer extends FObj {
 
-    // The value of FO traits (refined properties) that apply to fo:inline-container.
-    private Length alignmentAdjust;
-    private int alignmentBaseline;
-    private Length baselineShift;
+    private LengthRangeProperty inlineProgressionDimension;
     private LengthRangeProperty blockProgressionDimension;
+    private int overflow;
     private CommonBorderPaddingBackground commonBorderPaddingBackground;
     private CommonMarginInline commonMarginInline;
-    private int clip;
-    private int dominantBaseline;
-    private LengthRangeProperty inlineProgressionDimension;
+    private Numeric referenceOrientation;
+    private int displayAlign;
     private KeepProperty keepTogether;
+    private KeepProperty keepWithNext;
+    private KeepProperty keepWithPrevious;
     private SpaceProperty lineHeight;
-    private int overflow;
-    private Numeric referenceOrientation;
+    private Length alignmentAdjust;
+    private int alignmentBaseline;
+    private Length baselineShift;
+    private int dominantBaseline;
     private WritingModeTraits writingModeTraits;
-    // Unused but valid items, commented out for performance:
-    //     private CommonRelativePosition commonRelativePosition;
-    //     private int displayAlign;
-    //     private Length height;
-    //     private KeepProperty keepWithNext;
-    //     private KeepProperty keepWithPrevious;
-    //     private Length width;
-    // End of FO trait values
 
     /** used for FO validation */
-    private boolean blockItemFound = false;
+    private boolean blockItemFound;
 
     /**
-     * Base constructor
+     * Creates a new instance.
      *
-     * @param parent {@link FONode} that is the parent of this object
+     * @param parent the parent of this inline-container
      */
     public InlineContainer(FONode parent) {
         super(parent);
     }
 
-    /** {@inheritDoc} */
+    @Override
     public void bind(PropertyList pList) throws FOPException {
         super.bind(pList);
         alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST).getLength();
@@ -88,27 +77,31 @@ public class InlineContainer extends FOb
         blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
         commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
         commonMarginInline = pList.getMarginInlineProps();
-        clip = pList.get(PR_CLIP).getEnum();
+        displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum();
         dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum();
         inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange();
         keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
+        keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep();
+        keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep();
         lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
         overflow = pList.get(PR_OVERFLOW).getEnum();
         referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric();
         writingModeTraits = new WritingModeTraits(
-            WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()));
+                WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()),
+                pList.getExplicit(PR_WRITING_MODE) != null);
     }
 
     /**
      * {@inheritDoc}
      * <br>XSL Content Model: marker* (%block;)+
      */
+    @Override
     protected void validateChildNode(Locator loc, String nsURI, String localName)
                 throws ValidationException {
         if (FO_URI.equals(nsURI)) {
             if (localName.equals("marker")) {
                 if (blockItemFound) {
-                   nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+                   nodesOutOfOrderError(loc, "fo:marker", "(%block;)+");
                 }
             } else if (!isBlockItem(nsURI, localName)) {
                 invalidChildError(loc, nsURI, localName);
@@ -118,142 +111,131 @@ public class InlineContainer extends FOb
         }
     }
 
-    /** {@inheritDoc} */
+    @Override
     public void endOfNode() throws FOPException {
         if (!blockItemFound) {
             missingChildElementError("marker* (%block;)+");
         }
     }
 
-    /** @return the "alignment-adjust" FO trait */
-    public Length getAlignmentAdjust() {
-        return alignmentAdjust;
+    /** {@inheritDoc} */
+    public String getLocalName() {
+        return "inline-container";
     }
 
-    /** @return the "alignment-baseline" FO trait */
-    public int getAlignmentBaseline() {
-        return alignmentBaseline;
+    /**
+     * {@inheritDoc}
+     * @return {@link org.apache.fop.fo.Constants#FO_INLINE_CONTAINER}
+     */
+    public int getNameId() {
+        return FO_INLINE_CONTAINER;
     }
 
-    /** @return the "baseline-shift" FO trait */
-    public Length getBaselineShift() {
-        return baselineShift;
+    public LengthRangeProperty getInlineProgressionDimension() {
+        return inlineProgressionDimension;
     }
 
-    /** @return the "block-progression-dimension" FO trait */
     public LengthRangeProperty getBlockProgressionDimension() {
         return blockProgressionDimension;
     }
 
-    /** @return the "clip" FO trait */
-    public int getClip() {
-        return clip;
+    public int getOverflow() {
+        return overflow;
     }
 
-    /**@return Returns the {@link CommonBorderPaddingBackground} */
     public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
         return this.commonBorderPaddingBackground;
     }
 
-    /** @return Returns the {@link CommonMarginInline} */
     public CommonMarginInline getCommonMarginInline() {
         return this.commonMarginInline;
     }
 
-    /** @return the "dominant-baseline" FO trait */
-    public int getDominantBaseline() {
-        return dominantBaseline;
+    public int getReferenceOrientation() {
+        return referenceOrientation.getValue();
+    }
+
+    public int getDisplayAlign() {
+        return this.displayAlign;
+    }
+
+    public KeepProperty getKeepWithPrevious() {
+        return keepWithPrevious;
     }
 
-    /** @return the "keep-together" FO trait */
     public KeepProperty getKeepTogether() {
         return keepTogether;
     }
 
-    /** @return the "inline-progression-dimension" FO trait */
-    public LengthRangeProperty getInlineProgressionDimension() {
-        return inlineProgressionDimension;
+    public KeepProperty getKeepWithNext() {
+        return keepWithNext;
     }
 
-    /** @return the "line-height" FO trait */
     public SpaceProperty getLineHeight() {
         return lineHeight;
     }
 
-    /** @return the "overflow" FO trait */
-    public int getOverflow() {
-        return overflow;
+    public Length getAlignmentAdjust() {
+        return alignmentAdjust;
     }
 
-    /** @return the "reference-orientation" FO trait */
-    public int getReferenceOrientation() {
-        return referenceOrientation.getValue();
+    public int getAlignmentBaseline() {
+        return alignmentBaseline;
+    }
+
+    public Length getBaselineShift() {
+        return baselineShift;
+    }
+
+    public int getDominantBaseline() {
+        return dominantBaseline;
+    }
+
+    public WritingMode getWritingMode() {
+        return writingModeTraits.getWritingMode();
     }
 
     /**
-     * Obtain inline progression direction.
-     * @return the inline progression direction
+     * Obtain writing mode explicit indicator.
+     * @return the writing mode explicit indicator
      */
+    public boolean getExplicitWritingMode() {
+        return writingModeTraits.getExplicitWritingMode();
+    }
+
     public Direction getInlineProgressionDirection() {
         return writingModeTraits.getInlineProgressionDirection();
     }
 
-    /**
-     * Obtain block progression direction.
-     * @return the block progression direction
-     */
     public Direction getBlockProgressionDirection() {
         return writingModeTraits.getBlockProgressionDirection();
     }
 
-    /**
-     * Obtain column progression direction.
-     * @return the column progression direction
-     */
     public Direction getColumnProgressionDirection() {
         return writingModeTraits.getColumnProgressionDirection();
     }
 
-    /**
-     * Obtain row progression direction.
-     * @return the row progression direction
-     */
     public Direction getRowProgressionDirection() {
         return writingModeTraits.getRowProgressionDirection();
     }
 
-    /**
-     * Obtain (baseline) shift direction.
-     * @return the (baseline) shift direction
-     */
     public Direction getShiftDirection() {
         return writingModeTraits.getShiftDirection();
     }
 
-    /**
-     * Obtain writing mode.
-     * @return the writing mode
-     */
-    public WritingMode getWritingMode() {
-        return writingModeTraits.getWritingMode();
-    }
-
-    /** {@inheritDoc} */
-    public String getLocalName() {
-        return "inline-container";
+    @Override
+    public boolean isDelimitedTextRangeBoundary(int boundary) {
+        return false;
     }
 
-    /**
-     * {@inheritDoc}
-     * @return {@link org.apache.fop.fo.Constants#FO_INLINE_CONTAINER}
-     */
-    public int getNameId() {
-        return FO_INLINE_CONTAINER;
+    @Override
+    public boolean generatesReferenceAreas() {
+        return true;
     }
 
     @Override
-    public boolean isDelimitedTextRangeBoundary(int boundary) {
-        return false;
+    protected boolean isBidiBoundary(boolean propagate) {
+        return getExplicitWritingMode();
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/table/Table.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/table/Table.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/table/Table.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/flow/table/Table.java Thu Jan 30 15:51:03 2014
@@ -139,7 +139,8 @@ public class Table extends TableFObj imp
         tableOmitFooterAtBreak = pList.get(PR_TABLE_OMIT_FOOTER_AT_BREAK).getEnum();
         tableOmitHeaderAtBreak = pList.get(PR_TABLE_OMIT_HEADER_AT_BREAK).getEnum();
         writingModeTraits = new WritingModeTraits(
-            WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()));
+            WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()),
+            pList.getExplicit(PR_WRITING_MODE) != null);
 
         //Bind extension properties
         widowContentLimit = pList.get(PR_X_WIDOW_CONTENT_LIMIT).getLength();
@@ -554,6 +555,11 @@ public class Table extends TableFObj imp
         return writingModeTraits.getWritingMode();
     }
 
+    /** {@inheritDoc} */
+    public boolean getExplicitWritingMode() {
+        return writingModeTraits.getExplicitWritingMode();
+    }
+
     /** @return the "fox:widow-content-limit" extension FO trait */
     public Length getWidowContentLimit() {
         return widowContentLimit;
@@ -620,4 +626,9 @@ public class Table extends TableFObj imp
         return ranges;
     }
 
+    @Override
+    protected boolean isBidiBoundary(boolean propagate) {
+        return getExplicitWritingMode();
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/pagination/PageSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/pagination/PageSequence.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/pagination/PageSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/pagination/PageSequence.java Thu Jan 30 15:51:03 2014
@@ -96,7 +96,8 @@ public class PageSequence extends Abstra
         masterReference = pList.get(PR_MASTER_REFERENCE).getString();
         referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric();
         writingModeTraits = new WritingModeTraits(
-            WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()));
+            WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()),
+            pList.getExplicit(PR_WRITING_MODE) != null);
         if (masterReference == null || masterReference.equals("")) {
             missingPropertyError("master-reference");
         }
@@ -403,6 +404,16 @@ public class PageSequence extends Abstra
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean getExplicitWritingMode() {
+        if (writingModeTraits != null) {
+            return writingModeTraits.getExplicitWritingMode();
+        } else {
+            return false;
+        }
+    }
 
     @Override
     protected Stack collectDelimitedTextRanges(Stack ranges, DelimitedTextRange currentRange) {
@@ -423,6 +434,11 @@ public class PageSequence extends Abstra
         return ranges;
     }
 
+    @Override
+    protected boolean isBidiBoundary(boolean propagate) {
+        return true;
+    }
+
     /**
      * Releases a page-sequence's children after the page-sequence has been fully processed.
      */

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java Thu Jan 30 15:51:03 2014
@@ -83,13 +83,17 @@ public class GenericShorthandParser impl
                                                PropertyList propertyList)
                     throws PropertyException {
         Property prop = null;
+        String vProperty = "";
         // Try each of the stored values in turn
         Iterator iprop = property.getList().iterator();
         while (iprop.hasNext() && prop == null) {
             Property p = (Property)iprop.next();
+            if (p.getNCname() != null) {
+                vProperty += p.getNCname() + " ";
+            }
             prop = maker.convertShorthandProperty(propertyList, p, null);
-            propertyList.validatePropertyValue(p.getNCname(), prop, property);
         }
+        propertyList.validatePropertyValue(vProperty.trim(), prop, property);
         return prop;
     }
 

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontLoader.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontLoader.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontLoader.java Thu Jan 30 15:51:03 2014
@@ -26,7 +26,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.fop.apps.io.InternalResourceResolver;
-import org.apache.fop.fonts.truetype.TTFFontLoader;
+import org.apache.fop.fonts.truetype.OFFontLoader;
 import org.apache.fop.fonts.type1.Type1FontLoader;
 
 /**
@@ -105,7 +105,7 @@ public abstract class FontLoader {
             }
             loader = new Type1FontLoader(fontFileURI, embedded, useKerning, resourceResolver);
         } else {
-            loader = new TTFFontLoader(fontFileURI, subFontName, embedded, embeddingMode,
+            loader = new OFFontLoader(fontFileURI, subFontName, embedded, embeddingMode,
                     encodingMode, useKerning, useAdvanced, resourceResolver);
         }
         return loader.getFont();

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontManagerConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontManagerConfigurator.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontManagerConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontManagerConfigurator.java Thu Jan 30 15:51:03 2014
@@ -48,20 +48,24 @@ public class FontManagerConfigurator {
 
     private final Configuration cfg;
 
-    private final URI defaultBaseUri;
+    private final URI baseURI;
+
+    private final URI fallbackURI;
 
     private final ResourceResolver resourceResolver;
 
     /**
      * Main constructor
      * @param cfg the font manager configuration object
-     * @param defaultBaseUri the default URI base to use for URI resolution
+     * @param baseURI the URI against which to resolve relative URIs
+     * @param fallbackURI the URI to use as a fallback if font-base is unspecified
      * @param resourceResolver the resource resolver
      */
-    public FontManagerConfigurator(Configuration cfg, URI defaultBaseUri,
+    public FontManagerConfigurator(Configuration cfg, URI baseURI, URI fallbackURI,
             ResourceResolver resourceResolver) {
         this.cfg = cfg;
-        this.defaultBaseUri = defaultBaseUri;
+        this.baseURI = baseURI;
+        this.fallbackURI = fallbackURI;
         this.resourceResolver = resourceResolver;
     }
 
@@ -77,13 +81,13 @@ public class FontManagerConfigurator {
                 URI fontBase = InternalResourceResolver.getBaseURI(cfg.getChild("font-base")
                                                                       .getValue(null));
                 fontManager.setResourceResolver(ResourceResolverFactory.createInternalResourceResolver(
-                        defaultBaseUri.resolve(fontBase), resourceResolver));
+                        baseURI.resolve(fontBase), resourceResolver));
             } catch (URISyntaxException use) {
                 LogUtil.handleException(log, use, true);
             }
         } else {
             fontManager.setResourceResolver(ResourceResolverFactory.createInternalResourceResolver(
-                    defaultBaseUri, resourceResolver));
+                    fallbackURI, resourceResolver));
         }
         // caching (fonts)
         if (cfg.getChild("use-cache", false) != null) {

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontTriplet.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/FontTriplet.java Thu Jan 30 15:51:03 2014
@@ -27,7 +27,8 @@ import java.io.Serializable;
  */
 public class FontTriplet implements Comparable<FontTriplet>, Serializable {
 
-    public static final FontTriplet DEFAULT_FONT_TRIPLET = new FontTriplet("any", Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
+    public static final FontTriplet DEFAULT_FONT_TRIPLET
+            = new FontTriplet("any", Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
 
     /** serial version UID */
     private static final long serialVersionUID = 1168991106658033508L;

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/MultiByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/MultiByteFont.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/MultiByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/MultiByteFont.java Thu Jan 30 15:51:03 2014
@@ -23,6 +23,7 @@ import java.awt.Rectangle;
 import java.nio.CharBuffer;
 import java.nio.IntBuffer;
 import java.util.BitSet;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -71,6 +72,15 @@ public class MultiByteFont extends CIDFo
     /** Contains the character bounding boxes for all characters in the font */
     protected Rectangle[] boundingBoxes;
 
+    private boolean isOTFFile = false;
+
+    // since for most users the most likely glyphs are in the first cmap segments we store their mapping.
+    private static final int NUM_MOST_LIKELY_GLYPHS = 256;
+    private int[] mostLikelyGlyphs = new int[NUM_MOST_LIKELY_GLYPHS];
+
+    //A map to store each used glyph from the CID set against the glyph name.
+    private LinkedHashMap<Integer, String> usedGlyphNames = new LinkedHashMap<Integer, String>();
+
     /**
      * Default constructor
      */
@@ -115,6 +125,14 @@ public class MultiByteFont extends CIDFo
         return cidType;
     }
 
+    public void setIsOTFFile(boolean isOTFFile) {
+        this.isOTFFile = isOTFFile;
+    }
+
+    public boolean isOTFFile() {
+        return this.isOTFFile;
+    }
+
     /**
      * Sets the CIDType.
      * @param cidType The cidType to set
@@ -151,6 +169,14 @@ public class MultiByteFont extends CIDFo
         return this.cidSet;
     }
 
+    public void mapUsedGlyphName(int gid, String value) {
+        usedGlyphNames.put(gid, value);
+    }
+
+    public LinkedHashMap<Integer, String> getUsedGlyphNames() {
+        return usedGlyphNames;
+    }
+
     /** {@inheritDoc} */
     @Override
     public String getEncodingName() {
@@ -187,10 +213,15 @@ public class MultiByteFont extends CIDFo
      * @return the glyph index (or 0 if the glyph is not available)
      */
     // [TBD] - needs optimization, i.e., change from linear search to binary search
-    private int findGlyphIndex(int c) {
+    public int findGlyphIndex(int c) {
         int idx = c;
         int retIdx = SingleByteEncoding.NOT_FOUND_CODE_POINT;
 
+        // for most users the most likely glyphs are in the first cmap segments (meaning the one with
+        // the lowest unicode start values)
+        if (idx < NUM_MOST_LIKELY_GLYPHS && mostLikelyGlyphs[idx] != 0) {
+            return mostLikelyGlyphs[idx];
+        }
         for (int i = 0; (i < cmap.length) && retIdx == 0; i++) {
             if (cmap[i].getUnicodeStart() <= idx
                     && cmap[i].getUnicodeEnd() >= idx) {
@@ -198,6 +229,9 @@ public class MultiByteFont extends CIDFo
                 retIdx = cmap[i].getGlyphStartIndex()
                     + idx
                     - cmap[i].getUnicodeStart();
+                if (idx < NUM_MOST_LIKELY_GLYPHS) {
+                    mostLikelyGlyphs[idx] = retIdx;
+                }
             }
         }
         return retIdx;
@@ -291,22 +325,6 @@ public class MultiByteFont extends CIDFo
         return findCharacterFromGlyphIndex(gi, true);
     }
 
-
-    /** {@inheritDoc} */
-    @Override
-    public char mapChar(char c) {
-        notifyMapOperation();
-        int glyphIndex = findGlyphIndex(c);
-        if (glyphIndex == SingleByteEncoding.NOT_FOUND_CODE_POINT) {
-            warnMissingGlyph(c);
-            glyphIndex = findGlyphIndex(Typeface.NOT_FOUND);
-        }
-        if (isEmbeddable()) {
-            glyphIndex = cidSet.mapChar(glyphIndex, c);
-        }
-        return (char) glyphIndex;
-    }
-
     protected BitSet getGlyphIndices() {
         BitSet bitset = new BitSet();
         bitset.set(0);
@@ -339,6 +357,23 @@ public class MultiByteFont extends CIDFo
 
     /** {@inheritDoc} */
     @Override
+    public char mapChar(char c) {
+        notifyMapOperation();
+        int glyphIndex = findGlyphIndex(c);
+        if (glyphIndex == SingleByteEncoding.NOT_FOUND_CODE_POINT) {
+            warnMissingGlyph(c);
+            if (!isOTFFile) {
+                glyphIndex = findGlyphIndex(Typeface.NOT_FOUND);
+            }
+        }
+        if (isEmbeddable()) {
+            glyphIndex = cidSet.mapChar(glyphIndex, c);
+        }
+        return (char) glyphIndex;
+    }
+
+    /** {@inheritDoc} */
+    @Override
     public boolean hasChar(char c) {
         return (findGlyphIndex(c) != SingleByteEncoding.NOT_FOUND_CODE_POINT);
     }

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/SingleByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/SingleByteFont.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/SingleByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/SingleByteFont.java Thu Jan 30 15:51:03 2014
@@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.xmlgraphics.fonts.Glyphs;
 
 import org.apache.fop.apps.io.InternalResourceResolver;
-import org.apache.fop.fonts.truetype.TTFFile.PostScriptVersion;
+import org.apache.fop.fonts.truetype.OpenFont.PostScriptVersion;
 
 /**
  * Generic SingleByte font

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/AbstractFontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/AbstractFontReader.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/AbstractFontReader.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/AbstractFontReader.java Thu Jan 30 15:51:03 2014
@@ -32,8 +32,6 @@ import javax.xml.transform.TransformerFa
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.fop.util.CommandLineLogger;
-
 /**
  * Abstract base class for the PFM and TTF Reader command-line applications.
  */
@@ -90,10 +88,6 @@ public abstract class AbstractFontReader
     protected static void setLogLevel(String level) {
         // Set the evel for future loggers.
         LogFactory.getFactory().setAttribute("level", level);
-        if (log instanceof CommandLineLogger) {
-            // Set the level for the logger creates already.
-            ((CommandLineLogger) log).setLogLevel(level);
-        }
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/PFMReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/PFMReader.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/PFMReader.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/PFMReader.java Thu Jan 30 15:51:03 2014
@@ -29,11 +29,8 @@ import javax.xml.parsers.DocumentBuilder
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.Version;
 import org.apache.fop.fonts.type1.PFMFile;
-import org.apache.fop.util.CommandLineLogger;
 
 /**
  * A tool which reads PFM files from Adobe Type 1 fonts and creates
@@ -92,14 +89,6 @@ public class PFMReader extends AbstractF
         Map options = new java.util.HashMap();
         String[] arguments = parseArguments(options, args);
 
-        // Enable the simple command line logging when no other logger is
-        // defined.
-        LogFactory logFactory = LogFactory.getFactory();
-        if (System.getProperty("org.apache.commons.logging.Log") == null) {
-            logFactory.setAttribute("org.apache.commons.logging.Log",
-                                            CommandLineLogger.class.getName());
-        }
-
         determineLogLevel(options);
 
         PFMReader app = new PFMReader();

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/TTFReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/TTFReader.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/TTFReader.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/apps/TTFReader.java Thu Jan 30 15:51:03 2014
@@ -32,16 +32,13 @@ import org.w3c.dom.Element;
 import org.xml.sax.Attributes;
 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.OFFontLoader;
 import org.apache.fop.fonts.truetype.TTFFile;
-import org.apache.fop.util.CommandLineLogger;
 
-// CSOFF: InnerAssignmentCheck
 // CSOFF: LineLengthCheck
 
 /**
@@ -123,14 +120,6 @@ public class TTFReader extends AbstractF
         Map options = new java.util.HashMap();
         String[] arguments = parseArguments(options, args);
 
-        // Enable the simple command line logging when no other logger is
-        // defined.
-        LogFactory logFactory = LogFactory.getFactory();
-        if (System.getProperty("org.apache.commons.logging.Log") == null) {
-            logFactory.setAttribute("org.apache.commons.logging.Log",
-                                            CommandLineLogger.class.getName());
-        }
-
         determineLogLevel(options);
 
         TTFReader app = new TTFReader();
@@ -224,7 +213,8 @@ public class TTFReader extends AbstractF
         InputStream stream = new FileInputStream(fileName);
         try {
             FontFileReader reader = new FontFileReader(stream);
-            boolean supported = ttfFile.readFont(reader, fontName);
+            String header = OFFontLoader.readHeader(reader);
+            boolean supported = ttfFile.readFont(reader, header, fontName);
             if (!supported) {
                 return null;
             }

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java Thu Jan 30 15:51:03 2014
@@ -43,8 +43,8 @@ import org.apache.fop.fonts.FontTriplet;
 import org.apache.fop.fonts.FontUtil;
 import org.apache.fop.fonts.MultiByteFont;
 import org.apache.fop.fonts.truetype.FontFileReader;
+import org.apache.fop.fonts.truetype.OFFontLoader;
 import org.apache.fop.fonts.truetype.TTFFile;
-import org.apache.fop.fonts.truetype.TTFFontLoader;
 
 /**
  * Attempts to determine correct FontInfo
@@ -220,7 +220,7 @@ public class FontInfoFinder {
                     log.debug("Loading " + fontName);
                 }
                 try {
-                    TTFFontLoader ttfLoader = new TTFFontLoader(fontURI, fontName, true,
+                    OFFontLoader ttfLoader = new OFFontLoader(fontURI, fontName, true,
                             EmbeddingMode.AUTO, EncodingMode.AUTO, useKerning, useAdvanced,
                             resourceResolver);
                     customFont = ttfLoader.getFont();

Modified: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/GlyfTable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/GlyfTable.java?rev=1562866&r1=1562865&r2=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/GlyfTable.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/GlyfTable.java Thu Jan 30 15:51:03 2014
@@ -31,7 +31,7 @@ import java.util.TreeSet;
  */
 public class GlyfTable {
 
-    private final TTFMtxEntry[] mtxTab;
+    private final OFMtxEntry[] mtxTab;
 
     private final long tableOffset;
 
@@ -47,7 +47,7 @@ public class GlyfTable {
     /** All the glyphs that are composed, but do not appear in the subset. */
     private Set<Integer> composedGlyphs = new TreeSet<Integer>();
 
-    GlyfTable(FontFileReader in, TTFMtxEntry[] metrics, TTFDirTabEntry dirTableEntry,
+    GlyfTable(FontFileReader in, OFMtxEntry[] metrics, OFDirTabEntry dirTableEntry,
             Map<Integer, Integer> glyphs) throws IOException {
         mtxTab = metrics;
         tableOffset = dirTableEntry.getOffset();

Copied: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java (from r1562799, xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java?p2=xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java&p1=xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java&r1=1562799&r2=1562866&rev=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java Thu Jan 30 15:51:03 2014
@@ -19,6 +19,7 @@
 
 package org.apache.fop.fonts.truetype;
 
+import java.awt.Rectangle;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
@@ -149,6 +150,10 @@ public class OFFontLoader extends FontLo
         returnFont.setAscender(otf.getLowerCaseAscent());
         returnFont.setDescender(otf.getLowerCaseDescent());
         returnFont.setFontBBox(otf.getFontBBox());
+        returnFont.setUnderlinePosition(otf.getUnderlinePosition() - otf.getUnderlineThickness() / 2);
+        returnFont.setUnderlineThickness(otf.getUnderlineThickness());
+        returnFont.setStrikeoutPosition(otf.getStrikeoutPosition() - otf.getStrikeoutThickness() / 2);
+        returnFont.setStrikeoutThickness(otf.getStrikeoutThickness());
         returnFont.setFlags(otf.getFlags());
         returnFont.setStemV(Integer.parseInt(otf.getStemV())); //not used for TTF
         returnFont.setItalicAngle(Integer.parseInt(otf.getItalicAngle()));
@@ -161,15 +166,15 @@ public class OFFontLoader extends FontLo
             } else {
                 multiFont.setCIDType(CIDFontType.CIDTYPE2);
             }
-            int[] wx = otf.getWidths();
-            multiFont.setWidthArray(wx);
+            multiFont.setWidthArray(otf.getWidths());
+            multiFont.setBBoxArray(otf.getBoundingBoxes());
         } else {
             singleFont.setFontType(FontType.TRUETYPE);
             singleFont.setEncoding(otf.getCharSetName());
             returnFont.setFirstChar(otf.getFirstChar());
             returnFont.setLastChar(otf.getLastChar());
             singleFont.setTrueTypePostScriptVersion(otf.getPostScriptVersion());
-            copyWidthsSingleByte(otf);
+            copyGlyphMetricsSingleByte(otf);
         }
         returnFont.setCMap(getCMap(otf));
 
@@ -195,10 +200,14 @@ public class OFFontLoader extends FontLo
         return otf.getCMaps().toArray(array);
     }
 
-    private void copyWidthsSingleByte(OpenFont otf) {
+    private void copyGlyphMetricsSingleByte(OpenFont otf) {
         int[] wx = otf.getWidths();
+        Rectangle[] bboxes = otf.getBoundingBoxes();
         for (int i = singleFont.getFirstChar(); i <= singleFont.getLastChar(); i++) {
             singleFont.setWidth(i, otf.getCharWidth(i));
+            int[] bbox = otf.getBBox(i);
+            singleFont.setBoundingBox(i,
+                    new Rectangle(bbox[0], bbox[1], bbox[2] - bbox[0], bbox[3] - bbox[1]));
         }
 
         for (CMapSegment segment : otf.getCMaps()) {
@@ -214,7 +223,7 @@ public class OFFontLoader extends FontLo
                         if (glyphName.length() > 0) {
                             String unicode = Character.toString(u);
                             NamedCharacter nc = new NamedCharacter(glyphName, unicode);
-                            singleFont.addUnencodedCharacter(nc, wx[glyphIndex]);
+                            singleFont.addUnencodedCharacter(nc, wx[glyphIndex], bboxes[glyphIndex]);
                         }
                     }
                 }

Copied: xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/OpenFont.java (from r1562799, xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OpenFont.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/OpenFont.java?p2=xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/OpenFont.java&p1=xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OpenFont.java&r1=1562799&r2=1562866&rev=1562866&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/OpenFont.java (original)
+++ xmlgraphics/fop/branches/Temp_FopFontsForSVG/src/java/org/apache/fop/fonts/truetype/OpenFont.java Thu Jan 30 15:51:03 2014
@@ -19,6 +19,7 @@
 
 package org.apache.fop.fonts.truetype;
 
+import java.awt.Rectangle;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -195,6 +196,10 @@ public abstract class OpenFont {
     private int fontBBox4 = 0;
     private int capHeight = 0;
     private int os2CapHeight = 0;
+    private int underlinePosition;
+    private int underlineThickness;
+    private int strikeoutPosition;
+    private int strikeoutThickness;
     private int xHeight = 0;
     private int os2xHeight = 0;
     //Effective ascender/descender
@@ -995,10 +1000,22 @@ public abstract class OpenFont {
         for (int i = 0; i < wx.length; i++) {
             wx[i] = convertTTFUnit2PDFUnit(mtxTab[i].getWx());
         }
-
         return wx;
     }
 
+    public Rectangle[] getBoundingBoxes() {
+        Rectangle[] boundingBoxes = new Rectangle[mtxTab.length];
+        for (int i = 0; i < boundingBoxes.length; i++) {
+            int[] boundingBox = mtxTab[i].getBoundingBox();
+            boundingBoxes[i] = new Rectangle(
+                    convertTTFUnit2PDFUnit(boundingBox[0]),
+                    convertTTFUnit2PDFUnit(boundingBox[1]),
+                    convertTTFUnit2PDFUnit(boundingBox[2] - boundingBox[0]),
+                    convertTTFUnit2PDFUnit(boundingBox[3] - boundingBox[1]));
+        }
+        return boundingBoxes;
+    }
+
     /**
      * Returns an array (xMin, yMin, xMax, yMax) for a glyph.
      *
@@ -1039,6 +1056,22 @@ public abstract class OpenFont {
         return ansiKerningTab;
     }
 
+    public int getUnderlinePosition() {
+        return convertTTFUnit2PDFUnit(underlinePosition);
+    }
+
+    public int getUnderlineThickness() {
+        return convertTTFUnit2PDFUnit(underlineThickness);
+    }
+
+    public int getStrikeoutPosition() {
+        return convertTTFUnit2PDFUnit(strikeoutPosition);
+    }
+
+    public int getStrikeoutThickness() {
+        return convertTTFUnit2PDFUnit(strikeoutThickness);
+    }
+
     /**
      * Indicates if the font may be embedded.
      * @return boolean True if it may be embedded
@@ -1215,10 +1248,8 @@ public abstract class OpenFont {
         seekTab(fontFile, OFTableName.POST, 0);
         int postFormat = fontFile.readTTFLong();
         italicAngle = fontFile.readTTFULong();
-        //underlinePosition
-        fontFile.readTTFShort();
-        //underlineThickness
-        fontFile.readTTFShort();
+        underlinePosition = fontFile.readTTFShort();
+        underlineThickness = fontFile.readTTFShort();
         isFixedPitch = fontFile.readTTFULong();
 
         //Skip memory usage values
@@ -1322,7 +1353,10 @@ public abstract class OpenFont {
             } else {
                 isEmbeddable = true;
             }
-            fontFile.skip(11 * 2);
+            fontFile.skip(8 * 2);
+            strikeoutThickness = fontFile.readTTFShort();
+            strikeoutPosition = fontFile.readTTFShort();
+            fontFile.skip(2);
             fontFile.skip(10); //panose array
             fontFile.skip(4 * 4); //unicode ranges
             fontFile.skip(4);



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


Mime
View raw message