Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Oct 18, 2024

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)

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.
Copy link
Collaborator

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(),
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants