[xep-support] Vertical alignment of inlinemediaobject

G. Ken Holman gkholman at CraneSoftwrights.com
Thu Feb 21 19:35:18 PST 2008


At 2008-02-21 17:11 -0800, Peter Keung wrote:
>I've tried all sorts of combinations of alignment-baseline, 
>alignment-adjust, baseline-shift, relative-align, vertical-align, 
>display-align, etc.

Then I guess you didn't try the correct one!  :{)}

>What I want for inline image alignment is this, which seems to be 
>the default in FOP 0.24:
>
>  +-+  Blahhhh, Blahhh, Blahhh, Blahhh, Blahhh,
>   |  |
>  + +

That is an incorrect default ... the default is that the base of the 
image sits on top of the text baseline.

>In XEP, I get this:
>
>  +-+
>   | |
>  +-+  Blahhhh, Blahhh, Blahhh, Blahhh, Blahhh,

Yep!

>Basically, I want the image to output from the top down, aligned 
>with the top of the text with XEP. Is this possible?

Absolutely it is:  in XSL-FO the alignment-adjust= specifies which 
point of the object is to be used for alignment, while the 
alignment-baseline= specifies the point of the line to which the 
object is aligned.

So you want to align the before-edge of your image with the 
before-edge of the line.  Seems to work fine in XEP.

I hope the example below helps.  Just plug in the name of your image 
in place of "star.gif".

. . . . . . . . . . Ken

<?xml version="1.0" encoding="US-ASCII"?><!--align2.fo-->
<root xmlns="http://www.w3.org/1999/XSL/Format"
       font-family="Times" font-size="20pt">

   <layout-master-set>
     <simple-page-master master-name="frame"
                         page-height="297mm" page-width="210mm"
                         margin-top="15mm" margin-bottom="15mm"
                         margin-left="15mm" margin-right="15mm">
       <region-body region-name="frame-body"/>
     </simple-page-master>
   </layout-master-set>

   <page-sequence master-reference="frame">
     <flow flow-name="frame-body" xmlns="http://www.w3.org/1999/XSL/Format">
       <block>
         This is a test of image alignment; "Xy" is used
         to show the location of the top, baseline, and
         bottom of the character box.</block>
       <block>
         Default: image sits on baseline
         Xy<external-graphic src='url("star.gif")'/>yX
       </block>
       <block>
         Aligning the base to the bottom of the line:
         Xy<external-graphic src='url("star.gif")'
                             alignment-baseline="after-edge"/>yX
       </block>
       <block>
         Aligning the top to the top of the line:
         Xy<external-graphic src='url("star.gif")'
                             alignment-adjust="before-edge"
                             alignment-baseline="before-edge"/>yX
       </block>
       <block>End of test</block>
     </flow>
   </page-sequence>
</root>


--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman at CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/f/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html



More information about the Xep-support mailing list