xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Art Welch <ar...@EASTPOINT.COM>
Subject FW: halfLeading calculation problem
Date Mon, 18 Dec 2000 19:30:34 GMT
I am resending this, because I do not recall seeing it on the list and have
not received any replies.

Can someone lend some insight on this.

Thank You,
Art

>  -----Original Message-----
> From: 	Art Welch  
> Sent:	Friday, December 15, 2000 6:00 PM
> To:	'fop-dev@xml.apache.org'
> Subject:	halfLeading calculation problem
> 
> I noticed a problem where setting the line-height attribute on a block did
> not result in lines being produced with the specified height. For example
> setting a line-height="0.17in" was resulting in lines of approximately
> 0.15in. I believe that I know why this is happening. In
> BlockArea.BlockArea() the half leading is set as follows:
> 
> 	  this.halfLeading = (lineHeight - fontState.getFontSize())/2;
> 
> This is then used in BlockArea.addLineArea() as follows:
> 
>     public void addLineArea(LineArea la) {
> 	if (!la.isEmpty()) {
> 	    this.addDisplaySpace(this.halfLeading);
> 	    int size = la.getHeight();
> 	    this.addChild(la);
> 	    this.increaseHeight(size);
> 	    this.addDisplaySpace(this.halfLeading);
> 	}
>     }
> 
> I think that the idea hear is that the LineArea would have height equal to
> the font size. If this were the case then halfLeading + la.getHeight() +
> halfLeading would indeed add up to lineHeight. Unfortunately
> LineArea.getHeight() is coded as follows:
> 
>     public int getHeight() {
> 	return this.allocationHeight;
>     }
> 
> and the allocationHeight is set in the constructor by the following code:
> 
> 	this.nominalGlyphHeight = fontState.getAscender() -
> 	    fontState.getDescender(); 
> 	
> 	...
> 	
> 	this.allocationHeight = this.nominalGlyphHeight;
> 
> So we see that the LineArea will return the font Ascender - Descender for
> the Height. Using Courier (7pt) I have the following values:
> 
> 	Font Size	7048
> 	Ascender	4433
> 	Descender	-1106
> 
> These yield Ascender - Descender = 5539 which is of course not equal to
> the Font Size of 7048.
> 
> Assuming that there is not another problem, like the Ascender or
> Descender, or Font Size being calculated incorrectly, I submit that one of
> the height calculations must be incorrect. Can we fix this? Does anyone
> know which one (if either) is correct? My guess would be LineArea is
> correct, but I would need to do a bit more research to be certain.
> 
> Thank You,
> Art

Mime
View raw message