Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f7e0614

Browse files
Change ParagraphBuilder to replace the parent style's font families with the child style's font families (#10074)
Previously ParagraphBuilder was concatenating the child's fonts to the parent's font list, causing the parent's fonts to take precedence. Fixes flutter/flutter#35992
1 parent eb74f2c commit f7e0614

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/ui/text/paragraph_builder.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,10 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded,
438438
}
439439

440440
if (mask & tsFontFamilyMask) {
441-
style.font_families.insert(style.font_families.end(), fontFamilies.begin(),
442-
fontFamilies.end());
441+
// The child style's font families override the parent's font families.
442+
// If the child's fonts are not available, then the font collection will
443+
// use the system fallback fonts (not the parent's fonts).
444+
style.font_families = fontFamilies;
443445
}
444446

445447
if (mask & tsFontFeaturesMask) {

0 commit comments

Comments
 (0)