Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.0
-
None
-
Found by source code inspection
Description
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.