-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 Library: fix duplicate variants #54320
Conversation
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
…ce loading and load Font API instead
3881631
to
f72d258
Compare
* @param array $incoming The incoming font faces. | ||
* @return array The font faces that are in both the existing and incoming font families. | ||
*/ | ||
private function get_intersecting_font_faces( $existing, $incoming ) { |
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.
Should I add a test for this?
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 are not testing private class methods, and I also don't know if there is an easy way to do that and if we should do it. I would prefer to add a test case(s) for the public method (install) that covers the situations we are trying to fix with the changes in this PR.
Flaky tests detected in 83bff3d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6186790338
|
The rebase on this PR got ugly after the frontend was merged, so I opened a new PR at #54490. Closing this one. |
What?
This PR adds checks to ensure that multiple file types of the same font variant are not added, so that only one variation per font style and weight is stored.
Why?
Fixes #54253
How?
For fonts where the font family does not yet exist, checks the list of new font faces and compares their font weight and style, and if there is already an existing font face, skips adding the incoming one.
For font faces where the font family exists, adds a new function
get_intersecting_font_faces
which returns an array of font faces to be deleted and replaced by the incoming font face.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast