@@ -1201,6 +1201,9 @@ class FontVariation {
12011201/// * [Paragraph.getClosestGlyphInfoForOffset] , which finds the [GlyphInfo] of
12021202/// the glyph(s) onscreen that's closest to the given [Offset].
12031203final class GlyphInfo {
1204+ /// Creates a [GlyphInfo] with the specified values.
1205+ GlyphInfo (this .graphemeClusterLayoutBounds, this .graphemeClusterCodeUnitRange, this .writingDirection);
1206+
12041207 GlyphInfo ._(double left, double top, double right, double bottom, int graphemeStart, int graphemeEnd, bool isLTR)
12051208 : graphemeClusterLayoutBounds = Rect .fromLTRB (left, top, right, bottom),
12061209 graphemeClusterCodeUnitRange = TextRange (start: graphemeStart, end: graphemeEnd),
@@ -1209,7 +1212,7 @@ final class GlyphInfo {
12091212 /// The layout bounding rect of the associated character, in the paragraph's
12101213 /// coordinates.
12111214 ///
1212- /// This is **not** the tight bounding box that encloses the character's outline.
1215+ /// This is **not** a tight bounding box that encloses the character's outline.
12131216 /// The vertical extent reported is derived from the font metrics (instead of
12141217 /// glyph metrics), and the horizontal extent is the horizontal advance of the
12151218 /// character.
@@ -3017,18 +3020,24 @@ abstract class Paragraph {
30173020 List <TextBox > getBoxesForPlaceholders ();
30183021
30193022 /// Returns the text position closest to the given offset.
3023+ ///
3024+ /// This method always returns a [TextPosition] for any given [offset] , even
3025+ /// when the [offset] is not close to any text, or when the paragraph is empty.
3026+ /// This is useful for determining the text to select when the user drags the
3027+ /// text selection handle.
3028+ ///
3029+ /// See also:
3030+ ///
3031+ /// * [getClosestGlyphInfoForOffset] , which returns more information about
3032+ /// the closest character to an [Offset].
30203033 TextPosition getPositionForOffset (Offset offset);
30213034
30223035 /// Returns the [GlyphInfo] of the glyph closest to the given `offset` in the
3023- /// paragraph coordinate system, or null if the glyph is not in the visible
3024- /// range .
3036+ /// paragraph coordinate system, or null if if the text is empty, or is
3037+ /// entirely clipped or ellipsized away .
30253038 ///
30263039 /// This method first finds the line closest to `offset.dy` , and then returns
30273040 /// the [GlyphInfo] of the closest glyph(s) within that line.
3028- ///
3029- /// This method can be used to implement per-glyph hit-testing. The returned
3030- /// [GlyphInfo] can help determine whether the given `offset` directly hits a
3031- /// glyph in the paragraph.
30323041 GlyphInfo ? getClosestGlyphInfoForOffset (Offset offset);
30333042
30343043 /// Returns the [GlyphInfo] located at the given UTF-16 `codeUnitOffset` in
0 commit comments