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.
This commit is contained in:
Christian Dürr 2017-12-24 13:43:42 +01:00 committed by Joe Wilm
parent 645100cf5f
commit 62d9174509
1 changed files with 4 additions and 2 deletions

View File

@ -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)?;