@@ -441,18 +441,20 @@ void Paragraph::ComputeStrut(StrutMetrics* strut, SkFont& font) {
441
441
// force_strut makes all lines have exactly the strut metrics, and ignores all
442
442
// actual metrics. We only force the strut if the strut is non-zero and valid.
443
443
strut->force_strut = paragraph_style_.force_strut_height && valid_strut;
444
- const FontSkia* font_skia =
445
- static_cast <const FontSkia*>(font_collection_->GetMinikinFontForFamilies (
446
- paragraph_style_.strut_font_families ,
447
- // TODO(garyq): The variant is currently set to 0 (default) as we do
448
- // not have a property to set it with. We should eventually support
449
- // default, compact, and elegant variants.
450
- minikin::FontStyle (
451
- 0 , GetWeight (paragraph_style_.strut_font_weight ),
452
- paragraph_style_.strut_font_style == FontStyle::italic)));
453
-
454
- if (font_skia != nullptr ) {
455
- font.setTypeface (font_skia->GetSkTypeface ());
444
+ minikin::FontStyle minikin_font_style (
445
+ 0 , GetWeight (paragraph_style_.strut_font_weight ),
446
+ paragraph_style_.strut_font_style == FontStyle::italic);
447
+
448
+ std::shared_ptr<minikin::FontCollection> collection =
449
+ font_collection_->GetMinikinFontCollectionForFamilies (
450
+ paragraph_style_.strut_font_families , " " );
451
+ if (!collection) {
452
+ return ;
453
+ }
454
+ minikin::FakedFont faked_font = collection->baseFontFaked (minikin_font_style);
455
+
456
+ if (faked_font.font != nullptr ) {
457
+ font.setTypeface (static_cast <FontSkia*>(faked_font.font )->GetSkTypeface ());
456
458
font.setSize (paragraph_style_.strut_font_size );
457
459
SkFontMetrics strut_metrics;
458
460
font.getMetrics (&strut_metrics);
0 commit comments