Skip to content

Commit

Permalink
MU WPCOM: Port font-smoothing-antialiased feature from ETK (#38195)
Browse files Browse the repository at this point in the history
* MU WPCOM: Port font-smoothing-antialiased feature from ETK

* changelog
  • Loading branch information
arthur791004 authored Jul 5, 2024
1 parent e4f0926 commit f725afa
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
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 @@ -90,6 +90,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' );

0 comments on commit f725afa

Please sign in to comment.