Skip to content

Commit

Permalink
Fonts: Add Noto Serif JP, faux cjk subset (#630)
Browse files Browse the repository at this point in the history
* Fonts: Add Noto Serif JP, faux `cjk` subset

* Fix noto serif name

* Fonts: Fix path to Noto Serif by changing the folder name
  • Loading branch information
ryelle authored Jun 24, 2024
1 parent 92d700f commit dea7cc0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Binary file not shown.
6 changes: 5 additions & 1 deletion mu-plugins/global-fonts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function get_font_url( $font, $subset ) {
$lower_font = strtolower( trim( $font ) );
$lower_subset = strtolower( trim( $subset ) );

$valid_subsets = array( 'arrows', 'cyrillic-ext', 'cyrillic', 'greek-ext', 'greek', 'latin-ext', 'latin', 'vietnamese' );
$valid_subsets = array( 'arrows', 'cyrillic-ext', 'cyrillic', 'greek-ext', 'greek', 'latin-ext', 'latin', 'vietnamese', 'cjk' );
if ( ! in_array( $lower_subset, $valid_subsets ) ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
trigger_error( sprintf( 'Requested font subset %s does not exist.', esc_html( $lower_subset ) ), E_USER_WARNING );
Expand Down Expand Up @@ -212,6 +212,10 @@ function get_font_url( $font, $subset ) {
$font_folder = 'IBMPlexSans/';
$font_file_name = 'IBMPlexSans-SemiBold-';
break;
case 'noto serif jp':
$font_folder = 'NotoSerif/';
$font_file_name = 'NotoSerifJP-';
break;
}

$filepath = $font_folder . $font_file_name . $lower_subset . '.woff2';
Expand Down
13 changes: 13 additions & 0 deletions mu-plugins/global-fonts/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1233,3 +1233,16 @@
src: url(./IBMPlexSans/IBMPlexSans-SemiBold-arrows.woff2) format("woff2");
unicode-range: U+2190-2199;
}

/*------------------------------*
* Noto Serif JP *
*------------------------------*/

/* cjk */
@font-face {
font-family: "Noto Serif JP";
font-weight: 200 900;
font-style: normal;
font-display: swap;
src: url(./NotoSerif/NotoSerifJP-cjk.woff2) format("woff2");
}

0 comments on commit dea7cc0

Please sign in to comment.