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

@@ -8,9 +8,9 @@ use crate::{
animation::{Animation, AnimationEasing},
components::{Component, ComponentBase, ComponentTrait, InitData},
drawing::Color,
event::{CallbackDataCommon, EventAlterables, EventListenerCollection, EventListenerID, EventListenerKind},
event::{CallbackDataCommon, EventListenerCollection, EventListenerID, EventListenerKind},
i18n::Translation,
layout::{self, LayoutState, WidgetID, WidgetPair},
layout::{self, WidgetID, WidgetPair},
renderer_vk::text::{FontWeight, TextStyle},
widget::{
ConstructEssentials, EventResult,
@@ -53,6 +53,7 @@ struct State {
#[allow(clippy::struct_field_names)]
struct Data {
#[allow(dead_code)]
id_container: WidgetID, // Rectangle, transparent if not hovered
//id_outer_box: WidgetID, // Rectangle, parent of container

View File

@@ -17,6 +17,7 @@ pub struct InitData<'a> {
// common component data
#[derive(Default)]
pub struct ComponentBase {
#[allow(dead_code)]
lhandles: Vec<EventListenerID>,
}

View File

@@ -53,7 +53,8 @@ struct State {
}
struct Data {
body: WidgetID, // Div
#[allow(dead_code)]
body: WidgetID, // Div
slider_handle_rect_id: WidgetID, // Rectangle
slider_text_id: WidgetID, // Text
slider_handle_node: taffy::NodeId,