[][src]Struct fontdue::Font

pub struct Font { /* fields omitted */ }

Represents a font. Fonts are immutable after creation and owns its own copy of the font data.

Implementations

impl Font[src]

pub fn from_bytes<Data: Deref<Target = [u8]>>(
    data: Data,
    _: FontSettings
) -> FontResult<Font>
[src]

Constructs a font from an array of bytes.

pub fn horizontal_line_metrics(&self, px: f32) -> Option<LineMetrics>[src]

The new line height for the font. Only populated for fonts with vertical text layout metrics. None if unpopulated.

pub fn vertical_line_metrics(&self, px: f32) -> Option<LineMetrics>[src]

The new line height for the font. Only populated for fonts with horizontal text layout metrics. None if unpopulated.

pub fn metrics(&self, character: char, px: f32, offset: 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.

Arguments

  • index - The character in the font to to generate the layout metrics for.
  • px - The size to generate the layout metrics for the character at.
  • offset - The horizontal offset to generate the layout metrics for the character at. An offset of 0.0 applies no offsetting.

pub fn metrics_indexed(&self, index: usize, px: f32, offset: 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.

Arguments

  • index - The glyph index in the font to to generate the layout metrics for.
  • px - The size to generate the layout metrics for the glyph at.
  • offset - The horizontal offset to generate the layout metrics for the glyph at. An offset of 0.0 applies no offsetting.

pub fn rasterize_config(&self, config: GlyphRasterConfig) -> (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.

Arguments

  • character - The character to rasterize.
  • px - The size to render the character at.
  • offset - The horizontal offset to render the character at. An offset of 0.0 applies no offsetting.

pub fn rasterize(
    &self,
    character: char,
    px: f32,
    offset: 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.

Arguments

  • character - The character to rasterize.
  • px - The size to render the character at.
  • offset - The horizontal offset to render the character at. An offset of 0.0 applies no offsetting.

pub fn rasterize_indexed(
    &self,
    index: usize,
    px: f32,
    offset: 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.

Arguments

  • index - The glyph index in the font to rasterize.
  • px - The size to render the character at.
  • offset - The horizontal offset to render the glyph at. An offset of 0.0 applies no offsetting.

pub fn lookup_glyph_index(&self, character: char) -> usize[src]

Finds the internal glyph index for the given character. If the character is not present in the font then 0 is returned.

Auto Trait Implementations

impl Send for Font

impl Sync for Font

impl Unpin for Font

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, 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.