Skip to content

Add refresh fonts#1030

Merged
stephaniehobson merged 14 commits intomozilla:mainfrom
maureenlholland:add-refresh-fonts
Apr 2, 2025
Merged

Add refresh fonts#1030
stephaniehobson merged 14 commits intomozilla:mainfrom
maureenlholland:add-refresh-fonts

Conversation

@maureenlholland
Copy link
Collaborator

@maureenlholland maureenlholland commented Mar 12, 2025

Description

This approach is the breaking change. It removes Zilla Slab token, font files, and mixin.

Fallback font adjustments used this tool: https://highperformancewebfonts.com/tools/fafofal/

Mozilla heading styles need

    font-variant-ligatures: none;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.1;

Mozilla body styles need

    font-variant-ligatures: none;
    line-height: 1.2;
  • I have documented this change in the design system.
  • I have recorded this change in CHANGELOG.md.

Related PR

Needs new Protocol Tokens package: mozilla/protocol-tokens#114 [WIP]

Issue

#1029

Testing

Run locally and check font updates in http://localhost:3000/docs/fundamentals/typography

Build package locally and update local package in Bedrock: mozilla/bedrock#16083
(After local install on Bedrock, I was manually moving the mozilla-protocol/core/package/protocol folder up to be directly inside core folder, there's probably a better way to do that)

Check Mozilla branded pages have correct font styling

Check Firefox branded pages have correct font styling

@maureenlholland
Copy link
Collaborator Author

CI will be broken until the new tokens are available from protocol-tokens package

@supports (--css: variables) {
font-family: var(--title-font-family);
font-variant-ligatures: var(--title-font-ligatures);
font-weight: var(--title-font-weight);
Copy link
Collaborator Author

@maureenlholland maureenlholland Mar 18, 2025

Choose a reason for hiding this comment

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

This is problematic, it overrides the 700 font weight and makes the inherited 500 weight take effect. Needs a default fallback value or a Firefox-themed variable value

(pr)
Screenshot 2025-03-18 at 6 52 38 PM

(prod)
Screenshot 2025-03-18 at 6 50 05 PM

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

default fallback value works as expected

default-fallback

- [breaking] Zilla Slab font is removed for Mozilla rebrand fonts
- [breaking] the font-mozilla mixin is removed in favor of more
explicit font-mozilla-text and font-mozilla-headline
This approach ensures we have a common default (bold) across all
themes that don't choose to set a custom font-weight
@maureenlholland maureenlholland marked this pull request as ready for review March 19, 2025 10:44
@maureenlholland
Copy link
Collaborator Author

maureenlholland commented Mar 19, 2025

This is ready for local code review and can be merged when updated with new tokens from Protocol Tokens PR: mozilla/protocol-tokens#114

DO NOT MERGE until tokens package is released and updated

@maureenlholland maureenlholland added Do Not Merge ⚠️ Do Not Merge Review: XS Code review time: 30 mins or less Needs:Review 👋 Ready for Developer Review labels Mar 19, 2025

@supports (--css: variables) {
font-family: var(--title-font-family);
font-variant-ligatures: var(--title-font-ligatures);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

mozilla/bedrock#15790 (comment)

just noticed this comment on another PR, maybe best to use none as default here as well

this font.
#### Mozilla Headline

* [Download from Github](https://github.com/mozilla/zilla-slab/releases/latest)
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a repo https://github.com/mozilla/mozilla-type-family — however it still only houses pre-release versions.

Q: Is there any chance a prod-level asset will be provided at some point, perhaps adding more i18n support et al.?

Copy link
Contributor

Choose a reason for hiding this comment

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

We are not expecting expanded character support 🙁

I will check and see if there is a more recent version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated with the final* versions.

  • as much as anything on the web is ever final.

Co-authored-by: Jan Brasna <1784648+janbrasna@users.noreply.github.com>
@stephaniehobson
Copy link
Contributor

@maureenlholland An update to the tokens package has been published.

}

@font-face {
font-family: text-fallback;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unadjusted
text-unadjusted

Adjusted
text-adjusted

}

@font-face {
font-family: headline-fallback;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unadjusted
headline-unadjusted

Adjusted
headline-adjusted

Helvetica Neue a tougher fallback font to adjust for. Defaults from https://highperformancewebfonts.com/tools/fafofal/ seemed equally off and manual adjustment on top of that hasn't been a huge improvement

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to stick with Helvetica Neue if we can get a better result with something else. Since this is a serif maybe Georgia? It seems to have good support across OSs.

@font-face {
  font-family: fallback;
  src: local("Georgia");
  ascent-override: 90%;
  descent-override: 25.5%;
  line-gap-override: 0%;
  size-adjust: 105.99%;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely worth a try!

Copy link
Collaborator Author

@maureenlholland maureenlholland Mar 31, 2025

Choose a reason for hiding this comment

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

Suggested adjustment
georgia-test

Suggested + Manual adjustments

font-family: headline-fallback;
    src: local("Georgia");
    ascent-override: 89.2%;
    descent-override: 30.8%;
    line-gap-override: 0%;
    size-adjust: 99%;
georgia-fallback

This would mean our Headline stack becomes "'Mozilla Headline', 'Georgia', Arial, X-LocaleSpecific, sans-serif" in protocol-tokens package. I like the idea of having a serif fallback in this case, but I'm still on the fence about whether there's a meaningful improvement in fallback sizing compared to Helvetica Neue.

Slight preference is leaving Helvetica Neue for now, getting everything hooked into bedrock and doing a follow up refinement update if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Okay, thanks for looking at it.

@maureenlholland maureenlholland removed the Do Not Merge ⚠️ Do Not Merge label Mar 26, 2025
- Remove unused Bold MozillaHeadline
Copy link
Contributor

@stephaniehobson stephaniehobson left a comment

Choose a reason for hiding this comment

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

One thought after looking at the code: I'm curious for your thoughts on changing the fallback font for the headlines.

I'll test it on moz.org tomorrow.

@supports (--css: variables) {
font-family: var(--title-font-family);
font-variant-ligatures: var(--title-font-ligatures);
font-weight: var(--title-font-weight, #{$default-font-weight});
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

}

@font-face {
font-family: headline-fallback;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to stick with Helvetica Neue if we can get a better result with something else. Since this is a serif maybe Georgia? It seems to have good support across OSs.

@font-face {
  font-family: fallback;
  src: local("Georgia");
  ascent-override: 90%;
  descent-override: 25.5%;
  line-gap-override: 0%;
  size-adjust: 105.99%;
}

Copy link
Contributor

@stephaniehobson stephaniehobson left a comment

Choose a reason for hiding this comment

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

Spot checks in bedrock are good. Let's goooooooooo!

R+ 🖊️

@stephaniehobson stephaniehobson merged commit c62cba4 into mozilla:main Apr 2, 2025
1 check passed
Comment on lines +51 to +52
$font-stack-mozilla-text: "'Mozilla Text', Inter, 'Helvetica Neue', Arial, X-LocaleSpecific, sans-serif"
$font-stack-mozilla-headline: "'Mozilla Headline', Inter, 'Helvetica Neue', Arial, X-LocaleSpecific, sans-serif"
Copy link
Contributor

Choose a reason for hiding this comment

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

I missed this one:

Suggested change
$font-stack-mozilla-text: "'Mozilla Text', Inter, 'Helvetica Neue', Arial, X-LocaleSpecific, sans-serif"
$font-stack-mozilla-headline: "'Mozilla Headline', Inter, 'Helvetica Neue', Arial, X-LocaleSpecific, sans-serif"
$font-stack-mozilla-text: "'Mozilla Text', 'Helvetica Neue', Arial, X-LocaleSpecific, sans-serif"
$font-stack-mozilla-headline: "'Mozilla Headline', 'Helvetica Neue', Arial, X-LocaleSpecific, sans-serif"

removed in protocol-tokens#116

(I'm preparing a tokens.config doc update and a changelog entry for tokens version bump so I'll include this fix with it…)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs:Review 👋 Ready for Developer Review Review: XS Code review time: 30 mins or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Refresh fonts

3 participants