xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Partridge, Michael" <michael.partri...@ebenx.com>
Subject RE: Centering a _block_ (read div) of text
Date Fri, 04 Apr 2003 15:38:30 GMT
You could try indent calculation based on the length of the string for
each line. 

indent = (page-width - string-length) / 2

That's obviously not the xpath syntax you'd need to use, but it should
give you the result you want. Use the xpath function string-length() and
pass in your string. Then for the second line that needs extra indent,
try

indent = ((page-width - string-length) / 2) + extra-indent

Mike

-----Original Message-----
From: Marcus Andersson [mailto:marcan@home.se] 
Sent: Friday, April 04, 2003 8:44 AM
To: fop-user@xml.apache.org
Subject: Centering a _block_ (read div) of text


Hello

First: Thanx for the help with the questions yesterday.

I need a block of text to be centered. Just to center it is no problem,
the problem is that I want one line in one font and the next line in
another font and the second line should also be "skewed" relative to the
first line. See ascii image:

The whole region-body:
******************************
*         This is the first line                    *
*                   This is the second line     *
*                                                        *
*  etc...                                               *

So I want the complete block of the two lines to be centered. If I
create a block element with text-align="center" and in the block element
put a block element for each line and also put a start-indent on the
second line then the whole block don't get centered. The two lines get
centered separatly and then the second lines get an indent from the
centered position and that is not the result I want. The result I want
can be compared with creating a div-block that is centered in the body
and having the first line to the far left in that div and then the
second line relative-positioned some pixels to the right. Doing indent
on each line with a constant amount isn't an option since I'm generating
pdf's from different xml sources (as I guess most people are) and the
line lengths can vary.

Hope you understand the question. 

/Marcus

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Mime
View raw message