Skip to main content

TextLineImpl

Struct TextLineImpl 

Source
pub struct TextLineImpl { /* private fields */ }
Expand description

The line produced by the text formatter.

The run list is only written by TextLineImpl::replace_text_run (used by justification) and by TextLineImpl::finalize_line; everything else reads it.

Implementations§

Source§

impl TextLineImpl

Source

pub fn new( text_runs: Vec<Rc<dyn TextRun>>, first_text_source_index: i32, length: i32, paragraph_width: f64, paragraph_properties: Rc<dyn TextParagraphProperties>, resolved_flow_direction: FlowDirection, line_break: Option<Rc<TextLineBreak>>, has_collapsed: bool, ) -> Rc<Self>

Source

pub fn get_baseline_offset( text_line: &dyn TextLine, text_run: &dyn DrawableTextRun, ) -> f64

The vertical offset that aligns a run in a line according to the run’s baseline alignment.

Panics when the run has no properties (and therefore no baseline alignment).

Source

pub fn finalize_line(&self)

Trait Implementations§

Source§

impl TextLine for TextLineImpl

Source§

fn get_text_bounds( &self, first_text_source_index: i32, text_length: i32, ) -> Vec<TextBounds>

Returns no bounds for an empty range.

Source§

fn text_runs(&self) -> Ref<'_, [Rc<dyn TextRun>]>

Gets the text runs that are contained within a line (visual order).
Source§

fn first_text_source_index(&self) -> i32

Gets the first text source index in the line.
Source§

fn length(&self) -> i32

Gets the total number of text source positions of the line.
Source§

fn text_line_break(&self) -> Option<Rc<TextLineBreak>>

Gets the state of the line when broken by line breaking process.
Source§

fn has_collapsed(&self) -> bool

Gets a value that indicates whether the line is collapsed.
Source§

fn has_overflowed(&self) -> bool

Gets a value that indicates whether content of the line overflows the specified paragraph width.
Source§

fn baseline(&self) -> f64

Gets the distance from the top to the baseline of the current line of text.
Source§

fn extent(&self) -> f64

Gets the distance from the top-most to bottom-most black pixel in a line.
Source§

fn height(&self) -> f64

Gets the height of a line of text.
Source§

fn new_line_length(&self) -> i32

Gets the number of newline characters at the end of a line.
Source§

fn overhang_after(&self) -> f64

Gets the distance that black pixels extend beyond the bottom alignment edge of a line.
Source§

fn overhang_leading(&self) -> f64

Gets the distance that black pixels extend prior to the left leading alignment edge of the line.
Source§

fn overhang_trailing(&self) -> f64

Gets the distance that black pixels extend following the right trailing alignment edge of the line.
Source§

fn trailing_whitespace_length(&self) -> i32

Gets the number of whitespace code points beyond the last non-blank character in a line.
Source§

fn start(&self) -> f64

Gets the distance from the start of a paragraph to the starting point of a line.
Source§

fn width(&self) -> f64

Gets the width of a line of text, excluding trailing whitespace characters.
Source§

fn width_including_trailing_whitespace(&self) -> f64

Gets the width of a line of text, including trailing whitespace characters.
Source§

fn draw(&self, drawing_context: &mut dyn ITextDrawingSink, line_origin: Point)

Draws the text line onto the drawing context at the given origin.
Source§

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.
Source§

fn justify(&self, justification_properties: &dyn JustificationProperties)

Justifies the line by applying given justification properties.
Source§

fn get_character_hit_from_distance(&self, distance: f64) -> CharacterHit

Gets the character hit corresponding to the specified distance from the beginning of the line.
Source§

fn get_distance_from_character_hit(&self, character_hit: CharacterHit) -> f64

Gets the distance from the beginning of the line to the specified character hit.
Source§

fn get_next_caret_character_hit( &self, character_hit: CharacterHit, ) -> CharacterHit

Gets the next character hit for caret navigation.
Source§

fn get_previous_caret_character_hit( &self, character_hit: CharacterHit, ) -> CharacterHit

Gets the previous character hit for caret navigation.
Source§

fn get_backspace_caret_character_hit( &self, character_hit: CharacterHit, ) -> CharacterHit

Gets the previous character hit after backspacing.
Source§

fn dispose(&self)

Releases the resources of the line.
Source§

fn as_any(&self) -> &dyn Any

The line as Any, for downcasting to the concrete line type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.