From 2569a6d829991a2aebad001df2447483d44e1d9b Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 10 Apr 2006 07:39:01 +0000 Subject: List NBSP under adjustable spaces in CharUtilities. Generate space elements in the area tree from spaces in fo:character. Clearly mark test cases which test for NBSP. Document failure to generate adjustable spaces from fo:character in a disabled test case. Adjust checks to the fact the fo:character can now also generate spaces. Enable block_white-space-collapse_2.xml again git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@392901 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/layoutmgr/inline/CharacterLayoutManager.java | 16 +++++++++++----- src/java/org/apache/fop/util/CharUtilities.java | 4 +++- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src/java/org') diff --git a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java index 4bc66adfb..9067c575c 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java @@ -32,6 +32,7 @@ import org.apache.fop.layoutmgr.TraitSetter; import org.apache.fop.area.Trait; import org.apache.fop.traits.MinOptMax; import org.apache.fop.traits.SpaceVal; +import org.apache.fop.util.CharUtilities; import java.util.List; import java.util.LinkedList; @@ -73,12 +74,17 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { } private org.apache.fop.area.inline.TextArea getCharacterInlineArea(Character node) { - org.apache.fop.area.inline.TextArea ch + org.apache.fop.area.inline.TextArea text = new org.apache.fop.area.inline.TextArea(); - ch.addWord(String.valueOf(node.getCharacter()), 0); - TraitSetter.setProducerID(ch, node.getId()); - TraitSetter.addTextDecoration(ch, fobj.getTextDecoration()); - return ch; + char ch = node.getCharacter(); + if (CharUtilities.isAnySpace(ch)) { + text.addSpace(ch, 0, CharUtilities.isAdjustableSpace(ch)); + } else { + text.addWord(String.valueOf(ch), 0); + } + TraitSetter.setProducerID(text, node.getId()); + TraitSetter.addTextDecoration(text, fobj.getTextDecoration()); + return text; } /** @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int) */ diff --git a/src/java/org/apache/fop/util/CharUtilities.java b/src/java/org/apache/fop/util/CharUtilities.java index f200c3e2f..985c25df7 100644 --- a/src/java/org/apache/fop/util/CharUtilities.java +++ b/src/java/org/apache/fop/util/CharUtilities.java @@ -61,6 +61,8 @@ public class CharUtilities { public static final char ZERO_WIDTH_SPACE = '\u200B'; /** zero-width no-break space (= byte order mark) */ public static final char ZERO_WIDTH_NOBREAK_SPACE = '\uFEFF'; + /** soft hyphen */ + public static final char SOFT_HYPHEN = '\u00AD'; /** @@ -142,7 +144,7 @@ public class CharUtilities { //TODO: are there other kinds of adjustable spaces? return (c == '\u0020' // normal space - /*|| c == ''*/); + || c == NBSPACE); // no-break space } /** -- cgit v1.2.3