55// @dart = 2.10
66part of engine;
77
8+ const ui.Color _defaultTextColor = ui.Color (0xFFFF0000 );
9+
810class EngineLineMetrics implements ui.LineMetrics {
911 EngineLineMetrics ({
1012 required this .hardBreak,
@@ -1110,15 +1112,15 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
11101112 /// paragraph. Plain text is more efficient to lay out and measure than rich
11111113 /// text.
11121114 EngineParagraph ? _tryBuildPlainText () {
1113- ui.Color ? color;
1115+ ui.Color color = _defaultTextColor ;
11141116 ui.TextDecoration ? decoration;
11151117 ui.Color ? decorationColor;
11161118 ui.TextDecorationStyle ? decorationStyle;
11171119 ui.FontWeight ? fontWeight = _paragraphStyle._fontWeight;
11181120 ui.FontStyle ? fontStyle = _paragraphStyle._fontStyle;
11191121 ui.TextBaseline ? textBaseline;
1120- String ? fontFamily = _paragraphStyle._fontFamily;
1121- double ? fontSize = _paragraphStyle._fontSize;
1122+ String fontFamily = _paragraphStyle._fontFamily ?? DomRenderer .defaultFontFamily ;
1123+ double fontSize = _paragraphStyle._fontSize ?? DomRenderer .defaultFontSize ;
11221124 final ui.TextAlign textAlign = _paragraphStyle._effectiveTextAlign;
11231125 final ui.TextDirection textDirection = _paragraphStyle._effectiveTextDirection;
11241126 double ? letterSpacing;
@@ -1138,7 +1140,7 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
11381140 while (i < _ops.length && _ops[i] is EngineTextStyle ) {
11391141 final EngineTextStyle style = _ops[i];
11401142 if (style._color != null ) {
1141- color = style._color;
1143+ color = style._color! ;
11421144 }
11431145 if (style._decoration != null ) {
11441146 decoration = style._decoration;
@@ -1160,7 +1162,7 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
11601162 }
11611163 fontFamily = style._fontFamily;
11621164 if (style._fontSize != null ) {
1163- fontSize = style._fontSize;
1165+ fontSize = style._fontSize! ;
11641166 }
11651167 if (style._letterSpacing != null ) {
11661168 letterSpacing = style._letterSpacing;
@@ -1210,9 +1212,7 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
12101212 paint = foreground;
12111213 } else {
12121214 paint = ui.Paint ();
1213- if (color != null ) {
1214- paint.color = color;
1215- }
1215+ paint.color = color;
12161216 }
12171217
12181218 if (i >= _ops.length) {
0 commit comments