You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Kai Strackbein <KS...@t-online.de> on 2000/11/02 12:50:48 UTC

[BUG]

Hi !

We are using fop0_14_0 with JDK1.2.2 and JDK1.3. We've a problem
concerning word-wrapping in tables, if the first word in the new line
contains 'Umlaute' (these characters are special german characters). The
'Umlaut' and all preceding characters in that word are truncated.

Is this a known problem and do you have any solutions or tips where to
look upon.

Appended to this mail are a .fo and a .pdf-file, containing an example
for the problem.

Thanks
Kai Strackbein


Re: [BUG]

Posted by Dorothea Wiarda <wi...@vic.com>.
Kai Strackbein wrote:
> 
> Hi !
> 
> We are using fop0_14_0 with JDK1.2.2 and JDK1.3. We've a problem
> concerning word-wrapping in tables, if the first word in the new line
> contains 'Umlaute' (these characters are special german characters). The
> 'Umlaut' and all preceding characters in that word are truncated.

I looked into this problem. Actually, one does not need to have a table
to
dublicate the problem. The following  document will have the same
problem 

------------- Example for duplication
------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>

	<fo:simple-page-master master-name="table" 
                          page-height="29.7cm" page-width="21cm">
		<fo:region-body margin-top="3cm" margin-bottom="1cm"/>
	</fo:simple-page-master>


</fo:layout-master-set>

<fo:page-sequence master-name="table" font-family="sans-serif" 
             font-weight="normal" align="justify">
	<fo:flow flow-name="xsl-region-body">
          
<fo:block>Uberschriftberschriftberschriftberschriftberschriftaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
&#xDC;ber</fo:block>
	</fo:flow>
</fo:page-sequence>

</fo:root>
-------------------------------------------------------------------------------------------------

There must be enough text in the first line to allow the unlaut U to fit
but not the rest of the word. 


The reason: 
a) The unlaut U gets modeled as one org.apache.fop.fo.FOText instance
and the rest of the word in another.
b) In  org.apache.fop.layout.BlockArea the Lines are build (as
org.apache.fop.layout.LineArea instances).
Once a line is full, a new line is started. In
org.apache.fop.layout.LineArea text is added into  the Vector
pendingAreas until a whitespace character is encountered. 
Now, we add Umlaut U, it fits, put since it is not terminated with a
whitespace character it gets put intp
pendingAreas. Next we attempt to add ber, which does not fit in the
first line, hence a new 
org.apache.fop.layout.LineArea is started in
org.apache.fop.layout.BlockArea. The pendingAreas elements in the first
org.apache.fop.layout.LineArea are ignored.

A proposed solution:
Change the constructor of org.apache.fop.layout.LineArea to include a
reference to the previous instance, if any. 
Then add the remaining pendingAreas elements and update pendingWidth
accordingly. diff follows:

-------- diff for
org.apache.fop.layout.LineArea-------------------------------------------------

*** LineArea.java	Tue Nov  7 09:40:18 2000
--- LineArea.java.save	Tue Nov  7 09:09:58 2000
***************
*** 125,131 ****
  
      public LineArea(FontState fontState, int lineHeight, int
  		    halfLeading, int allocationWidth, int startIndent,
! 		    int endIndent,LineArea prevLineArea) { 
  	super(fontState);        
  	
  	this.currentFontState = fontState;
--- 125,131 ----
  
      public LineArea(FontState fontState, int lineHeight, int
  		    halfLeading, int allocationWidth, int startIndent,
! 		    int endIndent) { 
  	super(fontState);        
  	
  	this.currentFontState = fontState;
***************
*** 145,157 ****
  	this.startIndent = startIndent;
  	this.endIndent = endIndent;
  	
-         if(prevLineArea != null){
- 	    Enumeration e=prevLineArea.pendingAreas.elements();
-             while( e.hasMoreElements() ){
- 		pendingAreas.addElement(e.nextElement());
- 	    }
-             pendingWidth=prevLineArea.getPendingWidth();         
- 	}
      }
      
      public void render(Renderer renderer) {
--- 145,150 ----

--------------------------------------------------------------------------------------------
Of course the following changes need to be made to BlockArea:

-------- diff for
org.apache.fop.layout.BlockArea-------------------------------------------------

*** BlockArea.java	Tue Nov  7 09:36:24 2000
--- BlockArea.java.save	Tue Nov  7 09:09:28 2000
***************
*** 167,177 ****
  	while (ts != -1) {
  	    this.currentLineArea.align(this.align);
  	    this.addLineArea(this.currentLineArea);
-             
  	    this.currentLineArea = new
  		LineArea(fontState, lineHeight, halfLeading,
! 			 allocationWidth, startIndent, endIndent,
!                          currentLineArea);  
  	    if (currentHeight + currentLineArea.getHeight() >
  		this.maxHeight) {
  		return ts;
--- 167,175 ----
  	while (ts != -1) {
  	    this.currentLineArea.align(this.align);
  	    this.addLineArea(this.currentLineArea);
  	    this.currentLineArea = new
  		LineArea(fontState, lineHeight, halfLeading,
! 			 allocationWidth, startIndent, endIndent);  
  	    if (currentHeight + currentLineArea.getHeight() >
  		this.maxHeight) {
  		return ts;
***************
*** 201,207 ****
  	currentLineArea = new LineArea(fontState, lineHeight,
  				       halfLeading, allocationWidth,
  				       startIndent + textIndent,
! 				       endIndent,null);
      }
  
      public int getEndIndent() {
--- 199,205 ----
  	currentLineArea = new LineArea(fontState, lineHeight,
  				       halfLeading, allocationWidth,
  				       startIndent + textIndent,
! 				       endIndent);
      }
  
      public int getEndIndent() {
-----------------------------------------------------------------------------------------------------------

I don't know whether the LinkSet needs to be updated too. I don't
understand that part yet :).

Doro

________________________________________________________
Dorothea Wiarda

E-Mail:    wiarda@dwiarda.com
Web-Home:  http://www.dwiarda.com
           http://www.techno-info.com