pub struct TextRasterizer {
cache: HashMap<(u64, u32), Arc<Frame>>,
families: Vec<String>,
loaded: bool,
db: Database,
fonts: HashMap<ID, Option<FontArc>>,
user_fonts: Vec<String>,
}Fields§
§cache: HashMap<(u64, u32), Arc<Frame>>§families: Vec<String>§loaded: bool§db: Database§fonts: HashMap<ID, Option<FontArc>>§user_fonts: Vec<String>User font file paths already loaded (or attempted), so repeat calls are cheap.
Implementations§
Source§impl TextRasterizer
impl TextRasterizer
Sourcepub fn new() -> Self
pub fn new() -> Self
Cheap; fonts load lazily (or via load_system_fonts from a background thread).
Sourcepub fn load_system_fonts(&mut self)
pub fn load_system_fonts(&mut self)
Scan system fonts (≈100 ms). Idempotent.
Sourcepub fn load_user_fonts(&mut self, paths: &[String])
pub fn load_user_fonts(&mut self, paths: &[String])
Load user font files (Settings.user_fonts) into the database. Idempotent: paths already
loaded (or that failed) are skipped on repeat calls.
fn refresh_families(&mut self)
pub fn is_loaded(&self) -> bool
Sourcepub fn render(&mut self, style: &TextStyle, scale: f32) -> Arc<Frame>
pub fn render(&mut self, style: &TextStyle, scale: f32) -> Arc<Frame>
Render style at scale. Never fails: unknown fonts fall back to any sans font; empty text
yields a 1×1 transparent frame.
fn font_for(&mut self, style: &TextStyle) -> Option<FontArc>
fn rasterize(&mut self, style: &TextStyle, scale: f32) -> Option<Frame>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextRasterizer
impl !RefUnwindSafe for TextRasterizer
impl Send for TextRasterizer
impl Sync for TextRasterizer
impl Unpin for TextRasterizer
impl !UnwindSafe for TextRasterizer
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
Mutably borrows from an owned value. Read more
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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