Compare commits

...

3 Commits

Author SHA1 Message Date
mars 89f51bd6a5 Draw strikeout cells 2022-10-04 17:28:50 -06:00
mars f024522675 Inverse, underlined, and hidden cells 2022-10-04 17:23:26 -06:00
mars e7b61d2275 Switch to 16-pixel Terminus 2022-10-04 16:53:11 -06:00
5 changed files with 62467 additions and 73287 deletions

View File

@ -21,7 +21,7 @@ use winit::event::{Event, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::{Window, WindowBuilder};
static FONT_DATA: &[u8] = include_bytes!("ter-u20n.bdf");
static FONT_DATA: &[u8] = include_bytes!("ter-u16n.bdf");
pub struct TermListener {
sender: Sender<TermEvent>,
@ -174,7 +174,13 @@ impl App {
let mut missing_chars = std::collections::HashSet::new();
use alacritty_terminal::term::cell::Flags as CellFlags;
for cell in content.display_iter.into_iter() {
if cell.flags.contains(CellFlags::HIDDEN) {
continue;
}
if let Some(glyph) = self.font.glyphs().get(&cell.c) {
let term_row = cell.point.line.0 as usize;
let term_col = cell.point.column.0 as usize;
@ -185,13 +191,20 @@ impl App {
continue;
}
let bg = self.color_to_u32(&cell.bg);
let fg = self.color_to_u32(&cell.fg);
let (bg, fg) = if cell.flags.contains(CellFlags::INVERSE) {
(&cell.fg, &cell.bg)
} else {
(&cell.bg, &cell.fg)
};
let mut px_row = term_row * width * self.cell_height;
let bg = self.color_to_u32(&bg);
let fg = self.color_to_u32(&fg);
let px_row = term_row * width * self.cell_height;
let px_start = px_row + term_col * self.cell_width;
for y in 0..self.cell_height {
let px_start = px_row + term_col * self.cell_width;
let px_start = px_start + y * width;
for x in 0..self.cell_width {
let color = if glyph.get(x as u32, y as u32) {
fg
@ -201,8 +214,22 @@ impl App {
buffer[px_start + x as usize] = color;
}
}
if cell.flags.contains(CellFlags::STRIKEOUT) {
let px_start = px_start + (self.cell_height >> 1) * width;
px_row += width;
for x in 0..self.cell_width {
buffer[px_start + x as usize] = fg;
}
}
if cell.flags.contains(CellFlags::UNDERLINE) {
let px_start = px_start + (self.cell_height - 1) * width;
for x in 0..self.cell_width {
buffer[px_start + x as usize] = fg;
}
}
} else {
missing_chars.insert(cell.c);
@ -219,7 +246,8 @@ impl App {
if (term_row + 1) * self.cell_height < height && (term_col + 1) * self.cell_width < width {
let mut px_row = term_row * width * self.cell_height + term_col * self.cell_width;
let cursor_color = 0x00ff00ff;
let cursor_color = Color::Named(NamedColor::Foreground);
let cursor_color = self.color_to_u32(&cursor_color);
use alacritty_terminal::ansi::CursorShape;
match content.cursor.shape {

31216
src/ter-u16b.bdf Normal file

File diff suppressed because it is too large Load Diff

31216
src/ter-u16n.bdf Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff