pub struct TextSystem { /* private fields */ }Implementations§
Source§impl TextSystem
impl TextSystem
pub fn new() -> Self
pub fn with_atlas(width: u32, height: u32) -> Self
pub fn register_alias( &mut self, alias: impl Into<String>, family: impl Into<String>, )
pub fn font_families(&self) -> Vec<String>
pub fn set_subpixel_y(&mut self, on: bool)
pub fn subpixel_y(&self) -> bool
pub fn load_font(&mut self, data: Vec<u8>) -> Option<String>
pub fn set_default_family(&mut self, family: Option<String>)
pub fn default_family(&self) -> Option<&str>
pub fn set_scale_factor(&mut self, scale: f32)
pub fn scale_factor(&self) -> f32
pub fn shape(&mut self, text: &str, size: f32) -> Rc<ShapedText>
pub fn shape_weighted( &mut self, text: &str, size: f32, weight: FontWeight, ) -> Rc<ShapedText>
pub fn shape_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> Rc<ShapedText>
pub fn shape_wrapped( &mut self, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, ) -> Rc<ShapedText>
pub fn shape_wrapped_spaced( &mut self, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, spacing: LetterSpacing, ) -> Rc<ShapedText>
pub fn shape_styled( &mut self, text: &str, size: f32, weight: FontWeight, family: Option<&str>, style: FontStyle, ) -> Rc<ShapedText>
pub fn shape_spaced_styled( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> Rc<ShapedText>
pub fn shape_wrapped_styled( &mut self, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, family: Option<&str>, style: FontStyle, ) -> Rc<ShapedText>
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>
pub fn line_hash( line_text: &str, spans: &[StyledSpan], line_byte_start: usize, width: f32, ) -> u64
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
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>
pub fn shape_line_wrapped( &mut self, line: usize, text: &str, size: f32, weight: FontWeight, width: f32, mode: WrapMode, ) -> Rc<ShapedLine>
pub fn shape_line( &mut self, line: usize, text: &str, size: f32, ) -> Rc<ShapedLine>
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>>
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>>
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>
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>>
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>
pub fn invalidate_lines(&mut self, edited: Range<usize>)
pub fn invalidate_for_edit( &mut self, index: &LineIndex, edit_byte_start: usize, edit_byte_end: usize, )
pub fn apply_edit_invalidate( &mut self, edit_byte_start: usize, edit_byte_end: usize, line_of: &dyn Fn(usize) -> usize, )
pub fn line_reshapes(&self) -> u64
pub fn reset_line_reshapes(&mut self)
pub fn line_cache_len(&self) -> usize
pub fn draw_line( &mut self, line: &ShapedLine, origin: (f32, f32), color: Color, list: &mut RenderList, )
pub fn text_width(&mut self, text: &str, size: f32) -> f32
pub fn text_width_weighted( &mut self, text: &str, size: f32, weight: FontWeight, ) -> f32
pub fn text_width_spaced( &mut self, text: &str, size: f32, spacing: LetterSpacing, ) -> f32
pub fn text_width_weighted_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> f32
pub fn text_width_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> f32
pub fn caret_positions( &mut self, text: &str, size: f32, weight: FontWeight, ) -> Vec<f32>
pub fn caret_positions_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> Vec<f32>
pub fn caret_positions_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> Vec<f32>
pub fn caret_x( &mut self, text: &str, size: f32, weight: FontWeight, char_index: usize, ) -> f32
pub fn caret_x_spaced( &mut self, text: &str, size: f32, weight: FontWeight, char_index: usize, spacing: LetterSpacing, ) -> f32
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
pub fn char_index_from_x( &mut self, text: &str, size: f32, weight: FontWeight, x: f32, ) -> usize
pub fn char_index_from_x_spaced( &mut self, text: &str, size: f32, weight: FontWeight, x: f32, spacing: LetterSpacing, ) -> usize
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
pub fn truncate( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, ) -> String
pub fn truncate_spaced( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, spacing: LetterSpacing, ) -> String
pub fn truncate_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> String
pub fn elide( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, mode: ElideMode, ) -> String
pub fn elide_spaced( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, mode: ElideMode, spacing: LetterSpacing, ) -> String
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
pub fn draw( &mut self, shaped: &ShapedText, origin: (f32, f32), color: Color, list: &mut RenderList, )
pub fn draw_sprite( &mut self, key: u64, w: u32, h: u32, alpha: &[u8], dst: Rect, color: Color, list: &mut RenderList, )
pub fn shape_rich(&mut self, spans: &[TextSpan], size: f32) -> Rc<RichParagraph>
pub fn shape_rich_wrapped( &mut self, spans: &[TextSpan], size: f32, width: f32, mode: WrapMode, ) -> Rc<RichParagraph>
pub fn shape_rich_aligned( &mut self, spans: &[TextSpan], size: f32, width: f32, mode: WrapMode, align: RichAlign, ) -> Rc<RichParagraph>
pub fn shape_rich_full( &mut self, spans: &[TextSpan], size: f32, width: f32, mode: WrapMode, spacing: f32, align: RichAlign, ) -> Rc<RichParagraph>
pub fn draw_rich( &mut self, rich: &RichParagraph, origin: (f32, f32), default_color: Color, list: &mut RenderList, )
pub fn atlas(&self) -> &GlyphAtlas
pub fn atlas_mut(&mut self) -> &mut GlyphAtlas
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TextSystem
impl !RefUnwindSafe for TextSystem
impl !Send for TextSystem
impl !Sync for TextSystem
impl !UnwindSafe for TextSystem
impl Unpin for TextSystem
impl UnsafeUnpin for TextSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more