pub struct Font {
pub asset_id: AssetId,
pub path: String,
pub size_px: u32,
pub locator: Option<PayloadLocator>,
}Expand description
Rasterises a TrueType font into a glyph atlas at build time.
Reference a Font by name from a TextLabel. Declaring one is optional: text naming no Font draws with the engine’s built-in face at 24px, and compiles no atlas at all. Declare a Font to pick the face, or to pick the size the glyphs are rasterised at.
An empty path rasterises that same built-in face, which is how to get it at
a different size_px.
Font {
path: "assets/fonts/JetBrainsMono-Regular.ttf".into(),
size_px: 20,
..Default::default()
};Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
path: StringPath to the TTF file, relative to the project root.
size_px: u32Rasterisation size in pixels. Determines the rendered glyph height.
locator: Option<PayloadLocator>Filled by inject_locator after the build step packs the payload.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Font
impl<'de> Deserialize<'de> for Font
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl ResourceAsset for Font
Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnsafeUnpin for Font
impl UnwindSafe for Font
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