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

[Core Branding] Font Fixes (Web / Mobile) #13415

Merged
merged 10 commits into from
Dec 16, 2022
Merged

[Core Branding] Font Fixes (Web / Mobile) #13415

merged 10 commits into from
Dec 16, 2022

Conversation

grgia
Copy link
Contributor

@grgia grgia commented Dec 7, 2022

Details

Fixes android fonts, and updates font-family for crispier fonts. Also fixes italic mono console error on IOS. Note that with our new fonts, we do not support mono italics on mobile.

IOS error:
image

For future reference, this article was helpful.

Fixed Issues

$ #13413

Tests

  • Verify that no errors appear in the JS console
  • Open a chat and send a bold, italic, italic and bold, strikethrough, and regular chat
  • Do the same for mono
  • Open the console and verify that CSS for each font is using ExpensifyNeue-Regular

Offline tests

QA Steps

  • Verify that no errors appear in the JS console
  • Open a chat and send a *bold*, _italic_, *_italic and bold_*, ~strikethrough~, and regular chat
  • Do the same for `mono` (ex: *`mono bold`*)
  • Open the console and verify that CSS for each font is using ExpensifyNeue-Regular

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web image Screenshot 2022-12-07 at 2 55 26 PM image
Mobile Web - Chrome image
Mobile Web - Safari image image image
Desktop image image image
iOS image image image
Android image image image image

@grgia grgia requested a review from shawnborton December 7, 2022 21:55
@grgia grgia self-assigned this Dec 7, 2022
assets/css/fonts.css Outdated Show resolved Hide resolved
@shawnborton
Copy link
Contributor

Did some local testing and this is feeling pretty good to me!
image

Would be curious to see this on mobile web to see if we solved it over there too.

@grgia
Copy link
Contributor Author

grgia commented Dec 7, 2022

Added screenshots for mobile web on emulators

@shawnborton
Copy link
Contributor

Nice, much improved!

@grgia
Copy link
Contributor Author

grgia commented Dec 7, 2022

Waiting for android build for final screenshot, so I'm gonna open this for review now

@grgia grgia marked this pull request as ready for review December 7, 2022 23:58
@grgia grgia requested a review from a team as a code owner December 7, 2022 23:58
@melvin-bot melvin-bot bot requested review from ctkochan22 and mananjadhav and removed request for a team December 7, 2022 23:58
@melvin-bot
Copy link

melvin-bot bot commented Dec 7, 2022

@mananjadhav @ctkochan22 One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@grgia
Copy link
Contributor Author

grgia commented Dec 8, 2022

It looks like mono styles don't work on android (on main as well). I posted screenshots

@grgia
Copy link
Contributor Author

grgia commented Dec 8, 2022

I'm not thinking, this PR is for web styles. Do we want to allow styled mono on android/ios? Or do nothing and leave it as is for now

@shawnborton
Copy link
Contributor

We should definitely plan to fix mono - can you share screenshots of what that looks like? Also while you are at it, could you confirm that the new font is working on the native Android app?

In terms of fixing mono though, we could totally do it in a separate PR, or bundle it into this one if you'd like to - your call!

@grgia
Copy link
Contributor Author

grgia commented Dec 9, 2022

Here's the screenshot I took before on native android- looks like the mono styles are all the same

Native Web
image image

edit: looking at it, I don't think that's mono at all

@grgia
Copy link
Contributor Author

grgia commented Dec 9, 2022

https://expensify.slack.com/archives/C01GTK53T8Q/p1670546775495159
image

sike ...looks like I broke it 😂. Gonna throw this back in WIP to fix

@grgia grgia changed the title [Core Branding] Fix Web Fonts (bold/italic) [WIP] [Core Branding] Fix Web Fonts (bold/italic) Dec 9, 2022
@shawnborton
Copy link
Contributor

Oh wow, but it looks like none of the regular Neue fonts are working correctly on Android?

@grgia grgia changed the title [WIP] [Core Branding] Fix Web Fonts (bold/italic) [WIP] [Core Branding] Fix Web and Android Fonts (bold/italic) Dec 12, 2022
@grgia
Copy link
Contributor Author

grgia commented Dec 12, 2022

Would someone mind building this branch on android and sending a screenshot?

@shawnborton
Copy link
Contributor

Screenshots look great, nice and crispy - nice work Georgia!

@grgia
Copy link
Contributor Author

grgia commented Dec 14, 2022

@mananjadhav we don't currently have regression test steps for fonts, but will be adding them as core branding changes are finalized.

@mananjadhav
Copy link
Collaborator

mananjadhav commented Dec 14, 2022

Okay thanks for the update. I’ve tested them the composer with all font styles. I’ve also completed the checklist.

@ctkochan22 All yours

Copy link
Contributor

@roryabraham roryabraham left a comment

Choose a reason for hiding this comment

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

Okay, so I think we want to make some changes to this PR. Namely, the .woff and .woff2 assets are being bundled in the iOS and Android apps, despite the fact that they are not used on that platform. This is something that I solved in this PR, and we can borrow part of that code for this PR

To fix this, I think we'll want to:

  1. establish a directory structure like this:

    assets/fonts/
    ----------------|native  // all the .otf fonts for the mobile app
    ----------------|web    // all the .woff2 and .woff fonts for the web app (plus .otf for NewKansas, for now)
    
  2. Make this change in react-native.config.js to use assets/fonts/native for native font assets.

  3. Update this line to copy web fonts from assets/fonts/web instead of assets/fonts

  4. Make sure we update this line to also look for the ExpensifyNewKansas .otf files on web.

@shawnborton
Copy link
Contributor

New Kansas isn't actually ready to go yet, we haven't finalized the EULA - so that being said, it should have never been added to begin with. So if anything, I say we just rip out the NK files from this PR and then we follow up as a separate PR/issue to add NK when we get the green light.

@roryabraham
Copy link
Contributor

roryabraham commented Dec 15, 2022

Ok, so knowing that we can just:

  • Replace NewKansas with the old header font (Fabriga, if memory serves?), such that assets/fonts/native only includes .otf files and assets/fonts/web only includes .woff2 and .woff files.

  • Nix this change from my review above:

    Make sure we update this line to also look for the ExpensifyNewKansas .otf files on web.

@shawnborton
Copy link
Contributor

We should definitely not include Fabriga, that is not a brand font. Let's just get rid of the NK files for now and keep all of the font styles as they are, where are just using Expensify Neue for headline moments.

@shawnborton
Copy link
Contributor

Or yeah, like you said, just do nothing with the NK files that are there.

@grgia
Copy link
Contributor Author

grgia commented Dec 15, 2022

I just renamed the New Kansas file to match postscript in the android assets folder so when we do decide to use it, it won't break. Is it going to be replaced in the future anyways?

@shawnborton
Copy link
Contributor

It won't be replaced, it's the actual font (and font files, I think) that we'll be using.

Copy link
Contributor

@roryabraham roryabraham left a comment

Choose a reason for hiding this comment

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

LGTM now, thanks for making those changes 🙇

@grgia
Copy link
Contributor Author

grgia commented Dec 15, 2022

Made changes and added new screenshots!

@roryabraham
Copy link
Contributor

@mananjadhav Can you please retest and provide updated screenshots?

@roryabraham roryabraham mentioned this pull request Dec 16, 2022
@mananjadhav
Copy link
Collaborator

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web web-font-styles
Mobile Web - Chrome

Pending

Mobile Web - Safari

Pending

Desktop desktop-font-styles
iOS ios-font-styles
Android android-font-styles

@roryabraham @grgia Tested again but unable to run this on mWeb - Chrome and Safari both due to the Auth errors.

@roryabraham roryabraham merged commit ce76a1d into main Dec 16, 2022
@roryabraham roryabraham deleted the georgia-fontStyles branch December 16, 2022 19:17
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
TTI 801.748 ms → 808.330 ms (+6.582 ms, +0.8%)
nativeLaunch 9.103 ms → 9.241 ms (+0.138 ms, +1.5%)
regularAppStart 0.016 ms → 0.014 ms (-0.002 ms, -10.9%)
runJsBundle 193.871 ms → 184.000 ms (-9.871 ms, -5.1%)
Show details
Name Duration
TTI Baseline
Mean: 801.748 ms
Stdev: 34.928 ms (4.4%)
Runs: 745.3687959983945 751.358027998358 759.9968510009348 762.6732649989426 767.0989120006561 767.1959620006382 768.3378669992089 768.9774219989777 779.5741400010884 781.4362660013139 783.1249379999936 787.2102769985795 789.5099520012736 791.391047000885 792.5347779989243 792.7821709997952 794.5371659994125 799.9397360011935 810.471508000046 819.4643779993057 826.1310990005732 827.7696620002389 832.7860220000148 836.0480469986796 836.3888069987297 841.6341079995036 847.699482999742 848.8664849996567 854.4503990001976 887.6849629990757

Current
Mean: 808.330 ms
Stdev: 33.744 ms (4.2%)
Runs: 743.3507990017533 752.9810889996588 767.8323809988797 781.0851810015738 781.6932700015604 782.9837020002306 785.7305810004473 786.0965909995139 786.3037550002337 786.3989650011063 790.6966909989715 790.8442259989679 794.2776449993253 794.5315570011735 795.375840999186 801.7966019995511 801.9977589994669 805.3324050009251 809.2463500015438 812.4541239999235 818.7949680015445 820.9799599982798 828.3336319997907 834.7807479985058 836.144267000258 839.358575001359 842.6454549990594 851.3879709988832 869.5215030014515 875.5265309996903 889.7464030012488
nativeLaunch Baseline
Mean: 9.103 ms
Stdev: 1.029 ms (11.3%)
Runs: 7 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 11 11 11 11

Current
Mean: 9.241 ms
Stdev: 0.897 ms (9.7%)
Runs: 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11
regularAppStart Baseline
Mean: 0.016 ms
Stdev: 0.001 ms (8.1%)
Runs: 0.013305999338626862 0.01464800164103508 0.014810997992753983 0.01505500078201294 0.015096001327037811 0.015136998146772385 0.015177000313997269 0.015177000313997269 0.015258997678756714 0.015298999845981598 0.015341002494096756 0.015381000936031342 0.015381000936031342 0.015583999454975128 0.01574699953198433 0.015990998595952988 0.016112998127937317 0.016235001385211945 0.01635799929499626 0.016398001462221146 0.016479000449180603 0.016561001539230347 0.01672299951314926 0.016764000058174133 0.017170999199151993 0.01741500198841095 0.017659001052379608 0.017862997949123383 0.018717996776103973 0.019979000091552734

Current
Mean: 0.014 ms
Stdev: 0.001 ms (5.9%)
Runs: 0.012736000120639801 0.012816999107599258 0.013346999883651733 0.013590000569820404 0.013631001114845276 0.013631999492645264 0.013712998479604721 0.01371300220489502 0.013753999024629593 0.01387600228190422 0.013996999710798264 0.013996999710798264 0.014038000255823135 0.014078997075557709 0.014118999242782593 0.014322999864816666 0.014362998306751251 0.014444999396800995 0.014607999473810196 0.01464800164103508 0.014770999550819397 0.014892999082803726 0.014973998069763184 0.014974001795053482 0.015095997601747513 0.015096001327037811 0.01521800085902214 0.015298999845981598 0.015420999377965927 0.016968000680208206
runJsBundle Baseline
Mean: 193.871 ms
Stdev: 24.321 ms (12.5%)
Runs: 158 168 169 169 169 172 175 175 177 178 179 182 182 184 186 186 187 187 188 190 192 210 212 214 218 220 226 229 230 246 252

Current
Mean: 184.000 ms
Stdev: 16.517 ms (9.0%)
Runs: 153 160 163 167 169 171 173 173 175 175 175 176 178 179 179 180 180 180 181 181 183 185 189 198 199 201 203 204 204 217 218 219

@@ -7,9 +7,9 @@ const fontFamily = {
EXP_NEUE: 'ExpensifyNeue-Regular',
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for thinking of this so late... but I guess semantically, it makes more sense to just call this "Expensify Neue" or in this case, 'ExpensifyNeue' as that's the name of the font family. "Regular" is simply a weight of the font, like Bold or Semi-Bold or Light, etc. No need to fix this immediately, but just wanted to jot my thoughts down.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree! could we bundle this with the new kansas changes?

Copy link
Contributor

@shawnborton shawnborton Dec 19, 2022

Choose a reason for hiding this comment

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

I'm down with that! cc @luacmartins as I saw you picked up the NK changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just FYI we created a separate issue for this change: #13772

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @roryabraham in version: 1.2.42-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @yuwenmemon in version: 1.2.42-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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

Successfully merging this pull request may close these issues.

5 participants