[xep-support] center text vertically

Christian Kirchhoff ckirchho at directmedia.de
Tue Jan 23 03:30:34 PST 2007


 
Hallo,

I am working on a stylesheet that produces xsl-fo for a book cover. The
spine of the book cover lies in the middle of the document, the back page to
the left and the front page to the right.

I place the name of the author and the title of the book on the spine. In
Germany this text is read upwards, from bottom to top. Thus I use an
absolute positioned fo:block-container with reference-orientation="90".

The width of the spine depends on the number of pages of the book. Thus I
have to choose a proper font size for the spine's text.

In addition, the text on the spine should be horizontally centered. This
seems to be a more sophisticated task, cause the height of the text depends
on whether capital letters, letters with ascenders (e.g. b, l, t) or letters
with descenders (e.g. g, p, q) are present in the text.

The text usually contains capital letters, thus there has always be an
ascending height added to the overall height. And thus it only depends on
whether the text has letters with descenders or not. The text is contained
in three fo:inline elements that of course never should be too long and
always stay in one single line. Thus they should share one baseline.

I set display-align="center" for the fo:block-container. But the text
doesn't seem to be well centered. The definition of display-align="center"
mentions that it uses the before-edge and the after egde of the
allocation-rectangle, and not he corresponding edges of the
content-rectangle. Maybe that is the cause of the problem.

Right now I set the margin-top of the fo:block-container in order to shift
the contained text a little. I calculate the value by adding two values:
1. The first has two discrete values: 0.5 mm for books with page numbers
less that 150, and 1.0 mm for books with more pages. 
2. The second value is calculated proprtional to the page number: .01 mm *
page number.

Does anybody have any idea how to optimize this? 

Best regards,

Christian

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html



More information about the Xep-support mailing list