Skip to content

fix: honor Ruby font_family_fallback on Text and TextStyle - #45

Merged
AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/text-font-family-fallback
Oct 29, 2026
Merged

AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/text-font-family-fallback

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Summary

Ruby's Text (shared/text_control.rb) declares font_family_fallback, a list of family names such as text("Hi", font_family: "Inter", font_family_fallback: ["Arial"]). Ruby's TextStyle (types/text_style.rb) serializes the same attribute. No engine code read either one: the Material and Cupertino Text renderers and parseTextStyle all read font_family only. The fallback list was therefore dropped everywhere.

Fix

  • New neutral helper parseFontFamilyFallback in utils/text.dart. It takes a list of names, or a single name as a convenience, and returns null when the key is absent.
  • material_text.dart and cupertino_text.dart now set fontFamilyFallback from the Text font_family_fallback keyword.
  • parseTextStyle sets fontFamilyFallback from TextStyle.font_family_fallback. That covers style: on Text and every other control that takes a text style.

Tests

New test/widgets/ruby_text_font_family_fallback_test.dart, run on iOS and Android:

  • The Text keyword font_family_fallback: ["Arial", "Noto Sans"] reaches the rendered RichText style, together with font_family.
  • style: {font_family: "Inter", font_family_fallback: ["Arial"]} reaches it too.

All 4 tests failed before the fix (null).

verify_pr.sh: flutter test +699, all passed (695 baseline + 4 new). flutter analyze lib test found no issues. Flutter 3.41.2.

Wave-2 follow-up E3

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.

1 participant