diff options
author | Simon Pepping <spepping@apache.org> | 2004-09-05 18:16:32 +0000 |
---|---|---|
committer | Simon Pepping <spepping@apache.org> | 2004-09-05 18:16:32 +0000 |
commit | d93dfd6e1ef331a1539cdae9f2a37f274aba89c4 (patch) | |
tree | cbf5b895de93a9587ea3d2edbe02251a5ec6d4cd /src/java/org/apache/fop/area/inline | |
parent | 851188ac5728c24d819720440990f499d4e27106 (diff) | |
download | xmlgraphics-fop-d93dfd6e1ef331a1539cdae9f2a37f274aba89c4.tar.gz xmlgraphics-fop-d93dfd6e1ef331a1539cdae9f2a37f274aba89c4.zip |
New line breaking algorithm, patch 29124, submitted by Luca
Furini. This patch implements the algorithm for most but not yet all
inline layout managers.
For the algorithm, see D.E. Knuth and M.F. Plass, "Breaking paragraphs
into lines", Software, Practice and Experience 11 (1981) 1119-1184;
reprinted in: D. E. Knuth, "Digital typography", CSLI Lecture Notes
Number 78 (CLSI Publications, Stanford, CA, USA) pp. 67-155.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197907 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/area/inline')
-rw-r--r-- | src/java/org/apache/fop/area/inline/Character.java | 59 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/inline/TextArea.java | 36 |
2 files changed, 82 insertions, 13 deletions
diff --git a/src/java/org/apache/fop/area/inline/Character.java b/src/java/org/apache/fop/area/inline/Character.java index 9630614e0..bed1b194a 100644 --- a/src/java/org/apache/fop/area/inline/Character.java +++ b/src/java/org/apache/fop/area/inline/Character.java @@ -23,15 +23,19 @@ package org.apache.fop.area.inline; * This inline area holds a single character. */ public class Character extends InlineArea { - private char character; + // use a String instead of a character because if this character + // ends a syllable the hyphenation character must be added + private String character; + private int iTextWordSpaceAdjust = 0; + private int iTextLetterSpaceAdjust = 0; /** - * Create a new characater inline area with the given character. + * Create a new character inline area with the given character. * * @param ch the character for this inline area */ public Character(char ch) { - character = ch; + character = new String() + ch; } /** @@ -39,8 +43,55 @@ public class Character extends InlineArea { * * @return the character */ - public char getChar() { + public String getChar() { return character; } + + /** + * Add the hyphenation character and its length. + * + * @param hyphChar the hyphenation character + * @param hyphSize the size of the hyphenation character + */ + public void addHyphen(char hyphChar, int hyphSize) { + character += hyphChar; + this.setIPD(this.getIPD() + hyphSize); + } + + /** + * Get text word space adjust. + * + * @return the text word space adjustment + */ + public int getTextWordSpaceAdjust() { + return iTextWordSpaceAdjust; + } + + /** + * Set text word space adjust. + * + * @param iTWSadjust the text word space adjustment + */ + public void setTextWordSpaceAdjust(int iTWSadjust) { + iTextWordSpaceAdjust = iTWSadjust; + } + + /** + * Get text letter space adjust. + * + * @return the text letter space adjustment + */ + public int getTextLetterSpaceAdjust() { + return iTextLetterSpaceAdjust; + } + + /** + * Set text letter space adjust. + * + * @param iTLSadjust the text letter space adjustment + */ + public void setTextLetterSpaceAdjust(int iTLSadjust) { + iTextLetterSpaceAdjust = iTLSadjust; + } } diff --git a/src/java/org/apache/fop/area/inline/TextArea.java b/src/java/org/apache/fop/area/inline/TextArea.java index 110eaa03f..86bf35838 100644 --- a/src/java/org/apache/fop/area/inline/TextArea.java +++ b/src/java/org/apache/fop/area/inline/TextArea.java @@ -27,7 +27,8 @@ public class TextArea extends InlineArea { * The text for this inline area */ protected String text; - private int iTextSpaceAdjust = 0; + private int iTextWordSpaceAdjust = 0; + private int iTextLetterSpaceAdjust = 0; /** * Create a text inline area @@ -54,21 +55,38 @@ public class TextArea extends InlineArea { } /** - * Get text space adjust. + * Get text word space adjust. * - * @return the text space adjustment + * @return the text word space adjustment */ - public int getTextSpaceAdjust() { - return iTextSpaceAdjust; + public int getTextWordSpaceAdjust() { + return iTextWordSpaceAdjust; } /** - * Set text space adjust. + * Set text word space adjust. * - * @param iTSadjust the text space adjustment + * @param iTWSadjust the text word space adjustment */ - public void setTextSpaceAdjust(int iTSadjust) { - iTextSpaceAdjust = iTSadjust; + public void setTextWordSpaceAdjust(int iTWSadjust) { + iTextWordSpaceAdjust = iTWSadjust; + } + /** + * Get text letter space adjust. + * + * @return the text letter space adjustment + */ + public int getTextLetterSpaceAdjust() { + return iTextLetterSpaceAdjust; + } + + /** + * Set text letter space adjust. + * + * @param iTLSadjust the text letter space adjustment + */ + public void setTextLetterSpaceAdjust(int iTLSadjust) { + iTextLetterSpaceAdjust = iTLSadjust; } } |