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

MU WPCOM: Port font-smoothing-antialiased feature from ETK #38195

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

MU WPCOM: Port font-smoothing-antialiased feature from ETK
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public static function load_features() {
require_once __DIR__ . '/features/cloudflare-analytics/cloudflare-analytics.php';
require_once __DIR__ . '/features/error-reporting/error-reporting.php';
require_once __DIR__ . '/features/first-posts-stream/first-posts-stream-helpers.php';
require_once __DIR__ . '/features/font-smoothing-antialiased/font-smoothing-antialiased.php';
// To avoid potential collisions with ETK.
if ( ! class_exists( 'A8C\FSE\Help_Center' ) ) {
require_once __DIR__ . '/features/help-center/class-help-center.php';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@media (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
body.font-smoothing-antialiased,
/** Overriding an existing core WP rule so the ID selector is necessary */
body.font-smoothing-antialiased #wpwrap,
body.font-smoothing-antialiased #wpadminbar * {
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Apply the new font-smoothing styles.
*
* @package automattic/jetpack-mu-wpcom
*/

use Automattic\Jetpack\Jetpack_Mu_Wpcom;

// Turn off the feature on ETK plugin.
define( 'A8C_USE_FONT_SMOOTHING_ANTIALIASED', false );

/**
* Adds custom classes to the admin body classes.
*
* @param string $classes Classes for the body element.
* @return string
*/
function wpcom_add_font_smoothing_antialiased_class( $classes ) {
$classes .= ' font-smoothing-antialiased ';
return $classes;
}
add_filter( 'admin_body_class', 'wpcom_add_font_smoothing_antialiased_class' );

/**
* Enqueue assets
*/
function wpcom_enqueue_font_smoothing_antialiased_assets() {
wp_enqueue_style(
'wpcom-font-smoothing-antialiased',
plugins_url( 'font-smoothing-antialiased.css', __FILE__ ),
array(),
Jetpack_Mu_Wpcom::PACKAGE_VERSION
);
}
add_action( 'admin_enqueue_scripts', 'wpcom_enqueue_font_smoothing_antialiased_assets' );