From 575c366960d9fc23bd743d3ff6fc87b7bfb0714b Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 13 Jul 2020 23:09:31 -0400 Subject: [PATCH] linux console: we've got some hats now, motherfuckers #201 --- src/lib/linux.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/lib/linux.c b/src/lib/linux.c index 2f6de9228..f30a004f3 100644 --- a/src/lib/linux.c +++ b/src/lib/linux.c @@ -132,6 +132,67 @@ shim_lower_right_quad(struct consolefontdesc* cfd, unsigned idx){ return 0; } +static int +shim_no_upper_left_quad(struct consolefontdesc* cfd, unsigned idx){ + unsigned char* glyph = get_glyph(cfd, idx); + if(glyph == NULL){ + return -1; + } + for(unsigned r = 0 ; r < cfd->charheight / 2 ; ++r, ++glyph){ + *glyph = 0x0f; + } + for(unsigned r = cfd->charheight / 2 ; r < cfd->charheight ; ++r, ++glyph){ + *glyph = 0xff; + } + return 0; +} + +static int +shim_no_upper_right_quad(struct consolefontdesc* cfd, unsigned idx){ + unsigned char* glyph = get_glyph(cfd, idx); + if(glyph == NULL){ + return -1; + } + for(unsigned r = 0 ; r < cfd->charheight / 2 ; ++r, ++glyph){ + *glyph = 0xf0; + } + for(unsigned r = cfd->charheight / 2 ; r < cfd->charheight ; ++r, ++glyph){ + *glyph = 0xff; + } + return 0; +} + +static int +shim_no_lower_left_quad(struct consolefontdesc* cfd, unsigned idx){ + unsigned char* glyph = get_glyph(cfd, idx); + if(glyph == NULL){ + return -1; + } + for(unsigned r = 0 ; r < cfd->charheight / 2 ; ++r, ++glyph){ + *glyph = 0xff; + } + for(unsigned r = cfd->charheight / 2 ; r < cfd->charheight ; ++r, ++glyph){ + *glyph = 0x0f; + } + return 0; +} + +static int +shim_no_lower_right_quad(struct consolefontdesc* cfd, unsigned idx){ + unsigned char* glyph = get_glyph(cfd, idx); + if(glyph == NULL){ + return -1; + } + for(unsigned r = 0 ; r < cfd->charheight / 2 ; ++r, ++glyph){ + *glyph = 0xff; + } + for(unsigned r = cfd->charheight / 2 ; r < cfd->charheight ; ++r, ++glyph){ + *glyph = 0xf0; + } + return 0; +} + +// P // add UCS2 codepoint |w| to |map| for font idx |fidx| static int add_to_map(const notcurses* nc, struct unimapdesc* map, wchar_t w, unsigned fidx){ @@ -241,6 +302,10 @@ program_block_drawing_chars(const notcurses* nc, struct consolefontdesc* cfd, { .glyphfxn = shim_upper_right_quad, .w = L'▝', .found = false, }, { .glyphfxn = shim_lower_left_quad, .w = L'▖', .found = false, }, { .glyphfxn = shim_lower_right_quad, .w = L'▗', .found = false, }, + { .glyphfxn = shim_no_upper_left_quad, .w = L'▟', .found = false, }, + { .glyphfxn = shim_no_upper_right_quad, .w = L'▙', .found = false, }, + { .glyphfxn = shim_no_lower_left_quad, .w = L'▜', .found = false, }, + { .glyphfxn = shim_no_lower_right_quad, .w = L'▛', .found = false, }, }; // first, take a pass to see which glyphs we already have for(unsigned i = 0 ; i < cfd->charcount ; ++i){