Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update primary font to Roboto across all apps #4022

Merged
merged 5 commits into from
Oct 3, 2023
Merged

Conversation

kofi-q
Copy link
Contributor

@kofi-q kofi-q commented Oct 3, 2023

Overview

Easier by commit - last 2 commits are just snapshot updates and dead code deletion.

Slack context here.

Replacing Helvetica Neue with Roboto as the primary font in apps, for consistency across the website, marketing materials and apps.

Fonts downloaded from Google Fonts and converted to Base64 encoding with the Font Squirrel tool, to allow us to embed the fonts in a single shared source file.

  • Loading the fonts in the <AppBase> component used across our apps, but disabling for unit tests, since it seemed to slow them down quite a bit.
  • Deleting deprecated font files and references from frontend HTML files.
  • No change yet to letter size calculations (for VVSG compatibility), since the body to total height proportions of Roboto are fairly similar to Helvetica Neue.
  • Starting trying to remove Noto Emoji fonts, but we seem to be using them in a few places - we can replace those with Icons later and then deprecate Noto Emoji.

Demo Video or Screenshot

🤖 Roboto Helvetica Neue
Screenshot 2023-10-03 at 14 48 13 Screenshot 2023-10-02 at 17 15 44

Testing Plan

  • Added integration tests via the appa to verify that the new font is loaded correctly by <AppBase>

Checklist

  • [ ] I have added logging where appropriate to any new user actions, system updates such as file reads or storage writes, or errors introduced.
  • I have added a screenshot and/or video to this PR to demo the change
  • I have added the "user_facing_change" label to this PR to automate an announcement in #machine-product-updates

kofi-q added 4 commits October 3, 2023 13:38
Didn't add integration test packages to apps that don't have it yet,
since we're getting enough coverage of AppBase through these tests
anyway.
@kofi-q kofi-q requested a review from adghayes October 3, 2023 19:18
@kofi-q kofi-q requested a review from a team as a code owner October 3, 2023 19:18
@kofi-q kofi-q requested review from jonahkagan and removed request for a team and jonahkagan October 3, 2023 19:18
@kofi-q
Copy link
Contributor Author

kofi-q commented Oct 3, 2023

Leaving Drew as primary reviewer, but probably also worth a sanity check from @jonahkagan

@mattroe
Copy link

mattroe commented Oct 3, 2023

I don't see Roboto de-emphasized in the preview

@kofi-q
Copy link
Contributor Author

kofi-q commented Oct 3, 2023

I don't see Roboto de-emphasized in the preview

Oh, good catch! Will take a look and fix that font weight - thanks

if (!disableFontsForTests) {
loadFonts();
}
}, [disableFontsForTests]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this mean there will be an initial render without fonts loaded? Does that cause any visual weirdness?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good question - I didn't see any noticeable flicker on initial render when I was testing, but I'm going to try it out with caching disabled to see what kind of impact it might have

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't spot it while watching the refresh, but managed to catch a frame on a screen recording where the text is in sans-serif just before switching to Roboto. Just to be safe, I'm going to delay the rendering until loadFonts has run

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, thanks for looking into that

@kofi-q
Copy link
Contributor Author

kofi-q commented Oct 3, 2023

I don't see Roboto de-emphasized in the preview

Ok, turned out to be an old screenshot from when I had a bug in one of the font definitions - fixed the screenshot now

@kofi-q kofi-q merged commit f101f51 into main Oct 3, 2023
@kofi-q kofi-q deleted the rise-of-the-roboto branch October 3, 2023 20:09
React.useEffect(() => {
/* istanbul ignore next - tested via integration tests. */
if (!disableFontsForTests) {
loadFonts();
Copy link
Collaborator

Choose a reason for hiding this comment

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

React runs useEffect multiple times in development, so we end up with multiple <style> elements being added. While this may not cause any visual issues, it's maybe not great for resource usage and keeping things close to production if we can.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, just seeing this! Thanks for the callout - didn't know about the multiple useEffect invocations in dev. Will add a cleanup then, to address the dev weirdness

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

Successfully merging this pull request may close these issues.

4 participants