summaryrefslogtreecommitdiffstats
path: root/font/src/ft
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2019-04-20 22:47:05 +0000
committerGitHub <noreply@github.com>2019-04-20 22:47:05 +0000
commit0d060d5d801e3abb55035269138d819d38fc175b (patch)
tree7e5e6a390aa57ff8caafc782b2371634c906b3c9 /font/src/ft
parent371d13f8ef95157c97f7de9964bcbc89d4a8e930 (diff)
Fix cursor colors
This fixes a recent regression in cfc20d4f34dca535654cc32df18e785296af4cc5 which broke cursor colors when specified in the `colors.cursor` field in the config. It also removes a lot of unneeded code from the font crate related to the cursor rendering. This fixes #2338.
Diffstat (limited to 'font/src/ft')
-rw-r--r--font/src/ft/mod.rs60
1 files changed, 8 insertions, 52 deletions
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index bc6d6d89..d1765a5d 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -45,17 +45,14 @@ impl fmt::Debug for Face {
.field("ft_face", &self.ft_face)
.field("key", &self.key)
.field("load_flags", &self.load_flags)
- .field(
- "render_mode",
- &match self.render_mode {
- freetype::RenderMode::Normal => "Normal",
- freetype::RenderMode::Light => "Light",
- freetype::RenderMode::Mono => "Mono",
- freetype::RenderMode::Lcd => "Lcd",
- freetype::RenderMode::LcdV => "LcdV",
- freetype::RenderMode::Max => "Max",
- },
- )
+ .field("render_mode", &match self.render_mode {
+ freetype::RenderMode::Normal => "Normal",
+ freetype::RenderMode::Light => "Light",
+ freetype::RenderMode::Mono => "Mono",
+ freetype::RenderMode::Lcd => "Lcd",
+ freetype::RenderMode::LcdV => "LcdV",
+ freetype::RenderMode::Max => "Max",
+ })
.field("lcd_filter", &self.lcd_filter)
.finish()
}
@@ -313,47 +310,6 @@ impl FreeTypeRasterizer {
}
fn get_rendered_glyph(&mut self, glyph_key: GlyphKey) -> Result<RasterizedGlyph, Error> {
- // Render a custom symbol for the underline and beam cursor
- match glyph_key.c {
- super::UNDERLINE_CURSOR_CHAR => {
- // Get the primary face metrics
- // This always loads the default face
- let full = self.full_metrics(glyph_key.font_key)?;
-
- // Get the bottom of the bounding box
- let descent = (full.size_metrics.descender / 64) as i32;
-
- // Get the width of the cell
- let width = full.cell_width as i32;
-
- // Return the new custom glyph
- return super::get_underline_cursor_glyph(descent, width);
- },
- super::BEAM_CURSOR_CHAR | super::BOX_CURSOR_CHAR => {
- // Get the primary face metrics
- // This always loads the default face
- let full = self.full_metrics(glyph_key.font_key)?;
-
- // Get the height of the cell
- let height = (full.size_metrics.height / 64) as i32;
-
- // Get the top of the bounding box
- let descent = (full.size_metrics.descender / 64) as i32;
- let ascent = height + descent;
-
- // Get the width of the cell
- let width = full.cell_width as i32;
-
- // Return the new custom glyph
- return if glyph_key.c == super::BEAM_CURSOR_CHAR {
- super::get_beam_cursor_glyph(ascent, height, width)
- } else {
- super::get_box_cursor_glyph(ascent, height, width)
- };
- },
- _ => (),
- }
-
// Render a normal character if it's not a cursor
let font_key = self.face_for_glyph(glyph_key, false)?;
let face = &self.faces[&font_key];