Struct wr_glyph_rasterizer::rasterizer::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 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.
§

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

§

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

§

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.