bckfnn      2004/08/13 02:05:15

  Modified:    src/java/org/apache/fop/fo/properties
                        CompoundPropertyMaker.java
               src/java/org/apache/fop/fo FOPropertyMapping.java
                        PropertyManager.java
  Added:       src/java/org/apache/fop/fo/properties
                        SpacingPropertyMaker.java
  Log:
  Support for [letter|word]-spacing properties with a value of 'normal'.
  The value returned will be an Constants.NORMAL enum.
  
  Revision  Changes    Path
  1.6       +12 -4     
xml-fop/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java
  
  Index: CompoundPropertyMaker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CompoundPropertyMaker.java        18 Jun 2004 17:58:35 -0000      1.5
  +++ CompoundPropertyMaker.java        13 Aug 2004 09:05:15 -0000      1.6
  @@ -122,10 +122,14 @@
        * input value
        */
       protected Property checkEnumValues(String value) {
  +        Property result = null;
           if (shorthandMaker != null) {
  -            return shorthandMaker.checkEnumValues(value);
  +            result = shorthandMaker.checkEnumValues(value);
           }
  -        return null;
  +        if (result == null) {
  +            result = super.checkEnumValues(value);
  +        }
  +        return result;
       }
   
       /**
  @@ -190,7 +194,11 @@
        * @throws FOPException for invalid or inconsisten FO input
        */
       public Property make(PropertyList propertyList) throws FOPException {
  -        return makeCompound(propertyList, propertyList.getParentFObj());       
  +        if (defaultValue != null) {
  +            return make(propertyList, defaultValue, propertyList.getParentFObj());
  +        } else {
  +            return makeCompound(propertyList, propertyList.getParentFObj());
  +        }
       }
       
       /**
  
  
  
  1.1                  
xml-fop/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java
  
  Index: SpacingPropertyMaker.java
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /* $Id: SpacingPropertyMaker.java,v 1.1 2004/08/13 09:05:15 bckfnn Exp $ */
  
  package org.apache.fop.fo.properties;
  
  import org.apache.fop.apps.FOPException;
  import org.apache.fop.fo.Constants;
  import org.apache.fop.fo.FObj;
  import org.apache.fop.fo.PropertyList;
  
  /**
   * A maker which creates 'letter-spacing' and 'word-spacing' properties.
   * These two properties properties are standard space properties with 
   * additinal support for the 'normal' enum value.
   */
  
  public class SpacingPropertyMaker extends SpaceProperty.Maker {
      /**
       * Create a maker for [letter|word]-spacing.
       * @param propId the id for property.
       */
      public SpacingPropertyMaker(int propId) {
          super(propId);
      }
  
      /**
       * Support for the 'normal' value.
       */
      public Property convertProperty(Property p, 
                                         PropertyList propertyList,
                                         FObj fo) throws FOPException {
          if (p.getEnum() == Constants.NORMAL) {
              return p;
          }
          return super.convertProperty(p, propertyList, fo);
      }
  }
  
  
  
  1.13      +10 -4     xml-fop/src/java/org/apache/fop/fo/FOPropertyMapping.java
  
  Index: FOPropertyMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOPropertyMapping.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FOPropertyMapping.java    27 Feb 2004 17:57:40 -0000      1.12
  +++ FOPropertyMapping.java    13 Aug 2004 09:05:15 -0000      1.13
  @@ -40,6 +40,7 @@
   import org.apache.fop.fo.properties.Property;
   import org.apache.fop.fo.properties.PropertyMaker;
   import org.apache.fop.fo.properties.SpaceProperty;
  +import org.apache.fop.fo.properties.SpacingPropertyMaker;
   import org.apache.fop.fo.properties.StringProperty;
   import org.apache.fop.fo.properties.ToBeImplementedProperty;
   
  @@ -1586,9 +1587,13 @@
           addPropertyMaker("character", m);
   
           // letter-spacing
  -        m  = new ToBeImplementedProperty.Maker(PR_LETTER_SPACING);
  +        m  = new SpacingPropertyMaker(PR_LETTER_SPACING);
  +        m.useGeneric(genericSpace);
           m.setInherited(true);
  +        m.getSubpropMaker(CP_PRECEDENCE).setDefault("force");
  +        m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
           m.setDefault("normal");
  +        m.addEnum("normal", makeEnumProperty(NORMAL));
           addPropertyMaker("letter-spacing", m);
   
           // suppress-at-line-break
  @@ -1635,12 +1640,13 @@
           addPropertyMaker("treat-as-word-space", m);
   
           // word-spacing
  -        m  = new SpaceProperty.Maker(PR_WORD_SPACING);
  +        m  = new SpacingPropertyMaker(PR_WORD_SPACING);
           m.useGeneric(genericSpace);
           m.setInherited(true);
           m.getSubpropMaker(CP_PRECEDENCE).setDefault("force");
           m.getSubpropMaker(CP_CONDITIONALITY).setDefault("discard");
  -        m.setDefault("0pt");
  +        m.setDefault("normal");
  +        m.addEnum("normal", makeEnumProperty(NORMAL));
           addPropertyMaker("word-spacing", m);
       }
       
  
  
  
  1.32      +7 -2      xml-fop/src/java/org/apache/fop/fo/PropertyManager.java
  
  Index: PropertyManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertyManager.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- PropertyManager.java      18 Jun 2004 11:43:25 -0000      1.31
  +++ PropertyManager.java      13 Aug 2004 09:05:15 -0000      1.32
  @@ -35,6 +35,7 @@
   import org.apache.fop.traits.InlineProps;
   import org.apache.fop.traits.SpaceVal;
   import org.apache.fop.traits.LayoutProps; // keep, break, span, space?
  +import org.apache.fop.traits.MinOptMax;
   import org.apache.fop.fonts.FontMetrics;
   import org.apache.fop.fo.properties.CommonHyphenation;
   import org.xml.sax.Attributes;
  @@ -472,8 +473,12 @@
               textInfo.wrapOption = propertyList.get(PR_WRAP_OPTION).getEnum();
               textInfo.bWrap = (textInfo.wrapOption == Constants.WRAP);
   
  -            textInfo.wordSpacing = new SpaceVal(
  -                                     propertyList.get(PR_WORD_SPACING).getSpace());
  +            Property wordSpacing = propertyList.get(PR_WORD_SPACING);
  +            if (wordSpacing.getEnum() == NORMAL) {
  +                textInfo.wordSpacing = new SpaceVal(new MinOptMax(0), true, true, 
0);
  +            } else {
  +                textInfo.wordSpacing = new SpaceVal(wordSpacing.getSpace());
  +            }
   
               /* textInfo.letterSpacing =
                  new SpaceVal(propertyList.get("letter-spacing").getSpace());*/
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to