Open sciurius opened 7 months ago
In PDF/API2/Resource/CIDFont/TrueType/FontFile.pm, font metrics are scaled to 1000/upem. However, underlineposition and underlinethickness are not scaled.
PDF/API2/Resource/CIDFont/TrueType/FontFile.pm
upem
underlineposition
underlinethickness
PDF/API2/Content.pm, lines 2043-2044 seem to assume 1000, not upem:
PDF/API2/Content.pm
my $underlineposition = (-$self->{' font'}->underlineposition() * $self->{' fontsize'} / 1000 || 1); my $underlinethickness = ($self->{' font'}->underlinethickness() * $self->{' fontsize'} / 1000 || 1);
This affects all fonts with a design size not equal to 1000, which includes all modern TTF/OTF fonts that have a design size 2048.
The result can be seen in the attached image: left is LibreOffice, right is PDF::API2. The font is DejaVuSerif.
It is probably too late to change but it should at least be documented somewhere.
In
PDF/API2/Resource/CIDFont/TrueType/FontFile.pm
, font metrics are scaled to 1000/upem
. However,underlineposition
andunderlinethickness
are not scaled.PDF/API2/Content.pm
, lines 2043-2044 seem to assume 1000, notupem
:This affects all fonts with a design size not equal to 1000, which includes all modern TTF/OTF fonts that have a design size 2048.
The result can be seen in the attached image: left is LibreOffice, right is PDF::API2. The font is DejaVuSerif.
It is probably too late to change but it should at least be documented somewhere.