pub fn underline_for_range(&self, range: Range<usize>) -> Line {
        self.layout
            .as_ref()
            .map(|layout| {
                let p1 = layout.hit_test_text_position(range.start);
                let p2 = layout.hit_test_text_position(range.end);
                let line_metric = layout.line_metric(p1.line).unwrap();
                // heuristic; 1/5 of height is a rough guess at the descender pos?
                let y_pos = line_metric.baseline + (line_metric.height / 5.0);
                Line::new((p1.point.x, y_pos), (p2.point.x, y_pos))
            })
            .unwrap_or_else(|| Line::new(Point::ZERO, Point::ZERO))
    }
/// Return a line suitable for underlining a range of text.
///
/// This is really only intended to be used to indicate the composition
/// range while IME is active.
///
/// range is expected to be on a single visual line.
Return a line suitable for underlining a range of text.
This is really only intended to be used to indicate the composition
range while IME is active.

range is expected to be on a single visual line.
Return a line suitable for underlining a range of text . This is really only intended to be used to indicate the composition range while IME is active . range is expected to be on a single visual line .
pub fn underline_for_range(&self, range: Range<usize>) -> Line {
        self.layout
            .as_ref()
            .map(|layout| {
                let p1 = layout.hit_test_text_position(range.start);
                let p2 = layout.hit_test_text_position(range.end);
                let line_metric = layout.line_metric(p1.line).unwrap();
                // heuristic; 1/5 of height is a rough guess at the descender pos?
                let y_pos = line_metric.baseline + (line_metric.height / 5.0);
                Line::new((p1.point.x, y_pos), (p2.point.x, y_pos))
            })
            .unwrap_or_else(|| Line::new(Point::ZERO, Point::ZERO))
    }
pub fn underline_for_range ( & self , range : Range < usize > ) -> Line { self . layout . as_ref ( ) . map ( | layout | { let p1 = layout . hit_test_text_position ( range . start ) ; let p2 = layout . hit_test_text_position ( range . end ) ; let line_metric = layout . line_metric ( p1 . line ) . unwrap ( ) ; // heuristic; 1/5 of height is a rough guess at the descender pos? let y_pos = line_metric . baseline + ( line_metric . height / 5.0 ) ; Line :: new ( ( p1 . point . x , y_pos ) , ( p2 . point . x , y_pos ) ) } ) . unwrap_or_else ( | | Line :: new ( Point :: ZERO , Point :: ZERO ) ) }
Return a line suitable for underlining a range of text.
Return a line suitable for underlining a range of text .
&self
range
Range<usize>
&self
range
Range<usize>