This commit updates the theme.json style generation to allow a font family name to be repeated across theme.json origins (default, theme, custom).
Props mmaattiiaass, hellofromtonya, arthur791004, ironprogrammer.
Fixes#60605.
Built from https://develop.svn.wordpress.org/trunk@57720
git-svn-id: http://core.svn.wordpress.org/trunk@57221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Updates `wp_register_font_collection()` and `WP_Font_Collection` so that only font families can be loaded from a file or URL.
All metadata, such as name, description, and list of font categories, needs to be passed directly in PHP so that it can be properly localized.
Props swissspidy, mmaattiiaass, grantmkin, youknowriad.
Fixes#60509.
Built from https://develop.svn.wordpress.org/trunk@57686
git-svn-id: http://core.svn.wordpress.org/trunk@57187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes two bugs in the font library.
- Fonts using special characters were not being rendered properly in the frontend.
- Allows the ability to use generic() in font family names.
Props mmaattiiaass, nithins53, kafleg, vivekawsm, swissspidy, audrasjb.
Fixes#60537.
Built from https://develop.svn.wordpress.org/trunk@57657
git-svn-id: http://core.svn.wordpress.org/trunk@57158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes a bug where fonts could not be installed in PHP 8.1.0 through 8.1.11 due to incorrect MIME type assignment.
While `WP_Font_Utils::get_allowed_font_mime_types()` conditionally sets the MIME type for woff and woff2, it incorrectly checks against PHP 8.1.0. The MIME type change did not occur until PHP 8.1.12.
References:
* [https://github.com/php/php-src/issues/8805 PHP-src: finfo returns wrong mime type for woff/woff2 files].
* [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog].
* Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+ [55463].
* [https://github.com/WordPress/gutenberg/pull/59015 Gutenberg PR 59015].
Follow-up to [57539].
Props costdev, kafleg, hellofromTonya.
Fixes 60536.
Built from https://develop.svn.wordpress.org/trunk@57632
git-svn-id: http://core.svn.wordpress.org/trunk@57133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replaces the alias `join()` with its canonical `implode()`.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.
Follow-up to [57539], [49193].
Props davidbinda.
Fixes#60473.
Built from https://develop.svn.wordpress.org/trunk@57567
git-svn-id: http://core.svn.wordpress.org/trunk@57068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commits add three endpoints to retrieve and manipulate fonts in WordPress.
This commit also means that we now have a fully functional Font Library in the site editor.
Props get_dave, youknowriad, mmaattiiaass, grantmkin, swissspidy, mcsf, jorbin, ocean90.
See #59166.
Built from https://develop.svn.wordpress.org/trunk@57548
git-svn-id: http://core.svn.wordpress.org/trunk@57049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is the first step towards adding the font library to WordPress.
This commit includes the font library and font face CPTs.
It also adds the necessary APIs and classes to register and manipulate font collections.
This PR backports the font library post types and low level APIs to Core. This is the first step to include the font library entirely into Core. Once this merged, we'll open a PR with the necessary REST API controllers.
Props youknowriad, get_dave, grantmkin, swissspidy, hellofromtonya, mukesh27, mcsf.
See #59166.
Built from https://develop.svn.wordpress.org/trunk@57539
git-svn-id: http://core.svn.wordpress.org/trunk@57040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Instead of getting the name from the optional `'name'` field, the font-family name now comes from the required `'fontFamily'` field.
This change fixes a back-compat (BC) break in how the font-family name is pulled from the incoming font data in the `WP_Font_Face_Resolver`.
Why?
WP Core does not require the `'name'` field in theme.json. For themes that do not declare it, that set of font variations is ignored, thus causing a BC break from how the stopgap code worked (see [53282]).
However, `WP_Theme_JSON` schema does require the `fontFamily` field in each of the `typography.fontFamilies`.
== Other details:
Includes a parser to extract the first entry when a `fontFamily` field has a comma-separated list of font-families, e.g. `Inter, sans-serif`.
References:
* Merge from Gutenberg's PR https://github.com/WordPress/gutenberg/pull/54615.
Follow-up to [56500], [53282].
Props ironprogrammer, hellofromTonya, mmaattiiaass, pbking.
Fixes#59165.
Built from https://develop.svn.wordpress.org/trunk@56688
git-svn-id: http://core.svn.wordpress.org/trunk@56200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introducing Font Face, a server-side `@font-face` styles generator and printer.
tl;dr:
* Introduces Font Face.
* Deprecates `_wp_theme_json_webfonts_handler()`.
**Introduce Font Face**
From an array of fonts (i.e. each font-family and its font variations to be processed), it:
1. Validates each `font-face` declaration, i.e. the CSS property and value pairing. If validation fails, processing stops with no font-face styles printed.
3. Generates the `@font-face` CSS for each font-family.
4. Prints the CSS within a `<style id="wp-fonts-local">` element.
The entry point into Font Face is through a new global function called `wp_print_font_faces()`, which is automatically called:
* when the `'wp_head'` hook runs (for the front-end).
* when the `'admin_print_styles'` hook runs (for the back-end).
* when `_wp_get_iframed_editor_assets()` runs to inject the `@font-face` styles into the iframed editor.
Once called, it gets the fonts from Theme_JSON merged data layer, which includes theme defined fonts and user activated fonts (once the Font Library #59166 is introduced into Core).
For classic sites, themes and plugins can directly call `wp_print_font_faces()` and pass their fonts array to it for processing.
**Deprecates `_wp_theme_json_webfonts_handler()`.**
As Font Face is a direct replacement, the stopgap code in `_wp_theme_json_webfonts_handler()` (introduced in 6.0.0 via [53282]) is deprecated and unused in Core.
**Props note:**
There's a long multiple year history baked into Font Face, which dates back to the early versions of a web font API (see #46370 and [https://github.com/WordPress/gutenberg/issues/41479 roadmap]. The props list includes those who contributed from those early versions up to this commit.
**References:**
* #46370 original (Web)Fonts API proposal for registering and enqueuing web fonts.
* [https://github.com/WordPress/gutenberg/issues/41479 Gutenberg tracking issue] which includes the evolution from Webfonts API to Fonts API to Font Face.
* [53282] / #55567 Added the stopgap code `_wp_theme_json_webfonts_handler()` in 6.0.
* [https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face @font-face on mdn web docs]
* #59166 Font Library: Font manager for WordPress
Follow-up to [53282].
Props aristath, jonoaldersonwp, hellofromTonya, andraganescu, annezazu, antonvlasenko, arena, askdesign, azaozz, bph, bradley2083, colorful-tones, costdev, davidbaumwald, desrosj, dingo_d, djcowan, domainsupport, dryanpress, elmastudio, flixos90, francina, garrett-eclipse, gigitux, grantmkin, grapplerulrich, gziolo, ironprogrammer, jb510, jeffpaul, jeremyyip, jffng, joostdevalk, jorgefilipecosta, juanmaguitar, mamaduka, matveb, mburridge, mitogh, ndiego, ntsekouras, oandregal, ocean90, oglekler, paaljoachim, pagelab, peterwilsoncc, poena, priethor, scruffian, SergeyBiryukov, shiloey, simison, skorasaurus, soean, westonruter, wildworks, zaguiini.
Fixes#59165.
Built from https://develop.svn.wordpress.org/trunk@56500
git-svn-id: http://core.svn.wordpress.org/trunk@56012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [48456], database import and export icons were introduced. However, the arrows were pointing in the wrong directions. This reverses the arrows to be pointing correctly based on the action described in the name.
Props johnbillion, joen, desrosj, empireoflight.
Fixes#49913.
Built from https://develop.svn.wordpress.org/trunk@48506
git-svn-id: http://core.svn.wordpress.org/trunk@48268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [44940], the Dashicon files in core were updated to contain the latest version of the font from the GitHub repo. This change follows that up by fixing several backwards compatibility issues caused by the new build process used to generate the font files and fixes the missing menu icon when viewing the admin on small screens.
- `buddicons-bbpress-logo (f12b)` was moved back to the correct location of `f477`.
- `editor-ltr (f129)` was moved back to the correct location of `f10c`.
- `email-alt2 (f10a)` was moved to the correct location of `f467`.
The following icons were restored to their previous locations:
- `camera-alt (f129)`
- `edit-large (f327)`
- `editor-distractionfree (f211)`
- `update-alt (f113)`
- `twitter-alt (f302)`
- `text-page (f121)`
- `plugins-checked (f485)`
- `menu-alt3 (f349)`
- `menu-alt2 (f329)`
- `menu-alt (f228)`
- Duplicate lock icon at location `f315`
- Duplicate `editor-code` icon at location `f494`
- `arrow-up` at `f143`.
The `editor-ltr` and `editor-rtl` icons had also been switched. The arrows now point in the correct directions at the correct Unicode locations (`f10c` and `f320` respectively).
And, lastly, this change also introduces the `code-standards (f13a)` icon that was not included in the previous build.
Props afercia, earnjam, oztaser, joen, cathibosco1, ianbelanger, desrosj.
See #41074.
Fixes#46611.
Built from https://develop.svn.wordpress.org/trunk@45040
git-svn-id: http://core.svn.wordpress.org/trunk@44849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This change introduces the following new icons to the Dashicon font:
- `.dashicons-admin-site-alt (f11d)`
- `.dashicons-admin-site-alt2 (f11e)`
- `.dashicons-admin-site-alt3 (f11f)`
- `.dashicons-buddicons-activity (f452)`
- `.dashicons-buddicons-bbpress-logo (f12b)`
- `.dashicons-buddicons-buddypress-logo (f448)`
- `.dashicons-buddicons-community (f453)`
- `.dashicons-buddicons-forums (f449)`
- `.dashicons-buddicons-friends (f454)`
- `.dashicons-buddicons-groups (f456)`
- `.dashicons-buddicons-pm (f457)`
- `.dashicons-buddicons-replies (f451)`
- `.dashicons-buddicons-topics (f450)`
- `.dashicons-buddicons-tracking (f455)`
- `.dashicons-businessperson (f12e)`
- `.dashicons-businesswoman (f12f)`
- `.dashicons-color-picker (f131)`
- `.dashicons-editor-ltr (f129)`
- `.dashicons-editor-ol-rtl (f12c)`
- `.dashicons-email-alt2 (f10a)`
- `.dashicons-instagram (f12d)`
- `.dashicons-menu-alt (f10b)`
- `.dashicons-rest-api (f124)`
- `.dashicons-yes-alt (f12a)`
- `.dashicons-tide (f10d)`
These icons were added to the `.ttf, ` and `.eot` font files, as well as the SVG sprite. However, they were not added to the `.woff` font file. The new `dashicons.woff2` file should be utilized instead.
For instances where IE<11 needs to be supported, the `.woff` file will remain for backwards compatibility. However, if the new icons are needed in those scenarios, the WOFF format is now included as embedded within the `dashicons.css`.
Props EmpireOfLight, liljimmi, jaymanpandya, netweb, melchoyce, joen, folletto, nateallen, bahia0019, JeffPaul, desrosj, cathibosco1.
Fixes#41074.
Built from https://develop.svn.wordpress.org/trunk@44940
git-svn-id: http://core.svn.wordpress.org/trunk@44771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
New icons: `.dashicons-external`, `.dashicons-editor-contract` and `.dashicons-universal-access-alt`.
Updated icons: `.dashicons-code`, `.dashicons-universal-access`, `.dashicons-arrow-x-alt` and `.dashicons-arrow-x-alt2`.
Restores also `.dashicons-post-trash` as an alias for `.dashicons-trash`, which is the new one.
props melchoyce, empireoflight.
see #26936.
Built from https://develop.svn.wordpress.org/trunk@27989
git-svn-id: http://core.svn.wordpress.org/trunk@27819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd