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: usizeThe current number of individual glyphs waiting in pending batches.
pending_glyph_jobs: usizeThe current number of glyph request jobs that have been kicked to worker threads.
glyph_request_count: usizeThe 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: boolImplementations§
Source§impl GlyphRasterizer
impl GlyphRasterizer
pub fn request_glyphs<F>( &mut self, font: FontInstance, glyph_keys: &[GlyphKey], handle: F, )
pub fn enable_multithreading(&mut self, enable: bool)
Sourcefn flush_glyph_requests(
&mut self,
font: FontInstance,
glyphs: SmallVec<[GlyphKey; 16]>,
use_workers: bool,
)
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).
pub fn resolve_glyphs<F, G>(&mut self, handle: F, profile: &mut G)
Source§impl GlyphRasterizer
impl GlyphRasterizer
pub fn new( workers: Arc<ThreadPool>, dedicated_thread: Option<GlyphRasterThread>, can_use_r8_format: bool, ) -> Self
pub fn add_font(&mut self, font_key: FontKey, template: FontTemplate)
pub fn delete_font(&mut self, font_key: FontKey)
pub fn delete_fonts(&mut self, font_keys: &[FontKey])
pub fn delete_font_instance(&mut self, instance: &FontInstance)
pub fn prepare_font(&self, font: &mut FontInstance)
pub fn has_font(&self, font_key: FontKey) -> bool
Sourcepub fn template_has_bitmap_strikes(&self, template: &FontTemplate) -> bool
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.
pub fn get_glyph_dimensions( &mut self, font: &FontInstance, glyph_index: GlyphIndex, ) -> Option<GlyphDimensions>
pub fn get_glyph_index(&mut self, font_key: FontKey, ch: char) -> Option<u32>
fn remove_dead_fonts(&mut self)
Auto Trait Implementations§
impl !RefUnwindSafe for GlyphRasterizer
impl !UnwindSafe for GlyphRasterizer
impl Freeze for GlyphRasterizer
impl Send for GlyphRasterizer
impl Sync for GlyphRasterizer
impl Unpin for GlyphRasterizer
impl UnsafeUnpin for GlyphRasterizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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