diff options
author | fotis <fotis@unknown> | 2000-12-20 18:20:18 +0000 |
---|---|---|
committer | fotis <fotis@unknown> | 2000-12-20 18:20:18 +0000 |
commit | 072cbc6c03eb351b9707d74a554b986082504d8b (patch) | |
tree | 50e4075958a249616ddf5aba32696e222bea9902 /src/org/apache/fop | |
parent | 4978d870788545c99410908cdb9fe504263af925 (diff) | |
download | xmlgraphics-fop-072cbc6c03eb351b9707d74a554b986082504d8b.tar.gz xmlgraphics-fop-072cbc6c03eb351b9707d74a554b986082504d8b.zip |
using leader-length.optimum instead of maximum for line break and length calculation
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193915 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop')
-rw-r--r-- | src/org/apache/fop/fo/flow/Leader.java | 9 | ||||
-rw-r--r-- | src/org/apache/fop/layout/BlockArea.java | 5 | ||||
-rw-r--r-- | src/org/apache/fop/layout/LineArea.java | 25 |
3 files changed, 18 insertions, 21 deletions
diff --git a/src/org/apache/fop/fo/flow/Leader.java b/src/org/apache/fop/fo/flow/Leader.java index 4608254e4..f5792d024 100644 --- a/src/org/apache/fop/fo/flow/Leader.java +++ b/src/org/apache/fop/fo/flow/Leader.java @@ -118,17 +118,8 @@ public class Leader extends FObjMixed { "leader-length.optimum").getLength().mvalue(); int leaderLengthMinimum = this.properties.get( "leader-length.minimum").getLength().mvalue(); - //brute force method to set default, because default values cannot be set - //in the properties classes for all subtypes - if (leaderLengthMinimum == 12000) { - leaderLengthMinimum = 0; - } int leaderLengthMaximum = this.properties.get( "leader-length.maximum").getLength().mvalue(); - //here too - if (leaderLengthMaximum == 12000) { - leaderLengthMaximum = 24000; - } //the following properties only apply for leader-pattern = "rule" int ruleThickness = this.properties.get( "rule-thickness").getLength().mvalue(); diff --git a/src/org/apache/fop/layout/BlockArea.java b/src/org/apache/fop/layout/BlockArea.java index fc31e89f2..9f65f5bdc 100644 --- a/src/org/apache/fop/layout/BlockArea.java +++ b/src/org/apache/fop/layout/BlockArea.java @@ -230,8 +230,11 @@ public class BlockArea extends Area { this.currentLineArea.changeColor(red, green, blue); //check whether leader fits into the (rest of the) line + //using length.optimum to determine where to break the line as defined + // in the xsl:fo spec: "User agents may choose to use the value of 'leader-length.optimum' + // to determine where to break the line" (7.20.4) //if leader is longer then create a new LineArea and put leader there - if (leaderLengthMinimum <= (this.getContentWidth() - + if (leaderLengthOptimum <= (this.getContentWidth() - this.currentLineArea.finalWidth - this.currentLineArea.pendingWidth)) { this.currentLineArea.addLeader(leaderPattern, diff --git a/src/org/apache/fop/layout/LineArea.java b/src/org/apache/fop/layout/LineArea.java index 1da1435cb..6393dc607 100644 --- a/src/org/apache/fop/layout/LineArea.java +++ b/src/org/apache/fop/layout/LineArea.java @@ -442,15 +442,12 @@ public class LineArea extends Area { int leaderLength; int remainingWidth = this.getContentWidth() - this.getCurrentXPosition(); - - //here is the point to decide which leader-length is to be used, either - //optimum or maximum. At the moment maximum is used if the remaining - //width isn't smaller. In this case only the remaining width is used for - //the leader. Actually this means, optimum is never used at the moment. - if (remainingWidth < leaderLengthMaximum) { + //checks whether leaderLenghtOptimum fits into rest of line; + //should never overflow, asit has been checked already in BlockArea + if (remainingWidth < leaderLengthOptimum) { leaderLength = remainingWidth; } else { - leaderLength = leaderLengthMaximum; + leaderLength = leaderLengthOptimum; } switch (leaderPattern) { case LeaderPattern.SPACE: @@ -751,6 +748,10 @@ public class LineArea extends Area { } + /** extracts word for hyphenation and calls hyphenation package, + * handles cases of inword punctuation and quotation marks at the beginning + * of words, but not in a internationalized way + */ private int doHyphenation (char [] characters, int position, int wordStart, int remainingWidth) { //check whether the language property has been set if (this.language.equalsIgnoreCase("none")) { @@ -783,12 +784,9 @@ public class LineArea extends Area { //extracts whole word from string wordToHyphenate = getHyphenationWord(characters,wordStart+1); } else { -// remainingString = ""; wordToHyphenate = getHyphenationWord(characters,wordStart); } - - //if the extracted word is smaller than the remaining width //we have a non letter character inside the word. at the moment //we will only handle hard hyphens and slashes @@ -844,6 +842,7 @@ public class LineArea extends Area { return wordStart; } + /** calculates the wordWidth using the actual fontstate*/ private int getWordWidth (String word) { int wordLength = word.length(); @@ -856,6 +855,8 @@ public class LineArea extends Area { return width; } + + /** adds a single character to the line area tree*/ public int addCharacter (char data, LinkSet ls, boolean ul) { InlineArea ia = null; int remainingWidth = @@ -886,7 +887,8 @@ public class LineArea extends Area { } } - /** adds a string to the line area children. insert a space before the word */ + + /** adds a InlineArea containing the String startChar+wordBuf to the line area children. */ private void addWord (char startChar, StringBuffer wordBuf) { String word = wordBuf.toString(); InlineArea hia; @@ -910,6 +912,7 @@ public class LineArea extends Area { } + /** extracts from a hyphenated word the best (most greedy) fit */ private int getFinalHyphenationPoint(Hyphenation hyph, int remainingWidth) { int [] hyphenationPoints = hyph.getHyphenationPoints(); int numberOfHyphenationPoints = hyphenationPoints.length; |