- From: Dave Pawson <daveP@dpawson.freeserve.co.uk>
- Date: Sat, 18 Aug 2001 08:05:21 +0100
- To: www-xsl-fo@w3.org
For any others seeking a solution, Nikolai from Renderx forwarded this. An aweful lot of hoops to jump through to achieve what is really a fairly common problem. Even without the overflow problem, the lack of ability to centre the middle unit is a weakness. Regards DaveP >To achieve what you want, some modifications to your code are necessary. > >Version 1. > ><fo:block text-align-last="justify"> > <fo:inline>start</fo:inline> > <fo:inline>center</fo:inline> > <fo:inline>end</fo:inline> ></fo:block> > >I have put spaces (well, newlines) between the inlines. Those should be >expanded >during justification. However, I presume this won't be enough with XEP - it >tends >to increase letter-spacing, too. Moreover, spaces between inlines will be >expanded >to the same extent as spaces inside your inlines. > >Version 2. > ><fo:block text-align-last="justify"> > <fo:inline letter-spacing="0pt" word-spacing="0pt">start</fo:inline> > <fo:inline letter-spacing="0pt" word-spacing="0pt">center</fo:inline> > <fo:inline letter-spacing="0pt" word-spacing="0pt">end</fo:inline> ></fo:block> > >I have explicitly set both letter spacing and word spacing to 0 inside the >inlines. >In this way, I guarantee that only spaces between inlines are expanded >(because >inlines with explicitly specified letter-spacing and word-spacing are not >subject >to justification - sic!). However, this does not center the middle inline - >the two >spaces between inlines will be equal in size, but "right" and "left" may be >of >different length, so "center" is hardly in the exact middle. > >Version 3. > ><fo:block text-align-last="justify"> > <fo:inline>start</fo:inline> > <fo:leader leader-pattern="space" leader-length.minimum="0pt"/> > <fo:inline>center</fo:inline> > <fo:leader leader-pattern="space" leader-length.minimum="0pt"/> > <fo:inline>end</fo:inline> ></fo:block> > >Same result as in Version 2. Instead of fixing spaces inside inlines, >I have added space-filled leaders that always expand before spaces >during justification. (Leader-length.maximum="100%" by default, >so there's no need to specify it. However, remember that leader-length >is inheritable...) > >Version 4 (abusive). > >Let's use a weird property of lists: if indents are not specified on >fo:list-item-label/fo:list-item-body, the label and body areas overlap. >So - > ><fo:list-block> > <fo:list-item> > <fo:list-item-label> > <fo:block id="A" text-align="left">Left</fo:block> > </fo:list-item-label> > <fo:list-item-body> > <fo:list-block> > <fo:list-item> > <fo:list-item-label> > <fo:block id="B" text-align="center">Center</fo:block> > </fo:list-item-label> > <fo:list-item-body> > <fo:block id="C" text-align="right">Right</fo:block> > </fo:list-item-body> > </fo:list-item> > </fo:list-block> > </fo:list-item-body> > </fo:list-item> ></fo:list-block> > >Blocks A, B, and C all overlap. So, you can place your contents >independently >on all the three, and align them as you like. Here, the middle part is >actually centered. >There are two drawbacks, however: > >- if your lines are too long, they will overwrite each other - no wrapping >is possible; >- the whole thing is blamed as error by the XSL spec ;-) (label and body >should not overlap). > >Version 5. > >You could achieve the same effect by playing with absolutely positioned >block-containers, >putting them in the same rectangle. If you are drawing a header or a footer, >this might be the >best solution: > ><fo:block-container absolute-position="absolute" > left="1in" right="1in" bottom="1in" height="2in"> > <fo:block text-align="left">Left</fo:block> ></fo:block-container> > ><fo:block-container absolute-position="absolute" > left="1in" right="1in" bottom="1in" height="2in"> > <fo:block text-align="center">Center</fo:block> ></fo:block-container> > ><fo:block-container absolute-position="absolute" > left="1in" right="1in" bottom="1in" height="2in"> > <fo:block text-align="right">Right</fo:block> ></fo:block-container> > >Regards, >Nikolai
Received on Saturday, 18 August 2001 03:06:02 UTC