Struct embedded_graphics::fonts::font_builder::FontBuilder
source · pub struct FontBuilder<'a, C: PixelColor, Conf> {
pub pos: Coord,
/* private fields */
}
Expand description
The font builder
Fields
pos: Coord
Top left corner of the text
Trait Implementations
sourceimpl<'a, C: PixelColor + Clone, Conf> Clone for FontBuilder<'a, C, Conf>
impl<'a, C: PixelColor + Clone, Conf> Clone for FontBuilder<'a, C, Conf>
sourceimpl<'a, C: Debug + PixelColor, Conf: Debug> Debug for FontBuilder<'a, C, Conf>
impl<'a, C: Debug + PixelColor, Conf: Debug> Debug for FontBuilder<'a, C, Conf>
sourceimpl<'a, C, Conf> Font<'a, C> for FontBuilder<'a, C, Conf>where
C: PixelColor,
Conf: FontBuilderConf,
impl<'a, C, Conf> Font<'a, C> for FontBuilder<'a, C, Conf>where
C: PixelColor,
Conf: FontBuilderConf,
sourcefn render_str(text: &'a str) -> Self
fn render_str(text: &'a str) -> Self
Render a string in the implementing font’s typeface. Read more
sourcefn dimensions(&self) -> UnsignedCoord
fn dimensions(&self) -> UnsignedCoord
Get the dimensions of a piece of text rendered in a particular font
sourceimpl<'a, C, Conf> IntoIterator for &'a FontBuilder<'a, C, Conf>where
C: PixelColor,
Conf: FontBuilderConf,
impl<'a, C, Conf> IntoIterator for &'a FontBuilder<'a, C, Conf>where
C: PixelColor,
Conf: FontBuilderConf,
sourceimpl<'a, C, Conf> Transform for FontBuilder<'a, C, Conf>where
C: PixelColor,
impl<'a, C, Conf> Transform for FontBuilder<'a, C, Conf>where
C: PixelColor,
sourcefn translate(&self, by: Coord) -> Self
fn translate(&self, by: Coord) -> Self
Translate the image from its current position to a new position by (x, y) pixels, returning
a new Font8x16
. For a mutating transform, see translate_mut
.
// 8px x 1px test image
let text = Font8x16::render_str("Hello world")
let moved = text.translate(Coord::new(25, 30));
assert_eq!(text.pos, Coord::new(0, 0));
assert_eq!(moved.pos, Coord::new(25, 30));
sourcefn translate_mut(&mut self, by: Coord) -> &mut Self
fn translate_mut(&mut self, by: Coord) -> &mut Self
Translate the font origin from its current position to a new position by (x, y) pixels.
// 8px x 1px test image
let mut text = Font8x16::render_str("Hello world")
text.translate_mut(Coord::new(25, 30));
assert_eq!(text.pos, Coord::new(25, 30));
sourceimpl<'a, C, Conf> WithStyle<C> for FontBuilder<'a, C, Conf>where
C: PixelColor,
impl<'a, C, Conf> WithStyle<C> for FontBuilder<'a, C, Conf>where
C: PixelColor,
sourcefn with_style(self, style: Style<C>) -> Self
fn with_style(self, style: Style<C>) -> Self
Add a complete style to the object
sourcefn with_stroke(self, color: Option<C>) -> Self
fn with_stroke(self, color: Option<C>) -> Self
Set the stroke colour for the object Read more
sourcefn with_stroke_width(self, _width: u8) -> Self
fn with_stroke_width(self, _width: u8) -> Self
Set the stroke width for the object Read more
impl<'a, C: PixelColor + Copy, Conf> Copy for FontBuilder<'a, C, Conf>
impl<'a, C, Conf> Drawable for FontBuilder<'a, C, Conf>where
C: PixelColor,
Auto Trait Implementations
impl<'a, C, Conf> RefUnwindSafe for FontBuilder<'a, C, Conf>where
C: RefUnwindSafe,
Conf: RefUnwindSafe,
impl<'a, C, Conf> Send for FontBuilder<'a, C, Conf>where
C: Send,
Conf: Send,
impl<'a, C, Conf> Sync for FontBuilder<'a, C, Conf>where
C: Sync,
Conf: Sync,
impl<'a, C, Conf> Unpin for FontBuilder<'a, C, Conf>where
C: Unpin,
Conf: Unpin,
impl<'a, C, Conf> UnwindSafe for FontBuilder<'a, C, Conf>where
C: UnwindSafe,
Conf: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more