Remove canvas style attribute update when changing font weight#8733
Open
davepagurek wants to merge 1 commit intodev-2.0from
Open
Remove canvas style attribute update when changing font weight#8733davepagurek wants to merge 1 commit intodev-2.0from
davepagurek wants to merge 1 commit intodev-2.0from
Conversation
Continuous ReleaseCDN linkPublished PackagesCommit hash: 549b44a Previous deploymentsThis is an automated message. |
Contributor
Author
|
@Qianqianye does work for you on your test sketch? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #8732
Changes
Previously, in addition to changing
ctx.font, we would setcanvas.style['font-variation-settings']to set the font weight. This used to be necessary to get all browsers to do variable font weight. However, this CSS update causes a relayout on the page each time you change it, which can be quite costly when doing it many times per frame.That was set up in late 2024. Testing now, in 2026, it seems like neither Chrome nor Firefox has problems without this CSS update. We previously took it out for Safari, as it was actively messing up its rendering. It looks like now we can just take it out for everyone.
This now gets me 60fps on both Chrome and Safari.
Live: https://editor.p5js.org/davepagurek/sketches/JFCOpYLg9
PR Checklist
npm run lintpasses