pub struct TextSettings { /* private fields */ }Expand description
Immutable size, shaping policy, and budgets of one registered font.
Logical size is pixels per em, not a promise that every glyph has that height. Labels using a registration share this size and direction. Register another font configuration when a second size is needed. Display DPI is selected by the desktop runner; it never changes logical text metrics.
Engine budget types here are configuration values, not renderer resources. Font bytes must come from a trusted application asset. Dependency parsing and shaping are not an untrusted-font sandbox or an OS OOM guarantee.
Implementations§
Source§impl TextSettings
impl TextSettings
Sourcepub fn new(logical_em_size: f32) -> Result<Self, TextError>
pub fn new(logical_em_size: f32) -> Result<Self, TextError>
Creates a positive normal logical em size with the remaining defaults.
Non-finite, non-positive, or subnormal sizes return an error. Creation is headless and does not rasterize or allocate an atlas.
Sourcepub const fn with_direction(self, direction: TextDirection) -> Self
pub const fn with_direction(self, direction: TextDirection) -> Self
Selects a single-run shaping direction; this is not bidi paragraph layout.
Sourcepub const fn with_font_budget(self, budget: FontBudget) -> Self
pub const fn with_font_budget(self, budget: FontBudget) -> Self
Replaces per-font source-capacity and declared-glyph limits. Application-wide source limits still apply independently.
Sourcepub const fn with_layout_budget(self, budget: TextLayoutBudget) -> Self
pub const fn with_layout_budget(self, budget: TextLayoutBudget) -> Self
Replaces per-label input/output and per-glyph rasterization work limits. Zero limits are valid. A label exceeding a limit is rejected atomically.
Sourcepub const fn with_atlas_budget(self, budget: TextAtlasBudget) -> Self
pub const fn with_atlas_budget(self, budget: TextAtlasBudget) -> Self
Replaces fixed desktop atlas and per-run capacities.
This stores an already validated configuration without allocating GPU resources. Device dimensions and raster fit are checked on desktop use.
Sourcepub const fn logical_em_size(self) -> f32
pub const fn logical_em_size(self) -> f32
Returns the fixed logical-pixel em size shared by this registration.
Sourcepub const fn direction(self) -> TextDirection
pub const fn direction(self) -> TextDirection
Returns the requested direction for one horizontal shaping run.
Sourcepub const fn font_budget(self) -> FontBudget
pub const fn font_budget(self) -> FontBudget
Returns limits applied when taking ownership of font source bytes.
Sourcepub const fn layout_budget(self) -> TextLayoutBudget
pub const fn layout_budget(self) -> TextLayoutBudget
Returns limits applied to each changed label and rasterized glyph.
Sourcepub const fn atlas_budget(self) -> TextAtlasBudget
pub const fn atlas_budget(self) -> TextAtlasBudget
Returns the fixed physical atlas dimensions and per-run capacities.
Sourcepub fn with_atlas_limits(
self,
limits: TextAtlasLimits,
) -> Result<Self, TextError>
pub fn with_atlas_limits( self, limits: TextAtlasLimits, ) -> Result<Self, TextError>
Sets GPU-independent atlas/run configuration. Validation failure preserves self.
Available with both headless-text and text; desktop conversion is checked.
Sourcepub const fn atlas_limits(self) -> TextAtlasLimits
pub const fn atlas_limits(self) -> TextAtlasLimits
Returns the GPU-independent atlas/run configuration used by CPU label validation.
Sourcepub fn style(self, scale: f32) -> Result<TextStyle, TextError>
pub fn style(self, scale: f32) -> Result<TextStyle, TextError>
Creates Engine’s style for an explicit physical-pixels-per-logical scale.
A headless caller can use 1.0; desktop presentation uses actual DPI.
Invalid or unrepresentable physical size returns a typed font error.
This creates a value only and performs no GPU operation.
Trait Implementations§
Source§impl Clone for TextSettings
impl Clone for TextSettings
impl Copy for TextSettings
Source§impl Debug for TextSettings
impl Debug for TextSettings
Source§impl Default for TextSettings
impl Default for TextSettings
Source§impl PartialEq for TextSettings
impl PartialEq for TextSettings
impl StructuralPartialEq for TextSettings
Auto Trait Implementations§
impl Freeze for TextSettings
impl RefUnwindSafe for TextSettings
impl Send for TextSettings
impl Sync for TextSettings
impl Unpin for TextSettings
impl UnsafeUnpin for TextSettings
impl UnwindSafe for TextSettings
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromTemplate for T
impl<T> FromTemplate for T
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> 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> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.