sciurius / perl-Text-Layout

Pango style markup formatting for PDF::API2, Markdown, Cairo and more
2 stars 2 forks source link

t/152-pdfbuilder.t fails if PDF::Builder is installed #7

Closed eserte closed 3 years ago

eserte commented 4 years ago

See subject. A sample fail report on CPAN Testers: http://www.cpantesters.org/cpan/report/5c484370-8fa4-11ea-92a5-4f3975b42a2f

PhilterPaper commented 4 years ago

Yes, PDF::Builder 3.018 updated its corefont metrics files to expand to the full list of available glyphs. As part of this, the 'wx' (glyph width) sections were regenerated from the TTF font files. Unfortunately, several characters in the font are 1 unit narrower than they were before, resulting in a displayed character being (in the test case) 0.02pt narrower. So, in one test where 4 glyphs were narrower, the correct width of the string goes from 168.08 to 168 points.

Johan and I are in the midst of a somewhat heated discussion over what should be done about this (PhilterPaper/Perl-PDF-Builder#117). His position is that I should revert to the old wx table, and possibly even ignore the additional glyphs (which were added for PhilterPaper/Perl-PDF-Builder#7). My position is that it's better to more closely match the metrics of the TTF file that Adobe Reader actually uses (\Windows\Fonts\times.ttf for Times-Roman), and his t-test should be adjusted to use the new widths. I'm looking for a way to make both sides happy, but I haven't found anything yet that doesn't break a lot of things or isn't a lot of work.

It's a bit kludgy, but there are two ways to successfully install Text::Layout against PDF::Builder 3.018 or later:

  1. Swap out the 4 "Times" metric files in lib/PDF/Builder/Resource/Font/CoreFont/ for their 3.017 versions.
  2. Edit the 4 "Times" metric files to change hash element 'wx' to 'wxnew' and 'wxold' to 'wx'.

This should allow you to successfully install Text::Layout. Afterwards, you may (if you wish) restore the metrics files you changed.

Update: I see that 0.18.2 was just released, which avoids testing on Builder 3.018 or higher. For the time being, that could work.

PhilterPaper commented 4 years ago

PDF::Builder 3.019 (expected release July or August 2020) will have the font metrics reverted to the (slightly incorrect) Adobe Standard metrics rather than the actual widths used by TTF.

PhilterPaper commented 3 years ago

Since 3.019 last summer, PDF::Builder should be using the desired font metrics. Is it still giving problems? If not, any chance of welcoming back PDF::Builder support and closing this ticket?

sciurius commented 3 years ago

Oops. Should have done that a long time ago... Fixed in git.

PhilterPaper commented 3 years ago

Thanks!