Add super hacky underline drawing

Using underscores because it's easy. It's also wrong.

cc #11
This commit is contained in:
Joe Wilm 2016-12-29 16:05:32 -05:00
parent d06360216d
commit 818a2f6161
1 changed files with 19 additions and 3 deletions

View File

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