Opened 4 months ago
Last modified 2 months ago
#59166 assigned enhancement
Font Library: Font manager for WordPress
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | gutenberg-merge needs-dev-note has-patch has-unit-tests changes-requested |
Focuses: | Cc: |
Description (last modified by )
Introducing the Font Library, a font manager for WordPress.
This ticket is for tracking the merge of the Font Library from Gutenberg into Core.
What is the Font Library?
Font Library is a font manager for WordPress, similar to the Media Library. It provides a user interface and workflow experience for users to manage the fonts they want on globally used on their website.
It will be available globally, independently of the theme activated.
The list of installed fonts and their assets are site-wide available and the users can select the fonts activated (available in the editor) for each theme.
Using the Font Library users can:
- Install fonts
- Install local fonts
- Install Google fonts
- Activate/deactivate fonts
- Uninstall fonts
How it works:
- Install fonts: add the font family definition to the installed fonts. List and download the font face assets to
/wp-content/fonts/
(see GB 54122).- Install local fonts: The font assets are uploaded from the users devices to the
/wp-content/fonts/
folder and the font definitions are added to the list of installed fonts. - Install Google fonts: add the font families definition to the list and downloads the Google fonts assets to
/wp-content/fonts/
. The assets from Google are called just at the time of previewing fonts in the Font Library. After the fonts is installed no other request to Google or other third-party servers will be made because the font assets are hosted locally in the/wp-content/fonts/
folder.
- Install local fonts: The font assets are uploaded from the users devices to the
- Activate/deactivate fonts: add/remove font-family definitions from the font families list defined in Global Styles/Settings. The active fonts are the fonts that will be available to use in the editor. As we are using the Global Styles data the users are able to activate/deactivate fonts for each theme.
- Uninstall fonts: remove the font family definition from the list of installed fonts and delete the assets from
/wp-content/fonts/
folder. Only the non-active fonts from the user-installed fonts can be uninstalled. Theme fonts will be able to be deactivated but not uninstalled.
References:
- Stage 1: Google and Local fonts tracking ticket.
- Stage 2: Fonts Library extensions tracking ticket.
Change History (20)
This ticket was mentioned in PR #5190 on WordPress/wordpress-develop by @ironprogrammer.
3 months ago
#2
- Keywords has-patch added
This ticket was mentioned in PR #5285 on WordPress/wordpress-develop by @mmaattiiaass.
3 months ago
#3
- Keywords has-unit-tests added
Trac ticket: https://core.trac.wordpress.org/ticket/59166
#4
@
2 months ago
- Type changed from enhancement to task (blessed)
Converting this ticket into "blessed". Why?
The Font Library is a major feature planned for 6.4. It's included in Gutenberg 16.7. I've been deeply involved in its development cycle.
I think it's safe to move this feature into "blessed", giving it time for refinement and testing with the goal of shipping in 6.4. That said, I'll monitor it closely through the beta cycle.
@mmaattiiaass commented on PR #5285:
2 months ago
#5
Added 52 contributors as co-authors of this commit so they become co-authors the this entire PR when is merged.
This is the list of github usernames:
andrewserong anton-vlasenko annezazu azaozz bph ciampo colorful-tones costdev DAreRodz dcalhoun derekblank felixarntz getdave glendaviesnz gutenbergplugin gziolo hellofromtonya iqbalpb ironprogrammer jameskoster jasmussen jeffikus jffng jordesign krokodok LittleBigThing luisherranz madhusudhand Mamaduka margolisj matiasbenedetto mikachan mtias ntsekouras oandregal ocean90 ockham paaljoachim pbking priethor properlypurple ramonjd Ren2049 richtabor spacedmonkey t-hamano TimothyBJacobs tomoxygen vcanales walbo webd-uk youknowriad
Compiled from 110 related PRs and issues:
<details>
<summary>
(PRs and issues containing: "Font Library", "Fonts Library" or "Font Manager" in the title"):</summary>
Pull Request: Font Library: unregister font collection https://github.com/WordPress/gutenberg/pull/54701 Issue: Font Library: unregister font collection https://github.com/WordPress/gutenberg/issues/54697 Pull Request: Font Library: Fix error installing system fonts https://github.com/WordPress/gutenberg/pull/54713 Issue: Font Library https://github.com/WordPress/gutenberg/issues/54169 Pull Request: Font Library: adding docs https://github.com/WordPress/gutenberg/pull/54477 Issue: Font Library: .otf font files are rejected. https://github.com/WordPress/gutenberg/issues/54759 Pull Request: Font library: lib-font as npm dependency https://github.com/WordPress/gutenberg/pull/54440 Issue: Font Library: fix endpoint permissions https://github.com/WordPress/gutenberg/issues/54751 Pull Request: Drop support for otf font installation in font library https://github.com/WordPress/gutenberg/pull/54780 Pull Request: Font Library: move font uploads to a new tab https://github.com/WordPress/gutenberg/pull/54655 Issue: Font Library: Export fonts on theme export https://github.com/WordPress/gutenberg/issues/54226 Issue: [Tracking] Font Library. Stage 2: Fonts Library extensions https://github.com/WordPress/gutenberg/issues/53307 Pull Request: Font Library: Fix set upload dir test https://github.com/WordPress/gutenberg/pull/54762 Pull Request: Font Library: Frontend https://github.com/WordPress/gutenberg/pull/53650 Issue: Font Library: add progress-bar while uploading font assets https://github.com/WordPress/gutenberg/issues/54399 Issue: Font Library: Uninstall modal text is redundant https://github.com/WordPress/gutenberg/issues/54528 Issue: Font Library: should it include a 'featured' font category to list featured fonts as default view? https://github.com/WordPress/gutenberg/issues/54671 Issue: Font Library: include a system fonts collection by default. https://github.com/WordPress/gutenberg/issues/54186 Issue: Font Library: show the scrollbar bottom edge https://github.com/WordPress/gutenberg/issues/54401 Pull Request: Font Library: remove font files created by tests after tests run https://github.com/WordPress/gutenberg/pull/54771 Issue: Font Library: How to add lib-font package (or equivalent). https://github.com/WordPress/gutenberg/issues/53653 Issue: Font Library: Automatically switch to installed tab after successful upload of fonts. https://github.com/WordPress/gutenberg/issues/54779 Issue: Font Library: No message appears when pressing the Update button https://github.com/WordPress/gutenberg/issues/54601 Issue: Font Library: A border is drawn when there are no fonts available https://github.com/WordPress/gutenberg/issues/54527 Issue: Font Library: replace snackbar error notices with new component https://github.com/WordPress/gutenberg/issues/54504 Issue: Font Library: maintain focus order within nested modal https://github.com/WordPress/gutenberg/issues/54431 Issue: [Tracking] Font Library. Stage 1: Manage fonts and Local fonts upload https://github.com/WordPress/gutenberg/issues/52698 Issue: Font Library and Global Style revisions: inconsistencies around deleted font assets. https://github.com/WordPress/gutenberg/issues/54222 Issue: [Tracking] Font Library. Stage 3: UI, UX and performance improvements https://github.com/WordPress/gutenberg/issues/53926 Issue: [Fonts API] Remove all files once Font Library is merged https://github.com/WordPress/gutenberg/issues/51820 Issue: Font library: add support for detailed error messaging in API and UI https://github.com/WordPress/gutenberg/issues/54777 Issue: Font Picker: Refine, show font preview, and load only active fonts from library https://github.com/WordPress/gutenberg/issues/51151 Issue: Font Library: Some SVG image previes are clipped or not rendered legibly https://github.com/WordPress/gutenberg/issues/54688 Pull Request: Move the switch to enable new Font Library to Experiments setting https://github.com/WordPress/gutenberg/pull/54315 Pull Request: Font Library: Font Collections frontend https://github.com/WordPress/gutenberg/pull/54566 Pull Request: Font Library: fix space above theme fonts in font library modal https://github.com/WordPress/gutenberg/pull/54598 Pull Request: Fix Font library unit tests https://github.com/WordPress/gutenberg/pull/54645 Pull Request: Font Library: Refactor logic to disable font library in the frontend. https://github.com/WordPress/gutenberg/pull/54748 Pull Request: Font Library: use resolvable domain in test https://github.com/WordPress/gutenberg/pull/54763 Pull Request: Font Library: remove upload_mimes filter after uploading fonts https://github.com/WordPress/gutenberg/pull/54647 Pull Request: Font Library: fix duplicate variants https://github.com/WordPress/gutenberg/pull/54320 Pull Request: Font Library: Font Collection backend https://github.com/WordPress/gutenberg/pull/54098 Issue: Rename "Fonts Library" to "Font Library" https://github.com/WordPress/gutenberg/issues/53778 Pull Request: Font Library: Font Collection backend https://github.com/WordPress/gutenberg/pull/54097 Pull Request: Renames "Fonts Library" to "Font Library" https://github.com/WordPress/gutenberg/pull/53780 Issue: Font Library: Errors may occur with custom font-related actions https://github.com/WordPress/gutenberg/issues/54529 Pull Request: Font library: load font assets on editor canvas https://github.com/WordPress/gutenberg/pull/54334 Pull Request: Font Library: Font Collection backend https://github.com/WordPress/gutenberg/pull/53816 Pull Request: Font Library: use wporg cdn to host the google fonts json data https://github.com/WordPress/gutenberg/pull/54795 Pull Request: Font Library: changing the upload directory to wp-content/fonts https://github.com/WordPress/gutenberg/pull/54122 Pull Request: Font Library: Frontend [Stage 1] https://github.com/WordPress/gutenberg/pull/53884 Pull Request: Font Library: add more e2e tests https://github.com/WordPress/gutenberg/pull/54298 Pull Request: Font Library: add mime type validation for font uploads https://github.com/WordPress/gutenberg/pull/53986 Pull Request: Fonts Library: Test improvements https://github.com/WordPress/gutenberg/pull/53702 Issue: [Font Library] Frontend: Load font collections in the frontend https://github.com/WordPress/gutenberg/issues/54040 Issue: [Font Library] Frontend: Load SVG previews instead of font files https://github.com/WordPress/gutenberg/issues/54039 Issue: Font Library: replace font preview URLs from provosional to wporg CDN URLs https://github.com/WordPress/gutenberg/issues/54685 Pull Request: Font Library: fix modal width on mobile viewport https://github.com/WordPress/gutenberg/pull/54518 Pull Request: Font Library: setting wp_font_family custom post type as _builtin and not plublic https://github.com/WordPress/gutenberg/pull/54559 Pull Request: Font Library: Fix notification error for actions related to custom fonts https://github.com/WordPress/gutenberg/pull/54535 Issue: Font Library: Has extra space in the modal when there are no installed fonts. https://github.com/WordPress/gutenberg/issues/54592 Pull Request: Fonts Library: change upload directory to wp-content/fonts https://github.com/WordPress/gutenberg/pull/54076 Pull Request: Font Library: fix duplicate variants with different file types https://github.com/WordPress/gutenberg/pull/54490 Issue: Query Loop: "Font Library" appears in the post type dropdown https://github.com/WordPress/gutenberg/issues/54526 Pull Request: Fonts Library: Backend https://github.com/WordPress/gutenberg/pull/52704 Issue: Font Library: use /wp-content/fonts instead of /wp-content/uploads/fonts to store font assets. https://github.com/WordPress/gutenberg/issues/53965 Issue: Font Library: Same font faces with different file extensions are added as a separated variant. https://github.com/WordPress/gutenberg/issues/54253 Issue: [Font Library] Google fonts collection: generate SVG previews and add them to the list https://github.com/WordPress/gutenberg/issues/54038 Pull Request: Relocates Font Face and Fonts Library PHP files into Core's fonts directory https://github.com/WordPress/gutenberg/pull/53747 Issue: Font Library: where to store the list of Google Fonts? https://github.com/WordPress/gutenberg/issues/52795 Issue: Font Library: load collection data from a URL https://github.com/WordPress/gutenberg/issues/53992 Pull Request: Font Face & Font Library: Load PHP files only if the main class does not exist. https://github.com/WordPress/gutenberg/pull/54103 Pull Request: Font Library https://github.com/WordPress/gutenberg/pull/50927 Issue: Font Library: Add a disclaimer/notice saying the fonts will be downloaded from third-party sources. https://github.com/WordPress/gutenberg/issues/53882 Pull Request: Font Library: ensure merged fontFace data is enconded as an array instead of an object https://github.com/WordPress/gutenberg/pull/54435 Pull Request: Font Library: load collection JSON data from a URL in the collection config https://github.com/WordPress/gutenberg/pull/54067 Pull Request: Try disabling FONT_LIBRARY_ENABLE in PHP tests now that the lib is in Core https://github.com/WordPress/gutenberg/pull/54102 Issue: Font Library backend: can we use _wp_handle_upload() mime type validation ? https://github.com/WordPress/gutenberg/issues/53576 Pull Request: Fonts Library: update properties name from snake case to camel case to match the rest of the properties https://github.com/WordPress/gutenberg/pull/53746 Pull Request: [Block Library]: Remove font family support from 5.9 blocks https://github.com/WordPress/gutenberg/pull/37911 Pull Request: Font Library: Fix error installing system fonts https://github.com/WordPress/gutenberg/pull/54713 Issue: Font Library: Export fonts on theme export https://github.com/WordPress/gutenberg/issues/54226 Issue: [Tracking] Font Library. Stage 2: Fonts Library extensions https://github.com/WordPress/gutenberg/issues/53307 Issue: Font Library: include a system fonts collection by default. https://github.com/WordPress/gutenberg/issues/54186 Issue: [Tracking] Font Library. Stage 1: Manage fonts and Local fonts upload https://github.com/WordPress/gutenberg/issues/52698 Issue: Font Library: Automatically switch to installed tab after successful upload of fonts. https://github.com/WordPress/gutenberg/issues/54779 Issue: Font Library: should it include a 'featured' font category to list featured fonts as default view? https://github.com/WordPress/gutenberg/issues/54671 Issue: Font Library: A border is drawn when there are no fonts available https://github.com/WordPress/gutenberg/issues/54527 Issue: [Fonts API] Remove all files once Font Library is merged https://github.com/WordPress/gutenberg/issues/51820 Issue: Font Picker: Refine, show font preview, and load only active fonts from library https://github.com/WordPress/gutenberg/issues/51151 Issue: Rename "Fonts Library" to "Font Library" https://github.com/WordPress/gutenberg/issues/53778 Pull Request: Fonts Library: Test improvements https://github.com/WordPress/gutenberg/pull/53702 Pull Request: Font Library: remove upload_mimes filter after uploading fonts https://github.com/WordPress/gutenberg/pull/54647 Pull Request: Renames "Fonts Library" to "Font Library" https://github.com/WordPress/gutenberg/pull/53780 Pull Request: Fonts Library: change upload directory to wp-content/fonts https://github.com/WordPress/gutenberg/pull/54076 Pull Request: Font Library: fix space above theme fonts in font library modal https://github.com/WordPress/gutenberg/pull/54598 Pull Request: Fonts Library: Backend https://github.com/WordPress/gutenberg/pull/52704 Pull Request: Font Library: changing the upload directory to wp-content/fonts https://github.com/WordPress/gutenberg/pull/54122 Pull Request: Font Library: use wporg cdn to host the google fonts json data https://github.com/WordPress/gutenberg/pull/54795 Issue: Font Library: Has extra space in the modal when there are no installed fonts. https://github.com/WordPress/gutenberg/issues/54592 Pull Request: Font Library: Fix notification error for actions related to custom fonts https://github.com/WordPress/gutenberg/pull/54535 Issue: Font Library: use /wp-content/fonts instead of /wp-content/uploads/fonts to store font assets. https://github.com/WordPress/gutenberg/issues/53965 Pull Request: Relocates Font Face and Fonts Library PHP files into Core's fonts directory https://github.com/WordPress/gutenberg/pull/53747 Issue: Font Library: where to store the list of Google Fonts? https://github.com/WordPress/gutenberg/issues/52795 Issue: [Font Library] Google fonts collection: generate SVG previews and add them to the list https://github.com/WordPress/gutenberg/issues/54038 Issue: Font Library: Add a disclaimer/notice saying the fonts will be downloaded from third-party sources. https://github.com/WordPress/gutenberg/issues/53882 Pull Request: Fonts Library: update properties name from snake case to camel case to match the rest of the properties https://github.com/WordPress/gutenberg/pull/53746 Issue: Fonts Manager: inconsistent results for installed fonts https://github.com/WordPress/gutenberg/issues/54568 Pull Request: Font manager https://github.com/WordPress/gutenberg/pull/46332 Issue: Extra spacing in Font manager https://github.com/WordPress/gutenberg/issues/54649
</details>
@mmaattiiaass commented on PR #5285:
2 months ago
#6
All the comments were addressed on the latest commits. Coul you please, give it another review @spacedmonkey @hellofromtonya ?
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
2 months ago
@mmaattiiaass commented on PR #5285:
2 months ago
#8
I find the REST API structure/design here very confusing.
I don't understand why we have a separate font families endpoint that is going to end up with a very different shape from the fonts endpoint.
The custom POST /fonts
and DELETE /fonts
endpoints are for installing and uninstalling several font families at once.
The default wp_font_family
endpoint is to fetch the font families post from the frontend.
Is this what you are asking @TimothyBJacobs ?
@TimothyBlynJacobs commented on PR #5285:
2 months ago
#9
The custom POST /fonts and DELETE /fonts endpoints are for installing and uninstalling several font families at once.
Not exactly, for deleting or creating multiple font families at once, the /v1/batch
endpoint should be used. Making the endpoints themselves batched is not how Core REST API endpoints are designed.
The default wp_font_family endpoint is to fetch the font families post from the frontend.
Why isn't this done through the main fonts endpoint?
@mmaattiiaass commented on PR #5285:
2 months ago
#10
Not exactly, for deleting or creating multiple font families at once, the /v1/batch endpoint should be used
Do think this functionality is able to do the tasks that the install endpoint does?
- Conditional (based on the existence of that font family in the database) creating and/or updating wp_font_family posts.
- Upload/download assets and handle errors (this conditions the what (if any) post_content should be written for each post.
@spacedmonkey commented on PR #5285:
2 months ago
#11
+1 to comments about the rest api. Feedback needs to be actioned before commit.
@hellofromTonya commented on PR #5285:
2 months ago
#12
FYI: There's a discussion happening in Make/Core's slack REST API channel starting here https://wordpress.slack.com/archives/C02RQC26G/p1696280573385409.
@hellofromTonya commented on PR #5285:
2 months ago
#13
Update:
Thank you everyone for all sharing your expertise and time in reviewing, advising, and helping to get this feature ready 🙇♀️
Current status:
- Performance Team: 🟢
- REST API: 🔴 the endpoints need a redesign / refactoring, especially for using
/v1/batch
endpoint for batch processing. That work is underway with @matiasbenedetto and @anton-vlasenko working on it.
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
2 months ago
@mmaattiiaass commented on PR #5285:
2 months ago
#15
:wave: Thank you all so much for the feedback and reviews.
This is an update about the current status of the biggest concerns about this PR:
- Consolidate endpoint routes ✅
- Make endpoints singular (understand one font family per request) ✅
- Add response schemas ✅
- Group endpoints registering ✅
- Update the unit tests (90% done)
- Make ALL data input and output from endpoints snake_case instead of camelCase. (50% done).
These are all the endpoints added:
Font families:
POST /font-families/ DELETE /fonts-families/<slug> GET /fonts-families GET /fonts-families/<slug>
Font collections:
GET /fonts-collections GET /fonts-collections/<slug>
Could you please take a new look?
@spacedmonkey commented on PR #5285:
2 months ago
#16
@matiasbenedetto My review was requested. Please ensure before requesting my reviewing the following things are complete, before I review.
- All unit tests are pass.
- PHPCS coding standards pass.
- All feedback has been actioned.
@hellofromTonya commented on PR #5285:
2 months ago
#17
Sharing @spacedmonkey observations from Make/Core slack in the #core
channel:
I am currently reviewing the font apis PR . I must say, I am very worried about the PR in it's current state. The code simply doesn't follow the WP core code style and doesn't feel WordPress. I have a number of problems with it, including.
- Limited developer API. We need function like
wp_insert_font
/wp_create_font
etc.- Lack of filter or actions.
- No way to unregister font collections.
- Capabilities. Creating new fonts should have capabilies and not simply map to edit_theme_options
- Confusing API structure. Collection should have embedded font objects
- What happens to fonts when collections are unregistered.
- If fonts are stored as post object, can I query to get all fonts from a collection.
- Are fonts deleted when the user is deleted.
- No way to filter where a font is stored. ( #hosting channel for detail ).
With time very limited in this release, it feels like actioning the above, feel like it is going too hard to achieve in this release.
I think this feature needs some more time to bake.
No way to filter where a font is stored.
See https://github.com/WordPress/gutenberg/issues/54697 to add WP_FONTS_DIR
constant to unblock web hosts.
No way to unregister font collections.
#18
@
2 months ago
- Keywords changes-requested added
- Milestone changed from 6.4 to 6.5
- Type changed from task (blessed) to enhancement
The feature is not yet ready and needs more time.
An open thoughtful discussion happened today in Make/Core slack to discuss its needs and if the feature should or shouldn't stay in 6.4.
It was determined that the feature is not a dependency for other features in the release, including TT4 and the Editor.
Quoting Josepha @chanthaboune
Alright, my friends. I think the only right choice here is to punt Fonts to WP6.5.
Moving it to 6.5 gives the feature more time for Gutenberg and Core folks to continue working on the REST API, control mechanisms, etc. while also giving more time for testing and feedback through Gutenberg release cycles.
Thank you to everyone how has been contributing to it thus far.
It's an awesome feature. It will ship.
@mmaattiiaass commented on PR #5285:
2 months ago
#19
Closing this PR due to the inclusion of this feature was punted to 6.5:
https://wordpress.slack.com/archives/C02RQBWTW/p1696525101347939
@mmaattiiaass commented on PR #5285:
2 months ago
#20
Tracking the required changes to make Font Library ready for 6.5 in this Gutenberg issue: https://github.com/WordPress/gutenberg/issues/54169
Adds the
src/wp-content/fonts
folder to.gitignore
, treating it like the plugins or uploads folder. The font upload storage location was most recently updated in https://github.com/WordPress/gutenberg/pull/54122.Trac ticket: https://core.trac.wordpress.org/ticket/59166