Trait speedy2d::font::TextLayout[][src]

pub trait TextLayout {
    fn lookup_glyph_for_codepoint(&self, codepoint: char) -> Option<FontGlyph>;

#[must_use]    fn layout_text(
        &self,
        text: &str,
        scale: f32,
        options: TextOptions
    ) -> Rc<FormattedTextBlock>
    where
        Self: Sized
, { ... }
#[must_use] fn layout_text_from_unindexed_codepoints(
        &self,
        unindexed_codepoints: &[char],
        scale: f32,
        options: TextOptions
    ) -> Rc<FormattedTextBlock>
    where
        Self: Sized
, { ... }
#[must_use] fn layout_text_from_codepoints(
        &self,
        codepoints: &[Codepoint],
        scale: f32,
        options: TextOptions
    ) -> Rc<FormattedTextBlock>
    where
        Self: Sized
, { ... } }

Objects implementing this trait are able to lay out text, ready for rendering.

Required methods

fn lookup_glyph_for_codepoint(&self, codepoint: char) -> Option<FontGlyph>[src]

Returns the glyph corresponding to the provided codepoint. If the glyph cannot be found, None is returned.

Loading content...

Provided methods

#[must_use]fn layout_text(
    &self,
    text: &str,
    scale: f32,
    options: TextOptions
) -> Rc<FormattedTextBlock> where
    Self: Sized
[src]

Lays out a block of text with the specified scale and options. The result may be passed to Graphics2D::draw_text.

As the string undergoes normalization before being laid out, the user_index of each FormattedGlyph is undefined. To gain control over the user_index field, consider using either layout_text_line_from_codepoints() or layout_text_line_from_unindexed_codepoints().

#[must_use]fn layout_text_from_unindexed_codepoints(
    &self,
    unindexed_codepoints: &[char],
    scale: f32,
    options: TextOptions
) -> Rc<FormattedTextBlock> where
    Self: Sized
[src]

Lays out a block of text with the specified scale and options. The result may be passed to Graphics2D::draw_text.

The user_index field of each FormattedGlyph will be set to the location of the input codepoint in unindexed_codepoints, starting from zero.

#[must_use]fn layout_text_from_codepoints(
    &self,
    codepoints: &[Codepoint],
    scale: f32,
    options: TextOptions
) -> Rc<FormattedTextBlock> where
    Self: Sized
[src]

Lays out a block of text with the specified scale and options. The result may be passed to Graphics2D::draw_text.

The user_index field of each FormattedGlyph will be set to the user_index of the corresponding Codepoint.

Loading content...

Implementors

Loading content...