Fix single line bitmap canvas text shadow (flutter/engine#13901)

This commit is contained in:
Ferhat
2019-11-18 13:42:48 -08:00
committed by GitHub
parent b5d79e9c53
commit bf3e0cbf22
2 changed files with 9 additions and 2 deletions

View File

@@ -165,7 +165,8 @@ class EngineParagraph implements ui.Paragraph {
} else {
canDrawTextOnCanvas = _measurementResult.isSingleLine &&
_plainText != null &&
_geometricStyle.ellipsis == null;
_geometricStyle.ellipsis == null &&
_geometricStyle.shadows == null;
}
return canDrawTextOnCanvas &&
@@ -364,7 +365,9 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
double get _lineHeight {
// TODO(mdebbar): Implement proper support for strut styles.
// https://github.com/flutter/flutter/issues/32243
if (_strutStyle == null || _strutStyle._height == null || _strutStyle._height == 0) {
if (_strutStyle == null ||
_strutStyle._height == null ||
_strutStyle._height == 0) {
// When there's no strut height, always use paragraph style height.
return _height;
}
@@ -908,6 +911,7 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
wordSpacing: wordSpacing,
decoration: _textDecorationToCssString(decoration, decorationStyle),
ellipsis: _paragraphStyle._ellipsis,
shadows: shadows,
),
plainText: '',
paint: paint,
@@ -961,6 +965,7 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
wordSpacing: wordSpacing,
decoration: _textDecorationToCssString(decoration, decorationStyle),
ellipsis: _paragraphStyle._ellipsis,
shadows: shadows,
),
plainText: plainText,
paint: paint,

View File

@@ -17,6 +17,7 @@ class ParagraphGeometricStyle {
this.wordSpacing,
this.decoration,
this.ellipsis,
this.shadows,
});
final ui.FontWeight fontWeight;
@@ -29,6 +30,7 @@ class ParagraphGeometricStyle {
final double wordSpacing;
final String decoration;
final String ellipsis;
final List<ui.Shadow> shadows;
// Since all fields above are primitives, cache hashcode since ruler lookups
// use this style as key.