Of course, there are some more properties that can influence the placing
of the text so the following calculations are only exemplary and only
restricted to the scenario you posted.

However, there's one problem with your example to start with: You
specify font-family and font-size on the inline, but the dominant
baseline is actually defined by the font on the parent block which is
undefined in your example (depends on parent values not visible in the
example). So let me rework your example to make it simpler. I assume you
want to do this to exactly position text on a page, maybe to fill out
some form. That's why you need exact information on how the placing is
performed. Correct me if I'm wrong.

The adjusted example:
<fo:block-container width="600pt" height="280pt" top="0pt" left="0pt" 
overflow="hidden" absolute-position="fixed">
  <fo:block margin-top="aa" text-align="left" line-height="bb" font-family="a 
font" font-size="cc">
    <fo:inline color="rgb(11,51,60)">
      Some test
    </fo:inline>
  </fo:block>
</fo:block-container>

The block-container has fixed positioning on coordinate 0/0, so it has
the upper left corner in exactly the upper left corner of the sheet of
paper.

The first block has a margin-top which is internally translated to a
space-before of the same length with its conditionality subproperty set
to retain (it is always shown).

Let's assume for this example that the font is "Helvetica". Here are the
essential font metrics for Helvetica:
ascender = 718
descender = -207
These values can be found if you look into the XML font metrics file
that you can generate from a font with PFMReader and TTFReader.

We need to calculate some other helper variables:
font box = font-size * (font.ascender - font.descender) (area tree: text/@bpd)
block-height = font-size * line-height (area tree: block/@bpd)
half-leading is defined through the line-height property.
half-leading = (block-height - font box) / 2 (area tree: lineArea/@space-before 
and lineArea/@space-after)
baseline = font-size * ascender (area tree: text/@baseline)

So not the absolute coordinate baseline of "Some test":

x = 0 (because it's left aligned, no start-indent)
y = aa + half-leading + baseline

aa = block.margin-top = block.space-before = 20 pt = 20000 mpt
bb = line-height = 1.2
font-family = Helvetica
cc = font-size = 12 pt = 12000 mpt

font box = 12 pt * (718 - -207) = 11100 mpt
block-height = 12000 mpt * 1.2 = 14400 mpt
half-leading = (14400 mpt - 11000 mpt) / 2 = 1650 mpt
baseline = 12 pt * 718 = 8616 mpt

y = 20000 + 1650 + 8616 = 30266 mpt

Some pointers to the spec:
http://www.w3.org/TR/xsl11/#line-height
http://www.w3.org/TR/xsl11/#area-line (line areas are much more
complicated than the above example shows!)

I hope that's what you wanted.

Jeremias Maerki



On 15.11.2007 17:35:56 Peter Coppens wrote:
> 
> Gentlepeople
> 
> Assume the following fo structure 
> 
>   <fo:block-container width="600pt" top="0pt"  overflow="hidden"
> left="0.0pt" 
>         height="280pt" absolute-position="fixed">
> 
>     <fo:block linefeed-treatment="ignore">
>       <fo:block margin-top="aa" text-align="left" line-height="bb">
>        <fo:inline color="rgb(11,51,60)" font-family="a font" font-size="cc">
>          Some test
>        </fo:inline>
>       </fo:block>
>     </fo:block>
> 
> </fo:block-container>
> 
> I am trying to figure where the base line (let's say) of the characters will
> end up based on the values of margin-top, line-height and possibly the
> relevant font properties
> 
> Would anyone have any pointers to information that would help me to get
> started. I am sure it's in the fo spec, but i have not enough time to try
> and get my brain around that document (assuming I would ever succeed).
> 
> Many thanks indeed!
> 
> Peter
> -- 
> View this message in context: 
> http://www.nabble.com/Fop-layout-question-tf4815030.html#a13774821
> Sent from the FOP - Users mailing list archive at Nabble.com.


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

Reply via email to