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
This commit is contained in:
Jason Simmons 2019-07-23 17:57:56 -07:00 committed by GitHub
parent 99a3e1a60f
commit 4e67ab7b5f

View File

@ -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) {