From 818a2f6161a718f8f9762a972a5c42e756ccff51 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Thu, 29 Dec 2016 16:05:32 -0500 Subject: Add super hacky underline drawing Using underscores because it's easy. It's also wrong. cc #11 --- src/renderer/mod.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 79cfd665..54db4851 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -753,9 +753,25 @@ impl<'a> RenderApi<'a> { }; // Add cell to batch if glyph available - if let Some(glyph) = glyph_cache.get(&glyph_key, self) { - self.add_render_item(&cell, glyph); - } + glyph_cache.get(&glyph_key, self) + .map(|glyph| self.add_render_item(&cell, glyph)) + .and_then(|_| { + // FIXME This is a super hacky way to do underlined text. During + // a time crunch to release 0.1, this seemed like a really + // easy, clean hack. + if cell.flags.contains(cell::UNDERLINE) { + let glyph_key = GlyphKey { + font_key: font_key, + size: glyph_cache.font_size, + c: '_' + }; + + glyph_cache.get(&glyph_key, self) + } else { + None + } + }) + .map(|underscore| self.add_render_item(&cell, underscore)); } } } -- cgit v1.2.3-54-g00ecf