From b0f7a9d7979d07948fb366e29d29d7a7c4891bec Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 20 Feb 2019 17:44:35 -0800 Subject: [PATCH] inching towards sane emoji rendering with glutin frontend --- src/config.rs | 6 ++++++ src/font/ftfont.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index df3c348ec..d017ad307 100644 --- a/src/config.rs +++ b/src/config.rs @@ -195,6 +195,12 @@ impl TextStyle { } fn add_fallback(&mut self) { + #[cfg(target_os = "macos")] + self.font.push(FontAttributes { + family: "Apple Color Emoji".into(), + bold: None, + italic: None, + }); #[cfg(target_os = "macos")] self.font.push(FontAttributes { family: "Apple Symbols".into(), diff --git a/src/font/ftfont.rs b/src/font/ftfont.rs index 120e77afc..18ccc98ff 100644 --- a/src/font/ftfont.rs +++ b/src/font/ftfont.rs @@ -83,7 +83,7 @@ impl FreeTypeFontImpl { #[cfg(debug_assertions)] text: codepoint.to_string(), cluster: 0, - num_cells: 1, + num_cells: unicode_width::UnicodeWidthChar::width(codepoint).unwrap_or(1) as u8, font_idx: 0, glyph_pos, x_advance: (metrics.horiAdvance as f64 / 64.0).into(),