MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / load_default

Method load_default

src/renderer.rs:190–204  ·  view source on GitHub ↗

Load the default font. Stored outside the cache and never evicted.

(asset: &'static FontAsset)

Source from the content-addressed store, hash-verified

188
189 /// Load the default font. Stored outside the cache and never evicted.
190 pub async fn load_default(asset: &'static FontAsset) {
191 let font = match asset {
192 FontAsset::Bytes { data, .. } => {
193 macroquad::text::load_ttf_font_from_bytes(data)
194 .expect("Failed to load font from bytes")
195 }
196 FontAsset::Path(path) => {
197 let resolved = resolve_asset_path(path);
198 macroquad::text::load_ttf_font(resolved).await
199 .unwrap_or_else(|e| panic!("Failed to load font '{}': {:?}", path, e))
200 }
201 };
202 let mut fm = FONT_MANAGER.lock().unwrap();
203 fm.default_font = Some(DefaultFont { key: asset.key(), font });
204 }
205
206 /// Ensure a font is loaded (no-op if already cached).
207 pub async fn ensure(asset: &'static FontAsset) {

Callers

nothing calls this directly

Calls 2

resolve_asset_pathFunction · 0.85
keyMethod · 0.80

Tested by

no test coverage detected