From 91b56abb3a3a751b143be96de01c92f1b9c8b096 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 27 Oct 2019 15:20:18 -0700 Subject: [PATCH] confirmed that the descender emoji thing is macos specific so let's avoid doing it on linux and windows --- src/font/ftfont.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/font/ftfont.rs b/src/font/ftfont.rs index 4b399b49f..200784805 100644 --- a/src/font/ftfont.rs +++ b/src/font/ftfont.rs @@ -249,12 +249,16 @@ impl Font for FreeTypeFontImpl { bearing_x: (f64::from(ft_glyph.bitmap_left) * (dest_width as f64 / width as f64)), - // Fudge alert: this may be font specific, but I've found + // Fudge alert: this is font specific: I've found // that the emoji font on macOS doesn't account for the // descender in its metrics, so we're adding that offset // here to avoid rendering the glyph too high - bearing_y: descender - + (f64::from(ft_glyph.bitmap_top) * (dest_height as f64 / height as f64)), + bearing_y: if cfg!(target_os = "macos") { + descender + } else { + 0. + } + (f64::from(ft_glyph.bitmap_top) + * (dest_height as f64 / height as f64)), } } ftwrap::FT_Pixel_Mode::FT_PIXEL_MODE_GRAY => {