[
https://issues.apache.org/jira/browse/PDFBOX-5326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Brian Blocher updated PDFBOX-5326:
----------------------------------
Description:
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.
was:
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
> 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
> 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: [email protected]
For additional commands, e-mail: [email protected]