Skip to content

Conversation

@ryelle
Copy link
Contributor

@ryelle ryelle commented May 5, 2025

See WordPress/wporg-parent-2021#149 — This PR adds Noto Serif SC (Simplified Chinese), following the other additions of Noto for Japanese and Central Kurdish. I've also added a filter when calling to preload fonts, this will avoid excess locale conditionals in the blocks file.

On its own, this PR should not have any noticeable effect, except that Noto Kufi will not be preloaded. See WordPress/wporg-parent-2021#173 for actually loading Noto Serif SC, and test instructions.

@ryelle ryelle changed the title Fonts: Add Noto Serif SC for zh_CN locale Fonts: Add Noto Serif SC May 5, 2025
Comment on lines -260 to -262
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
trigger_error( sprintf( 'Requested font file %s does not exist.', esc_html( $filepath ) ), E_USER_WARNING );
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a helpful error message. Ideally it would be flagged to the translators, because it seems to trigger most often when they've translated the subset into their language, but instead we can silently ignore it. The only effect of ignoring it is that the font is not _pre_loaded, but it is still loaded.

@ryelle ryelle force-pushed the add/simplified-chinese-font branch from afc90a6 to b2ffd3d Compare May 5, 2025 21:43
Copy link

@devhaozi devhaozi May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This font file is large. Can use a tool like https://chinese-font.netlify.app/en/online-split/ to slice it to increase loading speed if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing out that package — I've tried it out a little and it creates a lot of smaller font files, which would not be great for managing the fonts. I'll do some more testing and see if we can find a balance.

Copy link

@devhaozi devhaozi May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing out that package — I've tried it out a little and it creates a lot of smaller font files, which would not be great for managing the fonts. I'll do some more testing and see if we can find a balance.

Documentation is at https://github.com/KonghaYao/cn-font-split/tree/release/packages/ffi-js#%E5%AE%8C%E6%95%B4%E7%9A%84%E5%8F%AF%E4%BC%A0%E5%85%A5%E5%8F%82%E6%95%B0
chunkSize and maxAllowSubsetsCount parameters seem to control the subpacket size

@ryelle ryelle moved this from 👀 In review (PRs only) to 🚀 Ready for deploy (PRs only) in WordPress.org Jun 3, 2025
@dd32 dd32 changed the title Fonts: Add Noto Serif SC Fonts: Add Noto Serif SC, KR, and subsetting tool for CJK Jul 1, 2025
@dd32
Copy link
Member

dd32 commented Jul 1, 2025

@ryelle Would you be able to double check the combined PR is correct? Visually it seems to have merged correctly.. but would like another set of eyes before I go to trunk

@ryelle
Copy link
Contributor Author

ryelle commented Jul 8, 2025

@dd32 Yep, this looks good to merge — it will need to be deployed along with parent & main theme updates: WordPress/wporg-parent-2021#173, WordPress/wporg-main-2022#560.

@ryelle ryelle merged commit b09bd4e into trunk Oct 15, 2025
2 of 3 checks passed
@ryelle ryelle deleted the add/simplified-chinese-font branch October 15, 2025 23:45
@github-project-automation github-project-automation bot moved this from 🚀 Ready for deploy (PRs only) to ✅ Done in WordPress.org Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants