Skip to main content

GlyphRasterizer

Struct GlyphRasterizer 

Source
pub struct GlyphRasterizer {
Show 14 fields workers: Arc<ThreadPool>, font_contexts: Arc<FontContexts>, dedicated_thread: Option<GlyphRasterThread>, fonts: FastHashSet<FontKey>, pending_glyph_count: usize, pending_glyph_jobs: usize, glyph_request_count: usize, pending_glyph_requests: FastHashMap<FontInstance, SmallVec<[GlyphKey; 16]>>, glyph_rx: Receiver<GlyphRasterJob>, glyph_tx: Sender<GlyphRasterJob>, fonts_to_remove: Vec<FontKey>, font_instances_to_remove: Vec<FontInstance>, enable_multithreading: bool, can_use_r8_format: bool,
}

Fields§

§workers: Arc<ThreadPool>§font_contexts: Arc<FontContexts>§dedicated_thread: Option<GlyphRasterThread>§fonts: FastHashSet<FontKey>

The current set of loaded fonts.

§pending_glyph_count: usize

The current number of individual glyphs waiting in pending batches.

§pending_glyph_jobs: usize

The current number of glyph request jobs that have been kicked to worker threads.

§glyph_request_count: usize

The number of glyphs requested this frame.

§pending_glyph_requests: FastHashMap<FontInstance, SmallVec<[GlyphKey; 16]>>

A map of current glyph request batches.

§glyph_rx: Receiver<GlyphRasterJob>§glyph_tx: Sender<GlyphRasterJob>§fonts_to_remove: Vec<FontKey>§font_instances_to_remove: Vec<FontInstance>§enable_multithreading: bool§can_use_r8_format: bool

Implementations§

Source§

impl GlyphRasterizer

Source

pub fn request_glyphs<F>( &mut self, font: FontInstance, glyph_keys: &[GlyphKey], handle: F, )
where F: FnMut(&GlyphKey) -> bool,

Source

pub fn enable_multithreading(&mut self, enable: bool)

Source

fn flush_glyph_requests( &mut self, font: FontInstance, glyphs: SmallVec<[GlyphKey; 16]>, use_workers: bool, )

Internal method to flush a list of glyph requests to a set of worker threads, or process on this thread if there isn’t much work to do (in which case the overhead of processing these on a thread is unlikely to be a performance win).

Source

pub fn resolve_glyphs<F, G>(&mut self, handle: F, profile: &mut G)

Source§

impl GlyphRasterizer

Source

pub fn new( workers: Arc<ThreadPool>, dedicated_thread: Option<GlyphRasterThread>, can_use_r8_format: bool, ) -> Self

Source

pub fn add_font(&mut self, font_key: FontKey, template: FontTemplate)

Source

pub fn delete_font(&mut self, font_key: FontKey)

Source

pub fn delete_fonts(&mut self, font_keys: &[FontKey])

Source

pub fn delete_font_instance(&mut self, instance: &FontInstance)

Source

pub fn prepare_font(&self, font: &mut FontInstance)

Source

pub fn has_font(&self, font_key: FontKey) -> bool

Source

pub fn template_has_bitmap_strikes(&self, template: &FontTemplate) -> bool

Returns whether the font template contains embedded bitmap strikes. Intended to be called once per font at add time on the render backend thread so the result can be cached for lock-free lookup during frame building. The detection consults the shared font cache directly rather than a worker FontContext, so it does not take a worker mutex.

Source

pub fn get_glyph_dimensions( &mut self, font: &FontInstance, glyph_index: GlyphIndex, ) -> Option<GlyphDimensions>

Source

pub fn get_glyph_index(&mut self, font_key: FontKey, ch: char) -> Option<u32>

Source

fn remove_dead_fonts(&mut self)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.