-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MU WPCOM: Port font-smoothing-antialiased feature from ETK (#38195)
* MU WPCOM: Port font-smoothing-antialiased feature from ETK * changelog
- Loading branch information
1 parent
e4f0926
commit f725afa
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/packages/jetpack-mu-wpcom/changelog/mu-wpcom-font-smoothing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...s/jetpack-mu-wpcom/src/features/font-smoothing-antialiased/font-smoothing-antialiased.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...s/jetpack-mu-wpcom/src/features/font-smoothing-antialiased/font-smoothing-antialiased.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ); |