-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Activate the fonts coming from the backend and not the data from the frontend #60093
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +973 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
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'm not sure this fixes #60040, as I'm testing using the instructions from that PR, using the Heineken Serif 18 font, and I'm still seeing the missing quotes in the preset:
If I add the quotes in manually the font renders correctly.
I tested the PR with the same font files that I used when testing the issue, and the name is wrapped in double quotes and works in my test. One space: Two spaces: Number and space: (I am using Chrome, macOS, WordPress 6.5 RC3 nightly.) |
I'm about to test this with the fonts provided as well. |
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.
packages/edit-site/src/components/global-styles/font-library-modal/context.js
Show resolved
Hide resolved
@mikachan Could you possibly re-test? It seems like your result is the outlier and it would be good to know whether this is a legitimate failure 🙏 |
Co-authored-by: Dave Smith <[email protected]>
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.
Thanks for the ping! I've re-tested and this PR is fixing the issue now 🎉
Just noting that my first round of testing was done by adding a single font file rather than multiple at once. However, I've just tested both ways (with a single font and with multiple at the same time) and it's definitely working. This is good to bring in I think!
I just had the time to test it too. It now works correctly for me with the PR. |
@mcsf You raised some potential concerns about the code of this PR in WP Slack. Are you able to review? |
@@ -402,14 +404,29 @@ function FontLibraryProvider( { children } ) { | |||
}; | |||
|
|||
const activateCustomFontFamilies = ( fontsToAdd ) => { | |||
// Merge the existing custom fonts with the new fonts. | |||
// Removes the id from the families and faces to avoid saving that to global styles post content. |
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 think we could explain here why we want to avoid saving to global styles post content.
Presumably the reason this code has been added now is because we're now using the font data from the API we're getting an id
field which wasn't present previously.
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.
Agreed, should explain.
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.
Although I think we can do that in a follow up.
@bph I've marked this to be cherry picked into Gutenberg 18.0.0 in order that it will be open for consideration for inclusion WP 6.5. @matiasbenedetto @creativecoder Let's be sure to test the Gutenberg RC when it's ready to check that including this PR doesn't cause any regressions elsewhere in the Plugin. |
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.
With fresh eyes this morning, this reads as more straightforward. LGTM.
@@ -402,14 +404,29 @@ function FontLibraryProvider( { children } ) { | |||
}; | |||
|
|||
const activateCustomFontFamilies = ( fontsToAdd ) => { | |||
// Merge the existing custom fonts with the new fonts. | |||
// Removes the id from the families and faces to avoid saving that to global styles post content. |
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.
Agreed, should explain.
There have been multiple reviews from contributors here and they are all ✅ I've gone ahead and merged this. |
This PR was triaged by Editor release leads and contributors in WP Slack as part of the final WordPress 6.5 process. See https://wordpress.slack.com/archives/C02QB2JS7/p1711371204886059 (requires registration). The criteria used was:
Conclusion: we propose that this fix is included in WP 6.5. Reason: bug affects the (blessed) Font Library feature in a severe way and this PR resolves in a clear and traceable manner. We now await a final decision from the full release team. |
…frontend (#60093) * Activate the fonts coming from the backend and not the data from the frontend * add comment ----- Co-authored-by: matiasbenedetto <[email protected]> Co-authored-by: mikachan <[email protected]> Co-authored-by: getdave <[email protected]> Co-authored-by: mcsf <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: huzaifaalmesbah <[email protected]> Co-authored-by: srueegger <[email protected]> Co-authored-by: annezazu <[email protected]>
I just cherry-picked this PR to the release/18.0 branch to get it included in the next release: 5ed745a |
@matiasbenedetto Please could we look into adding some test coverage for the changes in this PR. This will increase confidence of release team in including this in WP 6.5. See related Slack discussion. |
…frontend (#60093) * Activate the fonts coming from the backend and not the data from the frontend * add comment ----- Co-authored-by: matiasbenedetto <[email protected]> Co-authored-by: mikachan <[email protected]> Co-authored-by: getdave <[email protected]> Co-authored-by: mcsf <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: huzaifaalmesbah <[email protected]> Co-authored-by: srueegger <[email protected]> Co-authored-by: annezazu <[email protected]>
e2e test coverage is being worked on in #60221. |
…frontend (WordPress#60093) * Activate the fonts coming from the backend and not the data from the frontend * add comment ----- Co-authored-by: matiasbenedetto <[email protected]> Co-authored-by: mikachan <[email protected]> Co-authored-by: getdave <[email protected]> Co-authored-by: mcsf <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: huzaifaalmesbah <[email protected]> Co-authored-by: srueegger <[email protected]> Co-authored-by: annezazu <[email protected]>
I just cherry picked this into WP 6.5 RC 4 branch d2191d4 |
…frontend (#60093) * Activate the fonts coming from the backend and not the data from the frontend * add comment ----- Co-authored-by: matiasbenedetto <[email protected]> Co-authored-by: mikachan <[email protected]> Co-authored-by: getdave <[email protected]> Co-authored-by: mcsf <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: huzaifaalmesbah <[email protected]> Co-authored-by: srueegger <[email protected]> Co-authored-by: annezazu <[email protected]>
This merges several high priority bug fixes for the editor ahead of WordPress 6.5: - WordPress/gutenberg#60180 - WordPress/gutenberg#60093 - WordPress/gutenberg#60071 - WordPress/gutenberg#60130 - WordPress/gutenberg#59959 - WordPress/gutenberg#60167 Props youknowriad, annezazu, mcsf, jsnajdr, mmaattiiaass, get_dave, scruffian, mikachan, grantmkin, andraganescu, scruffian, antosguillamot, fabiankaegy, huzaifaalmesbah, krupajnanda, colorful-tones, liviopv, mamaduka, kim88, poena, peterwilsoncc, wildworks, swissspidy, desrosj, jorbin. Fixes #60315. git-svn-id: https://develop.svn.wordpress.org/trunk@57888 602fd350-edb4-49c9-b593-d223f7449a82
This merges several high priority bug fixes for the editor ahead of WordPress 6.5: - WordPress/gutenberg#60180 - WordPress/gutenberg#60093 - WordPress/gutenberg#60071 - WordPress/gutenberg#60130 - WordPress/gutenberg#59959 - WordPress/gutenberg#60167 Props youknowriad, annezazu, mcsf, jsnajdr, mmaattiiaass, get_dave, scruffian, mikachan, grantmkin, andraganescu, scruffian, antosguillamot, fabiankaegy, huzaifaalmesbah, krupajnanda, colorful-tones, liviopv, mamaduka, kim88, poena, peterwilsoncc, wildworks, swissspidy, desrosj, jorbin. Fixes #60315. Built from https://develop.svn.wordpress.org/trunk@57888 git-svn-id: http://core.svn.wordpress.org/trunk@57389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This merges several high priority bug fixes for the editor ahead of WordPress 6.5: - WordPress/gutenberg#60180 - WordPress/gutenberg#60093 - WordPress/gutenberg#60071 - WordPress/gutenberg#60130 - WordPress/gutenberg#59959 - WordPress/gutenberg#60167 Props youknowriad, annezazu, mcsf, jsnajdr, mmaattiiaass, get_dave, scruffian, mikachan, grantmkin, andraganescu, scruffian, antosguillamot, fabiankaegy, huzaifaalmesbah, krupajnanda, colorful-tones, liviopv, mamaduka, kim88, poena, peterwilsoncc, wildworks, swissspidy, desrosj, jorbin. Fixes #60315. Built from https://develop.svn.wordpress.org/trunk@57888 git-svn-id: https://core.svn.wordpress.org/trunk@57389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This merges several high priority bug fixes for the editor ahead of WordPress 6.5: - WordPress/gutenberg#60180 - WordPress/gutenberg#60093 - WordPress/gutenberg#60071 - WordPress/gutenberg#60130 - WordPress/gutenberg#59959 - WordPress/gutenberg#60167 Reviewed by jorbin, swissspidy. Merges [57888] to the 6.5 branch. Props youknowriad, annezazu, mcsf, jsnajdr, mmaattiiaass, get_dave, scruffian, mikachan, grantmkin, andraganescu, scruffian, antosguillamot, fabiankaegy, huzaifaalmesbah, krupajnanda, colorful-tones, liviopv, mamaduka, kim88, poena, peterwilsoncc, wildworks, swissspidy, desrosj, jorbin. Fixes #60315. git-svn-id: https://develop.svn.wordpress.org/branches/6.5@57891 602fd350-edb4-49c9-b593-d223f7449a82
This merges several high priority bug fixes for the editor ahead of WordPress 6.5: - WordPress/gutenberg#60180 - WordPress/gutenberg#60093 - WordPress/gutenberg#60071 - WordPress/gutenberg#60130 - WordPress/gutenberg#59959 - WordPress/gutenberg#60167 Reviewed by jorbin, swissspidy. Merges [57888] to the 6.5 branch. Props youknowriad, annezazu, mcsf, jsnajdr, mmaattiiaass, get_dave, scruffian, mikachan, grantmkin, andraganescu, scruffian, antosguillamot, fabiankaegy, huzaifaalmesbah, krupajnanda, colorful-tones, liviopv, mamaduka, kim88, poena, peterwilsoncc, wildworks, swissspidy, desrosj, jorbin. Fixes #60315. Built from https://develop.svn.wordpress.org/branches/6.5@57891 git-svn-id: http://core.svn.wordpress.org/branches/6.5@57392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…frontend (WordPress#60093) * Activate the fonts coming from the backend and not the data from the frontend * add comment ----- Co-authored-by: matiasbenedetto <[email protected]> Co-authored-by: mikachan <[email protected]> Co-authored-by: getdave <[email protected]> Co-authored-by: mcsf <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: huzaifaalmesbah <[email protected]> Co-authored-by: srueegger <[email protected]> Co-authored-by: annezazu <[email protected]>
What?
Activate the fonts coming from the backend and not the data from the frontend
Why?
In some cases, as in #60040, the data coming from the frontend can have non-properly formatted the
font-family
property. In the case of the issue linkedHeineken Serif 18
instead of"Heineken Serif 18"
.Fixes: #60040
How?
In this PR we use the font family and font face data coming from the API to activate the fonts (add to the Global Styles).
Testing Instructions
Screenshots or screencast
2024-03-21.16-46-32.mp4