Skip to main content

TextSystem

Struct TextSystem 

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

Implementations§

Source§

impl TextSystem

Source

pub fn new() -> Self

Source

pub fn with_atlas(width: u32, height: u32) -> Self

Source

pub fn register_alias( &mut self, alias: impl Into<String>, family: impl Into<String>, )

Source

pub fn font_families(&self) -> Vec<String>

Source

pub fn set_subpixel_y(&mut self, on: bool)

Source

pub fn subpixel_y(&self) -> bool

Source

pub fn load_font(&mut self, data: Vec<u8>) -> Option<String>

Source

pub fn set_default_family(&mut self, family: Option<String>)

Source

pub fn default_family(&self) -> Option<&str>

Source

pub fn set_scale_factor(&mut self, scale: f32)

Source

pub fn scale_factor(&self) -> f32

Source

pub fn shape(&mut self, text: &str, size: f32) -> Rc<ShapedText>

Source

pub fn shape_weighted( &mut self, text: &str, size: f32, weight: FontWeight, ) -> Rc<ShapedText>

Source

pub fn shape_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> Rc<ShapedText>

Source

pub fn shape_wrapped( &mut self, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, ) -> Rc<ShapedText>

Source

pub fn shape_wrapped_spaced( &mut self, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, spacing: LetterSpacing, ) -> Rc<ShapedText>

Source

pub fn shape_styled( &mut self, text: &str, size: f32, weight: FontWeight, family: Option<&str>, style: FontStyle, ) -> Rc<ShapedText>

Source

pub fn shape_spaced_styled( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> Rc<ShapedText>

Source

pub fn shape_wrapped_styled( &mut self, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, family: Option<&str>, style: FontStyle, ) -> Rc<ShapedText>

Source

pub fn shape_wrapped_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> Rc<ShapedText>

Source

pub fn line_hash( line_text: &str, spans: &[StyledSpan], line_byte_start: usize, width: f32, ) -> u64

Source

pub fn hash_line_content( text: &str, extra_hash: u64, size: f32, weight: FontWeight, family: &str, style: FontStyle, spacing: f32, mode: WrapMode, scale_bits: u32, ) -> u64

Source

pub fn shape_line_full( &mut self, line: usize, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, extra_hash: u64, ) -> Rc<ShapedLine>

Source

pub fn shape_line_wrapped( &mut self, line: usize, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, ) -> Rc<ShapedLine>

Source

pub fn shape_line( &mut self, line: usize, text: &str, size: f32, ) -> Rc<ShapedLine>

Source

pub fn shape_lines_visible<F>( &mut self, range: Range<usize>, get_line: F, size: f32, weight: FontWeight, width: f32, mode: WrapMode, ) -> Vec<Rc<ShapedLine>>
where F: Fn(usize) -> Option<String>,

Source

pub fn shape_lines_visible_full<F>( &mut self, range: Range<usize>, get_line: F, size: f32, weight: FontWeight, width: f32, mode: WrapMode, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, extra_hash_for: &dyn Fn(usize) -> u64, ) -> Vec<Rc<ShapedLine>>
where F: Fn(usize) -> Option<String>,

Source

pub fn shape_styled_line( &mut self, line: usize, line_text: &str, line_byte_start: usize, spans: &[StyledSpan], size: f32, weight: FontWeight, width: f32, mode: WrapMode, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> Rc<ShapedLine>

Source

pub fn shape_lines_visible_buffer( &mut self, buf: &StyledBuffer, range: Range<usize>, size: f32, weight: FontWeight, width: f32, mode: WrapMode, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> Vec<Rc<ShapedLine>>

Source

pub fn shape_rich_from_styled( &mut self, line_text: &str, line_byte_start: usize, styled: &[StyledSpan], size: f32, width: f32, mode: WrapMode, spacing: f32, align: RichAlign, ) -> Rc<RichParagraph>

Source

pub fn invalidate_lines(&mut self, edited: Range<usize>)

Source

pub fn invalidate_for_edit( &mut self, index: &LineIndex, edit_byte_start: usize, edit_byte_end: usize, )

Source

pub fn apply_edit_invalidate( &mut self, edit_byte_start: usize, edit_byte_end: usize, line_of: &dyn Fn(usize) -> usize, )

Source

pub fn line_reshapes(&self) -> u64

Source

pub fn reset_line_reshapes(&mut self)

Source

pub fn line_cache_len(&self) -> usize

Source

pub fn draw_line( &mut self, line: &ShapedLine, origin: (f32, f32), color: Color, list: &mut RenderList, )

Source

pub fn text_width(&mut self, text: &str, size: f32) -> f32

Source

pub fn text_width_weighted( &mut self, text: &str, size: f32, weight: FontWeight, ) -> f32

Source

pub fn text_width_spaced( &mut self, text: &str, size: f32, spacing: LetterSpacing, ) -> f32

Source

pub fn text_width_weighted_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> f32

Source

pub fn text_width_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> f32

Source

pub fn caret_positions( &mut self, text: &str, size: f32, weight: FontWeight, ) -> Vec<f32>

Source

pub fn caret_positions_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> Vec<f32>

Source

pub fn caret_positions_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> Vec<f32>

Source

pub fn caret_x( &mut self, text: &str, size: f32, weight: FontWeight, char_index: usize, ) -> f32

Source

pub fn caret_x_spaced( &mut self, text: &str, size: f32, weight: FontWeight, char_index: usize, spacing: LetterSpacing, ) -> f32

Source

pub fn caret_x_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, char_index: usize, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> f32

Source

pub fn char_index_from_x( &mut self, text: &str, size: f32, weight: FontWeight, x: f32, ) -> usize

Source

pub fn char_index_from_x_spaced( &mut self, text: &str, size: f32, weight: FontWeight, x: f32, spacing: LetterSpacing, ) -> usize

Source

pub fn char_index_from_x_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, x: f32, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> usize

Source

pub fn truncate( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, ) -> String

Source

pub fn truncate_spaced( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, spacing: LetterSpacing, ) -> String

Source

pub fn truncate_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> String

Source

pub fn elide( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, mode: ElideMode, ) -> String

Source

pub fn elide_spaced( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, mode: ElideMode, spacing: LetterSpacing, ) -> String

Source

pub fn elide_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, mode: ElideMode, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> String

Source

pub fn draw( &mut self, shaped: &ShapedText, origin: (f32, f32), color: Color, list: &mut RenderList, )

Source

pub fn draw_sprite( &mut self, key: u64, w: u32, h: u32, alpha: &[u8], dst: Rect, color: Color, list: &mut RenderList, )

Source

pub fn shape_rich(&mut self, spans: &[TextSpan], size: f32) -> Rc<RichParagraph>

Source

pub fn shape_rich_wrapped( &mut self, spans: &[TextSpan], size: f32, width: f32, mode: WrapMode, ) -> Rc<RichParagraph>

Source

pub fn shape_rich_aligned( &mut self, spans: &[TextSpan], size: f32, width: f32, mode: WrapMode, align: RichAlign, ) -> Rc<RichParagraph>

Source

pub fn shape_rich_full( &mut self, spans: &[TextSpan], size: f32, width: f32, mode: WrapMode, spacing: f32, align: RichAlign, ) -> Rc<RichParagraph>

Source

pub fn draw_rich( &mut self, rich: &RichParagraph, origin: (f32, f32), default_color: Color, list: &mut RenderList, )

Source

pub fn atlas(&self) -> &GlyphAtlas

Source

pub fn atlas_mut(&mut self) -> &mut GlyphAtlas

Trait Implementations§

Source§

impl Default for TextSystem

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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

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.