Einhugur PDF Plugin Question

Anybody here use it?

It is included in Björn’s collection and the whole collection cheaper than than the MBS DynaPDF option alone… But of course it is a lot less capable, though it mostly meets my needs…

And if just Björn exposes a few more things from the underlying library I don’t see needing anything else when I need to create PDFs from scratch. (I wish it could merge PDF’s but I can live with out that)

So I am trying to understand some things about it better. Maybe someone here can answer a question for me (I seem o be having issue posting to Björn’s mailing list)

On the Font Class one can get the BoundingBox parameters as well as Font Ascent and Decent…

But I don’t understand the difference between BoundingBox.top and Ascent and BoundingBox.Bottom and Descent.

If I understand what I can find though google, the boundingBox.Top would be the ascent for the tallest glyph, while boundingBox.Bottom would be the lowest descender in the font… Is that right?

BUT as these methods are not measuring a specific string, why are not BoundingBox.Top and Accent the same, and the same for bottom and descent? I seem to be missing something here!

BTW in the debugger the bounding box top and bottom both have larger absolute magnitudes than Ascent and descent….

Also I have no idea what boundBox left and right are… but would like to know!

I’m trying to write some higher level layout methods on top of the plugin methods to make it more RAD for me, so I need to understand how to measure things.

Thanks
-Karen

Those should be defined in the PDF spec

from page 282

Ascent The maximum height above the baseline reached by glyphs in this font. The height of glyphs for accented characters shall be excluded

Descent The maximum depth below the baseline reached by glyphs in this font. The value shall be a negative number

FontBBox A rectangle expressed in the glyph coordinate system that shall … be the smallest rect enclosing the shape that would result if all the glyphs of the font were place with their origins coincident and then filled

so the font bbox sounds like the smallest rect than can enclose any glyph in the font

edit - Theres nice illustration on page 241 of this

OK The Left and right define the width of the widest glyph in the font. No issue with that.

The Font Class reports the bottom and Top of the BoundingBox relative to the baseline … same for Ascent and Descent…

But as it is not measuring specific piece of text with specific glyphs, what are Font.Ascent And Font.Decent if not the same as BoundingBox Top and Bottom in this context?

And they are not the same here. Top > Ascent and Abs(Bottom) > Abs(Descent)…

That has me confused and wondering If I have been making a bad assumption about font measurement in Xojo all these years. The assumption I made was
Dim P as New Picture(1,1)

Dim TxtHt, TxtAscent, TxtDescent as Single

TxtHt = P.Graphics.TextHeight
TxtAscent = P.Graphics.TextAscent
TxtDescent = TxtAscent - TxtHt

In other words Abs(Descent) + TxtAscent = TxtHt

But is Graphic.TextHeight really the height of the bounding box in Xojo?

Anyway that is why I am really confused between the bounding box height and Ascent + Descent being different here.

-Karen

From the descriptions given it sounds like there are cases where they should differ since accents etc arent considered in one case but it seems they are in the other

And accents definitely could exceed the accent height

In Xojo code, not PDF, they should match given how Xojo handles fonts

But PDF was designed by and for typographers and pagesetters. So they look at things differently. I wonder if the bounding box is much larger in some cases because the font contains glyphs that have special adornments. Sometimes you get a glyph that has a really large flourish that well exceeds the normal glyphs sizes (esp in cursive fonts)
You might be able to look at the font in font viewer and see this
If not Apple has tools called “Font Tools for Xcode” on the developer site that I think let you examine fonts in great details

I’ve passed links to your questions to another message system where it might reach Bjorn

Thanks.
-karen