-
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
Font face resolver: print font faces from font families defined in all theme.json origins #59376
Conversation
…an one theme.json data origin.
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. |
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/compat/wordpress-6.5/fonts/font-face/class-wp-font-face-resolver.php ❔ lib/compat/wordpress-6.4/fonts/font-face/class-wp-font-face-resolver.php ❔ lib/compat/wordpress-6.4/fonts/fonts.php ❔ lib/load.php ❔ lib/compat/wordpress-6.5/fonts/font-face/class-wp-font-face.php |
} | ||
|
||
$fonts[ $font_family_name ] = static::convert_font_face_properties( $definition['fontFace'], $font_family_name ); | ||
$fonts[] = static::convert_font_face_properties( $definition['fontFace'], $font_family_name ); |
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.
This should move to 6.5 folder now I think.
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.
Do you think that because of this particular change or because of something else?
If you mean because of this particular change, this is my rationale:
I understand that the wordpress-6.4
folder holds the code needed to make the code work with the latest Gutenberg version running on WordPress < 6.4, right? That's still true, so I'm unsure why this should be moved.
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 understand that the wordpress-6.4 folder holds the code needed to make the code work with the latest Gutenberg version running on WordPress < 6.4, right?
no, wordpress-6.4 is the code that was backported during 6.4, so to make Gutenberg work with 6.3 and lower.
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.
wordpress-6.4 is the code that was backported during 6.4, so to make Gutenberg work with 6.3 and lower.
I think we said the same but with different words :)
Given this PR is only a bugfix, and these classes were merged in 6.4,
and only one bugfix will be different in 6.5
, should we still move all files to the WordPress-6.5 folder?
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.
yes, because the 6.4 folder will get removed once the minimum supported version for Gutenberg is going to be 6.4 but that particular fix will still be needed.
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 if we don't figure out a way to override the 6.4 use-case properly, then there's no match point in "fixing" this bug in Gutenberg. Maybe we should just close this PR.
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.
figure out a way to override the 6.4 use-case properly
The use 6.4 use-case would be printing all the font faces when running wp 6.4 + the latest GB plugin, but I don't understand the quote. Could you explain or add more context, please?
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 don't understand your question :P
I'm saying that if we can't override the class properly on Gutenberg, why change it at all, the 6.4 code should match the code that was merged in 6.4 and we can't move it to 6.5 and update it because it will have no effect anyway.
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.
Oh, I see, thanks for explaining. In that case, the bug will be still there when running 6.4 + Gutenberg. Is that ok? If that's OK we can close the PR.
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.
It's ok for me I think.
Closing this PR following @youknowriad 's rationale in this comment: #59376 (comment)
|
What?
Port this PR from WordPress core repo: WordPress/wordpress-develop#6161
Font face resolver: If a font family name is repeated across theme.json origins (default, theme, custom), only the font faces from one origin are rendered, so the site lacks the other font faces added.
This problem was reported originally here: #58764
Why?
To print the missing font faces when a font family is defined in more than one place.
Fixes: #58764
How ?
The
parse_settings
method of theWP_Font_Face_Resolver
class uses an associative array to list all the font families that must be printed on the page. This PR replaces it with an indexed array because the associative array prevents having more than one font family with the same name, causing the bug that this PR fixes and seems unnecessary.Testing instruction
<style id="wp-fonts-local"></style>
tag.