> On 31 Jul 2016, at 14:01, Aaron Mulder <ammul...@gmail.com> wrote: > > I was poking around the code for string widths in PDFont.getStringWidth and > etc. > > It looks like to compute the width of a string it just adds up the > widths of each individual character in the string: > > https://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java?revision=1750576&view=markup#l339 > > But the AFM files for the standard 14 fonts defines pairwise kerning > adjustments, so e.g. "AV" takes less width than the normal width of > "A" plus the normal width of "V": > > https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/Core14_AFMs.zip > > Is there something I'm missing? Or does this just mean PDFont > occasionally overestimates the width of text in those fonts?
That’s correct. getStringWidth is for use when creating new PDFs only, and we don’t implement kerning, so the width you get will be “correct” with respect to the text in the newly created PDF. The same goes for the “kern” and “GPOS” tables in TTF fonts. We don’t even parse them. — John > Thanks, > Aaron > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org > For additional commands, e-mail: users-h...@pdfbox.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org