xsl-list
[Top] [All Lists]

Re: graphics & multi-line text

2005-06-29 13:37:27
Michael Rerick wrote:
What I am trying to do is have a corporate graphic on the left side of a
page with the report text centered on the page and centered vertically on
the graphic (see below). This is at the top of the page. The report title
consists of two lines that need to have different font sizes. This is inside
a static-content region.


+-------+
|         |
|         |                              Report Title (in 14pt font)
|         |                                 Sub Title  (in 12 pt font)
|         |
+-------+

This is the closest I can get to what I want. The text is centered on the
page but is all on one line.

see below:
      <fo:root>
         <fo:layout-master-set>
            <fo:simple-page-master master-reference="page"
[snip]
               <fo:region-before extent="2.0in"/>
               <fo:region-body region-name="xsl-region-body"
                               margin-top="1.95in"

Note: this causes the region-before overlapping the body. It's
best to use an margin-top for the body which is at least as large
as the extent of the region before. In your case it probably wont
matter because the content in the region-before isn't high enough.

[snip]
            <fo:static-content flow-name="xsl-region-before">
               <fo:table width="10.5in">
                  <fo:table-column column-number="1" column-width="1.5in"/>
                  <fo:table-column column-number="2" column-width="1in"/>
                  <fo:table-column column-number="3" column-width="3in"/>
                  <fo:table-column column-number="4" column-width="1in"/>
                  <fo:table-column column-number="5" column-width="1in"/>
                  <fo:table-column column-number="6" column-width="1in"/>
                  <fo:table-column column-number="7" column-width="1in"/>
                  <fo:table-column column-number="8" column-width="1in"/>

Why do you think you need 8 columns, especially given that there's no
margin at the left? Two or three columns should be sufficient.

                  <fo:table-body>
                     <fo:table-row>
                        <fo:table-cell column-number="1"
number-columns-spanned="1">

Note: FOP usually requires you to enclose content in a table cells in
blocks. If you actually seee the graphics, you've been lucky.

                           <fo:inline>

What's the reason for the fo:inline here?

                              <fo:external-graphic
src="url(Corporate_05_black.jpg)" scaling="unifiorm" height=".6in"
width=".6in"/>
                           </fo:inline>
                        </fo:table-cell>
                        <fo:table-cell column-number="2"
number-columns-spanned="7" line-height=".6in">
                           <fo:block font-family="serif" font-size="14pt"
font-weight="bold"
                              text-align="center"
alignment-adjust="text-after-edge">
                              <xsl:text>REPORT TITLE </xsl:text>
                              (SUB-TITLE
                           </fo:block>

If you want to have multiple lines, just use multiple blocks. Note that
alignment-adjust isn't implemented in FOP. Furthermore,
text-align="center" will center the content horizontally, not
vertically. You could try display-align on the table cell (not the
blocks) for vertical centering, but I'd recommend using space-before for
this purpose.
Try

   <fo:block font-family="serif" font-size="14pt" font-weight="bold"
     space-before="0.6in / 2 - 13.5pt">
         <xsl:text>REPORT TITLE </xsl:text>
   </fo:block>
   <fo:block font-family="serif" font-size="12pt" font-weight="bold">
         <xsl:text>(SUB-TITLE </xsl:text>
   </fo:block>

You might want to fine tune the space-before so that the text optically
centered.

J.Pietschmann

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>