[][src]Struct alacritty::renderer::GlyphCache

pub struct GlyphCache {
    cache: HashMap<GlyphKey, Glyph, BuildHasherDefault<FnvHasher>>,
    rasterizer: Rasterizer,
    font_key: FontKey,
    bold_key: FontKey,
    italic_key: FontKey,
    bold_italic_key: FontKey,
    font_size: Size,
    glyph_offset: Delta<i8>,
    metrics: Metrics,
}

Naïve glyph cache.

Currently only keyed by char, and thus not possible to hold different representations of the same code point.

Fields

cache: HashMap<GlyphKey, Glyph, BuildHasherDefault<FnvHasher>>

Cache of buffered glyphs.

rasterizer: Rasterizer

Rasterizer for loading new glyphs.

font_key: FontKey

Regular font.

bold_key: FontKey

Bold font.

italic_key: FontKey

Italic font.

bold_italic_key: FontKey

Bold italic font.

font_size: Size

Font size.

glyph_offset: Delta<i8>

Glyph offset.

metrics: Metrics

Font metrics.

Implementations

impl GlyphCache[src]

pub fn new<L>(
    rasterizer: Rasterizer,
    font: &Font,
    loader: &mut L
) -> Result<GlyphCache, Error> where
    L: LoadGlyph
[src]

fn load_glyphs_for_font<L: LoadGlyph>(&mut self, font: FontKey, loader: &mut L)[src]

fn compute_font_keys(
    font: &Font,
    rasterizer: &mut Rasterizer
) -> Result<(FontKey, FontKey, FontKey, FontKey), Error>
[src]

Computes font keys for (Regular, Bold, Italic, Bold Italic).

fn load_regular_font(
    rasterizer: &mut Rasterizer,
    description: &FontDesc,
    size: Size
) -> Result<FontKey, Error>
[src]

fn make_desc(desc: &FontDescription, slant: Slant, weight: Weight) -> FontDesc[src]

fn get<L>(
    &mut self,
    glyph_key: GlyphKey,
    loader: &mut L,
    show_missing: bool
) -> Glyph where
    L: LoadGlyph
[src]

Get a glyph from the font.

If the glyph has never been loaded before, it will be rasterized and inserted into the cache.

Errors

This will fail when the glyph could not be rasterized. Usually this is due to the glyph not being present in any font.

fn load_glyph<L>(&self, loader: &mut L, glyph: RasterizedGlyph) -> Glyph where
    L: LoadGlyph
[src]

Load glyph into the atlas.

This will apply all transforms defined for the glyph cache to the rasterized glyph before insertion.

pub fn clear_glyph_cache<L: LoadGlyph>(&mut self, loader: &mut L)[src]

Clear currently cached data in both GL and the registry.

pub fn update_font_size<L: LoadGlyph>(
    &mut self,
    font: &Font,
    dpr: f64,
    loader: &mut L
) -> Result<(), Error>
[src]

pub fn font_metrics(&self) -> Metrics[src]

fn load_common_glyphs<L: LoadGlyph>(&mut self, loader: &mut L)[src]

Prefetch glyphs that are almost guaranteed to be loaded anyways.

pub fn static_metrics(font: Font, dpr: f64) -> Result<Metrics, Error>[src]

Calculate font metrics without access to a glyph cache.

Auto Trait Implementations

impl !RefUnwindSafe for GlyphCache

impl Send for GlyphCache

impl !Sync for GlyphCache

impl Unpin for GlyphCache

impl !UnwindSafe for GlyphCache

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.