-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[write] Add common util for computing searchRange #1191
base: main
Are you sure you want to change the base?
Conversation
This is shared in a few places, so it makes sense to have a single implementation. (It is used in the kern table, which is coming up)
//https://github.com/fonttools/fonttools/blob/729b3d2960ef/Lib/fontTools/ttLib/ttFont.py#L1147 | ||
/// calculate searchRange, entrySelector, and rangeShift | ||
/// | ||
/// these values are used in various tables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest enumerating them non-exclusively, e.g.
These values are used in at least the following tables:
* [OpenType font table directory](https://learn.microsoft.com/en-us/typography/opentype/spec/otff#table-directory)
* [cmap subtable format 4](https://learn.microsoft.com/en-us/typography/opentype/spec/cmap#format-4-segment-mapping-to-delta-values)
...others...
```
range_shift: range_shift.try_into().unwrap(), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test, perhaps based on the sample at https://learn.microsoft.com/en-us/typography/opentype/spec/cmap#format-4-segment-mapping-to-delta-values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and based on you comment, one for 0?
This is shared in a few places, so it makes sense to have a single implementation.
Ran into this in the context of the
kern
table, which I'll PR shortly; this code is shared in a few places.(CI is failing for other reasons, so let's hold off on this until that gets cleared up)