Skip to content

Implement font fallback#187520

Merged
auto-submit[bot] merged 11 commits into
flutter:masterfrom
Rusino:fallback
Jun 16, 2026
Merged

Implement font fallback#187520
auto-submit[bot] merged 11 commits into
flutter:masterfrom
Rusino:fallback

Conversation

@Rusino

@Rusino Rusino commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Pass the correct font line to Canvas2D
I was only able to demonstrate it working on text fonts (Sans vs Serif).

Part of #172561

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 3, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team labels Jun 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for fallback font families in WebTextStyle and updates WebStrutStyle to apply styles using WebTextStyle. It also adds a test verifying fallback font rendering. Feedback on these changes highlights that unconditionally quoting the font family and bypassing canonicalizeFontFamily can break generic font families, and that fallback fonts themselves should be canonicalized. Additionally, the reviewer noted that fontFamilyFallback was omitted in WebStrutStyle's usage of WebTextStyle, and pointed out leftover commented-out code.

Comment thread engine/src/flutter/lib/web_ui/lib/src/engine/web_paragraph/paragraph.dart Outdated
Comment thread engine/src/flutter/lib/web_ui/lib/src/engine/web_paragraph/paragraph.dart Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 3, 2026
@mdebbar mdebbar added the CICD Run CI/CD label Jun 3, 2026
mdebbar
mdebbar previously approved these changes Jun 3, 2026
Comment thread engine/src/flutter/lib/web_ui/lib/src/engine/web_paragraph/paragraph.dart Outdated
Comment thread engine/src/flutter/lib/web_ui/lib/src/engine/web_paragraph/paragraph.dart Outdated
Comment thread engine/src/flutter/lib/web_ui/lib/src/engine/web_paragraph/paragraph.dart Outdated
Comment thread engine/src/flutter/lib/web_ui/test/webparagraph/paragraph_test.dart Outdated
Comment thread engine/src/flutter/lib/web_ui/test/webparagraph/paragraph_test.dart Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 4, 2026
@Rusino Rusino added the CICD Run CI/CD label Jun 4, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 4, 2026
@Rusino Rusino added the CICD Run CI/CD label Jun 4, 2026
@Rusino Rusino requested a review from mdebbar June 4, 2026 17:07
@Rusino Rusino self-assigned this Jun 4, 2026
Comment thread engine/src/flutter/lib/web_ui/lib/src/engine/web_paragraph/paragraph.dart Outdated
Comment thread engine/src/flutter/lib/web_ui/lib/src/engine/web_paragraph/paragraph.dart Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 5, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 8, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 8, 2026
@mdebbar mdebbar added the CICD Run CI/CD label Jun 8, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 10, 2026
@Rusino Rusino requested a review from mdebbar June 10, 2026 19:38
@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems and removed CICD Run CI/CD labels Jun 12, 2026
@mdebbar mdebbar added the CICD Run CI/CD label Jun 12, 2026
@flutter-dashboard

Copy link
Copy Markdown

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #187520 at sha 012ab82

@flutter-dashboard flutter-dashboard Bot added the will affect goldens Changes to golden files label Jun 12, 2026
@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 12, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 12, 2026
@auto-submit

auto-submit Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/187520, Failed to enqueue flutter/flutter/187520 with HTTP 400: Pull request New changes require approval from someone other than mdebbar because they were the last pusher..

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 15, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 15, 2026
@auto-submit

auto-submit Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/187520, Failed to enqueue flutter/flutter/187520 with HTTP 400: Pull request New changes require approval from someone other than mdebbar because they were the last pusher..

@mdebbar mdebbar self-requested a review June 15, 2026 16:08
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 15, 2026

@harryterkelsen harryterkelsen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with a small question


if (needsFallbacks) {
// The fallback font families provided by the caller.
if (fontFamilyFallback != null && fontFamilyFallback.isNotEmpty) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we skip the caller-provided fallbacks if the main font family is a generic or Apple font?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's what we do already, unless I'm misunderstanding your question. This whole block of code is guarded by needsFallback which checks for exactly what you said.

@mdebbar mdebbar added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Jun 15, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 15, 2026
@auto-submit

auto-submit Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/187520, because - The status or check suite Linux linux_fuchsia_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 16, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Jun 16, 2026
Merged via the queue into flutter:master with commit 3a0420c Jun 16, 2026
210 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 16, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jun 16, 2026
flutter/flutter@5827d5f...3a0420c

2026-06-16 Rusino@users.noreply.github.com Implement font fallback (flutter/flutter#187520)
2026-06-16 amhurtado@protonmail.com Add FlatBuffers Verifier checks to Impeller asset loading (flutter/flutter#187878)
2026-06-16 engine-flutter-autoroll@skia.org Roll Packages from aa964a3 to 8286d39 (1 revision) (flutter/flutter#188067)
2026-06-16 engine-flutter-autoroll@skia.org Roll Skia from 9c2b83788409 to d7196b0b4939 (1 revision) (flutter/flutter#188066)
2026-06-16 engine-flutter-autoroll@skia.org Roll Skia from ef17057bb776 to 9c2b83788409 (1 revision) (flutter/flutter#188061)
2026-06-16 engine-flutter-autoroll@skia.org Roll Skia from 500025456bb5 to ef17057bb776 (1 revision) (flutter/flutter#188058)
2026-06-16 engine-flutter-autoroll@skia.org Roll Skia from cb1035ff14bf to 500025456bb5 (5 revisions) (flutter/flutter#188057)
2026-06-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from TbB86Po_HDe1dvXvT... to VeLhhlDcod09NR4Hb... (flutter/flutter#188055)
2026-06-16 engine-flutter-autoroll@skia.org Roll Skia from 70acf6a5e7c9 to cb1035ff14bf (3 revisions) (flutter/flutter#188054)
2026-06-16 41930132+hellohuanlin@users.noreply.github.com [pv]skip non-tappable web view workaround on ios 26.4 (flutter/flutter#185424)
2026-06-16 mdebbar@google.com [web] RenderParagraph needs paint after a DPR change (flutter/flutter#186968)
2026-06-16 30870216+gaaclarke@users.noreply.github.com Adds gamma correction to windows text. (flutter/flutter#187871)
2026-06-15 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Add a platform view test to android_hardware_smoke_test (#187913)" (flutter/flutter#188051)
2026-06-15 awolff@google.com Add a platform view test to android_hardware_smoke_test (flutter/flutter#187913)
2026-06-15 codefu@google.com feat: linux_analyze in a workflow (flutter/flutter#187889)
2026-06-15 mdebbar@google.com [web] Changes to WebParagraph configuration (flutter/flutter#187188)
2026-06-15 matt.boetger@gmail.com Fail gracefully on Android AVD lock errors during startup (flutter/flutter#187200)
2026-06-15 bkonyi@google.com [flutter_tools] Fix flakiness in widget_preview_detection_test (flutter/flutter#187938)
2026-06-15 jason-simmons@users.noreply.github.com Exclude fuchsia-sdk/sdk/.build-id from the builder cache archive (flutter/flutter#187826)
2026-06-15 engine-flutter-autoroll@skia.org Roll Skia from c8d9f80f13e4 to 70acf6a5e7c9 (4 revisions) (flutter/flutter#188020)
2026-06-15 engine-flutter-autoroll@skia.org Roll Packages from b78ad83 to aa964a3 (7 revisions) (flutter/flutter#188021)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
Pass the correct font line to Canvas2D
I was only able to demonstrate it working on text fonts (Sans vs Serif).

Part of flutter#172561

---------

Co-authored-by: Mouad Debbar <mdebbar@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants