[−][src]Struct fontdue::Font
Represents a font. Fonts are immutable after creation and owns its own copy of the font data.
Methods
impl Font
[src]
pub fn from_bytes<Data: Deref<Target = [u8]>>(data: Data) -> FontResult<Font>
[src]
Constructs a font from an array of bytes.
pub fn metrics(&self, character: char, px: f32) -> Metrics
[src]
Retrieves the layout metrics for the given character. If the caracter isn't present in the font, then the layout for the font's default character is returned instead.
pub fn metrics_indexed(&self, index: usize, px: f32) -> Metrics
[src]
Retrieves the layout metrics at the given index. You normally want to be using metrics(char, f32) instead, unless your glyphs are pre-indexed.
pub fn rasterize(&mut self, character: char, px: f32) -> (Metrics, Vec<u8>)
[src]
Retrieves the layout metrics and rasterized bitmap for the given character. If the caracter isn't present in the font, then the layout and bitmap for the font's default character is returned instead.
pub fn rasterize_indexed(&mut self, index: usize, px: f32) -> (Metrics, Vec<u8>)
[src]
Retrieves the layout metrics and rasterized bitmap at the given index. You normally want to be using rasterize(char, f32) instead, unless your glyphs are pre-indexed.
pub fn lookup_glyph_index(&self, character: char) -> usize
[src]
Auto Trait Implementations
impl Unpin for Font
impl Send for Font
impl Sync for Font
impl UnwindSafe for Font
impl RefUnwindSafe for Font
Blanket Implementations
impl<T> From<T> for 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.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,