[−][src]Struct alacritty::renderer::GlyphCache
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]
rasterizer: Rasterizer,
font: &Font,
loader: &mut L
) -> Result<GlyphCache, Error> where
L: LoadGlyph,
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]
font: &Font,
rasterizer: &mut Rasterizer
) -> Result<(FontKey, FontKey, FontKey, FontKey), Error>
Computes font keys for (Regular, Bold, Italic, Bold Italic).
fn load_regular_font(
rasterizer: &mut Rasterizer,
description: &FontDesc,
size: Size
) -> Result<FontKey, Error>
[src]
rasterizer: &mut Rasterizer,
description: &FontDesc,
size: Size
) -> Result<FontKey, Error>
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]
&mut self,
glyph_key: GlyphKey,
loader: &mut L,
show_missing: bool
) -> Glyph where
L: LoadGlyph,
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]
L: LoadGlyph,
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]
&mut self,
font: &Font,
dpr: f64,
loader: &mut L
) -> Result<(), Error>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,