From cfcfdda54037dbd9762a777e162345540fca9fba Mon Sep 17 00:00:00 2001 From: Mohammad AlSaleh Date: Fri, 19 Jan 2024 00:27:44 +0300 Subject: [PATCH] Don't set `monospace_em_width` on Emoji fonts "Noto Color Emoji" reports itself as a Monospace font. But resizing glyphs from such a font to fit a certain width may make emojis look rather small. So avoid font resizing with such fonts by not setting `monospace_em_width`. Fixes pop-os/cosmic-term#69. Signed-off-by: Mohammad AlSaleh --- src/font/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/font/mod.rs b/src/font/mod.rs index 25dbf9b7b7..3cd589f51e 100644 --- a/src/font/mod.rs +++ b/src/font/mod.rs @@ -80,8 +80,8 @@ impl Font { let (monospace_em_width, unicode_codepoints) = { db.with_face_data(id, |font_data, face_index| { let face = ttf_parser::Face::parse(font_data, face_index).ok()?; - let monospace_em_width = info - .monospaced + let is_monospace = info.monospaced && !info.post_script_name.contains("Emoji"); + let monospace_em_width = is_monospace .then(|| { let hor_advance = face.glyph_hor_advance(face.glyph_index(' ')?)? as f32; let upem = face.units_per_em() as f32; @@ -89,7 +89,7 @@ impl Font { }) .flatten(); - if info.monospaced && monospace_em_width.is_none() { + if is_monospace && monospace_em_width.is_none() { None?; }