Skip to content
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: create fonts dir if a font face needs to use the file system #56120

Merged
merged 4 commits into from
Nov 15, 2023

Conversation

matiasbenedetto
Copy link
Contributor

@matiasbenedetto matiasbenedetto commented Nov 14, 2023

What?

Font Library: create fonts dir if a font face needs to use the filesystem

Why?

Because if the fonts directory is not created the writing of the fonts files can fail on certain servers.

How?

create fonts dir if a font face needs to use the filesystem

Testing Instructions

  • Navigate to the font library.
  • Try to install a font from Google Fonts collection.
  • Check that is working as expected.

Copy link

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/experimental/fonts/font-library/class-wp-font-family.php

@matiasbenedetto matiasbenedetto added [Feature] Typography Font and typography-related issues and PRs [Type] Bug An existing feature does not function as intended labels Nov 14, 2023
@matiasbenedetto matiasbenedetto changed the title Font Library: create fonts dir if a font face need to use the filesystem Font Library: create fonts dir if a font face needs to use the filesystem Nov 14, 2023
@pbking
Copy link
Contributor

pbking commented Nov 14, 2023

I think perhaps this change handles that situation, which has already been merged but might not have been in the build that was being tested.

@matiasbenedetto
Copy link
Contributor Author

I think perhaps https://github.com/WordPress/gutenberg/pull/55893handles that situation, which has already been merged but might not have been in the build that was being tested.

@pbking thanks for pointing that out. Yep, that change should fix the problem when you try to add fonts using the API but I'm not sure that a REST API controller should be in charge of creating a directory but it doesn't hurt. Apart from that, I think the PHP class in charge of writing the font assets to the filesystem should be able to write the containing folder so I think this PR is still needed.

Copy link
Member

@mikachan mikachan left a comment

Choose a reason for hiding this comment

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

This tests well for me! I can successfully install a font from Google Fonts with this PR ✅

I've left a minor comment with a suggested wording change.

Co-authored-by: Sarah Norris <1645628+mikachan@users.noreply.github.com>
@matiasbenedetto matiasbenedetto merged commit 0917f86 into trunk Nov 15, 2023
49 checks passed
@matiasbenedetto matiasbenedetto deleted the try/create-fonts-dir branch November 15, 2023 16:01
@github-actions github-actions bot added this to the Gutenberg 17.1 milestone Nov 15, 2023
@bph bph changed the title Font Library: create fonts dir if a font face needs to use the filesystem Font Library: create fonts dir if a font face needs to use the file system Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Typography Font and typography-related issues and PRs [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants