From 4e67ab7b5f49a6728e47daf0192b72699ce3230c Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 23 Jul 2019 17:57:56 -0700 Subject: [PATCH] Change ParagraphBuilder to replace the parent style's font families with the child style's font families (flutter/engine#10074) Previously ParagraphBuilder was concatenating the child's fonts to the parent's font list, causing the parent's fonts to take precedence. Fixes https://github.com/flutter/flutter/issues/35992 --- engine/src/flutter/lib/ui/text/paragraph_builder.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/lib/ui/text/paragraph_builder.cc b/engine/src/flutter/lib/ui/text/paragraph_builder.cc index a32676731ac..8c858e6953b 100644 --- a/engine/src/flutter/lib/ui/text/paragraph_builder.cc +++ b/engine/src/flutter/lib/ui/text/paragraph_builder.cc @@ -438,8 +438,10 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded, } if (mask & tsFontFamilyMask) { - style.font_families.insert(style.font_families.end(), fontFamilies.begin(), - fontFamilies.end()); + // The child style's font families override the parent's font families. + // If the child's fonts are not available, then the font collection will + // use the system fallback fonts (not the parent's fonts). + style.font_families = fontFamilies; } if (mask & tsFontFeaturesMask) {