diff options
| -rw-r--r-- | installer-downloader/src/winapi_impl/mod.rs | 8 | ||||
| -rw-r--r-- | installer-downloader/src/winapi_impl/ui.rs | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/installer-downloader/src/winapi_impl/mod.rs b/installer-downloader/src/winapi_impl/mod.rs index fe755009da..0627c59569 100644 --- a/installer-downloader/src/winapi_impl/mod.rs +++ b/installer-downloader/src/winapi_impl/mod.rs @@ -8,7 +8,13 @@ mod ui; pub fn main() { nwg::init().expect("Failed to init Native Windows GUI"); - nwg::Font::set_global_family("Segoe UI").expect("Failed to set default font"); + let mut global_font = nwg::Font::default(); + nwg::FontBuilder::new() + .family("Segoe UI") + .size_absolute(ui::FONT_HEIGHT) + .build(&mut global_font) + .unwrap(); + nwg::Font::set_global_default(Some(global_font)); // Load "global" values and resources let environment = match Environment::load() { diff --git a/installer-downloader/src/winapi_impl/ui.rs b/installer-downloader/src/winapi_impl/ui.rs index daf04ce5b7..b9502d0036 100644 --- a/installer-downloader/src/winapi_impl/ui.rs +++ b/installer-downloader/src/winapi_impl/ui.rs @@ -20,6 +20,9 @@ use crate::resource::{ use super::delegate::QueueContext; +/// Font height +pub const FONT_HEIGHT: u32 = 16; + static BANNER_IMAGE_DATA: &[u8] = include_bytes!("../../assets/logo-icon.png"); static BANNER_TEXT_IMAGE_DATA: &[u8] = include_bytes!("../../assets/logo-text.png"); static ERROR_IMAGE_DATA: &[u8] = include_bytes!("../../assets/alert-circle.png"); @@ -473,6 +476,8 @@ fn create_link_font() -> Result<&'static nwg::Font, nwg::NwgError> { // SAFETY: Trivially safe. `LOGFONTW` is a C struct let mut logfont: LOGFONTW = unsafe { std::mem::zeroed() }; logfont.lfUnderline = 1; + logfont.lfHeight = -i32::try_from(FONT_HEIGHT).unwrap(); + for (dest, src) in logfont.lfFaceName.iter_mut().zip(face_name) { *dest = src; } |
