Skip to main content

SoftwareTextMeasurer

Struct SoftwareTextMeasurer 

Source
pub struct SoftwareTextMeasurer { /* private fields */ }

Implementations§

Source§

impl SoftwareTextMeasurer

Source

pub fn new(font: SoftwareTextFont, cache_capacity: usize) -> Self

Source

pub fn from_font_set(fonts: SoftwareTextFontSet, cache_capacity: usize) -> Self

Source

pub fn from_fonts_or_default(fonts: &[&[u8]], cache_capacity: usize) -> Self

Trait Implementations§

Source§

impl TextMeasurer for SoftwareTextMeasurer

Source§

fn measure(&self, text: &AnnotatedString, style: &TextStyle) -> TextMetrics

Source§

fn measure_subsequence( &self, text: &AnnotatedString, range: Range<usize>, style: &TextStyle, ) -> TextMetrics

Source§

fn get_offset_for_position( &self, text: &AnnotatedString, style: &TextStyle, x: f32, y: f32, ) -> usize

Source§

fn get_cursor_x_for_offset( &self, text: &AnnotatedString, style: &TextStyle, offset: usize, ) -> f32

Source§

fn layout(&self, text: &AnnotatedString, style: &TextStyle) -> TextLayoutResult

Source§

fn choose_auto_hyphen_break( &self, line: &str, style: &TextStyle, segment_start_char: usize, measured_break_char: usize, ) -> Option<usize>

Returns an alternate break boundary for Hyphens::Auto when a greedy break split lands in the middle of a word. Read more
Source§

fn measure_for_node( &self, node_id: Option<usize>, text: &AnnotatedString, style: &TextStyle, ) -> TextMetrics

Source§

fn measure_subsequence_for_node( &self, node_id: Option<usize>, text: &AnnotatedString, range: Range<usize>, style: &TextStyle, ) -> TextMetrics

Source§

fn measure_with_options( &self, text: &AnnotatedString, style: &TextStyle, options: TextLayoutOptions, max_width: Option<f32>, ) -> TextMetrics

Source§

fn measure_with_options_for_node( &self, node_id: Option<usize>, text: &AnnotatedString, style: &TextStyle, options: TextLayoutOptions, max_width: Option<f32>, ) -> TextMetrics

Source§

fn prepare_with_options( &self, text: &AnnotatedString, style: &TextStyle, options: TextLayoutOptions, max_width: Option<f32>, ) -> PreparedTextLayout

Source§

fn prepare_with_options_for_node( &self, node_id: Option<usize>, text: &AnnotatedString, style: &TextStyle, options: TextLayoutOptions, max_width: Option<f32>, ) -> PreparedTextLayout

Source§

fn prepare_with_options_fallback( &self, text: &AnnotatedString, style: &TextStyle, options: TextLayoutOptions, max_width: Option<f32>, ) -> PreparedTextLayout

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.