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
+7 -2
View File
@@ -198,7 +198,7 @@ fn add_child_internal(
pub struct LayoutCommon<'a> {
alterables: EventAlterables,
layout: &'a mut Layout,
pub layout: &'a mut Layout,
}
impl LayoutCommon<'_> {
@@ -564,6 +564,8 @@ impl Layout {
log::debug!("re-computing layout, size {}x{}", size.x, size.y);
self.prev_size = size;
let globals = self.state.globals.get();
self.state.tree.compute_layout_with_measure(
self.tree_root_node,
taffy::Size {
@@ -583,7 +585,10 @@ impl Layout {
None => taffy::Size::ZERO,
Some(h) => {
if let Some(w) = self.state.widgets.get(*h) {
w.0.borrow_mut().obj.measure(known_dimensions, available_space)
w.0
.borrow_mut()
.obj
.measure(&globals, known_dimensions, available_space)
} else {
taffy::Size::ZERO
}