This approach could have worked if it wasn't for the fact that the fonts and 
sizes may vary. I guess it also suggests that all characters should have the 
same width which they normally don't. 

But thanks anyway

/Marcus

----- Original Message ----- 
From: "Partridge, Michael" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 04, 2003 5:38 PM
Subject: RE: Centering a _block_ (read div) of text


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:[EMAIL PROTECTED] 
Sent: Friday, April 04, 2003 8:44 AM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to