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 2021/11/19 19:38:00 UTC

[jira] [Commented] (PDFBOX-5326) TTFSubsetter incorrectly calculating 'searchRange'

    [ https://issues.apache.org/jira/browse/PDFBOX-5326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17446635#comment-17446635 ] 

ASF subversion and git services commented on PDFBOX-5326:
---------------------------------------------------------

Commit 1895183 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1895183 ]

PDFBOX-5326: fix log2, as suggested by Brian Blocher

> TTFSubsetter incorrectly calculating 'searchRange'
> --------------------------------------------------
>
>                 Key: PDFBOX-5326
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5326
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.24
>            Reporter: Brian Blocher
>            Priority: Major
>             Fix For: 2.0.25, 3.0.0 PDFBox
>
>         Attachments: notworking.svg, working.svg
>
>
> The log2 method in TTFSubsetter is incorrectly calling _round_ instead of _floor_ on the log2 result.
> If 
> {code:java}
> Math.log(num) / Math.log(2){code}
> results in a whole number, the searchRange is correct but decimal results could get rounded up or down. 
> The spec calls for a _floor_ of the result.
> [https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#:~:text=uint16-,searchRange,-Maximum%20power%20of]
> Attached two svgs with embedded subset fonts. Firefox gives the best console error output.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org