pub struct FontLoadOptions {
pub mode: FontLoadMode,
pub external_dirs: Vec<PathBuf>,
pub asset_paths: Vec<SharedString>,
pub embedded_fonts: Vec<EmbeddedFont>,
pub required_families: Vec<SharedString>,
}Expand description
Options used by load_app_fonts to combine embedded and mounted fonts.
Fields§
§mode: FontLoadModeResource selection policy.
external_dirs: Vec<PathBuf>External directories scanned recursively for supported font files.
asset_paths: Vec<SharedString>Font asset paths resolved through the current GPUI gpui::AssetSource.
embedded_fonts: Vec<EmbeddedFont>Embedded fallback fonts bundled into the executable.
required_families: Vec<SharedString>Family names that must be visible after loading.
This is stronger than checking FontLoadReport.loaded: a GPUI backend can
accept bytes and still fail to expose a family if the file format is not
supported on that platform.
Implementations§
Source§impl FontLoadOptions
impl FontLoadOptions
Sourcepub fn new(mode: FontLoadMode) -> Self
pub fn new(mode: FontLoadMode) -> Self
Creates an option set for the supplied resource mode.
Sourcepub fn external_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn external_dir(self, dir: impl Into<PathBuf>) -> Self
Adds a recursively scanned external font directory.
Sourcepub fn asset_path(self, path: impl Into<SharedString>) -> Self
pub fn asset_path(self, path: impl Into<SharedString>) -> Self
Adds a GPUI asset path such as "fonts/PingFangSC-Regular.ttf".
Sourcepub fn embedded(
self,
name: impl Into<SharedString>,
bytes: impl Into<Cow<'static, [u8]>>,
) -> Self
pub fn embedded( self, name: impl Into<SharedString>, bytes: impl Into<Cow<'static, [u8]>>, ) -> Self
Adds one embedded font file to the fallback set.
Sourcepub fn require_family(self, family: impl Into<SharedString>) -> Self
pub fn require_family(self, family: impl Into<SharedString>) -> Self
Requires a family name to be visible after loading completes.
ExternalThenEmbedded uses this list to decide whether external files
really satisfied the selected typography. If an external source returns
Ok(()) but the family is still absent, embedded fallback fonts are tried
before the final report is produced.
Trait Implementations§
Source§impl Clone for FontLoadOptions
impl Clone for FontLoadOptions
Source§fn clone(&self) -> FontLoadOptions
fn clone(&self) -> FontLoadOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FontLoadOptions
impl Debug for FontLoadOptions
Source§impl Default for FontLoadOptions
impl Default for FontLoadOptions
Source§fn default() -> FontLoadOptions
fn default() -> FontLoadOptions
Auto Trait Implementations§
impl Freeze for FontLoadOptions
impl RefUnwindSafe for FontLoadOptions
impl Send for FontLoadOptions
impl Sync for FontLoadOptions
impl Unpin for FontLoadOptions
impl UnsafeUnpin for FontLoadOptions
impl UnwindSafe for FontLoadOptions
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().