Struct embedded_text::style::TextBoxStyle [−][src]
pub struct TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, { pub text_style: TextStyle<C, F>, pub alignment: A, pub vertical_alignment: V, pub height_mode: H, pub line_spacing: i32, pub tab_size: TabSize<F>, pub underlined: bool, pub strikethrough: bool, }
Styling options of a TextBox.
TextBoxStyle contains the Font, foreground and background PixelColor, line spacing,
HeightMode, HorizontalTextAlignment and VerticalTextAlignment information necessary
to draw a TextBox.
To construct a new TextBoxStyle object, use the new or from_text_style methods or
the TextBoxStyleBuilder object.
Fields
text_style: TextStyle<C, F>Style properties for text.
alignment: AHorizontal text alignment.
vertical_alignment: VVertical text alignment.
height_mode: HThe height behaviour
line_spacing: i32Desired space between lines, in pixels
tab_size: TabSize<F>Desired column width for tabs
underlined: boolIf true, the text will be underlined
strikethrough: boolIf true, the text will be crossed out
Implementations
impl<C, F, A, V, H> TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy,
A: HorizontalTextAlignment,
V: VerticalTextAlignment,
H: HeightMode, [src]
impl<C, F, A, V, H> TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy,
A: HorizontalTextAlignment,
V: VerticalTextAlignment,
H: HeightMode, [src]pub fn new(
font: F,
text_color: C,
alignment: A,
vertical_alignment: V,
height_mode: H
) -> Self[src]
font: F,
text_color: C,
alignment: A,
vertical_alignment: V,
height_mode: H
) -> Self
Creates a TextBoxStyle object with transparent background.
pub fn from_text_style(
text_style: TextStyle<C, F>,
alignment: A,
vertical_alignment: V,
height_mode: H
) -> Self[src]
text_style: TextStyle<C, F>,
alignment: A,
vertical_alignment: V,
height_mode: H
) -> Self
Creates a TextBoxStyle object from the given text style and alignment.
#[must_use]pub fn measure_line<'a>(
&self,
parser: &mut Parser<'a>,
carried_token: Option<Token<'a>>,
max_line_width: u32
) -> (u32, u32, Option<Token<'a>>, bool)[src]
&self,
parser: &mut Parser<'a>,
carried_token: Option<Token<'a>>,
max_line_width: u32
) -> (u32, u32, Option<Token<'a>>, bool)
Measure the width and count spaces in a single line of text.
Returns (width, rendered space count, carried token)
Instead of peeking ahead when processing tokens, this function advances the parser before
processing a token. If a token opens a new line, it will be returned as the carried token.
If the carried token is None, the parser has finished processing the text.
#[must_use]pub fn measure_text_height(&self, text: &str, max_width: u32) -> u32[src]
Measures text height when rendered using a given width.
Example: measure height of text when rendered using a 6x8 font and 72px width.
let style = TextBoxStyleBuilder::new(Font6x8) .text_color(BinaryColor::On) .build(); let height = style.measure_text_height( "Lorem Ipsum is simply dummy text of the printing and typesetting industry.", 72, ); // Expect 7 lines of text, wrapped in something like the following: // |Lorem Ipsum | // |is simply | // |dummy text | // |of the | // |printing and| // |typesetting | // |industry. | assert_eq!(7 * 8, height);
Trait Implementations
impl<C: Clone, F: Clone, A: Clone, V: Clone, H: Clone> Clone for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]
impl<C: Clone, F: Clone, A: Clone, V: Clone, H: Clone> Clone for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]fn clone(&self) -> TextBoxStyle<C, F, A, V, H>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<C: Copy, F: Copy, A: Copy, V: Copy, H: Copy> Copy for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]
impl<C: Copy, F: Copy, A: Copy, V: Copy, H: Copy> Copy for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]impl<C: Debug, F: Debug, A: Debug, V: Debug, H: Debug> Debug for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]
impl<C: Debug, F: Debug, A: Debug, V: Debug, H: Debug> Debug for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]impl<C: Default, F: Default, A: Default, V: Default, H: Default> Default for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]
impl<C: Default, F: Default, A: Default, V: Default, H: Default> Default for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]fn default() -> TextBoxStyle<C, F, A, V, H>[src]
impl<C: Eq, F: Eq, A: Eq, V: Eq, H: Eq> Eq for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]
impl<C: Eq, F: Eq, A: Eq, V: Eq, H: Eq> Eq for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]impl<C: Hash, F: Hash, A: Hash, V: Hash, H: Hash> Hash for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]
impl<C: Hash, F: Hash, A: Hash, V: Hash, H: Hash> Hash for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]impl<C: PartialEq, F: PartialEq, A: PartialEq, V: PartialEq, H: PartialEq> PartialEq<TextBoxStyle<C, F, A, V, H>> for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]
impl<C: PartialEq, F: PartialEq, A: PartialEq, V: PartialEq, H: PartialEq> PartialEq<TextBoxStyle<C, F, A, V, H>> for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]fn eq(&self, other: &TextBoxStyle<C, F, A, V, H>) -> bool[src]
fn ne(&self, other: &TextBoxStyle<C, F, A, V, H>) -> bool[src]
impl<C, F, A, V, H> StructuralEq for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]
impl<C, F, A, V, H> StructuralEq for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]impl<C, F, A, V, H> StructuralPartialEq for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]
impl<C, F, A, V, H> StructuralPartialEq for TextBoxStyle<C, F, A, V, H> where
C: PixelColor,
F: Font + Copy, [src]Auto Trait Implementations
impl<C, F, A, V, H> RefUnwindSafe for TextBoxStyle<C, F, A, V, H> where
A: RefUnwindSafe,
C: RefUnwindSafe,
F: RefUnwindSafe,
H: RefUnwindSafe,
V: RefUnwindSafe,
impl<C, F, A, V, H> RefUnwindSafe for TextBoxStyle<C, F, A, V, H> where
A: RefUnwindSafe,
C: RefUnwindSafe,
F: RefUnwindSafe,
H: RefUnwindSafe,
V: RefUnwindSafe, impl<C, F, A, V, H> Send for TextBoxStyle<C, F, A, V, H> where
A: Send,
C: Send,
F: Send,
H: Send,
V: Send,
impl<C, F, A, V, H> Send for TextBoxStyle<C, F, A, V, H> where
A: Send,
C: Send,
F: Send,
H: Send,
V: Send, impl<C, F, A, V, H> Sync for TextBoxStyle<C, F, A, V, H> where
A: Sync,
C: Sync,
F: Sync,
H: Sync,
V: Sync,
impl<C, F, A, V, H> Sync for TextBoxStyle<C, F, A, V, H> where
A: Sync,
C: Sync,
F: Sync,
H: Sync,
V: Sync, impl<C, F, A, V, H> Unpin for TextBoxStyle<C, F, A, V, H> where
A: Unpin,
C: Unpin,
F: Unpin,
H: Unpin,
V: Unpin,
impl<C, F, A, V, H> Unpin for TextBoxStyle<C, F, A, V, H> where
A: Unpin,
C: Unpin,
F: Unpin,
H: Unpin,
V: Unpin, impl<C, F, A, V, H> UnwindSafe for TextBoxStyle<C, F, A, V, H> where
A: UnwindSafe,
C: UnwindSafe,
F: UnwindSafe,
H: UnwindSafe,
V: UnwindSafe,
impl<C, F, A, V, H> UnwindSafe for TextBoxStyle<C, F, A, V, H> where
A: UnwindSafe,
C: UnwindSafe,
F: UnwindSafe,
H: UnwindSafe,
V: UnwindSafe,