Struct riddle_font::ImgFontBuilder [−][src]
pub struct ImgFontBuilder { /* fields omitted */ }
A utility to construct an ImgFont
given an image and a collection of glyph data.
Example
let img = Image::new(64, 64); let mut img_font_builder = ImgFontBuilder::new(); img_font_builder.vertical_spacing(32); img_font_builder.with_glyph(ImgFontGlyph { character: 'a', rect: Some(Rect::new([0,0], [32, 32])), horizontal_spacing: 32, .. Default::default() }); let img_font = img_font_builder.build(img); assert_eq!(128, img_font.render_simple("aaaa")?.width());
Implementations
impl ImgFontBuilder
[src]
pub fn new() -> Self
[src]
Construct a new builder.
pub fn vertical_spacing(&mut self, spacing: u32) -> &mut Self
[src]
Set the vertical spacing of the font. See ImgFont::vertical_spacing
.
pub fn with_glyph(&mut self, glyph: ImgFontGlyph) -> &mut Self
[src]
Register a glyph with the font. If more that one glyph is added with the same value for
ImgFontGlyph::character
the last one added will be the one that is respected.
pub fn build(self, img: Image) -> ImgFont
[src]
Take ownership of the given image, and finalize building of the ImgFont
.
Trait Implementations
impl Clone for ImgFontBuilder
[src]
fn clone(&self) -> ImgFontBuilder
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ImgFontBuilder
[src]
impl Default for ImgFontBuilder
[src]
fn default() -> ImgFontBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for ImgFontBuilder
impl Send for ImgFontBuilder
impl Sync for ImgFontBuilder
impl Unpin for ImgFontBuilder
impl UnwindSafe for ImgFontBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,