forked from 1b-agent/opencadstudio-upstream
Follow the system UI font face
Detect the desktop's configured interface font and use its family for all application UI text, instead of iced's generic sans-serif. - sys::ui_font reads the setting per platform: GNOME/Cinnamon/MATE gsettings, KDE kdeglobals, Xfce xfconf, the XDG Settings portal, GTK settings.ini and a Fontconfig fallback on Linux; the non-client message font (SystemParametersInfoForDpi at 96 DPI) on Windows; the AppKit system font on macOS. - ui_font::apply remaps generic sans-serif in iced's shared font database to that family. iced's Font::DEFAULT is sans-serif, so every widget, canvas text, bold/italic variant and ribbon measurement follows it with no call-site changes. A family that is not installed (or a generic alias) keeps iced's own choice. The font's weight and style are ignored. - Live updates: portal SettingChanged on Linux, a 2 s poll on Windows. A change bumps the font-system version so laid-out text reshapes, and iced::font::set_defaults relays out every window; ribbon large-button widths re-measure. Without a portal, Linux needs a restart; macOS has no user-adjustable UI font. - Monospaced text, drawing text (own cosmic-text font systems) and the web build's font loading are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bec9e63679
commit
62175f4ed5
10 files changed
+1134
-7
No files matched your search
@@ -2460,6 +2460,10 @@ pub enum Message {
|
||||
ApplyWebFont(crate::scene::text::web_font::Script),
|
||||
/// Completion of the UI renderer's runtime font registration.
|
||||
WebUiFontLoaded(crate::scene::text::web_font::Script, Result<(), String>),
|
||||
/// The desktop reported (or a poll may have found) a UI-font change.
|
||||
UiFontSettingsChanged,
|
||||
/// A re-read of the desktop UI font finished.
|
||||
UiFontDetected(Option<crate::sys::ui_font::SystemUiFont>),
|
||||
/// Ctrl+V. Routed by `update` into an open text editor, the drawing-object
|
||||
/// clipboard, or the system text clipboard.
|
||||
PasteShortcut,
|
||||
@@ -5551,6 +5555,9 @@ use std::path::PathBuf;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn run() -> iced::Result {
|
||||
// UI text follows the desktop's interface font: generic sans-serif, iced's
|
||||
// default font, is remapped to it before the first window opens.
|
||||
crate::sys::ui_font::apply(crate::sys::ui_font::detect().as_ref());
|
||||
iced::daemon(
|
||||
OpenCADStudio::boot,
|
||||
OpenCADStudio::update,
|
||||
|
||||
Reference in new issue
Block a user