pub enum Layout<L>where
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() -> Layout<BuiltInLineBreaker>
pub fn default_wrap() -> Layout<BuiltInLineBreaker>
Source§impl<L> Layout<L>where
L: LineBreaker,
impl<L> Layout<L>where
L: LineBreaker,
Sourcepub fn h_align(self, h_align: HorizontalAlign) -> Layout<L>
pub fn h_align(self, h_align: HorizontalAlign) -> Layout<L>
Returns an identical Layout but with the input h_align
Sourcepub fn v_align(self, v_align: VerticalAlign) -> Layout<L>
pub fn v_align(self, v_align: VerticalAlign) -> Layout<L>
Returns an identical Layout but with the input v_align
Sourcepub fn line_breaker<L2>(self, line_breaker: L2) -> Layout<L2>where
L2: LineBreaker,
pub fn line_breaker<L2>(self, line_breaker: L2) -> Layout<L2>where
L2: LineBreaker,
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> GlyphPositioner for Layout<L>where
L: LineBreaker,
impl<L> GlyphPositioner for Layout<L>where
L: LineBreaker,
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
impl<L> Copy for Layout<L>where
L: Copy + LineBreaker,
impl<L> Eq for Layout<L>where
L: Eq + LineBreaker,
impl<L> StructuralPartialEq for Layout<L>where
L: LineBreaker,
Auto Trait Implementations§
impl<L> Freeze for Layout<L>where
L: Freeze,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> FilterHaving<T, Here> for Twhere
T: ?Sized,
impl<T> FilterHaving<T, Here> for Twhere
T: ?Sized,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more