pub trait TextGeometry {
// Required methods
fn metrics(&self) -> TextMetrics;
fn line_count(&self) -> usize;
fn get_line(&self, index: usize) -> Option<TextLineRef<'_>>;
fn lines(&self) -> TextLines<'_> ⓘ;
fn lines_between(&self, top: f32, bottom: f32) -> TextLines<'_> ⓘ;
fn line_for_offset(&self, byte: usize) -> usize;
fn line_caret_positions(&self, line: usize) -> &[TextCaretPosition];
// Provided method
fn line(&self, index: usize) -> TextLineRef<'_> { ... }
}Expand description
Line geometry of laid-out text: lines in layout coordinates, their caret stops and the overall metrics.
TextLayout implements it for one shaped text, and
TextDocumentLayout for a document laid out
paragraph by paragraph.
Required Methods§
fn metrics(&self) -> TextMetrics
fn line_count(&self) -> usize
fn get_line(&self, index: usize) -> Option<TextLineRef<'_>>
fn lines(&self) -> TextLines<'_> ⓘ
Sourcefn lines_between(&self, top: f32, bottom: f32) -> TextLines<'_> ⓘ
fn lines_between(&self, top: f32, bottom: f32) -> TextLines<'_> ⓘ
Lines that may meet the vertical span top..bottom, plus one line on
each side; pad the span for glyphs that overhang their line.
Sourcefn line_for_offset(&self, byte: usize) -> usize
fn line_for_offset(&self, byte: usize) -> usize
Index of the line whose [start, end) holds byte, or the last line
when none does, like Flutter’s Paragraph.getLineBoundary.
Sourcefn line_caret_positions(&self, line: usize) -> &[TextCaretPosition]
fn line_caret_positions(&self, line: usize) -> &[TextCaretPosition]
The visual insertion points of one line in left-to-right screen order.
Provided Methods§
Sourcefn line(&self, index: usize) -> TextLineRef<'_>
fn line(&self, index: usize) -> TextLineRef<'_>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: TextGeometry + ?Sized> TextGeometry for Arc<T>
Layouts are shared as Arcs; geometry reads through them unchanged.
impl<T: TextGeometry + ?Sized> TextGeometry for Arc<T>
Layouts are shared as Arcs; geometry reads through them unchanged.