From 23d1949acdaea00c67a59d73a3da875d5f7847f5 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 2 Oct 2021 09:48:46 -0700 Subject: [PATCH] fonts: fixup win32 build refs #1189 --- wezterm-font/src/locator/gdi.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wezterm-font/src/locator/gdi.rs b/wezterm-font/src/locator/gdi.rs index f7e9c7d9d..8909f3310 100644 --- a/wezterm-font/src/locator/gdi.rs +++ b/wezterm-font/src/locator/gdi.rs @@ -137,6 +137,7 @@ fn handle_from_descriptor( attr: &FontAttributes, collection: &dwrote::FontCollection, descriptor: &FontDescriptor, + pixel_size: u16, ) -> Option { let font = collection.get_font_from_descriptor(&descriptor)?; let face = font.create_font_face(); @@ -146,7 +147,7 @@ fn handle_from_descriptor( log::debug!("{} -> {}", family_name, path.display()); let source = FontDataSource::OnDisk(path); - match best_matching_font(&source, attr, FontOrigin::DirectWrite) { + match best_matching_font(&source, attr, FontOrigin::DirectWrite, pixel_size) { Ok(Some(parsed)) => { return Some(parsed); } @@ -187,7 +188,7 @@ impl FontLocator for GdiFontLocator { } } - match handle_from_descriptor(font_attr, &collection, &descriptor) { + match handle_from_descriptor(font_attr, &collection, &descriptor, pixel_size) { Some(handle) => { log::debug!("Got {:?} from dwrote", handle); if try_handle(font_attr, handle, &mut fonts, loaded) { @@ -283,9 +284,12 @@ impl FontLocator for GdiFontLocator { resolved.insert(attr.clone()); let descriptor = attributes_to_descriptor(&attr); - if let Some(handle) = - handle_from_descriptor(&attr, &collection, &descriptor) - { + if let Some(handle) = handle_from_descriptor( + &attr, + &collection, + &descriptor, + 16, /* pixel_size: irrelevant really as we kinda want a scalable font for fallback */ + ) { handles.push(handle); } }