windows: Fix title bar font for Windows 10 (#13425)
This should fix the title bar font for Windows 10 as `Segoe Fluent Icons` is only for Windows 11 and Windows 10 should be using `Segoe MDL2 Assets`, I haven't tested this myself on a Windows 10 machine but the fonts work fine. Release Notes: - N/A
This commit is contained in:
parent
54afa6f69f
commit
2dee4f87fd
1 changed files with 20 additions and 1 deletions
|
@ -11,6 +11,25 @@ impl WindowsWindowControls {
|
||||||
pub fn new(button_height: Pixels) -> Self {
|
pub fn new(button_height: Pixels) -> Self {
|
||||||
Self { button_height }
|
Self { button_height }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn get_font() -> &'static str {
|
||||||
|
"Segoe Fluent Icons"
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn get_font() -> &'static str {
|
||||||
|
use windows::Wdk::System::SystemServices::RtlGetVersion;
|
||||||
|
|
||||||
|
let mut version = unsafe { std::mem::zeroed() };
|
||||||
|
let status = unsafe { RtlGetVersion(&mut version) };
|
||||||
|
|
||||||
|
if status.is_ok() && version.dwBuildNumber >= 22000 {
|
||||||
|
"Segoe Fluent Icons"
|
||||||
|
} else {
|
||||||
|
"Segoe MDL2 Assets"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderOnce for WindowsWindowControls {
|
impl RenderOnce for WindowsWindowControls {
|
||||||
|
@ -39,6 +58,7 @@ impl RenderOnce for WindowsWindowControls {
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.id("windows-window-controls")
|
.id("windows-window-controls")
|
||||||
|
.font_family(Self::get_font())
|
||||||
.flex()
|
.flex()
|
||||||
.flex_row()
|
.flex_row()
|
||||||
.justify_center()
|
.justify_center()
|
||||||
|
@ -110,7 +130,6 @@ impl RenderOnce for WindowsCaptionButton {
|
||||||
.content_center()
|
.content_center()
|
||||||
.w(width)
|
.w(width)
|
||||||
.h_full()
|
.h_full()
|
||||||
.font_family("Segoe Fluent Icons")
|
|
||||||
.text_size(px(10.0))
|
.text_size(px(10.0))
|
||||||
.hover(|style| style.bg(self.hover_background_color))
|
.hover(|style| style.bg(self.hover_background_color))
|
||||||
.active(|style| {
|
.active(|style| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue