TextLine
trait · ferroui-base · v0.5.0
trait TextLine: 'static
Represents a line of text that is used for text rendering.
All character indices and lengths are UTF-16 code units in text source coordinates.
Members
text_runsfirst_text_source_indexlengthtext_line_breakbaselineextenthas_collapsedhas_overflowedheightnew_line_lengthoverhang_afteroverhang_leadingoverhang_trailingstarttrailing_whitespace_lengthwidthwidth_including_trailing_whitespacedrawcollapsejustifyget_character_hit_from_distanceget_distance_from_character_hitget_next_caret_character_hitget_previous_caret_character_hitget_backspace_caret_character_hitget_text_boundsdisposeas_any
text_runs
fn text_runs(self: &Self) -> Ref<'_, [Rc<dyn TextRun>]>
Gets the text runs that are contained within a line (visual order).
first_text_source_index
fn first_text_source_index(self: &Self) -> i32
Gets the first text source index in the line.
length
fn length(self: &Self) -> i32
Gets the total number of text source positions of the line.
text_line_break
fn text_line_break(self: &Self) -> Option<Rc<TextLineBreak>>
Gets the state of the line when broken by line breaking process.
baseline
fn baseline(self: &Self) -> f64
Gets the distance from the top to the baseline of the current line of text.
extent
fn extent(self: &Self) -> f64
Gets the distance from the top-most to bottom-most black pixel in a line.
has_collapsed
fn has_collapsed(self: &Self) -> bool
Gets a value that indicates whether the line is collapsed.
has_overflowed
fn has_overflowed(self: &Self) -> bool
Gets a value that indicates whether content of the line overflows the specified paragraph width.
height
fn height(self: &Self) -> f64
Gets the height of a line of text.
new_line_length
fn new_line_length(self: &Self) -> i32
Gets the number of newline characters at the end of a line.
overhang_after
fn overhang_after(self: &Self) -> f64
Gets the distance that black pixels extend beyond the bottom alignment edge of a line.
overhang_leading
fn overhang_leading(self: &Self) -> f64
Gets the distance that black pixels extend prior to the left leading alignment edge of the line.
overhang_trailing
fn overhang_trailing(self: &Self) -> f64
Gets the distance that black pixels extend following the right trailing alignment edge of the line.
start
fn start(self: &Self) -> f64
Gets the distance from the start of a paragraph to the starting point of a line.
trailing_whitespace_length
fn trailing_whitespace_length(self: &Self) -> i32
Gets the number of whitespace code points beyond the last non-blank character in a line.
width
fn width(self: &Self) -> f64
Gets the width of a line of text, excluding trailing whitespace characters.
width_including_trailing_whitespace
fn width_including_trailing_whitespace(self: &Self) -> f64
Gets the width of a line of text, including trailing whitespace characters.
draw
fn draw(self: &Self, drawing_context: &mut dyn ITextDrawingSink, line_origin: Point)
Draws the text line onto the drawing context at the given origin.
collapse
fn collapse(self: Rc<Self>, collapsing_properties_list: &[Option<Rc<dyn TextCollapsingProperties>>]) -> Rc<dyn TextLine>
Create a collapsed line based on collapsed text properties. Returns the line itself when nothing has to be collapsed.
justify
fn justify(self: &Self, justification_properties: &dyn JustificationProperties)
Justifies the line by applying given justification properties.
get_character_hit_from_distance
fn get_character_hit_from_distance(self: &Self, distance: f64) -> CharacterHit
Gets the character hit corresponding to the specified distance from the beginning of the line.
get_distance_from_character_hit
fn get_distance_from_character_hit(self: &Self, character_hit: CharacterHit) -> f64
Gets the distance from the beginning of the line to the specified character hit.
get_next_caret_character_hit
fn get_next_caret_character_hit(self: &Self, character_hit: CharacterHit) -> CharacterHit
Gets the next character hit for caret navigation.
get_previous_caret_character_hit
fn get_previous_caret_character_hit(self: &Self, character_hit: CharacterHit) -> CharacterHit
Gets the previous character hit for caret navigation.
get_backspace_caret_character_hit
fn get_backspace_caret_character_hit(self: &Self, character_hit: CharacterHit) -> CharacterHit
Gets the previous character hit after backspacing.
get_text_bounds
fn get_text_bounds(self: &Self, first_text_source_character_index: i32, text_length: i32) -> Vec<TextBounds>
Get an array of bounding rectangles of a range of characters within a text line.
Returns a list of bounding rectangles, or an empty list for an empty range.
dispose
fn dispose(self: &Self)
Releases the resources of the line.
as_any
fn as_any(self: &Self) -> &dyn Any
The line as Any, for downcasting to the concrete line type.
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.