diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart index 76133b23c4..d41e536fe4 100644 --- a/packages/flutter/lib/src/painting/text_painter.dart +++ b/packages/flutter/lib/src/painting/text_painter.dart @@ -601,8 +601,11 @@ class TextPainter { canvas.drawParagraph(_paragraph, offset); } - // Complex glyphs can be represented by two or more UTF16 codepoints. This - // checks if the value represents a UTF16 glyph by itself or is a 'surrogate'. + // Returns true iff the given value is a valid UTF-16 surrogate. The value + // must be a UTF-16 code unit, meaning it must be in the range 0x0000-0xFFFF. + // + // See also: + // * https://en.wikipedia.org/wiki/UTF-16#Code_points_from_U+010000_to_U+10FFFF static bool _isUtf16Surrogate(int value) { return value & 0xF800 == 0xD800; }