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;
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
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);
}
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;
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());*/
* 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;
}
/**
* @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());
+ }
}
/**
--- /dev/null
+/*
+ * 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);
+ }
+}