Struct font::Font [] [src]

pub struct Font {
    pub units_per_em: usize,
    pub ascender: Number,
    pub descender: Number,
    pub case: Box<Case>,
}

A font.

Fields

units_per_em: usize

The number of units per em.

ascender: Number

The ascender line relative to the base line.

descender: Number

The descender line relative to the base line.

case: Box<Case>

The collection of glyphs.

Methods from Deref<Target=Box<Case>>

fn downcast<T>(self) -> Result<Box<T>, Box<Any + 'static>> where T: Any
1.0.0

Attempt to downcast the box to a concrete type.

Examples

use std::any::Any;

fn print_if_string(value: Box<Any>) {
    if let Ok(string) = value.downcast::<String>() {
        println!("String ({}): {}", string.len(), string);
    }
}

fn main() {
    let my_string = "Hello World".to_string();
    print_if_string(Box::new(my_string));
    print_if_string(Box::new(0i8));
}

fn downcast<T>(self) -> Result<Box<T>, Box<Any + 'static + Send>> where T: Any
1.0.0

Attempt to downcast the box to a concrete type.

Examples

use std::any::Any;

fn print_if_string(value: Box<Any + Send>) {
    if let Ok(string) = value.downcast::<String>() {
        println!("String ({}): {}", string.len(), string);
    }
}

fn main() {
    let my_string = "Hello World".to_string();
    print_if_string(Box::new(my_string));
    print_if_string(Box::new(0i8));
}

Trait Implementations

impl Deref for Font
[src]

type Target = Box<Case>

The resulting type after dereferencing

fn deref(&self) -> &Self::Target

The method called to dereference a value