]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fixed incomplete support for Unicode word joiners
authorManuel Mall <manuel@apache.org>
Wed, 18 Jul 2007 10:40:12 +0000 (10:40 +0000)
committerManuel Mall <manuel@apache.org>
Wed, 18 Jul 2007 10:40:12 +0000 (10:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@557219 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
src/java/org/apache/fop/util/CharUtilities.java
status.xml
test/layoutengine/standard-testcases/block_uax14_linebreaking.xml

index 8539bcbe3a0de78c1162cddfaff9d7c596dc86fb..de5f086b0dda7ce97c39f987670c3a677a9070c3 100644 (file)
@@ -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),
index 1aad75ad72b4c844c44828ec93052a2c41c9aa3b..5663dbb1ed7074b818be552cb9286bfcf1b5bb76 100644 (file)
@@ -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
     }
 
index d155da934c3474245b99efcf6cff946cbbaf9df5..43209785a12f7524b338a77a41fccd15da837870 100644 (file)
@@ -28,6 +28,9 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="MM" type="fix">
+        Fixed incomplete support for Unicode Word Joiner characters (U+2060 and U+FEFF).
+      </action>
       <action context="code" dev="AD" type="add" fixes-bug="42785" due-to="Max Berger">
         Support alignment-adjust for images.
       </action>
index 101e5197dcc40370066ed003d3f5f3072c789797..ea6e3ddcdf6caa6c767b8815423c778725bf711f 100755 (executable)
           <fo:block background-color="yellow" margin="0pt 0pt 3pt 0pt">
             No-break-point-in-normal-dates-12/12/2006-or-fractions-12345678/67890112
           </fo:block>
+          <fo:block background-color="silver" font-size="8pt" margin="3pt 0pt 0pt 0pt">
+            WJ -- Word Joiner (XB/XA)
+          </fo:block>
+          <fo:block background-color="yellow" margin="0pt 0pt 3pt 0pt">
+            Here we/&#x2060;prevent/&#x2060;any/&#x2060;breaks/&#x2060;after the/&#x2060;solidus
+          </fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
       <eval expected="114460" xpath="//flow/block[27]/lineArea[1]/text/@ipd"/>
       <eval expected="93380" xpath="//flow/block[27]/lineArea[2]/text/@ipd"/>
       <eval expected="132860" xpath="//flow/block[27]/lineArea[3]/text/@ipd"/>
+
+      <eval expected="3" xpath="count(//flow/block[29]/lineArea)"/>
+      <eval expected="21670" xpath="//flow/block[29]/lineArea[1]/text/@ipd"/>
+      <eval expected="145630" xpath="//flow/block[29]/lineArea[2]/text/@ipd"/>
+      <eval expected="53360" xpath="//flow/block[29]/lineArea[3]/text/@ipd"/>
   </checks>
 </testcase>