- From: Dave Pawson <daveP@dpawson.freeserve.co.uk>
- Date: Tue, 04 Dec 2001 18:33:42 +0000
- To: www-xsl-fo@w3.org
Stole this from the xml newsgroup. The question at the bottom is intrigueing me. From: Peter Flynn <peter@silmaril.ie> Newsgroups: comp.text.xml Subject: Re: How much space does a line with e.g. 12 pt need in centimeters? Lars Gregersen wrote: > On 3 Dec 2001 05:51:21 -0800, vialulu@excite.com (vialulu) wrote: > > >>Hi All, >> >>I want to figure out how much total line height a font-size with a >>certain pt value uses on a resulting PDF file, but in centimeters. I >>use FOP to transform XML into PDF, and I'd like to do some page break >>calculations based on how big various lines are, but I don't know the >>formula other than than 1pt = 1/72 inch. Do I do something like this >>to figure it out, for say a 12pt font-size: >> >> 12 * 1/72 (inches) * 2.54 (cm) + 10% >> (10% is just a guess for calculating the space >> above and below the font - is there an actual value >> I can use here?) Line height including leading is often 1.2 times the point size. > > No, there is no connection between the fontsize and the height of > glyphs. You'll have to look at the bounding boxes for each character. And you probably need to make sure you measure the highest possible character ascent and the deepest possibly descent. As a guide, this string is useful "Íl(/Xjy". In practice, this will return approximately the current point size, but usually slightly less, for complex and now largely irrelevant historical reasons going back some 500 years. Is there a function in XSL to retrieve the BB for a given glyph? It's trivial in LaTeX to find the height and depth of a character or string but I haven't seen the equivalent in XSL (but that doesn't mean much, there are lots of unexplored nooks and crannies :-) ///Peter
Received on Tuesday, 4 December 2001 13:34:11 UTC