pub struct FigletBuilder { /* private fields */ }Expand description
Fluent builder for Figlet renderers.
Construct via FigletBuilder::new and chain configuration methods
(#[must_use]); terminate with FigletBuilder::build to obtain a
reusable Figlet, or use FigletBuilder::render as a one-shot.
use rusty_figlet::{FigletBuilder, Font};
let figlet = FigletBuilder::new()
.font(Font::Standard)
.width(80)
.build()
.expect("build");
let _banner = figlet.render("X").expect("render");Implementations§
Source§impl FigletBuilder
impl FigletBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a builder with all defaults:
- font:
Font::Standard(resolves tostandard.flf) - width: 80 columns
- layout: font-default
- justify: font-default
Sourcepub fn font(self, font: Font) -> Self
pub fn font(self, font: Font) -> Self
Select a font.
When font is one of the 12 bundled variants, build
resolves the embedded .flf bytes via include_bytes!. When font
is Font::External, the supplied path is resolved at build()
time. Default: Font::Standard.
Sourcepub fn font_bytes(self, bytes: &[u8]) -> Self
pub fn font_bytes(self, bytes: &[u8]) -> Self
Supply raw .flf bytes directly (no filesystem access; FR-052 +
FR-056). Overrides any prior font call.
Sourcepub fn font_dirs(self, dirs: Vec<PathBuf>) -> Self
pub fn font_dirs(self, dirs: Vec<PathBuf>) -> Self
Add an extra directory to search for Font::External resolutions
(CLI -d <dir> counterpart per FR-010). Repeatable; directories are
searched in the order added. Has no effect on bundled or
font_bytes sources.
Sourcepub fn kerning(self) -> Self
pub fn kerning(self) -> Self
Force horizontal kerning (-k CLI counterpart).
Overrides the font’s default layout. Last layout-override wins.
Sourcepub fn full_width(self) -> Self
pub fn full_width(self) -> Self
Force full-width layout (-W CLI counterpart).
Overrides the font’s default layout. Last layout-override wins.
Sourcepub fn smush(self) -> Self
pub fn smush(self) -> Self
Force smushing per the font’s smush bits (-S CLI counterpart).
Overrides the font’s default layout. Last layout-override wins.
Sourcepub fn layout(self, flags: LayoutFlags) -> Self
pub fn layout(self, flags: LayoutFlags) -> Self
Apply a full sequence of layout-class flag occurrences with
last-wins semantics (FR-023). When non-empty, this sequence
supersedes any per-method kerning /
full_width / smush
override.
use rusty_figlet::{FigletBuilder, LayoutFlag, LayoutFlags};
let flags = LayoutFlags {
flags: vec![LayoutFlag::FullWidth, LayoutFlag::Kerning],
};
let _ = FigletBuilder::new().layout(flags);Sourcepub fn justify(self, j: Justify) -> Self
pub fn justify(self, j: Justify) -> Self
Set the justification mode. Default: font’s print-direction default.
Trait Implementations§
Source§impl Clone for FigletBuilder
impl Clone for FigletBuilder
Source§fn clone(&self) -> FigletBuilder
fn clone(&self) -> FigletBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more