Christophe Bouchon created PDFBOX-3286:
------------------------------------------
Summary: Think I found a bad constant (TTF) value and constant use
in PDFBox source
Key: PDFBOX-3286
URL: https://issues.apache.org/jira/browse/PDFBOX-3286
Project: PDFBox
Issue Type: Bug
Components: PDModel
Affects Versions: 2.0.0
Environment: Found by source code inspection
Reporter: Christophe Bouchon
Priority: Minor
Was searching if an OBLIQUE constant was defined somewhere for fsSelection
field of OS/2 TrueType table (org.apache.fontbox.ttf.OS2WindowsMetricsTable),
found a private one in org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder (line
53) in v2.0.0 but it was defined with value 256 instead of 512 (as defined in
official Microsoft documentation here:
https://www.microsoft.com/typography/otspec/os2.htm#fss, bits are defined
starting at 0 and oblique is bit 9, so OBLIQUE should have value 512 (1 << 9)
instead of 256. And the constant use (line 184), is wrong too, the line should
be
fd.setItalic((fsSelection & (ITALIC | OBLIQUE)) != 0);
instead of:
fd.setItalic((fsSelection & ITALIC) == fsSelection ||
(fsSelection & OBLIQUE) == fsSelection);
because fsSelection can contain other bits set at the same time (like BOLD = 1
<< 5), so the tests can be both false while one of the bit is set.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]