pbwest 2004/05/29 23:15:57
Modified: src/java/org/apache/fop/area Tag: FOP_0-20-0_Alt-Design
LineArea.java
Log:
Set iPDimMin to the advance of the longest word in the text.
Set bPDimMin = bPDimMax.
Revision Changes Path
No revision
No revision
1.2.2.3 +16 -2 xml-fop/src/java/org/apache/fop/area/LineArea.java
Index: LineArea.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/LineArea.java,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -r1.2.2.2 -r1.2.2.3
--- LineArea.java 29 May 2004 19:28:46 -0000 1.2.2.2
+++ LineArea.java 30 May 2004 06:15:57 -0000 1.2.2.3
@@ -26,6 +26,7 @@
import java.awt.font.TextMeasurer;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
+import java.text.BreakIterator;
import java.util.Map;
import org.apache.fop.datastructs.Node;
@@ -173,8 +174,21 @@
new Float(Math.max(
layout.getLeading(),
(layout.getAscent() + layout.getDescent())));
- // Find the shortest fragment of the text
- // TODO work out Locale handling
+ // Find the longest fragment of the text
+ BreakIterator words =
+ BreakIterator.getWordInstance(generatedBy.getLocale());
+ words.setText(text);
+ int begin = 0;
+ float maxWordWidth = 0;
+ int boundary = 0;
+ while ((boundary = words.next()) != BreakIterator.DONE) {
+ float width = measurer.getAdvanceBetween(begin, boundary);
+ maxWordWidth = Math.max(maxWordWidth, width);
+ begin = boundary;
+ }
+ iPDimMin = new Float(maxWordWidth);
+ // For now, set bPDimMin = bPDimMax.
+ bPDimMin = bPDimMax;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]