diff options
-rw-r--r-- | src/documentation/content/xdocs/compliance.ihtml | 3 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FOText.java | 10 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java | 6 | ||||
-rw-r--r-- | status.xml | 3 | ||||
-rw-r--r-- | test/layoutengine/disabled-testcases.xml | 5 | ||||
-rw-r--r-- | test/layoutengine/standard-testcases/inline_keep-together.xml | 22 | ||||
-rw-r--r-- | test/layoutengine/standard-testcases/page-breaking_5.xml | 8 |
7 files changed, 34 insertions, 23 deletions
diff --git a/src/documentation/content/xdocs/compliance.ihtml b/src/documentation/content/xdocs/compliance.ihtml index bf6d210e5..4860eb5c7 100644 --- a/src/documentation/content/xdocs/compliance.ihtml +++ b/src/documentation/content/xdocs/compliance.ihtml @@ -5111,6 +5111,9 @@ <li> [0.93] <integer> values are not supported. </li> + <li> + [Dev] <integer> values are not supported. + </li> </ul> </td> </tr> diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java index b2baf58a7..527cdbfc4 100644 --- a/src/java/org/apache/fop/fo/FOText.java +++ b/src/java/org/apache/fop/fo/FOText.java @@ -30,6 +30,7 @@ import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.properties.CommonFont; import org.apache.fop.fo.properties.CommonHyphenation; import org.apache.fop.fo.properties.CommonTextDecoration; +import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fo.properties.Property; import org.apache.fop.fo.properties.SpaceProperty; @@ -80,6 +81,7 @@ public class FOText extends FONode { private CommonFont commonFont; private CommonHyphenation commonHyphenation; private Color color; + private KeepProperty keepTogether; private Property letterSpacing; private SpaceProperty lineHeight; private int whiteSpaceTreatment; @@ -166,6 +168,7 @@ public class FOText extends FONode { commonFont = pList.getFontProps(); commonHyphenation = pList.getHyphenationProps(); color = pList.get(Constants.PR_COLOR).getColor(getUserAgent()); + keepTogether = pList.get(Constants.PR_KEEP_TOGETHER).getKeep(); lineHeight = pList.get(Constants.PR_LINE_HEIGHT).getSpace(); letterSpacing = pList.get(Constants.PR_LETTER_SPACING); whiteSpaceCollapse = pList.get(Constants.PR_WHITE_SPACE_COLLAPSE).getEnum(); @@ -556,6 +559,13 @@ public class FOText extends FONode { return color; } + /** + * @return the "keep-together" property. + */ + public KeepProperty getKeepTogether() { + return keepTogether; + } + /** * @return the "letter-spacing" property. */ diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index a805c363d..93196d8ab 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java @@ -164,6 +164,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager { private int lineStartBAP = 0; private int lineEndBAP = 0; + + private boolean keepTogether; /** * Create a Text layout manager. @@ -213,6 +215,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager { // in the SpaceVal.makeWordSpacing() method letterSpaceIPD = ls.getSpace(); wordSpaceIPD = MinOptMax.add(new MinOptMax(spaceCharIPD), ws.getSpace()); + + keepTogether = foText.getKeepTogether().getWithinLine().getEnum() == Constants.EN_ALWAYS; } @@ -562,7 +566,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { while (iNextStart < textArray.length) { ch = textArray[iNextStart]; boolean breakOpportunity = false; - byte breakAction = lbs.nextChar(ch); + byte breakAction = keepTogether? LineBreakStatus.PROHIBITED_BREAK : lbs.nextChar(ch); switch (breakAction) { case LineBreakStatus.COMBINING_PROHIBITED_BREAK: case LineBreakStatus.PROHIBITED_BREAK: diff --git a/status.xml b/status.xml index 43209785a..f9fcd31a4 100644 --- a/status.xml +++ b/status.xml @@ -28,6 +28,9 @@ <changes> <release version="FOP Trunk"> + <action context="code" dev="MM" type="add"> + Support for keep-together.within-line="always". + </action> <action context="Code" dev="MM" type="fix"> Fixed incomplete support for Unicode Word Joiner characters (U+2060 and U+FEFF). </action> diff --git a/test/layoutengine/disabled-testcases.xml b/test/layoutengine/disabled-testcases.xml index d81c0dc27..a7cf1a707 100644 --- a/test/layoutengine/disabled-testcases.xml +++ b/test/layoutengine/disabled-testcases.xml @@ -123,11 +123,6 @@ <reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=37579</reference> </testcase> <testcase> - <name>keeps on inlines NYI</name> - <file>inline_keep-together.xml</file> - <description>Keeps are not implemented in inline-level elements, yet.</description> - </testcase> - <testcase> <name>NPE for table inside an inline</name> <file>inline_block_nested_3.xml</file> <description>Placing a table as a child of an fo:inline produces a diff --git a/test/layoutengine/standard-testcases/inline_keep-together.xml b/test/layoutengine/standard-testcases/inline_keep-together.xml index 1bd82c0b8..af9317815 100644 --- a/test/layoutengine/standard-testcases/inline_keep-together.xml +++ b/test/layoutengine/standard-testcases/inline_keep-together.xml @@ -33,12 +33,11 @@ </fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple">
- <fo:flow flow-name="xsl-region-body" hyphenate="true">
+ <fo:flow flow-name="xsl-region-body">
<fo:block-container width="100pt" background-color="yellow">
- <fo:block>This is <fo:inline keep-together.within-line="always">BLah-blah-blah-blah!</fo:inline></fo:block>
- <fo:block>This is <fo:inline keep-together.within-line="always">Blah-blah-blah-blah!</fo:inline></fo:block>
- <fo:block>This is <fo:inline>Blah blah blah blah!</fo:inline></fo:block>
+ <fo:block keep-together.within-line="always">This is Blah blah blah blah!</fo:block>
<fo:block>This is <fo:inline keep-together.within-line="always">Blah blah blah blah!</fo:inline></fo:block>
+ <fo:block>This is <fo:wrapper keep-together.within-line="always">Blah blah blah blah!</fo:wrapper></fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
@@ -46,18 +45,15 @@ </fo>
<checks>
<!-- The layout engine should warn the user about the overflow in this case. -->
- <eval expected="This is " xpath="//flow/block[1]/block[1]/block[1]/lineArea[1]"/>
- <eval expected="BLah-blah-blah-blah!" xpath="//flow/block[1]/block[1]/block[1]/lineArea[2]"/>
+ <eval expected="This is Blah blah blah blah!" xpath="//flow/block[1]/block[1]/block[1]/lineArea[1]"/>
<!-- The layout engine should warn the user about the overflow in this case. -->
- <eval expected="This is " xpath="//flow/block[1]/block[1]/block[2]/lineArea[1]"/>
- <eval expected="Blah-blah-blah-blah!" xpath="//flow/block[1]/block[1]/block[2]/lineArea[2]"/>
-
- <eval expected="This is Blah blah " xpath="//flow/block[1]/block[1]/block[3]/lineArea[1]"/>
- <eval expected="blah blah!" xpath="//flow/block[1]/block[1]/block[3]/lineArea[2]"/>
+ <eval expected="This is" xpath="//flow/block[1]/block[1]/block[2]/lineArea[1]"/>
+ <eval expected="Blah blah blah blah!" xpath="//flow/block[1]/block[1]/block[2]/lineArea[2]"/>
<!-- The layout engine should warn the user about the overflow in this case. -->
- <eval expected="This is " xpath="//flow/block[1]/block[1]/block[4]/lineArea[1]"/>
- <eval expected="Blah blah blah blah!" xpath="//flow/block[1]/block[1]/block[4]/lineArea[2]"/>
+ <eval expected="This is" xpath="//flow/block[1]/block[1]/block[3]/lineArea[1]"/>
+ <eval expected="Blah blah blah blah!" xpath="//flow/block[1]/block[1]/block[3]/lineArea[2]"/>
+
</checks>
</testcase>
diff --git a/test/layoutengine/standard-testcases/page-breaking_5.xml b/test/layoutengine/standard-testcases/page-breaking_5.xml index ffd337c92..f0067d004 100644 --- a/test/layoutengine/standard-testcases/page-breaking_5.xml +++ b/test/layoutengine/standard-testcases/page-breaking_5.xml @@ -41,10 +41,10 @@ </fo:layout-master-set> <fo:page-sequence master-reference="master"> <fo:flow flow-name="xsl-region-body"> - <fo:block background-color="orange" keep-together="always">Apache FOP is a great tool to create PDF documents with.</fo:block> - <fo:block background-color="orange" keep-together="always">Apache FOP is a great tool to create PDF documents with.</fo:block> - <fo:block background-color="orange" keep-together="always">Apache FOP is a great tool to create PDF documents with.</fo:block> - <fo:block background-color="orange" keep-together="always">Apache FOP is a great tool to create PDF documents with.</fo:block> + <fo:block background-color="orange" keep-together.within-page="always">Apache FOP is a great tool to create PDF documents with.</fo:block> + <fo:block background-color="orange" keep-together.within-page="always">Apache FOP is a great tool to create PDF documents with.</fo:block> + <fo:block background-color="orange" keep-together.within-page="always">Apache FOP is a great tool to create PDF documents with.</fo:block> + <fo:block background-color="orange" keep-together.within-page="always">Apache FOP is a great tool to create PDF documents with.</fo:block> <fo:block background-color="yellow">last line in new block</fo:block> </fo:flow> </fo:page-sequence> |