Skip to content

Theme: Use adjusted Segoe font-face for medium -> semibold fallback - #80020

Closed
aduth wants to merge 4 commits into
trunkfrom
fix/segoe-consistent-medium-semibold-fallback
Closed

Theme: Use adjusted Segoe font-face for medium -> semibold fallback#80020
aduth wants to merge 4 commits into
trunkfrom
fix/segoe-consistent-medium-semibold-fallback

Conversation

@aduth

@aduth aduth commented Jul 8, 2026

Copy link
Copy Markdown
Member

What?

Closes #79525

Defines a custom Segoe UI font variant to control the fallback behavior for Windows system font missing medium font-weight (500), preferring to fall back to a bolder font (600) than a lighter font (400).

Why?

As described in #79525, our typography scale relies on visual distinctiveness between regular (400) and medium (500) font-weights. But currently, Windows browsers will show a 400 font-weight for everything, because the Segoe system font does not include a 500 font-weight.

How?

  • Updates medium font-weight from 499 to 500 to avoid the fallback to 400
  • Adds a new "Segoe UI WordPress Adjusted" font to the shared font-families used in @wordpress/theme and @wordpress/base-styles, ahead of system-ui
  • Registers @font-face declarations to define "Segoe UI WordPress Adjusted" to emulate the default behavior, with one exception: 'Segoe UI Semibold' is registered at font-weight: 500 instead of the default effective font-weight: 600 so that it is used at weights between 500 and 700 (default is that it is used between 600 and 700).

There's a lot more discussion in #79525 to the technical considerations of this implementation, specifically around specification behavior and browser behavior inconsistencies.

Testing Instructions

Verify visual hierarchy of boldness in Storybook "Text" story, ideally from a Windows machine:

  1. Run npm run storybook:dev
  2. Go to http://localhost:50240/?path=/docs/design-system-components-text--docs#all-variants
  3. Observe that heading variants are bolder than body variants
  4. Compare against live version: https://wordpress.github.io/gutenberg/?path=/docs/design-system-components-text--docs#all-variants

Screenshots or screencast

The screenshots below are captured in a Windows environment, which is what's most impacted by these changes:

Browser Before After
Chrome image image
Firefox image image

Use of AI Tools

Implemented with assistance by Cursor + Claude Opus 4.8, with reviews and iterations prompted by myself.

@aduth
aduth requested review from a team, ajitbohra and ellatrix as code owners July 8, 2026 18:54
@aduth aduth added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Base styles /packages/base-styles [Package] Theme /packages/theme labels Jul 8, 2026
@github-actions github-actions Bot added [Package] Components /packages/components [Package] Editor /packages/editor [Package] Block editor /packages/block-editor [Package] Edit Post /packages/edit-post labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: aduth <aduth@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: simison <simison@git.wordpress.org>
Co-authored-by: mattmiklic <mattmiklic@git.wordpress.org>
Co-authored-by: fcoveram <fcoveram@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Size Change: +2.36 kB (+0.03%)

Total Size: 7.68 MB

📦 View Changed
Filename Size Change
build/modules/boot/index.min.js 51.1 kB +114 B (+0.22%)
build/modules/content-types/index.min.js 161 kB +45 B (+0.03%)
build/scripts/block-directory/index.min.js 44.1 kB +11 B (+0.02%)
build/scripts/block-editor/index.min.js 417 kB +24 B (+0.01%)
build/scripts/block-library/index.min.js 333 kB -1 B (0%)
build/scripts/components/index.min.js 270 kB +13 B (0%)
build/scripts/edit-post/index.min.js 52.2 kB +11 B (+0.02%)
build/scripts/edit-site/index.min.js 300 kB +24 B (+0.01%)
build/scripts/editor/index.min.js 494 kB +1 B (0%)
build/scripts/format-library/index.min.js 29.6 kB +11 B (+0.04%)
build/scripts/media-utils/index.min.js 118 kB +11 B (+0.01%)
build/scripts/patterns/index.min.js 12.3 kB +10 B (+0.08%)
build/styles/block-directory/style-rtl.css 2.09 kB -3 B (-0.14%)
build/styles/block-directory/style-rtl.min.css 1.08 kB -2 B (-0.18%)
build/styles/block-directory/style.css 2.09 kB -3 B (-0.14%)
build/styles/block-directory/style.min.css 1.09 kB -1 B (-0.09%)
build/styles/block-editor/content-rtl.css 5.68 kB +13 B (+0.23%)
build/styles/block-editor/content-rtl.min.css 4.15 kB +18 B (+0.44%)
build/styles/block-editor/content.css 5.68 kB +12 B (+0.21%)
build/styles/block-editor/content.min.css 4.14 kB +18 B (+0.44%)
build/styles/block-editor/default-editor-styles-rtl.css 714 B +17 B (+2.44%)
build/styles/block-editor/default-editor-styles-rtl.min.css 243 B +19 B (+8.48%) 🔍
build/styles/block-editor/default-editor-styles.css 714 B +17 B (+2.44%)
build/styles/block-editor/default-editor-styles.min.css 243 B +19 B (+8.48%) 🔍
build/styles/block-editor/style-rtl.css 19.2 kB +23 B (+0.12%)
build/styles/block-editor/style-rtl.min.css 16.4 kB +32 B (+0.2%)
build/styles/block-editor/style.css 19.2 kB +21 B (+0.11%)
build/styles/block-editor/style.min.css 16.4 kB +32 B (+0.2%)
build/styles/block-library/editor-rtl.css 12.7 kB +15 B (+0.12%)
build/styles/block-library/editor-rtl.min.css 10.4 kB +18 B (+0.17%)
build/styles/block-library/editor.css 12.7 kB +16 B (+0.13%)
build/styles/block-library/editor.min.css 10.4 kB +19 B (+0.18%)
build/styles/block-library/more/editor-rtl.css 814 B +18 B (+2.26%)
build/styles/block-library/more/editor-rtl.min.css 411 B +18 B (+4.58%) 🔍
build/styles/block-library/more/editor.css 816 B +18 B (+2.26%)
build/styles/block-library/more/editor.min.css 411 B +18 B (+4.58%) 🔍
build/styles/block-library/navigation-link/editor-rtl.css 1.27 kB -1 B (-0.08%)
build/styles/block-library/navigation-link/editor-rtl.min.css 709 B -1 B (-0.14%)
build/styles/block-library/navigation-link/editor.css 1.27 kB -2 B (-0.16%)
build/styles/block-library/navigation-link/editor.min.css 711 B -2 B (-0.28%)
build/styles/block-library/navigation/editor-rtl.css 3.4 kB +12 B (+0.35%)
build/styles/block-library/navigation/editor-rtl.min.css 2.3 kB +23 B (+1.01%)
build/styles/block-library/navigation/editor.css 3.4 kB +12 B (+0.35%)
build/styles/block-library/navigation/editor.min.css 2.3 kB +19 B (+0.83%)
build/styles/block-library/nextpage/editor-rtl.css 816 B +17 B (+2.13%)
build/styles/block-library/nextpage/editor-rtl.min.css 411 B +19 B (+4.85%) 🔍
build/styles/block-library/nextpage/editor.css 816 B +16 B (+2%)
build/styles/block-library/nextpage/editor.min.css 411 B +19 B (+4.85%) 🔍
build/styles/block-library/video/editor-rtl.css 838 B -1 B (-0.12%)
build/styles/block-library/video/editor-rtl.min.css 426 B -2 B (-0.47%)
build/styles/block-library/video/editor.css 838 B -2 B (-0.24%)
build/styles/block-library/video/editor.min.css 427 B -1 B (-0.23%)
build/styles/commands/style-rtl.css 2.17 kB -1 B (-0.05%)
build/styles/commands/style-rtl.min.css 1.18 kB -2 B (-0.17%)
build/styles/commands/style.css 2.17 kB -1 B (-0.05%)
build/styles/components/style-rtl.css 18.1 kB +28 B (+0.15%)
build/styles/components/style-rtl.min.css 15 kB +37 B (+0.25%)
build/styles/components/style.css 18.2 kB +20 B (+0.11%)
build/styles/components/style.min.css 15.1 kB +36 B (+0.24%)
build/styles/edit-post/style-rtl.css 3.31 kB +13 B (+0.39%)
build/styles/edit-post/style-rtl.min.css 1.96 kB +17 B (+0.87%)
build/styles/edit-post/style.css 3.31 kB +12 B (+0.36%)
build/styles/edit-post/style.min.css 1.96 kB +17 B (+0.87%)
build/styles/edit-site/style-rtl.css 21.3 kB +34 B (+0.16%)
build/styles/edit-site/style-rtl.min.css 17.5 kB +52 B (+0.3%)
build/styles/edit-site/style.css 21.3 kB +33 B (+0.16%)
build/styles/edit-site/style.min.css 17.5 kB +52 B (+0.3%)
build/styles/edit-widgets/style-rtl.css 4.97 kB +11 B (+0.22%)
build/styles/edit-widgets/style-rtl.min.css 3.54 kB +15 B (+0.43%)
build/styles/edit-widgets/style.css 4.96 kB +11 B (+0.22%)
build/styles/edit-widgets/style.min.css 3.54 kB +15 B (+0.43%)
build/styles/editor/style-rtl.css 31 kB +55 B (+0.18%)
build/styles/editor/style-rtl.min.css 26.3 kB +34 B (+0.13%)
build/styles/editor/style.css 31 kB +55 B (+0.18%)
build/styles/editor/style.min.css 26.3 kB +34 B (+0.13%)
build/styles/media-utils/style-rtl.css 2.26 kB +13 B (+0.58%)
build/styles/media-utils/style-rtl.min.css 1.25 kB +19 B (+1.55%)
build/styles/media-utils/style.css 2.26 kB +13 B (+0.58%)
build/styles/media-utils/style.min.css 1.25 kB +19 B (+1.55%)
build/styles/theme/design-tokens-rtl.css 3.71 kB +335 B (+9.93%) ⚠️
build/styles/theme/design-tokens-rtl.min.css 1.72 kB +105 B (+6.49%) 🔍
build/styles/theme/design-tokens.css 3.71 kB +335 B (+9.93%) ⚠️
build/styles/theme/design-tokens.min.css 1.72 kB +105 B (+6.49%) 🔍
build/styles/widgets/style-rtl.css 2.16 kB +14 B (+0.65%)
build/styles/widgets/style-rtl.min.css 1.19 kB +22 B (+1.89%)
build/styles/widgets/style.css 2.17 kB +14 B (+0.65%)
build/styles/widgets/style.min.css 1.19 kB +21 B (+1.8%)

compressed-size-action

@t-hamano t-hamano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR! I have confirmed that this approach works correctly in both Chrome and Firefox.

This approach works well under a pure design system, but may not be the case for WordPress sites.

In the post editor and site editor, this old font family provided by core is basically applied. Therefore, if we specify weight 500, it will refer to Segoe UI as before and fall back to 600.

Please refer to the screenshot below. Almost all bold text is falling back to 600, but Column Count and Row Count within the table placeholder will render at weight 500.

Image

This means that because the application of the new font family is inconsistent, changing the weight to 500 will result in variations in the actual rendered thickness.

I believe that to solve this issue across WordPress, we would need to directly add font-face and font-family to the core common.css. However, I think it would be too risky to try this in the 7.1 release.

@ciampo

ciampo commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

If the approach is promising but we don't want to merge it before 7.1, let's make sure that we leave @wordpress/theme in a state where this future change won't be a breaking change — this is important because the package will be marked as stable in the upcoming Gutenberg / WordPress release.

If we're confident in this approach as-is, it looks fine, since the changes are only internal (ie only token values are being changed, no public API changes).

This also means that the same a11y shortcomings mentioned before will continue to be around for now, but I guess a known shrotcoming is better than unknown bugs

@t-hamano

t-hamano commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

I see. So, what do you think of the following procedure?

  • 7.1: Ship this PR as is. The 500 font weight falls back to 600 where the Segoe UI WordPress Adjusted font family is not applied, but accept this behavior.
  • 7.2: Add "Segoe UI WordPress Adjusted" font family to common.css. This will ensure that weight 500 is consistently represented across the WordPress dashboard.

I don't fully understand the design system yet, so please let me know if there's anything I'm getting wrong.

@ciampo

ciampo commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@WordPress/gutenberg-components let's all take a moment to review the proposed approach.

@aduth

aduth commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Given how widespread this impact is, I think we've transcended this being just a design system problem 😅 It seems that we're in a tricky spot where we want to use 400 and 500 as different weights to express hierarchy, and also want to use system fonts, but the Windows system font doesn't have a 500 font weight, and the spec behavior of fonts is such that without significant coercion (as implemented here), it will fallback to 400 and thus violate the desired hierarchy.

As far as what that all means for how we proceed today:

  • We could revisit whether the hierarchy itself. If font-weight 600 is more universally supported and we could tolerate that from a design perspective (cc @WordPress/gutenberg-design), that would be a much simpler option
  • Regardless, as you highlight @t-hamano , this impacts anywhere we currently use 500 font-weight, which is not just the editor. Is it better for things to be more consistently broken (i.e. consistently falling back to 400 and breaking the hierarchy) or for the improved version to be applied inconsistently, at least in WordPress 7.1. The former is the status quo, and the latter would be achieved by merging this pull request.
  • We will want some resolution to "are we using 500 or 600" as far as the public API of design system theming, which currently exposes regular and medium tokens. Adding a semibold token later is possible, but if we decide that we want to avoid medium altogether because of the known cross-platform inconsistencies, then we'd be better off removing that token before it gets merged as part of WordPress 7.1.
@ciampo

ciampo commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

if we decide that we want to avoid medium altogether because of the known cross-platform inconsistencies, then we'd be better off removing that token before it gets merged as part of WordPress 7.1.

Emphasis on this. If we want to move to 600 and stop using 500 altogether, we should consider removing the token, and we should do that before WP 7.1 gets released.

@t-hamano

t-hamano commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

I realized there is another factor that complicates this issue: since Segoe UI is a font designed for Western languages, different results can be obtained with other languages. For example, when Japanese was used, I obtained the following results in my environment.

https://codepen.io/editor/Tetsuaki-Hamno/pen/019f4ae8-8594-743d-9cb9-f1ebcb227034

Chrome: Perhaps because Noto Sans JP has recently been included by default, the weight 500 is now rendering correctly.

image

Firefox: In my environment, since Meiryo is applied, weight 500 falls back to 400. However, if Noto Sans JP is explicitly applied in the browser settings, weight 500 is rendered correctly, similar to Chrome.

image

Emphasis on this. If we want to move to 600 and stop using 500 altogether, we should consider removing the token, and we should do that before WP 7.1 gets released.

Even if we migrate from 500 to 600, there might be no guarantee that weight 600 can represent the intended weight across all operating systems, languages, and browsers.

For example, as I mentioned earlier that Meiryo is applied as the system font in Firefox, it seems that the Meiryo font only supports weights 400 and 700. Therefore, weight 600 will fall back to 700.

image

To put it extremely, using only weights of 400 and 700 would be the most stable method, but I don't think this is ideal.

Perhaps it's reasonable to give up on solving all scenarios and just change the medium font weight from 499 to 500, leaving it to each OS, language, and browser to determine how that weight is actually rendered.

@ciampo

ciampo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

there might be no guarantee that weight 600 can represent the intended weight across all operating systems, languages, and browsers.

That is true, but there's a fundamental difference between 500 and 600:

  • when not found, 500 falls back to 400 (at least per the spec, we know that Chrome on Windows is not compliant);
  • when not found, 600 falls back to 700.

As inconvenient as either option is, in terms of accessibility and visual hierarchy, the 600 fallback feels like a better/safer behavior to me. It ensures minimal buttons / links are different from non-interactive text, and it makes headings stand out.

@t-hamano

Copy link
Copy Markdown
Contributor

That is true, but there's a fundamental difference between 500 and 600:

I see. Then, would the best approach be to remove the medium token, create a new token for semibold, and replace the existing medium token with the semibold token?

@ciampo

ciampo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

That is true, but there's a fundamental difference between 500 and 600:

I see. Then, would the best approach be to remove the medium token, create a new token for semibold, and replace the existing medium token with the semibold token?

That's what I'm suspecting, too. I can also create a PR to test that approach

@ciampo ciampo reopened this Jul 10, 2026
@ciampo

ciampo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Opened #80093 to test the medium -> semibold approach.

@jasmussen

Copy link
Copy Markdown
Contributor

Noting that I shared some relevant feedback here.

@github-actions

Copy link
Copy Markdown

Flaky tests detected in 6f3e03d.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/29083848793
📝 Reported issues:

@ciampo

ciampo commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded by #80093.

@ciampo ciampo closed this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Base styles /packages/base-styles [Package] Block editor /packages/block-editor [Package] Components /packages/components [Package] Edit Post /packages/edit-post [Package] Editor /packages/editor [Package] Theme /packages/theme [Type] Bug An existing feature does not function as intended

4 participants