Struct riddle_font::ImgFontGenerator[][src]

pub struct ImgFontGenerator { /* fields omitted */ }

A utility for generating ImgFonts from TTFonts.

Example

let ttf_font = TTFont::load(&font_bytes[..])?;

let img_font = ImgFontGenerator::new("ABCDEF", 32).generate(&ttf_font)?;

assert_eq!(6, img_font.glyphs().len());

Implementations

impl ImgFontGenerator[src]

pub fn new(chars: &str, pixel_height: u32) -> Self[src]

Create a new generator, specifying the set of characters to generate and the pixel height at which the font will be rendered.

pub fn packing_size_policy(
    &mut self,
    policy: ImagePackerSizePolicy
) -> &mut Self
[src]

Override the packing rule which controls how the individual glyph images are combined in to the final image. See riddle_image::packer::ImagePackerSizePolicy.

The default is riddle_image::packer::ImagePackerSizePolicy::Pow2Square.

pub fn generate(&self, ttfont: &TTFont) -> Result<ImgFont, FontError>[src]

Build the ImgFont for the given TTFont using the parameters specified in the generator.

Trait Implementations

impl Clone for ImgFontGenerator[src]

impl Default for ImgFontGenerator[src]

Auto Trait Implementations

impl RefUnwindSafe for ImgFontGenerator

impl Send for ImgFontGenerator

impl Sync for ImgFontGenerator

impl Unpin for ImgFontGenerator

impl UnwindSafe for ImgFontGenerator

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.