@@ -75,7 +75,11 @@ class CkParagraphStyle implements ui.ParagraphStyle {
75
75
EngineStrutStyle style = value as EngineStrutStyle ;
76
76
final SkStrutStyleProperties skStrutStyle = SkStrutStyleProperties ();
77
77
if (style._fontFamily != null ) {
78
- final List <String > fontFamilies = < String > [style._fontFamily! ];
78
+ String fontFamily = style._fontFamily! ;
79
+ if (! skiaFontCollection.registeredFamilies.contains (fontFamily)) {
80
+ fontFamily = 'Roboto' ;
81
+ }
82
+ final List <String > fontFamilies = < String > [fontFamily];
79
83
if (style._fontFamilyFallback != null ) {
80
84
fontFamilies.addAll (style._fontFamilyFallback! );
81
85
}
@@ -531,10 +535,10 @@ class CkParagraph extends ManagedSkiaObject<SkParagraph>
531
535
for (int i = 0 ; i < skRects.length; i++ ) {
532
536
final List <double > rect = skRects[i];
533
537
result.add (ui.TextBox .fromLTRBD (
534
- rect[0 ],
535
- rect[1 ],
536
- rect[2 ],
537
- rect[3 ],
538
+ rect[0 ],
539
+ rect[1 ],
540
+ rect[2 ],
541
+ rect[3 ],
538
542
_paragraphStyle._textDirection! ,
539
543
));
540
544
}
@@ -563,20 +567,10 @@ class CkParagraph extends ManagedSkiaObject<SkParagraph>
563
567
assert (constraints.width != null ); // ignore: unnecessary_null_comparison
564
568
_lastLayoutConstraints = constraints;
565
569
566
- // Infinite width breaks layout, just use a very large number instead.
567
- // TODO(het): Remove this once https://bugs.chromium.org/p/skia/issues/detail?id=9874
568
- // is fixed.
569
- double width;
570
- const double largeFiniteWidth = 1000000 ;
571
- if (constraints.width.isInfinite) {
572
- width = largeFiniteWidth;
573
- } else {
574
- width = constraints.width;
575
- }
576
570
// TODO(het): CanvasKit throws an exception when laid out with
577
571
// a font that wasn't registered.
578
572
try {
579
- skiaObject.layout (width);
573
+ skiaObject.layout (constraints. width);
580
574
} catch (e) {
581
575
html.window.console.warn ('CanvasKit threw an exception while laying '
582
576
'out the paragraph. The font was "${_paragraphStyle ._fontFamily }". '
0 commit comments