Skip to content

Commit

Permalink
linux console: we've got some hats now, motherfuckers #201
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jul 14, 2020
1 parent f15e09c commit 90c1235
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/lib/linux.c
Expand Up @@ -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){
Expand Down Expand Up @@ -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){
Expand Down

0 comments on commit 90c1235

Please sign in to comment.