pub struct FontCx {
pub context: FontContext,
/* private fields */
}Expand description
A font database and cache, used for font family resolution and text layout.
This resource is a wrapper around parley::FontContext.
Fields§
§context: FontContextA font database/cache (wrapper around a Fontique Collection and SourceCache).
Implementations§
Source§impl FontCx
impl FontCx
Sourcepub fn get_family<'a>(&'a mut self, source: &'a FontSource) -> Option<&'a str>
pub fn get_family<'a>(&'a mut self, source: &'a FontSource) -> Option<&'a str>
Get the family name associated with a FontSource.
If the FontSource is a Handle, returns None. The family name can be found by using the handle to look
up the Font asset instead.
Sourcepub fn set_generic_family(
&mut self,
generic: GenericFamily,
family_name: &str,
) -> Result<(), TextError>
pub fn set_generic_family( &mut self, generic: GenericFamily, family_name: &str, ) -> Result<(), TextError>
Sets the fallback font for a given generic family.
In most cases, these methods do not need to called manually,
as parley::fontique will automatically select appropriate default fonts based on available system fonts.
Note that the parley/system feature must be enabled to allow automatic system font discovery.
These methods will return an error if the provided family name does not already exist in the font collection.
Sourcepub fn set_serif_family(&mut self, family_name: &str) -> Result<(), TextError>
pub fn set_serif_family(&mut self, family_name: &str) -> Result<(), TextError>
Sets the serif generic family mapping.
Sourcepub fn set_sans_serif_family(
&mut self,
family_name: &str,
) -> Result<(), TextError>
pub fn set_sans_serif_family( &mut self, family_name: &str, ) -> Result<(), TextError>
Sets the sans-serif generic family mapping.
Sourcepub fn set_cursive_family(&mut self, family_name: &str) -> Result<(), TextError>
pub fn set_cursive_family(&mut self, family_name: &str) -> Result<(), TextError>
Sets the cursive generic family mapping.
Sourcepub fn set_fantasy_family(&mut self, family_name: &str) -> Result<(), TextError>
pub fn set_fantasy_family(&mut self, family_name: &str) -> Result<(), TextError>
Sets the fantasy generic family mapping.
Sourcepub fn set_monospace_family(
&mut self,
family_name: &str,
) -> Result<(), TextError>
pub fn set_monospace_family( &mut self, family_name: &str, ) -> Result<(), TextError>
Sets the monospace generic family mapping.
Sourcepub fn set_system_ui_family(
&mut self,
family_name: &str,
) -> Result<(), TextError>
pub fn set_system_ui_family( &mut self, family_name: &str, ) -> Result<(), TextError>
Sets the system-ui generic family mapping.
Sourcepub fn set_ui_serif_family(
&mut self,
family_name: &str,
) -> Result<(), TextError>
pub fn set_ui_serif_family( &mut self, family_name: &str, ) -> Result<(), TextError>
Sets the ui-serif generic family mapping.
Sourcepub fn set_ui_sans_serif_family(
&mut self,
family_name: &str,
) -> Result<(), TextError>
pub fn set_ui_sans_serif_family( &mut self, family_name: &str, ) -> Result<(), TextError>
Sets the ui-sans-serif generic family mapping.
Sourcepub fn set_ui_monospace_family(
&mut self,
family_name: &str,
) -> Result<(), TextError>
pub fn set_ui_monospace_family( &mut self, family_name: &str, ) -> Result<(), TextError>
Sets the ui-monospace generic family mapping.
Sourcepub fn set_ui_rounded_family(
&mut self,
family_name: &str,
) -> Result<(), TextError>
pub fn set_ui_rounded_family( &mut self, family_name: &str, ) -> Result<(), TextError>
Sets the ui-rounded generic family mapping.
Sourcepub fn set_emoji_family(&mut self, family_name: &str) -> Result<(), TextError>
pub fn set_emoji_family(&mut self, family_name: &str) -> Result<(), TextError>
Sets the emoji generic family mapping.
Sourcepub fn set_math_family(&mut self, family_name: &str) -> Result<(), TextError>
pub fn set_math_family(&mut self, family_name: &str) -> Result<(), TextError>
Sets the math generic family mapping.
Sourcepub fn set_fang_song_family(
&mut self,
family_name: &str,
) -> Result<(), TextError>
pub fn set_fang_song_family( &mut self, family_name: &str, ) -> Result<(), TextError>
Sets the fangsong generic family mapping.
Sourcepub fn restore_generic_families(&mut self)
pub fn restore_generic_families(&mut self)
Call after clearing the font Collection to restore the generic family mappings.
Trait Implementations§
Source§impl Component for FontCx
impl Component for FontCx
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreimpl Resource for FontCx
Auto Trait Implementations§
impl !RefUnwindSafe for FontCx
impl !UnwindSafe for FontCx
impl Freeze for FontCx
impl Send for FontCx
impl Sync for FontCx
impl Unpin for FontCx
impl UnsafeUnpin for FontCx
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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
Source§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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 more