Struct FontCatalog
pub struct FontCatalog { /* private fields */ }Implementations§
§impl FontCatalog
impl FontCatalog
pub fn product( root: impl Into<PathBuf>, locale: impl Into<String>, ) -> FontCatalog
pub fn controlled_fixture( root: impl Into<PathBuf>, locale: impl Into<String>, ) -> FontCatalog
pub fn root(&self) -> &Path
pub fn locale(&self) -> &str
pub fn load(&self) -> Result<FontSystem, FontCatalogError>
pub fn load_bytes(
&self,
bytes: impl FnMut(&str) -> Option<Vec<u8>>,
) -> Result<FontSystem, FontCatalogError>
pub fn load_bytes( &self, bytes: impl FnMut(&str) -> Option<Vec<u8>>, ) -> Result<FontSystem, FontCatalogError>
Load canonical assets from host-provided bytes, with no filesystem or ambient fonts. Every asset is size/hash/face validated before a font system is returned.
§Errors
Rejects missing, corrupt, or mismatched assets.
pub fn load_browser_startup_bytes(
&self,
bytes: impl FnMut(&str) -> Option<(Vec<u8>, String)>,
) -> Result<FontSystem, FontCatalogError>
pub fn load_browser_startup_bytes( &self, bytes: impl FnMut(&str) -> Option<(Vec<u8>, String)>, ) -> Result<FontSystem, FontCatalogError>
Load the canonical core families required before a browser can mount. Script, symbol, math, and emoji assets remain absent until shaping reports demand and the host supplies their verified bytes.
bytes gives each asset’s bytes with the lowercase hex SHA-256 the
page computed for them, checked as in Self::install_browser_asset:
hashing them again here held back the first frame.
§Errors
Rejects a missing startup asset, or one whose digest is not the pinned one.
pub fn install_browser_asset(
&self,
system: &mut FontSystem,
name: &str,
data: Vec<u8>,
sha256: &str,
) -> Result<bool, FontCatalogError>
pub fn install_browser_asset( &self, system: &mut FontSystem, name: &str, data: Vec<u8>, sha256: &str, ) -> Result<bool, FontCatalogError>
Validate and add one canonical optional browser asset to a live font
system. Returns false when the exact asset faces are already present.
sha256 is the lowercase hex SHA-256 of data as the page computed it
with the browser’s native, asynchronous digest; it is checked against
the digest compiled into this build. Hashing the bytes again here held
the page’s main thread for about 350 ms a font. Bytes of another size
cannot carry the pinned digest, and the page’s loader has refused
them already, so the size is not compared again here.
§Errors
Rejects unknown names, a digest other than the pinned one, or mismatched face metadata.
Trait Implementations§
§impl Clone for FontCatalog
impl Clone for FontCatalog
§fn clone(&self) -> FontCatalog
fn clone(&self) -> FontCatalog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for FontCatalog
impl RefUnwindSafe for FontCatalog
impl Send for FontCatalog
impl Sync for FontCatalog
impl Unpin for FontCatalog
impl UnsafeUnpin for FontCatalog
impl UnwindSafe for FontCatalog
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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>
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