pub struct BorrowedWithFontSystem<'a, T> { /* private fields */ }
Expand description
A value borrowed together with an FontSystem
Implementations§
Source§impl BorrowedWithFontSystem<'_, Buffer>
impl BorrowedWithFontSystem<'_, Buffer>
Sourcepub fn shape_until_cursor(&mut self, cursor: Cursor, prune: bool)
pub fn shape_until_cursor(&mut self, cursor: Cursor, prune: bool)
Shape lines until cursor, also scrolling to include cursor in view
Sourcepub fn shape_until_scroll(&mut self, prune: bool)
pub fn shape_until_scroll(&mut self, prune: bool)
Shape lines until scroll
Sourcepub fn line_shape(&mut self, line_i: usize) -> Option<&ShapeLine>
pub fn line_shape(&mut self, line_i: usize) -> Option<&ShapeLine>
Shape the provided line index and return the result
Sourcepub fn line_layout(&mut self, line_i: usize) -> Option<&[LayoutLine]>
pub fn line_layout(&mut self, line_i: usize) -> Option<&[LayoutLine]>
Lay out the provided line index and return the result
Sourcepub fn set_metrics(&mut self, metrics: Metrics)
pub fn set_metrics(&mut self, metrics: Metrics)
Sourcepub fn set_size(&mut self, width_opt: Option<f32>, height_opt: Option<f32>)
pub fn set_size(&mut self, width_opt: Option<f32>, height_opt: Option<f32>)
Set the current buffer dimensions
Sourcepub fn set_metrics_and_size(
&mut self,
metrics: Metrics,
width_opt: Option<f32>,
height_opt: Option<f32>,
)
pub fn set_metrics_and_size( &mut self, metrics: Metrics, width_opt: Option<f32>, height_opt: Option<f32>, )
Sourcepub fn set_tab_width(&mut self, tab_width: u16)
pub fn set_tab_width(&mut self, tab_width: u16)
Set tab width (number of spaces between tab stops)
Sourcepub fn set_text(&mut self, text: &str, attrs: Attrs<'_>, shaping: Shaping)
pub fn set_text(&mut self, text: &str, attrs: Attrs<'_>, shaping: Shaping)
Set text of buffer, using provided attributes for each line by default
Sourcepub fn set_rich_text<'r, 's, I>(
&mut self,
spans: I,
default_attrs: Attrs<'_>,
shaping: Shaping,
alignment: Option<Align>,
)
pub fn set_rich_text<'r, 's, I>( &mut self, spans: I, default_attrs: Attrs<'_>, shaping: Shaping, alignment: Option<Align>, )
Set text of buffer, using an iterator of styled spans (pairs of text and attributes)
let mut buffer = Buffer::new_empty(Metrics::new(32.0, 44.0));
let mut buffer = buffer.borrow_with(&mut font_system);
let attrs = Attrs::new().family(Family::Serif);
buffer.set_rich_text(
[
("hello, ", attrs),
("cosmic\ntext", attrs.family(Family::Monospace)),
],
attrs,
Shaping::Advanced,
None,
);
Source§impl BorrowedWithFontSystem<'_, Editor<'_>>
impl BorrowedWithFontSystem<'_, Editor<'_>>
Source§impl BorrowedWithFontSystem<'_, SyntaxEditor<'_, '_>>
impl BorrowedWithFontSystem<'_, SyntaxEditor<'_, '_>>
Source§impl BorrowedWithFontSystem<'_, ViEditor<'_, '_>>
impl BorrowedWithFontSystem<'_, ViEditor<'_, '_>>
Source§impl<'buffer, E: Edit<'buffer>> BorrowedWithFontSystem<'_, E>
impl<'buffer, E: Edit<'buffer>> BorrowedWithFontSystem<'_, E>
Sourcepub fn with_buffer_mut<F: FnOnce(&mut BorrowedWithFontSystem<'_, Buffer>) -> T, T>(
&mut self,
f: F,
) -> T
pub fn with_buffer_mut<F: FnOnce(&mut BorrowedWithFontSystem<'_, Buffer>) -> T, T>( &mut self, f: F, ) -> T
Get the internal Buffer
, mutably
Sourcepub fn set_tab_width(&mut self, tab_width: u16)
pub fn set_tab_width(&mut self, tab_width: u16)
Set the current tab width. A tab_width
of 0 is not allowed, and will be ignored
Sourcepub fn shape_as_needed(&mut self, prune: bool)
pub fn shape_as_needed(&mut self, prune: bool)
Shape lines until scroll, after adjusting scroll if the cursor moved
Trait Implementations§
Source§impl<'a, T: Debug> Debug for BorrowedWithFontSystem<'a, T>
impl<'a, T: Debug> Debug for BorrowedWithFontSystem<'a, T>
Source§impl<T> Deref for BorrowedWithFontSystem<'_, T>
impl<T> Deref for BorrowedWithFontSystem<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for BorrowedWithFontSystem<'a, T>
impl<'a, T> !RefUnwindSafe for BorrowedWithFontSystem<'a, T>
impl<'a, T> Send for BorrowedWithFontSystem<'a, T>where
T: Send,
impl<'a, T> Sync for BorrowedWithFontSystem<'a, T>where
T: Sync,
impl<'a, T> Unpin for BorrowedWithFontSystem<'a, T>
impl<'a, T> !UnwindSafe for BorrowedWithFontSystem<'a, T>
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