add WguiFontSystem, remove FONT_SYSTEM singleton, custom fonts, add Light font weight

there are a few gzip-compressed ttf as for now, looks like variable fonts aren't parsed properly by cosmic_text. Not sure why. Also, we probably need to have a fallback for CJK characters in the future, or just fallback to the built-in ones in the OS.
This commit is contained in:
Aleksander
2025-11-07 22:21:57 +01:00
parent d2c23ac6a9
commit 71898056f3
33 changed files with 202 additions and 65 deletions
+2
View File
@@ -5,6 +5,7 @@ use crate::{
use glam::Vec2;
use wgui::{
assets::AssetPath,
font_config::WguiFontConfig,
globals::WguiGlobals,
layout::{LayoutParams, RcLayout},
parser::{ParseDocumentParams, ParserState},
@@ -24,6 +25,7 @@ impl TestbedAny {
let globals = WguiGlobals::new(
Box::new(assets::Asset {}),
wgui::globals::Defaults::default(),
&WguiFontConfig::default(),
)?;
let (layout, state) = wgui::parser::new_layout_from_assets(
+3 -1
View File
@@ -8,11 +8,12 @@ use glam::Vec2;
use wgui::{
assets::AssetPath,
components::{
Component,
button::{ButtonClickCallback, ComponentButton},
checkbox::ComponentCheckbox,
Component,
},
drawing::Color,
font_config::WguiFontConfig,
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, LayoutParams, RcLayout, Widget},
@@ -76,6 +77,7 @@ impl TestbedGeneric {
let globals = WguiGlobals::new(
Box::new(assets::Asset {}),
wgui::globals::Defaults::default(),
&WguiFontConfig::default(),
)?;
let extra = ParseDocumentExtra {