From d0ffc489d529e3d63362b5780cd83558459eeda4 Mon Sep 17 00:00:00 2001 From: Manuel Mall Date: Wed, 18 Jul 2007 10:40:12 +0000 Subject: [PATCH] Fixed incomplete support for Unicode word joiners git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@557219 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/layoutmgr/inline/TextLayoutManager.java | 4 ++-- src/java/org/apache/fop/util/CharUtilities.java | 7 ++++++- status.xml | 3 +++ .../standard-testcases/block_uax14_linebreaking.xml | 11 +++++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index 8539bcbe3..de5f086b0 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java @@ -538,7 +538,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { */ private static boolean isSpace(final char ch) { return ch == CharUtilities.SPACE - || ch == CharUtilities.NBSPACE + || CharUtilities.isNonBreakableSpace(ch) || CharUtilities.isFixedWidthSpace(ch); } @@ -689,7 +689,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { (short) 1, (short) 0, wordSpaceIPD, false, true, breakOpportunity); iThisStart = (short) (iNextStart + 1); - } else if (CharUtilities.isFixedWidthSpace(ch)) { + } else if (CharUtilities.isFixedWidthSpace(ch) || CharUtilities.isZeroWidthSpace(ch)) { // create the AreaInfo object MinOptMax ipd = new MinOptMax(font.getCharWidth(ch)); ai = new AreaInfo(iNextStart, (short) (iNextStart + 1), diff --git a/src/java/org/apache/fop/util/CharUtilities.java b/src/java/org/apache/fop/util/CharUtilities.java index 1aad75ad7..5663dbb1e 100644 --- a/src/java/org/apache/fop/util/CharUtilities.java +++ b/src/java/org/apache/fop/util/CharUtilities.java @@ -60,6 +60,8 @@ public class CharUtilities { public static final char NBSPACE = '\u00A0'; /** zero-width space */ public static final char ZERO_WIDTH_SPACE = '\u200B'; + /** word joiner */ + public static final char WORD_JOINER = '\u2060'; /** zero-width no-break space (= byte order mark) */ public static final char ZERO_WIDTH_NOBREAK_SPACE = '\uFEFF'; /** soft hyphen */ @@ -106,6 +108,7 @@ public class CharUtilities { */ public static boolean isZeroWidthSpace(char c) { return c == ZERO_WIDTH_SPACE // 200Bh + || c == WORD_JOINER // 2060h || c == ZERO_WIDTH_NOBREAK_SPACE; // FEFFh (also used as BOM) } @@ -115,7 +118,8 @@ public class CharUtilities { * @return true if the character has a fixed-width */ public static boolean isFixedWidthSpace(char c) { - return (c >= '\u2000' && c <= '\u200B') || c == '\u3000'; + return (c >= '\u2000' && c <= '\u200B') + || c == '\u3000'; // c == '\u2000' // en quad // c == '\u2001' // em quad // c == '\u2002' // en space @@ -142,6 +146,7 @@ public class CharUtilities { (c == NBSPACE // no-break space || c == '\u202F' // narrow no-break space || c == '\u3000' // ideographic space + || c == WORD_JOINER // word joiner || c == ZERO_WIDTH_NOBREAK_SPACE); // zero width no-break space } diff --git a/status.xml b/status.xml index d155da934..43209785a 100644 --- a/status.xml +++ b/status.xml @@ -28,6 +28,9 @@ + + Fixed incomplete support for Unicode Word Joiner characters (U+2060 and U+FEFF). + Support alignment-adjust for images. diff --git a/test/layoutengine/standard-testcases/block_uax14_linebreaking.xml b/test/layoutengine/standard-testcases/block_uax14_linebreaking.xml index 101e5197d..ea6e3ddcd 100755 --- a/test/layoutengine/standard-testcases/block_uax14_linebreaking.xml +++ b/test/layoutengine/standard-testcases/block_uax14_linebreaking.xml @@ -112,6 +112,12 @@ No-break-point-in-normal-dates-12/12/2006-or-fractions-12345678/67890112 + + WJ -- Word Joiner (XB/XA) + + + Here we/⁠prevent/⁠any/⁠breaks/⁠after the/⁠solidus + @@ -184,5 +190,10 @@ + + + + + -- 2.39.5