Enum glyph_brush_layout::Layout
source · pub enum Layout<L: LineBreaker> {
SingleLine {
line_breaker: L,
h_align: HorizontalAlign,
v_align: VerticalAlign,
},
Wrap {
line_breaker: L,
h_align: HorizontalAlign,
v_align: VerticalAlign,
},
}
Expand description
Built-in GlyphPositioner
implementations.
Takes generic LineBreaker
to indicate the wrapping style.
See BuiltInLineBreaker
.
Example
let layout = Layout::default().h_align(HorizontalAlign::Right);
Variants§
SingleLine
Renders a single line from left-to-right according to the inner alignment. Hard breaking will end the line, partially hitting the width bound will end the line.
Wrap
Renders multiple lines from left-to-right according to the inner alignment. Hard breaking characters will cause advancement to another line. A characters hitting the width bound will also cause another line to start.
Implementations§
source§impl Layout<BuiltInLineBreaker>
impl Layout<BuiltInLineBreaker>
pub fn default_single_line() -> Self
pub fn default_wrap() -> Self
source§impl<L: LineBreaker> Layout<L>
impl<L: LineBreaker> Layout<L>
sourcepub fn h_align(self, h_align: HorizontalAlign) -> Self
pub fn h_align(self, h_align: HorizontalAlign) -> Self
Returns an identical Layout
but with the input h_align
sourcepub fn v_align(self, v_align: VerticalAlign) -> Self
pub fn v_align(self, v_align: VerticalAlign) -> Self
Returns an identical Layout
but with the input v_align
sourcepub fn line_breaker<L2: LineBreaker>(self, line_breaker: L2) -> Layout<L2>
pub fn line_breaker<L2: LineBreaker>(self, line_breaker: L2) -> Layout<L2>
Returns an identical Layout
but with the input line_breaker
Trait Implementations§
source§impl Default for Layout<BuiltInLineBreaker>
impl Default for Layout<BuiltInLineBreaker>
source§impl<L: LineBreaker> GlyphPositioner for Layout<L>
impl<L: LineBreaker> GlyphPositioner for Layout<L>
source§fn calculate_glyphs<F, S>(
&self,
fonts: &[F],
geometry: &SectionGeometry,
sections: &[S]
) -> Vec<SectionGlyph>where
F: Font,
S: ToSectionText,
fn calculate_glyphs<F, S>(
&self,
fonts: &[F],
geometry: &SectionGeometry,
sections: &[S]
) -> Vec<SectionGlyph>where
F: Font,
S: ToSectionText,
Calculate a sequence of positioned glyphs to render. Custom implementations should
return the same result when called with the same arguments to allow layout caching.
source§fn bounds_rect(&self, geometry: &SectionGeometry) -> Rect
fn bounds_rect(&self, geometry: &SectionGeometry) -> Rect
Return a screen rectangle according to the requested render position and bounds
appropriate for the glyph layout.
source§fn recalculate_glyphs<F, S, P>(
&self,
previous: P,
change: GlyphChange,
fonts: &[F],
geometry: &SectionGeometry,
sections: &[S]
) -> Vec<SectionGlyph>
fn recalculate_glyphs<F, S, P>( &self, previous: P, change: GlyphChange, fonts: &[F], geometry: &SectionGeometry, sections: &[S] ) -> Vec<SectionGlyph>
Recalculate a glyph sequence after a change. Read more
source§impl<L: PartialEq + LineBreaker> PartialEq for Layout<L>
impl<L: PartialEq + LineBreaker> PartialEq for Layout<L>
impl<L: Copy + LineBreaker> Copy for Layout<L>
impl<L: Eq + LineBreaker> Eq for Layout<L>
impl<L: LineBreaker> StructuralEq for Layout<L>
impl<L: LineBreaker> StructuralPartialEq for Layout<L>
Auto Trait Implementations§
impl<L> RefUnwindSafe for Layout<L>where
L: RefUnwindSafe,
impl<L> Send for Layout<L>where
L: Send,
impl<L> Sync for Layout<L>where
L: Sync,
impl<L> Unpin for Layout<L>where
L: Unpin,
impl<L> UnwindSafe for Layout<L>where
L: UnwindSafe,
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