-
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
Deprecate and make Fonts API non-functional. #52485
Conversation
3f9804b
to
7d6f907
Compare
With Font Face, the Fonts API is no longer needed. However for sites using Fonts API, the public facing functions, classes, and methods still need to be available in memory to avoid fatal errors. This commit: 1. Adds a bc-layer into the Font Face. 2. Copies each of the Fonts API files into it. 3. Deprecates each file and public function, class, and method. 4. Makes each function and method non-functional.
7d6f907
to
71f09ac
Compare
Test ReportPR tested: #52485 Environment
Steps to TestFollow the steps listed in the PR's description above. Expected Results
occurs before applying the changes from this PR. Actual Results
Supplemental Artifacts |
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.
The code LGTM.
However, I'm not sure why the fatal error doesn't occur when the BC layer files are not loaded. Please see my test report here: #52485 (comment).
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.
Code LGTM 👍
Oh silly me 🤦♀️ Thanks @anton-vlasenko for flagging this. I missed a step in the Set up process and the fatal error is a different one. I've updated the testing instructions. The tester plugin already guards against the functions not existing. By commenting out those lines of code, a fatal error will happen when it attempts to invoke |
Thank you, @hellofromtonya. I'm able to reproduce the fatal error now. |
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.
LGTM ✅.
Thank you @aristath and @anton-vlasenko 🎉 Merging now. |
Removed |
Closes 51819.
What?
Creates a BC Layer in the new Font Face.
Deprecates all of the Fonts API's public-facing files, functions, classes, and methods.
Makes the Fonts API non-functional, i.e. as Font Face replaces it.
Why?
Font Face replaces Fonts API.
For sites using the Fonts API, this PR:
How?
fonts/bc-layer
directory.private
methods.Testing Instructions
Set up
a. Open
lib/load.php
.b. Scroll down to where the Font Face files are loaded.
c. Add
true ||
in theif
:webfonts.php
file:Reproduce the fatal error
Before applying the changes from this PR (or comment out the BC Layer files loading in
lib/load.php
, refresh the admin page on your test site.Expected: Fatal error such as:
the path to the
webfonts.php
will be different in your test site.This fatal error happens because the tester plugin is using the Fonts API but it is not loaded into memory.
Test this PR
Expected: No fatal error. There will be deprecation notices as the tester plugin is using the Fonts API (which is now deprecated).
a. Go to Site Editor > Styles > Typography > Headings.
b. Select "FONT".
Expected: Google Fonts such as Arvo, Merriweather, Open Sans, etc. are not in the list. Rather, only the theme's fonts in the list.
Using TT3, the FONT picker should contain:
Note: To see all of the Google Fonts the tester plugin registers, remove the
true
so that the Font Face libs are not loaded.