{{ message }}
Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates TextStyle to support a nullable _fontFamily and simplifies the list construction of font families in pushStyle. It also adds a test case to verify that the first fallback font is preferred when fontFamily is null. The review feedback correctly identifies that the prefix ? syntax used in the collection literal is invalid in Dart and suggests using a collection if statement instead.
TextStyle stored a null fontFamily as '', and ParagraphBuilder.pushStyle always prepended it, so the font families passed to the engine were ['', ...fontFamilyFallback]. This made the default font take precedence over fontFamilyFallback[0], contrary to the TextStyle docs. Fixes flutter#194543
arthvr9
force-pushed
the
fix-fontfamily-fallback-194543
branch
from
October 21, 2026 11:31
9354471 to
79916c2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TextStylestored a nullfontFamilyas'', andParagraphBuilder.pushStylealways prepended it, so the engine received['', ...fontFamilyFallback]. The platform default font (FlutterTestinflutter_tester) therefore took precedence overfontFamilyFallback[0], contrary to theTextStyle.fontFamilydocs.This keeps
_fontFamilynullable and builds the list as[?fontFamily, ...?fontFamilyFallback], the same wayStrutStylealready does.Added a test in
testing/dart/paragraph_test.dart: with onlyfontFamilyFallback: ['Ahem'], the alphabetic baseline should be 0.8em (Ahem), not 0.75em (FlutterTest). I confirmed it fails on current stable (Expected: <80.0> Actual: <75.0>).Fixes #194543
Pre-launch Checklist
///).