I have discovered a truly remarkable method of finding the width of text in proportional fonts in PDFs, which this comment field is too small to contain.
I can probably bundle up a general explanation and pass it on to the authors; is this worth doing, or is the problem already solved elsewhere?
I have discovered a truly remarkable method of finding the width of text in proportional fonts in PDFs, which this comment field is too small to contain.
Interested Perl/PDF hackers want to know! Perhaps you could write it up as a node on Perl Monks [perlmonks.org].
I'll give you some more information and see if you're still interested.
Factoid #1: Positioning in PDF is given in thousandths of a point (ie 72000ths of an inch), as far as I can recall.
Factoid #2: The basic PDF fonts (Times, Courier, etc) have their exact metrics, including each character's width in 72000ths of an inch, defined in special files that are freely distributable and included in every installation of Adobe Reader (and presumably Ghostscript et al).
The kerning information is in there too - I tend to ignore it cos the difference is so tiny, but basically it's represented as a huge set of letter pairs with the associated positive or negative offsets. So yes, it's more complex than just multiplying the sum of widths by the font size, but not by much.
I wrote a PDF generator in Delphi; it was quite an educational experience. I recommend the intellectual challenge.
d there are 2.83 milimeters to each postscipt point
OK, something's backwards here.
A point is 1/72 of an inch, so there's no way a point can measure 2.83mm. Dividing 25.4mm/72, I get 0.3527mm for a point. Oh, you got them reversed, a mm is 2.834pt.
Proportional font text widths (Score:1)
I can probably bundle up a general explanation and pass it on to the authors; is this worth doing, or is the problem already solved elsewhere?
Re:Proportional font text widths (Score:1)
Interested Perl/PDF hackers want to know! Perhaps you could write it up as a node on Perl Monks [perlmonks.org].
Re:Proportional font text widths (Score:2)
Re:Proportional font text widths (Score:1)
Factoid #1: Positioning in PDF is given in thousandths of a point (ie 72000ths of an inch), as far as I can recall.
Factoid #2: The basic PDF fonts (Times, Courier, etc) have their exact metrics, including each character's width in 72000ths of an inch, defined in special files that are freely distributable and included in every installation of Adobe Reader (and presumably Ghostscript et al).
Factoid #3: The font metrics files are easily
Re:Proportional font text widths (Score:1)
Re:Proportional font text widths (Score:2)
Re:Proportional font text widths (Score:1)
I wrote a PDF generator in Delphi; it was quite an educational experience. I recommend the intellectual challenge.
Of points and millimeters... (Score:1)
A point is 1/72 of an inch, so there's no way a point can measure 2.83mm. Dividing 25.4mm/72, I get 0.3527mm for a point. Oh, you got them reversed, a mm is 2.834pt.
Re:Of points and millimeters... (Score:2)