From 62d9174509059460262ce458b622d87d1562d406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20D=C3=BCrr?= Date: Sun, 24 Dec 2017 13:43:42 +0100 Subject: [PATCH] Use font_key provided with cursor glyphs Previously it was assumed that the font_key for the normal font is always 0, because this assumption was a bit of a stretch, now the font_key provided with the glyph is used. This is always the bold, italics or normal font associated with the cell. --- font/src/ft/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs index a4a118b..b46b008 100644 --- a/font/src/ft/mod.rs +++ b/font/src/ft/mod.rs @@ -298,7 +298,8 @@ impl FreeTypeRasterizer { match glyph_key.c { super::UNDERLINE_CURSOR_CHAR => { // Get the primary face metrics - let face = self.faces.get(&FontKey { token: 0 }).unwrap(); + // This always loads the default face + let face = self.faces.get(glyph_key.font_key)?; let size_metrics = face.ft_face .size_metrics() .ok_or(Error::MissingSizeMetrics)?; @@ -314,7 +315,8 @@ impl FreeTypeRasterizer { } super::BEAM_CURSOR_CHAR | super::BOX_CURSOR_CHAR => { // Get the primary face metrics - let face = self.faces.get(&FontKey { token: 0 }).unwrap(); + // This always loads the default face + let face = self.faces.get(glyph_key.font_key)?; let size_metrics = face.ft_face .size_metrics() .ok_or(Error::MissingSizeMetrics)?;