From bb4a922930ef5d69bc1b0b28844fed13074bd946 Mon Sep 17 00:00:00 2001 From: nick black Date: Tue, 22 Jun 2021 04:48:44 -0400 Subject: [PATCH] handle KDFONTOP response, set up copy range better #1726 --- src/lib/termdesc.c | 5 ++--- src/poc/linuxconsole.c | 40 ++++++++++++++-------------------------- 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index cec0fd7a3e..3b7ba0b88b 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -246,9 +246,8 @@ apply_term_heuristics(tinfo* ti, const char* termname, int fd, termname = "Linux console"; ti->caps.braille = false; // no caps.braille, no caps.sextants in linux console // FIXME if the NCOPTION_NO_FONT_CHANGES, this isn't true - // FIXME we probably want to do this based off ioctl()s in linux.c - // FIXME until #1726 is fixed this definitely is not happening - ti->caps.quadrants = false; // we program caps.quadrants on the console + // FIXME we probably want to ID based off ioctl()s in linux.c + ti->caps.quadrants = true; // we program caps.quadrants on the console } // run a wcwidth(⣿) to guarantee libc Unicode 3 support, independent of term if(wcwidth(L'⣿') < 0){ diff --git a/src/poc/linuxconsole.c b/src/poc/linuxconsole.c index 6c1592c2f4..7cc44c42cc 100644 --- a/src/poc/linuxconsole.c +++ b/src/poc/linuxconsole.c @@ -64,6 +64,10 @@ get_linux_colormap(int fd){ return 0; } +// each row is laid out as bytes, one bit per pixel, rounded up to the +// lowest sufficient number of bytes. each character is thus +// +// height * rowbytes, where rowbytes = width + 7 / 8 static int explode_glyph_row(const unsigned char** row, unsigned width){ unsigned char mask = 0x80; @@ -103,33 +107,17 @@ get_linux_consolefont(int fd, unsigned showglyphs){ return -1; } if(showglyphs){ - for(unsigned i = 0 ; i < cfo.charcount ; i += 7){ - const unsigned char* g1 = (unsigned char*)cfo.data + 32 * i; - const unsigned char* g2 = g1 + 32; - const unsigned char* g3 = g2 + 32; - const unsigned char* g4 = g3 + 32; - const unsigned char* g5 = g4 + 32; - const unsigned char* g6 = g5 + 32; - const unsigned char* g7 = g6 + 32; + // FIXME get real screen width + const int atonce = 80 / (cfo.width + 1); + const int Bper = 64; + const unsigned char* g[atonce]; + for(unsigned i = 0 ; i < cfo.charcount ; i += atonce){ + for(int o = 0 ; o < atonce ; ++o){ + g[o] = (unsigned char*)cfo.data + Bper * (i + o); + } for(unsigned row = 0 ; row < cfo.height ; ++row){ - explode_glyph_row(&g1, cfo.width); - if(i < cfo.charcount - 1u){ - explode_glyph_row(&g2, cfo.width); - if(i < cfo.charcount - 2u){ - explode_glyph_row(&g3, cfo.width); - if(i < cfo.charcount - 3u){ - explode_glyph_row(&g4, cfo.width); - if(i < cfo.charcount - 4u){ - explode_glyph_row(&g5, cfo.width); - if(i < cfo.charcount - 5u){ - explode_glyph_row(&g6, cfo.width); - if(i < cfo.charcount - 6u){ - explode_glyph_row(&g7, cfo.width); - } - } - } - } - } + for(int o = 0 ; o < atonce ; ++o){ + explode_glyph_row(&g[o], cfo.width); } printf("\n"); }