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

Fix for rare issues on iOS with reading binary data #2

Merged
merged 1 commit into from Nov 14, 2021

Conversation

lojjic
Copy link

@lojjic lojjic commented Nov 14, 2021

See this issue for background. Certain conditions in iOS can sometimes cause the Typr._bin read functions to return NaN.

The culprit, for whatever reason, is the use of TypedArrays with a shared buffer to read the binary datatypes. It's possible that it has something to do with endianness and certain JIT modes on iOS. Regardless, switching to use DataView solves the issue, and seems to improve performance in some cases too.

(I'm treating this fork as the new source of truth for pre-Harfbuzz Typr, so I'm submitting this PR here.)

…ys with a shared buffer.

This solves rare issues seen on iOS where read values would be NaN, perhaps due to endianness. It seems to give a slight performance increase in some cases as well.
@fredli74
Copy link
Owner

Looks like DataView has been around almost as long as TypedArrays (except some of the 64-bit functions), so it should be safe. Good change, I like it. Let me just run it in my projects for testing, to make sure nothing has changed before I merge.

@fredli74 fredli74 merged commit 84f4873 into fredli74:master Nov 14, 2021
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.

None yet

2 participants