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 vh...@apache.org on 2012/04/05 18:20:17 UTC

svn commit: r1309921 [13/42] - in /xmlgraphics/fop/branches/Temp_TrueTypeInPostScript: ./ examples/embedding/ examples/embedding/java/embedding/ examples/embedding/java/embedding/atxml/ examples/embedding/java/embedding/tools/ examples/plan/src/org/apa...

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOPropertyMapping.java Thu Apr  5 16:19:19 2012
@@ -62,8 +62,9 @@ import org.apache.fop.fo.properties.Spac
 import org.apache.fop.fo.properties.SpacingPropertyMaker;
 import org.apache.fop.fo.properties.StringProperty;
 import org.apache.fop.fo.properties.TableBorderPrecedence;
-import org.apache.fop.fo.properties.TextDecorationProperty;
+import org.apache.fop.fo.properties.TextDecorationMaker;
 import org.apache.fop.fo.properties.ToBeImplementedProperty;
+import org.apache.fop.fo.properties.URIProperty;
 import org.apache.fop.fo.properties.VerticalAlignShorthandParser;
 import org.apache.fop.fo.properties.WhiteSpaceShorthandParser;
 import org.apache.fop.fo.properties.XMLLangShorthandParser;
@@ -79,11 +80,11 @@ public final class FOPropertyMapping imp
     private FOPropertyMapping() {
     }
 
-    private static Map propNames = new HashMap();               // CSOK: VisibilityModifier
-    private static Map subPropNames = new HashMap();            // CSOK: VisibilityModifier
-    private static Map propIds = new HashMap();                 // CSOK: VisibilityModifier
+    private static Map<String, Integer> propNames = new HashMap<String, Integer>();
+    private static Map<String, Integer> subPropNames = new HashMap<String, Integer>();
+    private static Map<Integer, String> propIds = new HashMap<Integer, String>();
 
-    private static PropertyMaker[] generics = null;             // CSOK: VisibilityModifier
+    private static PropertyMaker[] generics = null;
 
     // The rest is only used during the building of the generics array.
     private Property[] enums = null;
@@ -246,8 +247,8 @@ public final class FOPropertyMapping imp
      */
     private static void addPropertyMaker(String name, PropertyMaker maker) {
         generics[maker.getPropId()] = maker;
-        propNames.put(name, new Integer(maker.getPropId()));
-        propIds.put(new Integer(maker.getPropId()), name);
+        propNames.put(name, maker.getPropId());
+        propIds.put(maker.getPropId(), name);
     }
 
     /**
@@ -256,8 +257,8 @@ public final class FOPropertyMapping imp
      * @param id   Id for the subproperty from CP_* in Constants.java.
      */
     private static void addSubpropMakerName(String name, int id) {
-        subPropNames.put(name, new Integer(id));
-        propIds.put(new Integer(id), name);
+        subPropNames.put(name, id);
+        propIds.put(id, name);
     }
 
     /**
@@ -342,9 +343,9 @@ public final class FOPropertyMapping imp
      */
     public static int getPropertyId(String name) {
         if (name != null) {
-            Integer i = (Integer) propNames.get(name);
+            Integer i = propNames.get(name);
             if (i != null) {
-                return i.intValue();
+                return i;
             }
         }
         return -1;
@@ -357,9 +358,9 @@ public final class FOPropertyMapping imp
      */
     public static int getSubPropertyId(String name) {
         if (name != null) {
-            Integer i = (Integer) subPropNames.get(name);
+            Integer i = subPropNames.get(name);
             if (i != null) {
-                return i.intValue();
+                return i;
             }
         }
         return -1;
@@ -373,10 +374,10 @@ public final class FOPropertyMapping imp
     public static String getPropertyName(int id) {
         if (((id & Constants.COMPOUND_MASK) == 0)
                 || ((id & Constants.PROPERTY_MASK) == 0)) {
-            return (String) propIds.get(new Integer(id));
+            return propIds.get(id);
         } else {
-            return propIds.get(new Integer(id & Constants.PROPERTY_MASK))
-                    + "." + propIds.get(new Integer(id & Constants.COMPOUND_MASK));
+            return propIds.get(id & Constants.PROPERTY_MASK)
+                    + "." + propIds.get(id & Constants.COMPOUND_MASK);
         }
     }
 
@@ -631,7 +632,7 @@ public final class FOPropertyMapping imp
         m.setDefault("black");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_TOP_COLOR, PR_BORDER_TOP_COLOR,
-                PR_BORDER_RIGHT_COLOR);
+                              PR_BORDER_RIGHT_COLOR, PR_BORDER_LEFT_COLOR);
         corr.setRelative(true);
         addPropertyMaker("border-before-color", m);
 
@@ -640,7 +641,7 @@ public final class FOPropertyMapping imp
         m.useGeneric(genericBorderStyle);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_TOP_STYLE, PR_BORDER_TOP_STYLE,
-                PR_BORDER_RIGHT_STYLE);
+                              PR_BORDER_RIGHT_STYLE, PR_BORDER_LEFT_STYLE);
         corr.setRelative(true);
         addPropertyMaker("border-before-style", m);
 
@@ -650,7 +651,7 @@ public final class FOPropertyMapping imp
         m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_TOP_WIDTH, PR_BORDER_TOP_WIDTH,
-                PR_BORDER_RIGHT_WIDTH);
+                              PR_BORDER_RIGHT_WIDTH, PR_BORDER_LEFT_WIDTH);
         corr.setRelative(true);
         addPropertyMaker("border-before-width", m);
 
@@ -661,7 +662,7 @@ public final class FOPropertyMapping imp
         m.setDefault("black");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_BOTTOM_COLOR, PR_BORDER_BOTTOM_COLOR,
-                PR_BORDER_LEFT_COLOR);
+                              PR_BORDER_LEFT_COLOR, PR_BORDER_RIGHT_COLOR);
         corr.setRelative(true);
         addPropertyMaker("border-after-color", m);
 
@@ -670,7 +671,7 @@ public final class FOPropertyMapping imp
         m.useGeneric(genericBorderStyle);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_BOTTOM_STYLE, PR_BORDER_BOTTOM_STYLE,
-                PR_BORDER_LEFT_STYLE);
+                              PR_BORDER_LEFT_STYLE, PR_BORDER_RIGHT_STYLE);
         corr.setRelative(true);
         addPropertyMaker("border-after-style", m);
 
@@ -680,7 +681,7 @@ public final class FOPropertyMapping imp
         m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_BOTTOM_WIDTH, PR_BORDER_BOTTOM_WIDTH,
-                PR_BORDER_LEFT_WIDTH);
+                              PR_BORDER_LEFT_WIDTH, PR_BORDER_LEFT_WIDTH);
         corr.setRelative(true);
         addPropertyMaker("border-after-width", m);
 
@@ -691,7 +692,7 @@ public final class FOPropertyMapping imp
         m.setDefault("black");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_LEFT_COLOR, PR_BORDER_RIGHT_COLOR,
-                PR_BORDER_TOP_COLOR);
+                              PR_BORDER_TOP_COLOR, PR_BORDER_TOP_COLOR);
         corr.setRelative(true);
         addPropertyMaker("border-start-color", m);
 
@@ -700,7 +701,7 @@ public final class FOPropertyMapping imp
         m.useGeneric(genericBorderStyle);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_LEFT_STYLE, PR_BORDER_RIGHT_STYLE,
-                PR_BORDER_TOP_STYLE);
+                              PR_BORDER_TOP_STYLE, PR_BORDER_TOP_STYLE);
         corr.setRelative(true);
         addPropertyMaker("border-start-style", m);
 
@@ -710,7 +711,7 @@ public final class FOPropertyMapping imp
         m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_LEFT_WIDTH, PR_BORDER_RIGHT_WIDTH,
-                PR_BORDER_TOP_WIDTH);
+                              PR_BORDER_TOP_WIDTH, PR_BORDER_TOP_WIDTH);
         corr.setRelative(true);
         addPropertyMaker("border-start-width", m);
 
@@ -721,7 +722,7 @@ public final class FOPropertyMapping imp
         m.setDefault("black");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_RIGHT_COLOR, PR_BORDER_LEFT_COLOR,
-                PR_BORDER_BOTTOM_COLOR);
+                              PR_BORDER_BOTTOM_COLOR, PR_BORDER_BOTTOM_COLOR);
         corr.setRelative(true);
         addPropertyMaker("border-end-color", m);
 
@@ -730,7 +731,7 @@ public final class FOPropertyMapping imp
         m.useGeneric(genericBorderStyle);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_RIGHT_STYLE, PR_BORDER_LEFT_STYLE,
-                PR_BORDER_BOTTOM_STYLE);
+                              PR_BORDER_BOTTOM_STYLE, PR_BORDER_BOTTOM_STYLE);
         corr.setRelative(true);
         addPropertyMaker("border-end-style", m);
 
@@ -740,7 +741,7 @@ public final class FOPropertyMapping imp
         m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_RIGHT_WIDTH, PR_BORDER_LEFT_WIDTH,
-                PR_BORDER_BOTTOM_WIDTH);
+                              PR_BORDER_BOTTOM_WIDTH, PR_BORDER_BOTTOM_WIDTH);
         corr.setRelative(true);
         addPropertyMaker("border-end-width", m);
 
@@ -754,7 +755,7 @@ public final class FOPropertyMapping imp
         m.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_BEFORE_COLOR, PR_BORDER_BEFORE_COLOR,
-                PR_BORDER_START_COLOR);
+                              PR_BORDER_START_COLOR, PR_BORDER_START_COLOR);
         addPropertyMaker("border-top-color", m);
 
         // border-top-style
@@ -765,7 +766,7 @@ public final class FOPropertyMapping imp
         m.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_BEFORE_STYLE, PR_BORDER_BEFORE_STYLE,
-                PR_BORDER_START_STYLE);
+                              PR_BORDER_START_STYLE, PR_BORDER_START_STYLE);
         addPropertyMaker("border-top-style", m);
 
         // border-top-width
@@ -777,7 +778,7 @@ public final class FOPropertyMapping imp
         bwm.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(bwm);
         corr.setCorresponding(PR_BORDER_BEFORE_WIDTH, PR_BORDER_BEFORE_WIDTH,
-                PR_BORDER_START_WIDTH);
+                              PR_BORDER_START_WIDTH, PR_BORDER_START_WIDTH);
         addPropertyMaker("border-top-width", bwm);
 
         // border-bottom-color
@@ -790,7 +791,7 @@ public final class FOPropertyMapping imp
         m.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_AFTER_COLOR, PR_BORDER_AFTER_COLOR,
-                PR_BORDER_END_COLOR);
+                              PR_BORDER_END_COLOR, PR_BORDER_END_COLOR);
         addPropertyMaker("border-bottom-color", m);
 
         // border-bottom-style
@@ -801,7 +802,7 @@ public final class FOPropertyMapping imp
         m.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_AFTER_STYLE, PR_BORDER_AFTER_STYLE,
-                PR_BORDER_END_STYLE);
+                              PR_BORDER_END_STYLE, PR_BORDER_END_STYLE);
         addPropertyMaker("border-bottom-style", m);
 
         // border-bottom-width
@@ -813,7 +814,7 @@ public final class FOPropertyMapping imp
         bwm.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(bwm);
         corr.setCorresponding(PR_BORDER_AFTER_WIDTH, PR_BORDER_AFTER_WIDTH,
-                PR_BORDER_END_WIDTH);
+                              PR_BORDER_END_WIDTH, PR_BORDER_END_WIDTH);
         addPropertyMaker("border-bottom-width", bwm);
 
         // border-left-color
@@ -826,7 +827,7 @@ public final class FOPropertyMapping imp
         m.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_START_COLOR, PR_BORDER_END_COLOR,
-                PR_BORDER_AFTER_COLOR);
+                              PR_BORDER_AFTER_COLOR, PR_BORDER_BEFORE_COLOR);
         addPropertyMaker("border-left-color", m);
 
         // border-left-style
@@ -837,7 +838,7 @@ public final class FOPropertyMapping imp
         m.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_START_STYLE, PR_BORDER_END_STYLE,
-                PR_BORDER_AFTER_STYLE);
+                              PR_BORDER_AFTER_STYLE, PR_BORDER_BEFORE_STYLE);
         addPropertyMaker("border-left-style", m);
 
         // border-left-width
@@ -849,7 +850,7 @@ public final class FOPropertyMapping imp
         bwm.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(bwm);
         corr.setCorresponding(PR_BORDER_START_WIDTH, PR_BORDER_END_WIDTH,
-                PR_BORDER_AFTER_WIDTH);
+                              PR_BORDER_AFTER_WIDTH, PR_BORDER_BEFORE_WIDTH);
         addPropertyMaker("border-left-width", bwm);
 
         // border-right-color
@@ -862,7 +863,7 @@ public final class FOPropertyMapping imp
         m.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_END_COLOR, PR_BORDER_START_COLOR,
-                PR_BORDER_BEFORE_COLOR);
+                              PR_BORDER_BEFORE_COLOR, PR_BORDER_AFTER_COLOR);
         addPropertyMaker("border-right-color", m);
 
         // border-right-style
@@ -873,7 +874,7 @@ public final class FOPropertyMapping imp
         m.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_BORDER_END_STYLE, PR_BORDER_START_STYLE,
-                PR_BORDER_BEFORE_STYLE);
+                              PR_BORDER_BEFORE_STYLE, PR_BORDER_AFTER_STYLE);
         addPropertyMaker("border-right-style", m);
 
         // border-right-width
@@ -885,7 +886,7 @@ public final class FOPropertyMapping imp
         bwm.addShorthand(generics[PR_BORDER]);
         corr = new CorrespondingPropertyMaker(bwm);
         corr.setCorresponding(PR_BORDER_END_WIDTH, PR_BORDER_START_WIDTH,
-                PR_BORDER_BEFORE_WIDTH);
+                              PR_BORDER_BEFORE_WIDTH, PR_BORDER_AFTER_WIDTH);
         addPropertyMaker("border-right-width", bwm);
 
         // padding-before
@@ -894,7 +895,7 @@ public final class FOPropertyMapping imp
         m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_PADDING_TOP, PR_PADDING_TOP,
-                PR_PADDING_RIGHT);
+                              PR_PADDING_RIGHT, PR_PADDING_LEFT);
         corr.setRelative(true);
         addPropertyMaker("padding-before", m);
 
@@ -904,7 +905,7 @@ public final class FOPropertyMapping imp
         m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_PADDING_BOTTOM, PR_PADDING_BOTTOM,
-                PR_PADDING_LEFT);
+                              PR_PADDING_LEFT, PR_PADDING_RIGHT);
         corr.setRelative(true);
         addPropertyMaker("padding-after", m);
 
@@ -914,7 +915,7 @@ public final class FOPropertyMapping imp
         m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_PADDING_LEFT, PR_PADDING_RIGHT,
-                PR_PADDING_TOP);
+                              PR_PADDING_TOP, PR_PADDING_TOP);
         corr.setRelative(true);
         addPropertyMaker("padding-start", m);
 
@@ -924,7 +925,7 @@ public final class FOPropertyMapping imp
         m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_PADDING_RIGHT, PR_PADDING_LEFT,
-                PR_PADDING_BOTTOM);
+                              PR_PADDING_BOTTOM, PR_PADDING_BOTTOM);
         corr.setRelative(true);
         addPropertyMaker("padding-end", m);
 
@@ -933,7 +934,7 @@ public final class FOPropertyMapping imp
         m.useGeneric(genericPadding);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_PADDING_BEFORE, PR_PADDING_BEFORE,
-                PR_PADDING_START);
+                              PR_PADDING_START, PR_PADDING_START);
         addPropertyMaker("padding-top", m);
 
         // padding-bottom
@@ -941,7 +942,7 @@ public final class FOPropertyMapping imp
         m.useGeneric(genericPadding);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_PADDING_AFTER, PR_PADDING_AFTER,
-                PR_PADDING_END);
+                              PR_PADDING_END, PR_PADDING_END);
         addPropertyMaker("padding-bottom", m);
 
         // padding-left
@@ -949,7 +950,7 @@ public final class FOPropertyMapping imp
         m.useGeneric(genericPadding);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_PADDING_START, PR_PADDING_END,
-                PR_PADDING_AFTER);
+                              PR_PADDING_AFTER, PR_PADDING_BEFORE);
         addPropertyMaker("padding-left", m);
 
         // padding-right
@@ -957,7 +958,7 @@ public final class FOPropertyMapping imp
         m.useGeneric(genericPadding);
         corr = new CorrespondingPropertyMaker(m);
         corr.setCorresponding(PR_PADDING_END, PR_PADDING_START,
-                PR_PADDING_BEFORE);
+                              PR_PADDING_BEFORE, PR_PADDING_AFTER);
         addPropertyMaker("padding-right", m);
     }
 
@@ -1150,7 +1151,7 @@ public final class FOPropertyMapping imp
         m  = new SpaceProperty.Maker(PR_SPACE_BEFORE);
         m.useGeneric(genericSpace);
         corr = new SpacePropertyMaker(m);
-        corr.setCorresponding(PR_MARGIN_TOP, PR_MARGIN_TOP, PR_MARGIN_RIGHT);
+        corr.setCorresponding(PR_MARGIN_TOP, PR_MARGIN_TOP, PR_MARGIN_RIGHT, PR_MARGIN_LEFT);
         corr.setUseParent(false);
         corr.setRelative(true);
         addPropertyMaker("space-before", m);
@@ -1159,7 +1160,7 @@ public final class FOPropertyMapping imp
         m  = new SpaceProperty.Maker(PR_SPACE_AFTER);
         m.useGeneric(genericSpace);
         corr = new SpacePropertyMaker(m);
-        corr.setCorresponding(PR_MARGIN_BOTTOM, PR_MARGIN_BOTTOM, PR_MARGIN_LEFT);
+        corr.setCorresponding(PR_MARGIN_BOTTOM, PR_MARGIN_BOTTOM, PR_MARGIN_LEFT, PR_MARGIN_RIGHT);
         corr.setUseParent(false);
         corr.setRelative(true);
         addPropertyMaker("space-after", m);
@@ -1170,14 +1171,14 @@ public final class FOPropertyMapping imp
         m.setDefault("0pt");
         m.setPercentBase(LengthBase.CONTAINING_REFAREA_WIDTH);
         IndentPropertyMaker sCorr = new IndentPropertyMaker(m);
-        sCorr.setCorresponding(PR_MARGIN_LEFT, PR_MARGIN_RIGHT, PR_MARGIN_TOP);
+        sCorr.setCorresponding(PR_MARGIN_LEFT, PR_MARGIN_RIGHT, PR_MARGIN_TOP, PR_MARGIN_TOP);
         sCorr.setUseParent(false);
         sCorr.setRelative(true);
         sCorr.setPaddingCorresponding(new int[] {
-             PR_PADDING_LEFT, PR_PADDING_RIGHT, PR_PADDING_TOP
+             PR_PADDING_LEFT, PR_PADDING_RIGHT, PR_PADDING_TOP, PR_PADDING_TOP
         });
         sCorr.setBorderWidthCorresponding(new int[] {
-            PR_BORDER_LEFT_WIDTH, PR_BORDER_RIGHT_WIDTH, PR_BORDER_TOP_WIDTH
+            PR_BORDER_LEFT_WIDTH, PR_BORDER_RIGHT_WIDTH, PR_BORDER_TOP_WIDTH, PR_BORDER_TOP_WIDTH
         });
         addPropertyMaker("start-indent", m);
 
@@ -1187,14 +1188,16 @@ public final class FOPropertyMapping imp
         m.setDefault("0pt");
         m.setPercentBase(LengthBase.CONTAINING_REFAREA_WIDTH);
         IndentPropertyMaker eCorr = new IndentPropertyMaker(m);
-        eCorr.setCorresponding(PR_MARGIN_RIGHT, PR_MARGIN_LEFT, PR_MARGIN_BOTTOM);
+        eCorr.setCorresponding(PR_MARGIN_RIGHT, PR_MARGIN_LEFT,
+                               PR_MARGIN_BOTTOM, PR_MARGIN_BOTTOM);
         eCorr.setUseParent(false);
         eCorr.setRelative(true);
         eCorr.setPaddingCorresponding(new int[] {
-            PR_PADDING_RIGHT, PR_PADDING_LEFT, PR_PADDING_BOTTOM
+            PR_PADDING_RIGHT, PR_PADDING_LEFT, PR_PADDING_BOTTOM, PR_PADDING_BOTTOM
         });
         eCorr.setBorderWidthCorresponding(new int[] {
-            PR_BORDER_RIGHT_WIDTH, PR_BORDER_LEFT_WIDTH, PR_BORDER_BOTTOM_WIDTH
+            PR_BORDER_RIGHT_WIDTH, PR_BORDER_LEFT_WIDTH,
+            PR_BORDER_BOTTOM_WIDTH, PR_BORDER_BOTTOM_WIDTH
         });
         addPropertyMaker("end-indent", m);
     }
@@ -1351,10 +1354,10 @@ public final class FOPropertyMapping imp
         m.addSubpropMaker(l);
 
         pdim = new DimensionPropertyMaker(m);
-        pdim.setCorresponding(PR_HEIGHT, PR_HEIGHT, PR_WIDTH);
+        pdim.setCorresponding(PR_HEIGHT, PR_HEIGHT, PR_WIDTH, PR_WIDTH);
         pdim.setExtraCorresponding(new int[][] {
-             {PR_MIN_HEIGHT, PR_MIN_HEIGHT, PR_MIN_WIDTH, },
-             {PR_MAX_HEIGHT, PR_MAX_HEIGHT, PR_MAX_WIDTH, }
+             {PR_MIN_HEIGHT, PR_MIN_HEIGHT, PR_MIN_WIDTH, PR_MIN_WIDTH},
+             {PR_MAX_HEIGHT, PR_MAX_HEIGHT, PR_MAX_WIDTH, PR_MAX_WIDTH}
         });
         pdim.setRelative(true);
         m.setCorresponding(pdim);
@@ -1418,10 +1421,10 @@ public final class FOPropertyMapping imp
 
         pdim = new DimensionPropertyMaker(m);
         pdim.setRelative(true);
-        pdim.setCorresponding(PR_WIDTH, PR_WIDTH, PR_HEIGHT);
+        pdim.setCorresponding(PR_WIDTH, PR_WIDTH, PR_HEIGHT, PR_HEIGHT);
         pdim.setExtraCorresponding(new int[][] {
-            {PR_MIN_WIDTH, PR_MIN_WIDTH, PR_MIN_HEIGHT, },
-            {PR_MAX_WIDTH, PR_MAX_WIDTH, PR_MAX_HEIGHT, }
+            {PR_MIN_WIDTH, PR_MIN_WIDTH, PR_MIN_HEIGHT, PR_MIN_HEIGHT },
+            {PR_MAX_WIDTH, PR_MAX_WIDTH, PR_MAX_HEIGHT, PR_MIN_HEIGHT }
         });
         m.setCorresponding(pdim);
         addPropertyMaker("inline-progression-dimension", m);
@@ -1490,6 +1493,37 @@ public final class FOPropertyMapping imp
         addPropertyMaker("fox:block-progression-unit", l);
     }
 
+    private Property calcWritingModeDependent ( int pv, int wm ) {
+        if ( pv == EN_LEFT ) {
+            if ( wm == Constants.EN_LR_TB ) {
+                pv = EN_START;
+            } else if ( wm == Constants.EN_RL_TB ) {
+                pv = EN_END;
+            } else {
+                pv = EN_START;
+            }
+        } else if ( pv == EN_RIGHT ) {
+            if ( wm == Constants.EN_LR_TB ) {
+                pv = EN_END;
+            } else if ( wm == Constants.EN_RL_TB ) {
+                pv = EN_START;
+            } else {
+                pv = EN_END;
+            }
+        }
+        return makeWritingModeDependentEnum ( pv );
+    }
+
+    private Property makeWritingModeDependentEnum ( int pv ) {
+        if ( pv == EN_START ) {
+            return getEnumProperty ( EN_START, "START" );
+        } else if ( pv == EN_END ) {
+            return getEnumProperty ( EN_END, "END" );
+        } else {
+            return null;
+        }
+    }
+
     private void createBlockAndLineProperties() {               // CSOK: MethodLength
         PropertyMaker m;
 
@@ -1575,16 +1609,29 @@ public final class FOPropertyMapping imp
         addPropertyMaker("white-space-treatment", m);
 
         // text-align TODO: make it a StringProperty with enums.
-        m  = new EnumProperty.Maker(PR_TEXT_ALIGN);
+        m  = new EnumProperty.Maker(PR_TEXT_ALIGN) {
+            public Property get(int subpropId, PropertyList propertyList,
+                    boolean bTryInherit, boolean bTryDefault) throws PropertyException {
+                Property p = super.get(subpropId, propertyList, bTryInherit, bTryDefault);
+                if ( p != null ) {
+                    int pv = p.getEnum();
+                    if ( ( pv == EN_LEFT ) || ( pv == EN_RIGHT ) ) {
+                        p = calcWritingModeDependent
+                            ( pv, propertyList.get(Constants.PR_WRITING_MODE).getEnum() );
+                    }
+                }
+                return p;
+            }
+        };
         m.setInherited(true);
-        // Note: both 'end', 'right' and 'outside' are mapped to END
-        //       both 'start', 'left' and 'inside' are mapped to START
         m.addEnum("center", getEnumProperty(EN_CENTER, "CENTER"));
         m.addEnum("end", getEnumProperty(EN_END, "END"));
-        m.addEnum("right", getEnumProperty(EN_END, "END"));
         m.addEnum("start", getEnumProperty(EN_START, "START"));
-        m.addEnum("left", getEnumProperty(EN_START, "START"));
         m.addEnum("justify", getEnumProperty(EN_JUSTIFY, "JUSTIFY"));
+        // [GA] must defer writing-mode relative mapping of left/right
+        m.addEnum("left", getEnumProperty(EN_LEFT, "LEFT"));
+        m.addEnum("right", getEnumProperty(EN_RIGHT, "RIGHT"));
+        // [GA] inside and outside are not correctly implemented by the following mapping
         m.addEnum("inside", getEnumProperty(EN_START, "START"));
         m.addEnum("outside", getEnumProperty(EN_END, "END"));
         m.setDefault("start");
@@ -1604,7 +1651,6 @@ public final class FOPropertyMapping imp
                 }
                 return p;
             }
-
             private Property calcRelative(PropertyList propertyList) throws PropertyException {
                 Property corresponding = propertyList.get(PR_TEXT_ALIGN);
                 if (corresponding == null) {
@@ -1619,6 +1665,12 @@ public final class FOPropertyMapping imp
                     return getEnumProperty(EN_START, "START");
                 } else if (correspondingValue == EN_CENTER) {
                     return getEnumProperty(EN_CENTER, "CENTER");
+                } else if (correspondingValue == EN_LEFT) {
+                    return calcWritingModeDependent
+                        ( EN_LEFT, propertyList.get(Constants.PR_WRITING_MODE).getEnum() );
+                } else if (correspondingValue == EN_RIGHT) {
+                    return calcWritingModeDependent
+                        ( EN_RIGHT, propertyList.get(Constants.PR_WRITING_MODE).getEnum() );
                 } else {
                     return null;
                 }
@@ -1694,7 +1746,7 @@ public final class FOPropertyMapping imp
 
         // text-decoration
         //m  = new EnumProperty.Maker(PR_TEXT_DECORATION);
-        m  = new TextDecorationProperty.Maker(PR_TEXT_DECORATION);
+        m  = new TextDecorationMaker(PR_TEXT_DECORATION);
         m.setInherited(false);
         m.addEnum("none", getEnumProperty(EN_NONE, "NONE"));
         m.addEnum("underline", getEnumProperty(EN_UNDERLINE, "UNDERLINE"));
@@ -2170,6 +2222,12 @@ public final class FOPropertyMapping imp
         m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
         m.setDefault("auto");
         addPropertyMaker("letter-value", m);
+
+        // fox:alt-text, used for accessibility
+        m = new StringProperty.Maker(PR_X_NUMBER_CONVERSION_FEATURES);
+        m.setInherited(false);
+        m.setDefault("");
+        addPropertyMaker("fox:number-conversion-features", m);
     }
 
     private void createPaginationAndLayoutProperties() {
@@ -2511,6 +2569,7 @@ public final class FOPropertyMapping imp
         m.addEnum("lr-tb", getEnumProperty(EN_LR_TB, "LR_TB"));
         m.addEnum("rl-tb", getEnumProperty(EN_RL_TB, "RL_TB"));
         m.addEnum("tb-rl", getEnumProperty(EN_TB_RL, "TB_RL"));
+        m.addEnum("tb-lr", getEnumProperty(EN_TB_LR, "TB_LR"));
         m.addKeyword("lr", "lr-tb");
         m.addKeyword("rl", "rl-tb");
         m.addKeyword("tb", "tb-rl");
@@ -2532,12 +2591,6 @@ public final class FOPropertyMapping imp
         m.setDefault("");
         addPropertyMaker("id", m);
 
-        // foi:ptr, used for accessibility
-        m = new StringProperty.Maker(PR_X_PTR);
-        m.setInherited(false);
-        m.setDefault("");
-        addPropertyMaker("foi:ptr", m);
-
         // fox:alt-text, used for accessibility
         m = new StringProperty.Maker(PR_X_ALT_TEXT);
         m.setInherited(false);
@@ -2572,7 +2625,7 @@ public final class FOPropertyMapping imp
         addPropertyMaker("score-spaces", m);
 
         // src
-        m  = new StringProperty.Maker(PR_SRC);
+        m  = new URIProperty.Maker(PR_SRC);
         m.setInherited(false);
         m.setDefault("");
         addPropertyMaker("src", m);
@@ -2819,6 +2872,12 @@ public final class FOPropertyMapping imp
         m.setDatatypeParser(new XMLLangShorthandParser());
         addPropertyMaker("xml:lang", m);
 
+        // xml:base
+        m  = new URIProperty.Maker(PR_X_XML_BASE);
+        m.setInherited(true);
+        m.setDefault("");
+        addPropertyMaker("xml:base", m);
+
        }
 
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOText.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOText.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOText.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOText.java Thu Apr  5 16:19:19 2012
@@ -21,11 +21,15 @@ package org.apache.fop.fo;
 
 import java.awt.Color;
 import java.nio.CharBuffer;
+import java.util.Map;
 import java.util.NoSuchElementException;
+import java.util.Stack;
 
 import org.xml.sax.Locator;
 
+import org.apache.fop.accessibility.StructureTreeElement;
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.flow.Block;
 import org.apache.fop.fo.properties.CommonFont;
@@ -44,7 +48,8 @@ public class FOText extends FONode imple
     /** the <code>CharBuffer</code> containing the text */
     private CharBuffer charBuffer;
 
-    /** properties relevant for #PCDATA */
+    // The value of FO traits (refined properties) that apply to #PCDATA
+    // (aka implicit sequence of fo:character)
     private CommonFont commonFont;
     private CommonHyphenation commonHyphenation;
     private Color color;
@@ -57,6 +62,10 @@ public class FOText extends FONode imple
     private Property wordSpacing;
     private int wrapOption;
     private Length baselineShift;
+    private String country;
+    private String language;
+    private String script;
+    // End of trait values
 
     /**
      * Points to the previous FOText object created within the current
@@ -79,6 +88,14 @@ public class FOText extends FONode imple
     /** Holds the text decoration values. May be null */
     private CommonTextDecoration textDecoration;
 
+    private StructureTreeElement structureTreeElement;
+
+    /* bidi levels */
+    private int[] bidiLevels;
+
+    /* advanced script processing state */
+    private Map/*<MapRange,String>*/ mappings;
+
     private static final int IS_WORD_CHAR_FALSE = 0;
     private static final int IS_WORD_CHAR_TRUE = 1;
     private static final int IS_WORD_CHAR_MAYBE = 2;
@@ -95,45 +112,44 @@ public class FOText extends FONode imple
     /** {@inheritDoc} */
     protected void characters(char[] data, int start, int length,
             PropertyList list, Locator locator) throws FOPException {
-
-        if (this.charBuffer == null) {
+        if (charBuffer == null) {
             // buffer not yet initialized, do so now
-            this.charBuffer = CharBuffer.allocate(length);
+            int newLength = ( length < 16 ) ? 16 : length;
+            charBuffer = CharBuffer.allocate(newLength);
         } else {
             // allocate a larger buffer, and transfer contents
-            int newLength = this.charBuffer.limit() + length;
-            CharBuffer newBuffer = CharBuffer.allocate(newLength);
-            this.charBuffer.rewind();
-            newBuffer.put(this.charBuffer);
-            this.charBuffer = newBuffer;
+            int requires = charBuffer.position() + length;
+            int capacity = charBuffer.capacity();
+            if ( requires > capacity ) {
+                int newCapacity = capacity * 2;
+                if ( requires > newCapacity ) {
+                    newCapacity = requires;
+                }
+                CharBuffer newBuffer = CharBuffer.allocate(newCapacity);
+                charBuffer.rewind();
+                newBuffer.put(charBuffer);
+                charBuffer = newBuffer;
+            }
         }
+        // extend limit to capacity
+        charBuffer.limit(charBuffer.capacity());
         // append characters
-        this.charBuffer.put(data, start, length);
-
+        charBuffer.put(data, start, length);
+        // shrink limit to position
+        charBuffer.limit(charBuffer.position());
     }
 
     /**
      * Return the array of characters for this instance.
      *
-     * @return  a char array containing the text
+     * @return  a char sequence containing the text
      */
-    public char[] getCharArray() {
-
+    public CharSequence getCharSequence() {
         if (this.charBuffer == null) {
             return null;
         }
-
-        if (this.charBuffer.hasArray()) {
-            return this.charBuffer.array();
-        }
-
-        // only if the buffer implementation has
-        // no accessible backing array, return a new one
-        char[] ca = new char[this.charBuffer.limit()];
         this.charBuffer.rewind();
-        this.charBuffer.get(ca);
-        return ca;
-
+        return this.charBuffer.asReadOnlyBuffer().subSequence(0, this.charBuffer.limit());
     }
 
     /** {@inheritDoc} */
@@ -143,10 +159,10 @@ public class FOText extends FONode imple
         if (removeChildren) {
             // not really removing, just make sure the char buffer
             // pointed to is really a different one
-            if (this.charBuffer != null) {
-                ft.charBuffer = CharBuffer.allocate(this.charBuffer.limit());
-                this.charBuffer.rewind();
-                ft.charBuffer.put(this.charBuffer);
+            if (charBuffer != null) {
+                ft.charBuffer = CharBuffer.allocate(charBuffer.limit());
+                charBuffer.rewind();
+                ft.charBuffer.put(charBuffer);
                 ft.charBuffer.rewind();
             }
         }
@@ -171,13 +187,18 @@ public class FOText extends FONode imple
         this.wrapOption = pList.get(Constants.PR_WRAP_OPTION).getEnum();
         this.textDecoration = pList.getTextDecorationProps();
         this.baselineShift = pList.get(Constants.PR_BASELINE_SHIFT).getLength();
+        this.country = pList.get(Constants.PR_COUNTRY).getString();
+        this.language = pList.get(Constants.PR_LANGUAGE).getString();
+        this.script = pList.get(Constants.PR_SCRIPT).getString();
     }
 
     /** {@inheritDoc} */
     protected void endOfNode() throws FOPException {
+        if ( charBuffer != null ) {
+            charBuffer.rewind();
+        }
         super.endOfNode();
-        getFOEventHandler().characters(
-                this.getCharArray(), 0, this.charBuffer.limit());
+        getFOEventHandler().characters(this);
     }
 
     /** {@inheritDoc} */
@@ -196,20 +217,20 @@ public class FOText extends FONode imple
      */
     public boolean willCreateArea() {
         if (whiteSpaceCollapse == Constants.EN_FALSE
-                && this.charBuffer.limit() > 0) {
+                && charBuffer.limit() > 0) {
             return true;
         }
 
         char ch;
-        this.charBuffer.rewind();
-        while (this.charBuffer.hasRemaining()) {
-            ch = this.charBuffer.get();
+        charBuffer.rewind();
+        while (charBuffer.hasRemaining()) {
+            ch = charBuffer.get();
             if (!((ch == CharUtilities.SPACE)
                     || (ch == CharUtilities.LINEFEED_CHAR)
                     || (ch == CharUtilities.CARRIAGE_RETURN)
                     || (ch == CharUtilities.TAB))) {
                 // not whitespace
-                this.charBuffer.rewind();
+                charBuffer.rewind();
                 return true;
             }
         }
@@ -252,13 +273,13 @@ public class FOText extends FONode imple
             return;
         }
 
-        this.charBuffer.rewind();
-        CharBuffer tmp = this.charBuffer.slice();
+        charBuffer.rewind();
+        CharBuffer tmp = charBuffer.slice();
         char c;
-        int lim = this.charBuffer.limit();
+        int lim = charBuffer.limit();
         int pos = -1;
         while (++pos < lim) {
-            c = this.charBuffer.get();
+            c = charBuffer.get();
             switch (textTransform) {
                 case Constants.EN_UPPERCASE:
                     tmp.put(Character.toUpperCase(c));
@@ -383,25 +404,25 @@ public class FOText extends FONode imple
      * @return The previous FOText node in this Block; null, if this is the
      * first FOText in this Block.
      */
-    public FOText getPrevFOTextThisBlock () {
-        return prevFOTextThisBlock;
-    }
+    //public FOText getPrevFOTextThisBlock () {
+    //    return prevFOTextThisBlock;
+    //}
 
     /**
      * @return The next FOText node in this Block; null if this is the last
      * FOText in this Block; null if subsequent FOText nodes have not yet been
      * processed.
      */
-    public FOText getNextFOTextThisBlock () {
-        return nextFOTextThisBlock;
-    }
+    //public FOText getNextFOTextThisBlock () {
+    //    return nextFOTextThisBlock;
+    //}
 
     /**
      * @return The nearest ancestor block object which contains this FOText.
      */
-    public Block getAncestorBlock () {
-        return ancestorBlock;
-    }
+    //public Block getAncestorBlock () {
+    //    return ancestorBlock;
+    //}
 
     /**
      * Determines whether the input char should be considered part of a
@@ -494,6 +515,9 @@ public class FOText extends FONode imple
         private boolean canRemove = false;
         private boolean canReplace = false;
 
+        public TextCharIterator() {
+        }
+
         /** {@inheritDoc} */
         public boolean hasNext() {
            return (this.currentPosition < charBuffer.limit());
@@ -565,67 +589,88 @@ public class FOText extends FONode imple
     }
 
     /**
-     * @return the "color" property.
+     * @return the "color" trait.
      */
     public Color getColor() {
         return color;
     }
 
     /**
-     * @return the "keep-together" property.
+     * @return the "keep-together" trait.
      */
     public KeepProperty getKeepTogether() {
         return keepTogether;
     }
 
     /**
-     * @return the "letter-spacing" property.
+     * @return the "letter-spacing" trait.
      */
     public Property getLetterSpacing() {
         return letterSpacing;
     }
 
     /**
-     * @return the "line-height" property.
+     * @return the "line-height" trait.
      */
     public SpaceProperty getLineHeight() {
         return lineHeight;
     }
 
     /**
-     * @return the "white-space-treatment" property
+     * @return the "white-space-treatment" trait
      */
     public int getWhitespaceTreatment() {
         return whiteSpaceTreatment;
     }
 
     /**
-     * @return the "word-spacing" property.
+     * @return the "word-spacing" trait.
      */
     public Property getWordSpacing() {
         return wordSpacing;
     }
 
     /**
-     * @return the "wrap-option" property.
+     * @return the "wrap-option" trait.
      */
     public int getWrapOption() {
         return wrapOption;
     }
 
-    /** @return the "text-decoration" property. */
+    /** @return the "text-decoration" trait. */
     public CommonTextDecoration getTextDecoration() {
         return textDecoration;
     }
 
-    /** @return the baseline-shift property */
+    /** @return the baseline-shift trait */
     public Length getBaseLineShift() {
         return baselineShift;
     }
 
+    /** @return the country trait */
+    public String getCountry() {
+        return country;
+    }
+
+    /** @return the language trait */
+    public String getLanguage() {
+        return language;
+    }
+
+    /** @return the script trait */
+    public String getScript() {
+        return script;
+    }
+
     /** {@inheritDoc} */
     public String toString() {
-        return (this.charBuffer == null) ? "" : this.charBuffer.toString();
+        if ( charBuffer == null ) {
+            return "";
+        } else {
+            CharBuffer cb = charBuffer.duplicate();
+            cb.rewind();
+            return cb.toString();
+        }
     }
 
     /** {@inheritDoc} */
@@ -649,25 +694,229 @@ public class FOText extends FONode imple
 
     /** {@inheritDoc} */
     public char charAt(int position) {
-        return this.charBuffer.get(position);
+        return charBuffer.get(position);
     }
 
     /** {@inheritDoc} */
     public CharSequence subSequence(int start, int end) {
-        return this.charBuffer.subSequence(start, end);
+        return charBuffer.subSequence(start, end);
     }
 
     /** {@inheritDoc} */
     public int length() {
-        return this.charBuffer.limit();
+        return charBuffer.limit();
     }
 
     /**
      * Resets the backing <code>java.nio.CharBuffer</code>
      */
     public void resetBuffer() {
-        if (this.charBuffer != null) {
-            this.charBuffer.rewind();
+        if (charBuffer != null) {
+            charBuffer.rewind();
+        }
+    }
+
+    @Override
+    public boolean isDelimitedTextRangeBoundary ( int boundary ) {
+        return false;
+    }
+
+    @Override
+    public void setStructureTreeElement(StructureTreeElement structureTreeElement) {
+        this.structureTreeElement = structureTreeElement;
+    }
+
+    /** @return the structure tree element. */
+    public StructureTreeElement getStructureTreeElement() {
+        return structureTreeElement;
+    }
+
+    /**
+     * Set bidirectional level over interval [start,end).
+     * @param level the resolved level
+     * @param start the starting index of interval
+     * @param end the ending index of interval
+     */
+    public void setBidiLevel ( int level, int start, int end ) {
+        if ( start < end ) {
+            if ( bidiLevels == null ) {
+                bidiLevels = new int [ length() ];
+            }
+            for ( int i = start, n = end; i < n; i++ ) {
+                bidiLevels [ i ] = level;
+            }
+            if ( parent != null ) {
+                ( (FObj) parent ).setBidiLevel ( level );
+            }
+        } else {
+            assert start < end;
+        }
+    }
+
+    /**
+     * Obtain bidirectional level of each character
+     * represented by this FOText.
+     * @return a (possibly empty) array of bidi levels or null
+     * in case no bidi levels have been assigned
+     */
+    public int[] getBidiLevels() {
+        return bidiLevels;
+    }
+
+    /**
+     * Obtain bidirectional level of each character over
+     * interval [start,end).
+     * @param start the starting index of interval
+     * @param end the ending index of interval
+     * @return a (possibly empty) array of bidi levels or null
+     * in case no bidi levels have been assigned
+     */
+    public int[] getBidiLevels ( int start, int end ) {
+        if ( this.bidiLevels != null ) {
+            assert start <= end;
+            int n = end - start;
+            int[] bidiLevels = new int [ n ];
+            for ( int i = 0; i < n; i++ ) {
+                bidiLevels[i] = this.bidiLevels [ start + i ];
+            }
+            return bidiLevels;
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Obtain bidirectional level of character at
+     * specified position, which must be a non-negative integer
+     * less than the length of this FO.
+     * @param position an offset position into FO's characters
+     * @return a resolved bidi level or -1 if default
+     * @throws IndexOutOfBoundsException if position is not non-negative integer
+     * or is greater than or equal to length
+     */
+    public int bidiLevelAt ( int position ) throws IndexOutOfBoundsException {
+        if ( ( position < 0 ) || ( position >= length() ) ) {
+            throw new IndexOutOfBoundsException();
+        } else if ( bidiLevels != null ) {
+            return bidiLevels [ position ];
+        } else {
+            return -1;
+        }
+    }
+
+    /**
+     * Add characters mapped by script substitution processing.
+     * @param start index in character buffer
+     * @param end index in character buffer
+     * @param mappedChars sequence of character codes denoting substituted characters
+     */
+    public void addMapping ( int start, int end, CharSequence mappedChars ) {
+        if ( mappings == null ) {
+            mappings = new java.util.HashMap();
         }
+        mappings.put ( new MapRange ( start, end ), mappedChars.toString() );
+    }
+
+    /**
+     * Determine if characters over specific interval  have a mapping.
+     * @param start index in character buffer
+     * @param end index in character buffer
+     * @return true if a mapping exist such that the mapping's interval is coincident to
+     * [start,end)
+     */
+    public boolean hasMapping ( int start, int end ) {
+        return ( mappings != null ) && ( mappings.containsKey ( new MapRange ( start, end ) ) );
     }
+
+    /**
+     * Obtain mapping of characters over specific interval.
+     * @param start index in character buffer
+     * @param end index in character buffer
+     * @return a string of characters representing the mapping over the interval
+     * [start,end)
+     */
+    public String getMapping ( int start, int end ) {
+        if ( mappings != null ) {
+            return (String) mappings.get ( new MapRange ( start, end ) );
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Obtain length of mapping of characters over specific interval.
+     * @param start index in character buffer
+     * @param end index in character buffer
+     * @return the length of the mapping (if present) or zero
+     */
+    public int getMappingLength ( int start, int end ) {
+        if ( mappings != null ) {
+            return ( (String) mappings.get ( new MapRange ( start, end ) ) ) .length();
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Obtain bidirectional levels of mapping of characters over specific interval.
+     * @param start index in character buffer
+     * @param end index in character buffer
+     * @return a (possibly empty) array of bidi levels or null
+     * in case no bidi levels have been assigned
+     */
+    public int[] getMappingBidiLevels ( int start, int end ) {
+        if ( hasMapping ( start, end ) ) {
+            int   nc = end - start;
+            int   nm = getMappingLength ( start, end );
+            int[] la = getBidiLevels ( start, end );
+            if ( la == null ) {
+                return null;
+            } else if ( nm == nc ) {            // mapping is same length as mapped range
+                return la;
+            } else if ( nm > nc ) {             // mapping is longer than mapped range
+                int[] ma = new int [ nm ];
+                System.arraycopy ( la, 0, ma, 0, la.length );
+                for ( int i = la.length,
+                          n = ma.length, l = ( i > 0 ) ? la [ i - 1 ] : 0; i < n; i++ ) {
+                    ma [ i ] = l;
+                }
+                return ma;
+            } else {                            // mapping is shorter than mapped range
+                int[] ma = new int [ nm ];
+                System.arraycopy ( la, 0, ma, 0, ma.length );
+                return ma;
+            }
+        } else {
+            return getBidiLevels ( start, end );
+        }
+    }
+
+    @Override
+    protected Stack collectDelimitedTextRanges ( Stack ranges, DelimitedTextRange currentRange ) {
+        if ( currentRange != null ) {
+            currentRange.append ( charIterator(), this );
+        }
+        return ranges;
+    }
+
+    private static class MapRange {
+        private int start;
+        private int end;
+        MapRange(int start, int end) {
+            this.start = start;
+            this.end = end;
+        }
+        public int hashCode() {
+            return ( start * 31 ) + end;
+        }
+        public boolean equals ( Object o ) {
+            if ( o instanceof MapRange ) {
+                MapRange r = (MapRange) o;
+                return ( r.start == start ) && ( r.end == end );
+            } else {
+                return false;
+            }
+        }
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOTreeBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOTreeBuilder.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOTreeBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOTreeBuilder.java Thu Apr  5 16:19:19 2012
@@ -33,10 +33,10 @@ import org.apache.commons.logging.LogFac
 
 import org.apache.xmlgraphics.util.QName;
 
+import org.apache.fop.accessibility.fo.FO2StructureTreeConverter;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.FormattingResults;
-import org.apache.fop.area.AreaTreeHandler;
 import org.apache.fop.fo.ElementMapping.Maker;
 import org.apache.fop.fo.extensions.ExtensionElementMapping;
 import org.apache.fop.fo.pagination.Root;
@@ -53,7 +53,7 @@ import org.apache.fop.util.ContentHandle
 public class FOTreeBuilder extends DefaultHandler {
 
     /** logging instance */
-    protected Log log = LogFactory.getLog(FOTreeBuilder.class);
+    private static final Log LOG = LogFactory.getLog(FOTreeBuilder.class);
 
     /** The registry for ElementMapping instances */
     protected ElementMappingRegistry elementMappingRegistry;
@@ -104,6 +104,10 @@ public class FOTreeBuilder extends Defau
         //one of the RTF-, MIF- etc. Handlers.
         foEventHandler = foUserAgent.getRendererFactory().createFOEventHandler(
                 foUserAgent, outputFormat, stream);
+        if (userAgent.isAccessibilityEnabled()) {
+            foEventHandler = new FO2StructureTreeConverter(
+                    foUserAgent.getStructureTreeEventHandler(), foEventHandler);
+        }
         builderContext = new FOTreeBuilderContext();
         builderContext.setPropertyListMaker(new PropertyListMaker() {
             public PropertyList make(FObj fobj, PropertyList parentPropertyList) {
@@ -140,8 +144,8 @@ public class FOTreeBuilder extends Defau
         used = true;
         empty = true;
         rootFObj = null;    // allows FOTreeBuilder to be reused
-        if (log.isDebugEnabled()) {
-            log.debug("Building formatting object tree");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Building formatting object tree");
         }
         foEventHandler.startDocument();
         this.mainFOHandler = new MainFOHandler();
@@ -158,8 +162,8 @@ public class FOTreeBuilder extends Defau
             eventProducer.emptyDocument(this);
         }
         rootFObj = null;
-        if (log.isDebugEnabled()) {
-            log.debug("Parsing of document complete");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Parsing of document complete");
         }
         foEventHandler.endDocument();
     }
@@ -188,17 +192,17 @@ public class FOTreeBuilder extends Defau
 
     /** {@inheritDoc} */
     public void warning(SAXParseException e) {
-        log.warn(e.getLocalizedMessage());
+        LOG.warn(e.getLocalizedMessage());
     }
 
     /** {@inheritDoc} */
     public void error(SAXParseException e) {
-        log.error(e.toString());
+        LOG.error(e.toString());
     }
 
     /** {@inheritDoc} */
     public void fatalError(SAXParseException e) throws SAXException {
-        log.error(e.toString());
+        LOG.error(e.toString());
         throw e;
     }
 
@@ -219,13 +223,7 @@ public class FOTreeBuilder extends Defau
      * @return the results of the rendering process.
      */
     public FormattingResults getResults() {
-        if (getEventHandler() instanceof AreaTreeHandler) {
-            return ((AreaTreeHandler) getEventHandler()).getResults();
-        } else {
-            //No formatting results available for output formats no
-            //involving the layout engine.
-            return null;
-        }
+        return getEventHandler().getResults();
     }
 
     /**
@@ -364,7 +362,7 @@ public class FOTreeBuilder extends Defau
             }
 
             if (currentFObj.getParent() == null) {
-                log.debug("endElement for top-level " + currentFObj.getName());
+                LOG.debug("endElement for top-level " + currentFObj.getName());
             }
 
             currentFObj = currentFObj.getParent();
@@ -398,7 +396,9 @@ public class FOTreeBuilder extends Defau
                 FOValidationEventProducer eventProducer
                     = FOValidationEventProducer.Provider.get(
                         userAgent.getEventBroadcaster());
-                eventProducer.unknownFormattingObject(this, currentFObj.getName(),
+                String name = (currentFObj != null ? currentFObj.getName()
+                                                   : "{" + namespaceURI + "}" + localName);
+                eventProducer.unknownFormattingObject(this, name,
                         new QName(namespaceURI, localName),
                         getEffectiveLocator());
             }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOValidationEventProducer.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOValidationEventProducer.xml?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOValidationEventProducer.xml (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FOValidationEventProducer.xml Thu Apr  5 16:19:19 2012
@@ -9,6 +9,7 @@
   <message key="rule.childOfSPM">The element must be a child of fo:simple-page-master.</message>
   <message key="rule.childOfDeclarations">The element must be a child of fo:declarations.</message>
   <message key="rule.childOfSPMorDeclarations">The element must be a child of fo:declarations or fo:simple-page-master.</message>
+  <message key="rule.childOfSPMorPSorDeclarations">The element must be a child of fo:declarations, fo:simple-page-master or fo:page-sequence.</message>
   <message key="rule.childOfInstreamForeignObjectorExternalGraphic">The element must be a child of fo:instream-foreign-object or fo:external-graphic.</message>
   <message key="rule.childOfPageSequence">The element must be a child of fo:page-sequence.</message>
   <message key="rule.childOfPageSequenceOrSPM">The element must be a child of fo:page-sequence or fo:simple-page-master.</message>

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FObj.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FObj.java Thu Apr  5 16:19:19 2012
@@ -47,16 +47,17 @@ public abstract class FObj extends FONod
     private static final PropertyMaker[] PROPERTY_LIST_TABLE
                             = FOPropertyMapping.getGenericMappings();
 
-    /**
-     * pointer to the descendant subtree
-     */
+    /** pointer to the descendant subtree */
     protected FONode firstChild;
 
+    /** pointer to the end of the descendant subtree */
+    protected FONode lastChild;
+
     /** The list of extension attachments, null if none */
-    private List/*<ExtensionAttachment>*/ extensionAttachments = null;
+    private List<ExtensionAttachment> extensionAttachments = null;
 
     /** The map of foreign attributes, null if none */
-    private Map/*<QName,String>*/ foreignAttributes = null;
+    private Map<QName, String> foreignAttributes = null;
 
     /** Used to indicate if this FO is either an Out Of Line FO (see rec)
      *  or a descendant of one. Used during FO validation.
@@ -66,6 +67,8 @@ public abstract class FObj extends FONod
     /** Markers added to this element. */
     private Map markers = null;
 
+    private int bidiLevel = -1;
+
     // The value of properties relevant for all fo objects
     private String id = null;
     // End of property values
@@ -117,9 +120,7 @@ public abstract class FObj extends FONod
                     throws FOPException {
         setLocator(locator);
         pList.addAttributesToList(attlist);
-        if (!inMarker()
-                || "marker".equals(elementName)) {
-            pList.setWritingMode();
+        if (!inMarker() || "marker".equals(elementName)) {
             bind(pList);
         }
     }
@@ -197,13 +198,19 @@ public abstract class FObj extends FONod
             } else {
                 if (firstChild == null) {
                     firstChild = child;
+                    lastChild = child;
                 } else {
-                    FONode prevChild = firstChild;
-                    while (prevChild.siblings != null
-                            && prevChild.siblings[1] != null) {
-                        prevChild = prevChild.siblings[1];
+                    if (lastChild == null) {
+                        FONode prevChild = firstChild;
+                        while (prevChild.siblings != null
+                                && prevChild.siblings[1] != null) {
+                            prevChild = prevChild.siblings[1];
+                        }
+                        FONode.attachSiblings(prevChild, child);
+                    } else {
+                        FONode.attachSiblings(lastChild, child);
+                        lastChild = child;
                     }
-                    FONode.attachSiblings(prevChild, child);
                 }
             }
         }
@@ -238,6 +245,13 @@ public abstract class FObj extends FONod
                 nextChild.siblings[0] = prevChild;
             }
         }
+        if (child == lastChild) {
+            if (child.siblings != null) {
+                lastChild = siblings[0];
+            } else {
+                lastChild = null;
+            }
+        }
     }
 
     /**
@@ -421,6 +435,7 @@ public abstract class FObj extends FONod
      * Convenience method for validity checking.  Checks if the
      * incoming node is a member of the "%block;" parameter entity
      * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
+     *
      * @param nsURI namespace URI of incoming node
      * @param lName local name (i.e., no prefix) of incoming node
      * @return true if a member, false if not
@@ -440,6 +455,7 @@ public abstract class FObj extends FONod
      * Convenience method for validity checking.  Checks if the
      * incoming node is a member of the "%inline;" parameter entity
      * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
+     *
      * @param nsURI namespace URI of incoming node
      * @param lName local name (i.e., no prefix) of incoming node
      * @return true if a member, false if not
@@ -529,7 +545,7 @@ public abstract class FObj extends FONod
 
     /** @return whether this object has an id set */
     public boolean hasId() {
-        return id != null && id.length() > 0;
+        return (id != null && id.length() > 0);
     }
 
     /** {@inheritDoc} */
@@ -542,6 +558,63 @@ public abstract class FObj extends FONod
         return "fo";
     }
 
+    /** {@inheritDoc} */
+    public boolean isBidiRangeBlockItem() {
+        String ns = getNamespaceURI();
+        String ln = getLocalName();
+        return !isNeutralItem(ns, ln) && isBlockItem(ns, ln);
+    }
+
+    /**
+     * Recursively set resolved bidirectional level of FO (and its ancestors) if
+     * and only if it is non-negative and if either the current value is reset (-1)
+     * or the new value is less than the current value.
+     * @param bidiLevel a non-negative bidi embedding level
+     */
+    public void setBidiLevel(int bidiLevel) {
+        assert bidiLevel >= 0;
+        if ( bidiLevel >= 0 ) {
+            if ( ( this.bidiLevel < 0 ) || ( bidiLevel < this.bidiLevel ) ) {
+                this.bidiLevel = bidiLevel;
+                if ( parent != null ) {
+                    FObj foParent = (FObj) parent;
+                    int parentBidiLevel = foParent.getBidiLevel();
+                    if ( ( parentBidiLevel < 0 ) || ( bidiLevel < parentBidiLevel ) ) {
+                        foParent.setBidiLevel ( bidiLevel );
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Obtain resolved bidirectional level of FO.
+     * @return either a non-negative bidi embedding level or -1
+     * in case no bidi levels have been assigned
+     */
+    public int getBidiLevel() {
+        return bidiLevel;
+    }
+
+    /**
+     * Obtain resolved bidirectional level of FO or nearest FO
+     * ancestor that has a resolved level.
+     * @return either a non-negative bidi embedding level or -1
+     * in case no bidi levels have been assigned to this FO or
+     * any ancestor
+     */
+    public int getBidiLevelRecursive() {
+        for ( FONode fn = this; fn != null; fn = fn.getParent() ) {
+            if ( fn instanceof FObj ) {
+                int level = ( (FObj) fn).getBidiLevel();
+                if ( level >= 0 ) {
+                    return level;
+                }
+            }
+        }
+        return -1;
+    }
+
     /**
      * Add a new extension attachment to this FObj.
      * (see org.apache.fop.fo.FONode for details)
@@ -554,7 +627,7 @@ public abstract class FObj extends FONod
                     "Parameter attachment must not be null");
         }
         if (extensionAttachments == null) {
-            extensionAttachments = new java.util.ArrayList/*<ExtensionAttachment>*/();
+            extensionAttachments = new java.util.ArrayList<ExtensionAttachment>();
         }
         if (log.isDebugEnabled()) {
             log.debug("ExtensionAttachment of category "
@@ -591,7 +664,7 @@ public abstract class FObj extends FONod
             throw new NullPointerException("Parameter attributeName must not be null");
         }
         if (foreignAttributes == null) {
-            foreignAttributes = new java.util.HashMap/*<QName,String>*/();
+            foreignAttributes = new java.util.HashMap<QName, String>();
         }
         foreignAttributes.put(attributeName, value);
     }
@@ -611,7 +684,7 @@ public abstract class FObj extends FONod
     }
 
     /** Basic {@link FONode.FONodeIterator} implementation */
-    public class FObjIterator implements FONodeIterator {
+    public static class FObjIterator implements FONodeIterator {
 
         private static final int F_NONE_ALLOWED = 0;
         private static final int F_SET_ALLOWED = 1;
@@ -679,6 +752,9 @@ public abstract class FObj extends FONod
                         && currentNode.siblings[1] != null) {
                     FONode.attachSiblings(newNode, currentNode.siblings[1]);
                 }
+                if (currentNode == parentNode.lastChild) {
+                    parentNode.lastChild = newNode;
+                }
             } else {
                 throw new IllegalStateException();
             }
@@ -694,12 +770,18 @@ public abstract class FObj extends FONod
                 parentNode.firstChild = newNode;
                 currentIndex = 0;
                 currentNode = newNode;
+                if (parentNode.lastChild == null) {
+                    parentNode.lastChild = newNode;
+                }
             } else {
                 if (currentNode.siblings != null
                         && currentNode.siblings[1] != null) {
                     FONode.attachSiblings((FONode) o, currentNode.siblings[1]);
                 }
                 FONode.attachSiblings(currentNode, (FONode) o);
+                if (currentNode == parentNode.lastChild) {
+                    parentNode.lastChild = newNode;
+                }
             }
             flags &= F_NONE_ALLOWED;
         }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FObjMixed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FObjMixed.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FObjMixed.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/FObjMixed.java Thu Apr  5 16:19:19 2012
@@ -50,6 +50,7 @@ public abstract class FObjMixed extends 
     }
 
     /** {@inheritDoc} */
+    @Override
     protected void characters(char[] data, int start, int length,
                                  PropertyList pList,
                                  Locator locator) throws FOPException {
@@ -64,6 +65,7 @@ public abstract class FObjMixed extends 
     }
 
     /** {@inheritDoc} */
+    @Override
     protected void endOfNode() throws FOPException {
 
         super.endOfNode();
@@ -150,6 +152,7 @@ public abstract class FObjMixed extends 
     }
 
     /** {@inheritDoc} */
+    @Override
     protected void addChildNode(FONode child) throws FOPException {
 
         flushText();
@@ -169,6 +172,17 @@ public abstract class FObjMixed extends 
     }
 
     /** {@inheritDoc} */
+    @Override
+    public void removeChild(FONode child) {
+        super.removeChild(child);
+        if (child == this.currentTextNode) {
+            // reset to following sibling
+            this.currentTextNode = child.siblings != null ? child.siblings[1] : null;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
     public void finalizeNode() throws FOPException {
 
         flushText();
@@ -183,7 +197,8 @@ public abstract class FObjMixed extends 
      *
      * @return iterator for this object
      */
+    @Override
     public CharIterator charIterator() {
         return new RecursiveCharIterator(this);
     }
-}
\ No newline at end of file
+}

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/PropertyList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/PropertyList.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/PropertyList.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/PropertyList.java Thu Apr  5 16:19:19 2012
@@ -30,7 +30,6 @@ import org.apache.xmlgraphics.util.QName
 import org.apache.fop.apps.FopFactory;
 import org.apache.fop.fo.expr.PropertyException;
 import org.apache.fop.fo.properties.CommonAbsolutePosition;
-import org.apache.fop.fo.properties.CommonAccessibility;
 import org.apache.fop.fo.properties.CommonAural;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.fo.properties.CommonFont;
@@ -47,8 +46,6 @@ import org.apache.fop.fo.properties.Prop
  */
 public abstract class PropertyList {
 
-    // writing-mode index
-    private int writingMode;
 
     private static boolean[] inheritableProperty;
 
@@ -221,51 +218,60 @@ public abstract class PropertyList {
     }
 
     /**
-     * Set writing mode for this FO.
-     * Use that from the nearest ancestor, including self, which generates
-     * reference areas, or from root FO if no ancestor found.
-     * @throws PropertyException ...
-     */
-    public void setWritingMode() throws PropertyException {
-        FObj p = fobj.findNearestAncestorFObj();
-        // If this is a reference area or the root, use the property value.
-        if (fobj.generatesReferenceAreas() || p == null) {
-            writingMode = get(Constants.PR_WRITING_MODE).getEnum();
-        } else {
-            // Otherwise get the writing mode value from the parent.
-            writingMode = getParentPropertyList().getWritingMode();
-        }
-    }
-
-    /**
-     * Return the "writing-mode" property value.
-     * @return the "writing-mode" property value.
-     */
-    public int getWritingMode() {
-        return writingMode;
-    }
-
-
-    /**
-     * Uses the stored writingMode.
+     * Select a writing mode dependent property ID based on value of writing mode property.
      * @param lrtb the property ID to return under lrtb writingmode.
      * @param rltb the property ID to return under rltb writingmode.
      * @param tbrl the property ID to return under tbrl writingmode.
+     * @param tblr the property ID to return under tblr writingmode.
      * @return one of the property IDs, depending on the writing mode.
      */
-    public int getWritingMode(int lrtb, int rltb, int tbrl) {
-        switch (writingMode) {
-            case Constants.EN_LR_TB: return lrtb;
-            case Constants.EN_RL_TB: return rltb;
-            case Constants.EN_TB_RL: return tbrl;
+    public int selectFromWritingMode(int lrtb, int rltb, int tbrl, int tblr) {
+        int propID;
+        try {
+            switch (get(Constants.PR_WRITING_MODE).getEnum()) {
+            case Constants.EN_LR_TB:
+                propID = lrtb;
+                break;
+            case Constants.EN_RL_TB:
+                propID = rltb;
+                break;
+            case Constants.EN_TB_RL:
+                propID = tbrl;
+                break;
+            case Constants.EN_TB_LR:
+                propID = tblr;
+                break;
             default:
-                //nop
+            propID = -1;
+                break;
+            }
+        } catch ( PropertyException e ) {
+            propID = -1;
+        }
+        return propID;
+    }
+
+    private String addAttributeToList(Attributes attributes,
+                                    String attributeName) throws ValidationException {
+        String attributeValue = attributes.getValue(attributeName);
+        if ( attributeValue != null ) {
+            convertAttributeToProperty(attributes, attributeName, attributeValue);
         }
-        return -1;
+        return attributeValue;
     }
 
     /**
-     * Adds the attributes, passed in by the parser to the PropertyList
+     * <p>Adds the attributes, passed in by the parser to the PropertyList.</p>
+     * <p>Note that certain attributes are given priority in terms of order of
+     * processing due to conversion dependencies, where the order is as follows:</p>
+     * <ol>
+     * <li>writing-mode</li>
+     * <li>column-number</li>
+     * <li>number-columns-spanned</li>
+     * <li>font</li>
+     * <li>font-size</li>
+     * <li><emph>all others in order of appearance</emph></li>
+     * </ol>
      *
      * @param attributes Collection of attributes passed to us from the parser.
      * @throws ValidationException if there is an attribute that does not
@@ -274,48 +280,44 @@ public abstract class PropertyList {
     public void addAttributesToList(Attributes attributes)
                     throws ValidationException {
         /*
+         * Give writing-mode highest conversion priority.
+         */
+        addAttributeToList(attributes, "writing-mode");
+
+        /*
          * If column-number/number-columns-spanned are specified, then we
          * need them before all others (possible from-table-column() on any
          * other property further in the list...
          */
-        String attributeName = "column-number";
-        String attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName,
-            attributeValue);
-        attributeName = "number-columns-spanned";
-        attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName,
-            attributeValue);
+        addAttributeToList(attributes, "column-number");
+        addAttributeToList(attributes, "number-columns-spanned");
 
         /*
          * If font-size is set on this FO, must set it first, since
          * other attributes specified in terms of "ems" depend on it.
          */
-        attributeName = "font";
-        attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName,
-                attributeValue);
-        if (attributeValue == null) {
+        String checkValue = addAttributeToList(attributes, "font");
+        if (checkValue == null || "".equals(checkValue)) {
             /*
              * font shorthand wasn't specified, so still need to process
              * explicit font-size
              */
-            attributeName = "font-size";
-            attributeValue = attributes.getValue(attributeName);
-            convertAttributeToProperty(attributes, attributeName,
-                    attributeValue);
+            addAttributeToList(attributes, "font-size");
         }
 
         String attributeNS;
+        String attributeName;
+        String attributeValue;
         FopFactory factory = getFObj().getUserAgent().getFactory();
         for (int i = 0; i < attributes.getLength(); i++) {
             /* convert all attributes with the same namespace as the fo element
-             * the "xml:lang" property is a special case */
+             * the "xml:lang" and "xml:base" properties are special cases */
             attributeNS = attributes.getURI(i);
             attributeName = attributes.getQName(i);
             attributeValue = attributes.getValue(i);
             if (attributeNS == null || attributeNS.length() == 0
-                    || "xml:lang".equals(attributeName)) {
+                    || "xml:lang".equals(attributeName)
+                    || "xml:base".equals(attributeName)) {
                 convertAttributeToProperty(attributes, attributeName, attributeValue);
             } else if (!factory.isNamespaceIgnored(attributeNS)) {
                 ElementMapping mapping = factory.getElementMappingRegistry().getElementMapping(
@@ -368,15 +370,14 @@ public abstract class PropertyList {
                                             String attributeValue)
                     throws ValidationException {
 
-        if (attributeValue != null) {
-
-            if (attributeName.startsWith("xmlns:")
-                    || "xmlns".equals(attributeName)) {
-                //Ignore namespace declarations if the XML parser/XSLT processor
-                //reports them as 'regular' attributes
-                return;
-            }
+        if (attributeName.startsWith("xmlns:")
+                || "xmlns".equals(attributeName)) {
+            /* Ignore namespace declarations if the XML parser/XSLT processor
+             * reports them as 'regular' attributes */
+            return;
+        }
 
+        if (attributeValue != null) {
             /* Handle "compound" properties, ex. space-before.minimum */
             String basePropertyName = findBasePropertyName(attributeName);
             String subPropertyName = findSubPropertyName(attributeName);
@@ -604,15 +605,6 @@ public abstract class PropertyList {
     }
 
     /**
-     * Constructs a CommonAccessibility object.
-     * @return the CommonAccessibility object
-     * @throws PropertyException if there's a problem while processing the properties
-     */
-    public CommonAccessibility getAccessibilityProps() throws PropertyException {
-        return new CommonAccessibility(this);
-    }
-
-    /**
      * Constructs a CommonAural object.
      * @return the CommonAural object
      * @throws PropertyException if there's a problem while processing the properties
@@ -659,4 +651,3 @@ public abstract class PropertyList {
         return CommonTextDecoration.createFromPropertyList(this);
     }
 }
-

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/ValidationException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/ValidationException.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/ValidationException.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/ValidationException.java Thu Apr  5 16:19:19 2012
@@ -19,9 +19,10 @@
 
 package org.apache.fop.fo;
 
-import org.apache.fop.apps.FOPException;
 import org.xml.sax.Locator;
 
+import org.apache.fop.apps.FOPException;
+
 /**
  * Exception thrown during FO tree validation.
  */

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/XMLObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/XMLObj.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/XMLObj.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/XMLObj.java Thu Apr  5 16:19:19 2012
@@ -19,7 +19,6 @@
 
 package org.apache.fop.fo;
 
-// Java
 import java.awt.geom.Point2D;
 import java.util.HashMap;
 
@@ -33,8 +32,8 @@ import org.xml.sax.Locator;
 
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.datatypes.Length;
-import org.apache.fop.util.XMLConstants;
 import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener;
+import org.apache.fop.util.XMLConstants;
 
 /**
  * Abstract class modelling generic, non-XSL-FO XML objects. Such objects are

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java Thu Apr  5 16:19:19 2012
@@ -21,6 +21,7 @@ package org.apache.fop.fo;
 
 import java.util.List;
 import java.util.Stack;
+
 import org.apache.fop.fo.flow.Block;
 import org.apache.fop.util.CharUtilities;
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java Thu Apr  5 16:19:19 2012
@@ -20,9 +20,10 @@
 package org.apache.fop.fo.expr;
 
 import java.util.List;
+
 import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.FOPropertyMapping;
+import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.flow.table.ColumnNumberManager;
 import org.apache.fop.fo.flow.table.Table;
 import org.apache.fop.fo.flow.table.TableCell;

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/Function.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/Function.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/Function.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/Function.java Thu Apr  5 16:19:19 2012
@@ -19,8 +19,8 @@
 
 package org.apache.fop.fo.expr;
 
-import org.apache.fop.fo.properties.Property;
 import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.fo.properties.Property;
 
 /**
  * Interface for managing XSL-FO Functions

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/ICCColorFunction.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/ICCColorFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/ICCColorFunction.java Thu Apr  5 16:19:19 2012
@@ -41,6 +41,7 @@ class ICCColorFunction extends FunctionB
     }
 
     /** {@inheritDoc} */
+    @Override
     public PercentBase getPercentBase() {
         return new ICCPercentBase();
     }
@@ -50,7 +51,9 @@ class ICCColorFunction extends FunctionB
                          PropertyInfo pInfo) throws PropertyException {
         // Map color profile NCNAME to src from declarations/color-profile element
         String colorProfileName = args[3].getString();
-        Declarations decls = pInfo.getFO().getRoot().getDeclarations();
+        Declarations decls = (pInfo.getFO() != null
+                ? pInfo.getFO().getRoot().getDeclarations()
+                : null);
         ColorProfile cp = null;
         if (decls == null) {
             //function used in a color-specification
@@ -76,7 +79,9 @@ class ICCColorFunction extends FunctionB
         }
         String src = (cp != null ? cp.getSrc() : "");
 
-        float red = 0, green = 0, blue = 0;
+        float red = 0;
+        float green = 0;
+        float blue = 0;
         red = args[0].getNumber().floatValue();
         green = args[1].getNumber().floatValue();
         blue = args[2].getNumber().floatValue();

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/LabelEndFunction.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/LabelEndFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/LabelEndFunction.java Thu Apr  5 16:19:19 2012
@@ -19,9 +19,9 @@
 
 package org.apache.fop.fo.expr;
 
-import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.flow.ListItem;

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/NCnameProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/NCnameProperty.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/NCnameProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/NCnameProperty.java Thu Apr  5 16:19:19 2012
@@ -24,6 +24,7 @@ import java.awt.Color;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.fo.properties.Property;
 import org.apache.fop.util.ColorUtil;
+import org.apache.fop.util.CompareUtil;
 
 /**
  * Class for handling NC Name objects
@@ -79,4 +80,20 @@ public class NCnameProperty extends Prop
         return this.ncName;
     }
 
+    @Override
+    public int hashCode() {
+        return CompareUtil.getHashCode(ncName);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof NCnameProperty)) {
+            return false;
+        }
+        NCnameProperty other = (NCnameProperty) obj;
+        return CompareUtil.equal(ncName, other.ncName);
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/NumericProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/NumericProperty.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/NumericProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/NumericProperty.java Thu Apr  5 16:19:19 2012
@@ -23,10 +23,11 @@ import java.awt.Color;
 
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.datatypes.Length;
-import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.properties.FixedLength;
 import org.apache.fop.fo.properties.Property;
+import org.apache.fop.util.CompareUtil;
 
 /**
  * A numeric property which hold the final absolute result of an expression
@@ -127,4 +128,25 @@ public class NumericProperty extends Pro
             return value + "^" + dim;
         }
     }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + dim;
+        result = prime * result + CompareUtil.getHashCode(value);
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof NumericProperty)) {
+            return false;
+        }
+        NumericProperty other = (NumericProperty) obj;
+        return dim == other.dim && CompareUtil.equal(value, other.value);
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/PropertyParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/PropertyParser.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/PropertyParser.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/expr/PropertyParser.java Thu Apr  5 16:19:19 2012
@@ -69,6 +69,8 @@ public final class PropertyParser extend
         FUNCTION_TABLE.put("label-end", new LabelEndFunction());
         FUNCTION_TABLE.put("body-start", new BodyStartFunction());
         FUNCTION_TABLE.put("rgb-icc", new ICCColorFunction());
+        FUNCTION_TABLE.put("rgb-named-color", new NamedColorFunction()); //since XSL-FO 2.0
+        FUNCTION_TABLE.put("cie-lab-color", new CIELabColorFunction()); //since XSL-FO 2.0
         FUNCTION_TABLE.put("cmyk", new CMYKcolorFunction()); //non-standard!!!
 
         /**



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