Make widget default font size consistent with plain Text - #12237
Merged
Conversation
ogoffart
force-pushed
the
olivier/fix-#12226
branch
from
June 25, 2026 10:44
028876b to
9a48288
Compare
The Fluent and Cosmic styles used 14/13 rem for the widget body text, which is slightly larger than a plain Text element (1 rem). Anchor the body size to 1 rem so widgets and Text match. Express the font sizes as the design spec point sizes relative to the base that maps to 1 rem. Fixes: #12226
The scale was anchored so body-large (16sp) maps to 1rem, which made a plain Text larger than a normal widget label. Anchor it to 14sp instead (the Material default text size, and what the platform reports as the default font), so a plain Text matches a normal label. body-large, used for text input, is then 1.14rem, larger than a label, as the spec intends. Put the RadioButton labels on the 14sp title-small role so the selection controls are consistent.
In the Fluent, Cupertino and Cosmic styles the body text style is 1rem with the normal weight, which is already the default for a Text. Setting font-size and font-weight to the body style on a plain Text only adds bindings without changing the result, so remove them.
ogoffart
force-pushed
the
olivier/fix-#12226
branch
from
June 25, 2026 11:45
9a48288 to
5ee8120
Compare
tronical
reviewed
Jun 25, 2026
| out property <TextStyle> body: { font-size: 14 * 0.0769rem, font-weight: FontWeight.normal }; | ||
| out property <TextStyle> body-strong: { font-size: 14 * 0.0769rem, font-weight: FontWeight.semi-bold }; | ||
| out property <TextStyle> title: { font-size: 24 * 0.0769rem, font-weight: FontWeight.light }; | ||
| out property <TextStyle> body: { font-size: 14pt * 1rem / 14pt, font-weight: FontWeight.normal }; |
Member
There was a problem hiding this comment.
If this should match our default font size, is it still used anywhere?
tronical
approved these changes
Jun 25, 2026
tronical
left a comment
Member
There was a problem hiding this comment.
Ah, with the lock file change gone this LGTM :)
michneaionuc
approved these changes
Jun 25, 2026
… styles The textedit page navigation test asserts where PageDown lands, which depends on the input font size. Material renders the input larger than the other styles, so the cursor lands one column over and the assertion failed. Pin the font size to 1rem so every style behaves the same.
tronical
reviewed
Jun 26, 2026
The body text style resolves to 1rem and normal weight, which is what an unset font-size/font-weight already gives. Remove it from the Fluent, Cupertino and Cosmic settings and let the default apply.
tronical
approved these changes
Jun 30, 2026
tronical
pushed a commit
that referenced
this pull request
Jul 1, 2026
* Make the default font size consistent between widgets and Text The Fluent and Cosmic styles used 14/13 rem for the widget body text, which is slightly larger than a plain Text element (1 rem). Anchor the body size to 1 rem so widgets and Text match. Express the font sizes as the design spec point sizes relative to the base that maps to 1 rem. Fixes: #12226 * Material: use the 14sp default text size as the 1rem base The scale was anchored so body-large (16sp) maps to 1rem, which made a plain Text larger than a normal widget label. Anchor it to 14sp instead (the Material default text size, and what the platform reports as the default font), so a plain Text matches a normal label. body-large, used for text input, is then 1.14rem, larger than a label, as the spec intends. Put the RadioButton labels on the 14sp title-small role so the selection controls are consistent. * widgets: drop redundant body font bindings on plain Text In the Fluent, Cupertino and Cosmic styles the body text style is 1rem with the normal weight, which is already the default for a Text. Setting font-size and font-weight to the body style on a plain Text only adds bindings without changing the result, so remove them. * tests: pin the TextEdit font size so page navigation is stable across styles The textedit page navigation test asserts where PageDown lands, which depends on the input font size. Material renders the input larger than the other styles, so the cursor lands one column over and the assertion failed. Pin the font size to 1rem so every style behaves the same. * widgets: drop the body font role now that it equals the default The body text style resolves to 1rem and normal weight, which is what an unset font-size/font-weight already gives. Remove it from the Fluent, Cupertino and Cosmic settings and let the default apply. (cherry picked from commit cad72ee)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Widgets rendered their default text at a different size than a plain
Text {}, so e.g. aSwitchlabel didn't match adjacent text.14/13 rem; anchor it to1remso it matches a plainText.1rem(e.g.28pt * 1rem / 14pt) instead of magic factors.1remto the 14sp default text size (Body Medium / theplatform default font) instead of Body Large (16sp), so normal labels match a plain
TextwhileLineEdit(Body Large) stays larger, per the M3 spec.font-size/font-weight: …body…bindings on plainTextelements (they just re-set the default).Fixes #12226