Skip to content

move ctx.font string to the state struct #2187

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

Merged
merged 1 commit into from
Jan 8, 2023
Merged

move ctx.font string to the state struct #2187

merged 1 commit into from
Jan 8, 2023

Conversation

chearon
Copy link
Collaborator

@chearon chearon commented Jan 7, 2023

I don't totally understand why we were using a Nan::Persistent<v8::Value> instead of storing a standard string + turn it into a v8 value on the fly, so hopefully this is right.

fixes #1946

@chearon
Copy link
Collaborator Author

chearon commented Jan 7, 2023

Ah, @zbjornson you fixed it the same way for other properties in 0e6504a

Copy link
Collaborator

@zbjornson zbjornson left a comment

Choose a reason for hiding this comment

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

My only guess is that someone wanted to avoid the overhead of going between a V8 string and a std::string, but this branch improves performance of get font by about 10% and has no impact on set font.

@zbjornson zbjornson merged commit fdf709a into master Jan 8, 2023
@zbjornson zbjornson deleted the ch/1946 branch January 8, 2023 22:22
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.

CanvasRenderingContext2d.restore() does not restore font weight
2 participants