You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Brian Blocher (Jira)" <ji...@apache.org> on 2021/11/18 18:44:00 UTC

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

Brian Blocher created PDFBOX-5326:
-------------------------------------

             Summary: 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


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



--
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