The value returned will be an Constants.NORMAL enum. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197868 13f79535-47bb-0310-9956-ffa450edef68pull/30/head
@@ -40,6 +40,7 @@ import org.apache.fop.fo.properties.NumberProperty; | |||
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 @@ public class FOPropertyMapping implements Constants { | |||
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 @@ public class FOPropertyMapping implements Constants { | |||
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); | |||
} | |||
@@ -35,6 +35,7 @@ import org.apache.fop.traits.BlockProps; | |||
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 @@ public class PropertyManager implements Constants { | |||
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());*/ |
@@ -122,10 +122,14 @@ public class CompoundPropertyMaker extends PropertyMaker { | |||
* 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 @@ public class CompoundPropertyMaker extends PropertyMaker { | |||
* @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()); | |||
} | |||
} | |||
/** |
@@ -0,0 +1,52 @@ | |||
/* | |||
* 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$ */ | |||
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); | |||
} | |||
} |