pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: Getting visual bounds of a glyph
Date Fri, 29 Jan 2016 19:20:34 GMT

> On 29 Jan 2016, at 06:46, Branden Visser <mrvisser@gmail.com> wrote:
> 
> Hi everyone,
> 
> I thought we had a process to get the visual bounds of a character
> sealed, until we bumped into a few more PDF documents where the
> bounding box we calculating is way bigger than the character itself
> (about double the size). We're using the 2.0.0-SNAPSHOT code, but
> we've verified this occurs in both RC2 and RC3.

Assuming that you’re using PDFont#getPath(..) then you should be able to
measure the visual bounds of a glyph accurately.

> I've written a gist with a Scala/Java-ish sample of our calculation
> [1], where the TextPosition being passed in is the one provided by
> PDFTextStripper in processTextPosition (I know it's inaccurate, but
> we're only using the text rendering matrix from it which I think
> should be accurate?)

> I'm assuming you may need more information, but first I'm considering
> that our logic for getting the bounds is missing some important pieces
> that jump out at you all.
> 
> Is the gist correct?

I’ve commented on your gist on GitHub. You’ve mostly got it right but you
want to end up with device space, not user space.

— John

> Thanks,
> Branden
> 
> [1] https://gist.github.com/anonymous/063db3b1b5ed040be41c
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message