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

View File

@@ -10,6 +10,7 @@ use crate::{
EventListenerKind::{self, InternalStateChange, MouseLeave},
MouseWheelEvent,
},
globals::Globals,
layout::{Layout, LayoutState, WidgetID},
stack::{ScissorStack, TransformStack},
};
@@ -108,6 +109,7 @@ impl WidgetState {
// global draw params
pub struct DrawState<'a> {
pub globals: &'a Globals,
pub layout: &'a Layout,
pub primitives: &'a mut Vec<RenderPrimitive>,
pub transform_stack: &'a mut TransformStack,
@@ -151,6 +153,7 @@ pub trait WidgetObj: AnyTrait {
fn measure(
&mut self,
_globals: &Globals,
_known_dimensions: taffy::Size<Option<f32>>,
_available_space: taffy::Size<taffy::AvailableSpace>,
) -> taffy::Size<f32> {
@@ -181,11 +184,7 @@ impl EventResult {
#[must_use]
pub fn merge(self, other: Self) -> Self {
if self > other {
self
} else {
other
}
if self > other { self } else { other }
}
}