You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2016/03/25 17:42:25 UTC
[jira] [Commented] (PDFBOX-3286) Think I found a bad constant (TTF)
value and constant use in PDFBox source
[ https://issues.apache.org/jira/browse/PDFBOX-3286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15212047#comment-15212047 ]
ASF subversion and git services commented on PDFBOX-3286:
---------------------------------------------------------
Commit 1736615 from [~lehmi] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1736615 ]
PDFBOX-3286: fixed constant value and constant usage as proposed by Christophe Bouchon
> 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
> Assignee: Andreas Lehmkühler
> Priority: Minor
> Fix For: 2.0.1, 2.1.0
>
>
> 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
> {code}
> fd.setItalic((fsSelection & (ITALIC | OBLIQUE)) != 0);
> {code}
> instead of:
> {code}
> fd.setItalic((fsSelection & ITALIC) == fsSelection ||
> (fsSelection & OBLIQUE) == fsSelection);
> {code}
> 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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org