Skip to content

fix: prevent browser font synthesis for MMPoly font weights#40349

Merged
ameliejyc merged 1 commit intomainfrom
fix/mmpoly-font-weight-synthesis
Feb 25, 2026
Merged

fix: prevent browser font synthesis for MMPoly font weights#40349
ameliejyc merged 1 commit intomainfrom
fix/mmpoly-font-weight-synthesis

Conversation

@georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Feb 23, 2026

Description

This PR fixes a font rendering issue where the MMPoly font was being artificially synthesized by browsers, resulting in blurry and muddy text appearance on mobile devices.

The problem occurs because the DisplayMd typography variant applies font-weight: 700 on small screens (<768px) and font-weight: 500 on larger screens, but only the Regular (400) weight was loaded for MMPoly. This caused browsers to synthesize the bold text artificially.

The solution adds explicit @font-face declarations for weights 500 and 700, both pointing to the Regular font file. This tells browsers to use the exact font file rather than creating synthetic bold rendering.

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Fixed blurry MMPoly font rendering on mobile devices by preventing browser font synthesis

Related issues

Part of: MetaMask/metamask-design-system#928

Manual testing steps

  1. Build the extension with these changes
  2. View any page that uses the DisplayMd typography variant with MMPoly font on a mobile viewport (<768px width)
  3. Verify that the text appears crisp and clear, not blurry or muddy
  4. Compare with uppercase text to ensure rendering quality is maintained

Screenshots/Recordings

Before

Text appeared blurry and muddy due to browser-synthesized bold rendering

text.fix.before720.mov

After

Text renders clearly using the explicit Regular font file for all weights

text.fix.after720.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
CSS-only change that maps additional MMPoly weights to an existing font file; low risk aside from potential minor typography/weight appearance differences.

Overview
Prevents browsers from synthesizing MMPoly bold/medium weights (which caused blurry text in responsive typography).

Adds explicit @font-face declarations for MMPoly at weights 500 and 700, both pointing to the existing Regular .woff2, with inline documentation referencing the design-system issue.

Written by Cursor Bugbot for commit 184d6ed. This will update automatically on new commits. Configure here.

Add explicit @font-face declarations for font-weight 500 and 700 for the
MMPoly font family, both pointing to the Regular font file. This prevents
browsers from artificially synthesizing bold text when the DisplayMd
typography variant applies font-weight: 700 on small screens (<768px).

Without these declarations, browsers create synthetic bold rendering which
results in blurry and muddy text appearance, particularly noticeable with
uppercase transformations on mobile devices.

This is a temporary fix until the MMPoly variable font can be implemented
to support the full weight range properly.

Fixes: MetaMask/metamask-design-system#928

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-design-system All issues relating to design system in Extension label Feb 23, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 23, 2026

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/core-extension-ux (1 files, +22 -0)
  • 📁 ui/
    • 📁 css/
      • 📁 utilities/
        • 📄 fonts.scss +22 -0

@georgewrmarshall georgewrmarshall self-assigned this Feb 23, 2026
@georgewrmarshall georgewrmarshall marked this pull request as ready for review February 23, 2026 23:09
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner February 23, 2026 23:09
font-style: normal;
}

// Additional weight declarations to prevent browser font synthesis
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a temporary fix that maps multiple font weights to the same font file. The ideal long-term solution would be using MM_Poly-Variable.woff2 which supports the full weight range natively.

// By explicitly mapping weights 500 and 700 to the Regular font file, we ensure
// consistent rendering quality across all screen sizes.
// See: https://github.com/MetaMask/metamask-design-system/issues/928
@font-face {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Weight 500 is used by DisplayMd on larger screens. Explicitly declaring this weight prevents the browser from interpolating between weights, which would cause subtle rendering inconsistencies.

font-weight: 500;
font-style: normal;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Weight 700 is applied on small screens (< 768px). Without this declaration, browsers would synthesize bold rendering by algorithmically thickening the font, causing the blurry appearance reported in the issue.

@sonarqubecloud
Copy link

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 23, 2026

Builds ready [184d6ed]
⚡ Performance Benchmarks (1431 ± 108 ms)
👆 Interaction Benchmarks
ActionMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account27614288292
total27614288292
Confirm Txconfirm_tx60583560756118
total60583560756118
Bridge User Actionsbridge_load_page25319262281
bridge_load_asset_picker16648194244
bridge_search_token70918729733
total11285111781200
🔌 Startup Benchmarks
BuildMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
Chrome Browserify Startup Standard HomeuiStartup14311224186810814811618
load1205102415839712541357
domContentLoaded119699615719712511351
domInteractive2917108202586
firstPaint165691171127215294
backgroundConnect21319133318216243
firstReactRender19124462030
initialActions107113
loadScripts100079713749610501159
setupStore1363251520
numNetworkReqs312288192384
Chrome Browserify Startup Power User HomeuiStartup16781320250616417261986
load11261011187116111011536
domContentLoaded11081005186815410861518
domInteractive3518140253379
firstPaint199721624217238317
backgroundConnect28025235819290314
firstReactRender22145272436
initialActions104112
loadScripts90680516351498821287
setupStore1574351724
numNetworkReqs58361602756130
Chrome Webpack Startup Standard HomeuiStartup86370313641159371073
load7346141074102798898
domContentLoaded7296101067101792893
domInteractive2816130222381
firstPaint1126040065136215
backgroundConnect28198793144
firstReactRender19123662232
initialActions104112
loadScripts7266081059100790889
setupStore1274351319
numNetworkReqs3122102202586
Chrome Webpack Startup Power User HomeuiStartup1228952184616012971544
load72064212831147031008
domContentLoaded7116371274114694999
domInteractive33181212630114
firstPaint1406352383158322
backgroundConnect18012934951180292
firstReactRender22164242328
initialActions102011
loadScripts7096351261111692989
setupStore1354281334
numNetworkReqs1063826150135226
Firefox Browserify Startup Standard HomeuiStartup16881440251022416912238
load14191202226018614461750
domContentLoaded14171195225918614461750
domInteractive77322013998143
firstPaint------
backgroundConnect61322172762106
firstReactRender13112011415
initialActions102122
loadScripts13901175222918014201684
setupStore197157251644
numNetworkReqs321998212793
Firefox Browserify Startup Power User HomeuiStartup27691938452742328633536
load15701254232025616132177
domContentLoaded15691254232025716132177
domInteractive1083448990108353
firstPaint------
backgroundConnect2731151216240236882
firstReactRender19147481921
initialActions207123
loadScripts15331231229224615612134
setupStore1456762194183613
numNetworkReqs58261483773142
Firefox Webpack Startup Standard HomeuiStartup17011476319823117251985
load14251233261313914711532
domContentLoaded14241232261313914711532
domInteractive114291416138131178
firstPaint------
backgroundConnect61252323765134
firstReactRender16125651624
initialActions103112
loadScripts14001216259213814441506
setupStore226176301572
numNetworkReqs301997172768
Firefox Webpack Startup Power User HomeuiStartup27502054422045327943817
load16091376262228216502231
domContentLoaded16081376262228216502231
domInteractive13534771151115579
firstPaint------
backgroundConnect230114893176214624
firstReactRender23167192331
initialActions203122
loadScripts15731352259326916162117
setupStore18681212232272669
numNetworkReqs57271903688127
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2192221221
srpButtonToSrpForm9229495
confirmSrpToPwForm2102121
pwFormToMetricsScreen1501515
metricsToWalletReadyScreen1601616
doneButtonToHomeScreen64655699702
openAccountMenuToAccountListLoaded77589278317867
total87774488358835
Onboarding New WalletcreateWalletToSocialScreen2200220220
srpButtonToPwForm1041105105
createPwToRecoveryScreen8088
skipBackupToMetricsScreen3723840
agreeButtonToOnboardingSuccess1611717
doneButtonToAssetList58917610610
total97917993993
Asset DetailsassetClickToPriceChart4054647
total4054647
Solana Asset DetailsassetClickToPriceChart4504545
total4504545
Import Srp HomeloginToHomeScreen19464919962008
openAccountMenuAfterLogin4044247
homeAfterImportWithNewWallet25327925532651
total45239346084609
Send TransactionsopenSendPageFromHome33124149
selectTokenToSendFormLoaded2322226
reviewTransactionToConfirmationPage8569863871
total91519934938
SwapopenSwapPageFromHome1024104107
fetchAndDisplaySwapQuotes4570245704574
total4668546674676
🌐 Dapp Page Load Benchmarks

Current Commit: 184d6ed | Date: 2/23/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±38ms) 🟡 | historical mean value: 1.06s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 719ms (±35ms) 🟢 | historical mean value: 738ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±10ms) 🟢 | historical mean value: 81ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 38ms 1.00s 1.30s 1.07s 1.30s
domContentLoaded 719ms 35ms 693ms 983ms 748ms 983ms
firstPaint 76ms 10ms 60ms 164ms 84ms 164ms
firstContentfulPaint 76ms 10ms 60ms 164ms 84ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -45.05 KiB (-1.03%)
  • ui: -13 Bytes (0%)
  • common: -46.28 KiB (-0.41%)

@georgewrmarshall georgewrmarshall added this pull request to the merge queue Feb 24, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 24, 2026
@georgewrmarshall georgewrmarshall added this pull request to the merge queue Feb 24, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 24, 2026
@ameliejyc ameliejyc added this pull request to the merge queue Feb 25, 2026
Merged via the queue into main with commit 3916fb7 Feb 25, 2026
359 of 362 checks passed
@ameliejyc ameliejyc deleted the fix/mmpoly-font-weight-synthesis branch February 25, 2026 10:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2026
@metamaskbot metamaskbot added the release-13.21.0 Issue or pull request that will be included in release 13.21.0 label Feb 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.21.0 Issue or pull request that will be included in release 13.21.0 size-S team-design-system All issues relating to design system in Extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants