[Fwd: Re: vertical centering of a fo:inline]

Patrick Buchinger wrote:

> hello!
>
> i want to do the following:
>
> i need one textline with different font-families and/or font-sizes. i
> managed this problem with using fo:inline elements within a fo:block.
>
> now i need to vertically center all fo:inline elements. so, for example,
> i have the text "big letters" with font-size="2.0mm" directly followed
> by the text "small letters" with font-size="1.0mm". i need the text
> "small letters" to appear vertically centered.
>
> i tried this
>
> <snip>
>
> <fo:block-container position="absolute" left="7.0mm" top="34.5mm"
> width="70mm" height="55mm">
>  <fo:block>
>    <fo:inline font-size="2.0mm">
>      big letters
>    </fo:inline>
>    <fo:inline vertical-align="center" font-size="1.0mm">
>      small letters
>    </fo:inline>
>  </fo:block>
> </fo:block-container>
>
> </snip>
>
> but the text "small letters" always appears at the baseline.
>  
>
What happens if you do:

<fo:inline font-size="2.0mm">
big letters
<fo:inline vertical-align="center" font-size="1.0mm">
 small letters
</fo:inline>
</fo:inline>

To give it better context

> when i'm using a table, the text would be vertically centered, but i
> have troubles with the column-width since i don't know the text which
> has to be printed. it was impossible for me to create table-cells which
> exactly have the text's width (remember, i need the different texts
> directly one after another).
>
> here is the code i tried:
>
> <snip>
>  <fo:block-container position="absolute" left="7.0mm" top="32.0mm"
> width="70mm" height="55mm">
>      <fo:table table-layout="auto" width="100%">
>  
>
Why the width="100%"?
Now the rendered can not create a table smaller then 70mm, so it will 
distribute the whitespace over the two columns.

>        <fo:table-column/>
>        <fo:table-column/>
>        <fo:table-body>
>          <fo:table-row>
>            <fo:table-cell display-align="center">
>              <fo:block font-size="2.0mm">
>                big letters
>              </fo:block>
>            </fo:table-cell>
>            <fo:table-cell display-align="center">
>              <fo:block font-size="1.0mm">
>                small letters
>              </fo:block>
>            </fo:table-cell>
>              </fo:block>
>            </fo:table-cell>
>          </fo:table-row>
>        </fo:table-body>
>      </fo:table>
>  </fo:block-container>
>
> </snip>
>
> this code gives me two table-cells, each 50% width.
>  
>
Also note that table-layout="auto" is often not fully supported

Regards,
 NaN.

Received on Wednesday, 28 July 2004 09:34:57 UTC