diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index 153b3db6d..519c0f807 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -418,7 +418,12 @@ pub fn font_definitions_with(language: crate::i18n::Language, used: &[String]) - let paths = candidates(role); let refs: Vec<(&str, u32)> = paths.iter().map(|(p, i)| (p.as_str(), *i)).collect(); let mut chain: Vec = Vec::new(); - if let Some(fd) = try_load(&refs) { + if let Some(mut fd) = try_load(&refs) { + // Helvetica Neue Bold's own TrueType hints close Cyrillic е into ө at 13 pt on a Retina + // screen (#1184). Core Text never runs them, so this draws it the way macOS does. + if cfg!(target_os = "macos") && role == UI_BOLD { + fd.tweak.hinting = Some(false); + } let key = format!("sys-{role}"); fonts.font_data.insert(key.clone(), Arc::new(fd)); chain.push(key); @@ -1045,4 +1050,19 @@ mod tests { assert_eq!(*a, epaint_default_fonts::UBUNTU_LIGHT); assert!(try_load(&[(p.as_str(), 3)]).is_none(), "a face the kept file doesn't have is still refused"); } + + #[test] + fn macos_bold_interface_face_is_drawn_unhinted() { + // #1184: Helvetica Neue Bold's own TrueType hints close Cyrillic е into ө at 13 pt on a + // Retina screen. Core Text never runs them, so on macOS the face goes unhinted like every + // other app draws it; the regular face and the other platforms keep egui's default. + let fonts = font_definitions_for_language(Language::En); + let hinting = |key: &str| fonts.font_data.get(key).map(|fd| fd.tweak.hinting); + if let Some(bold) = hinting(&format!("sys-{UI_BOLD}")) { + assert_eq!(bold, if cfg!(target_os = "macos") { Some(false) } else { None }); + } + if let Some(regular) = hinting(&format!("sys-{UI}")) { + assert_eq!(regular, None, "only the bold face is affected"); + } + } }