diff --git a/src/lib/blitset.h b/src/lib/blitset.h index 400971a56..41e8f70d7 100644 --- a/src/lib/blitset.h +++ b/src/lib/blitset.h @@ -16,6 +16,22 @@ lookup_blitset(const tinfo* tcache, ncblitter_e setid, bool may_degrade) { return NULL; } } + // without braille support, NCBLIT_BRAILLE decays to NCBLIT_3x2 + if(!tcache->braille && setid == NCBLIT_BRAILLE){ + if(may_degrade){ + setid = NCBLIT_3x2; + }else{ + return NULL; + } + } + // without sextant support, NCBLIT_3x2 decays to NCBLIT_2x2 + if(!tcache->sextants && setid == NCBLIT_3x2){ + if(may_degrade){ + setid = NCBLIT_2x2; + }else{ + return NULL; + } + } const struct blitset* bset = notcurses_blitters; while(bset->egcs){ if(bset->geom == setid){ @@ -75,4 +91,12 @@ rgba_blitter(const struct notcurses* nc, const struct ncvisual_options* opts) { return rgba_blitter_low(&nc->tcache, scale, maydegrade, opts ? opts->blitter : NCBLIT_DEFAULT); } +static inline ncblitter_e +ncplot_defblitter(const notcurses* nc){ + if(notcurses_canutf8(nc)){ + return NCBLIT_8x1; + } + return NCBLIT_1x1; +} + #endif diff --git a/src/lib/plot.h b/src/lib/plot.h index 2f7f0ef00..7f146aa26 100644 --- a/src/lib/plot.h +++ b/src/lib/plot.h @@ -45,11 +45,7 @@ class ncppplot { const notcurses* notc = ncplane_notcurses(n); ncblitter_e blitter = opts ? opts->gridtype : NCBLIT_DEFAULT; if(blitter == NCBLIT_DEFAULT){ - if(notcurses_canutf8(ncplane_notcurses(n))){ - blitter = NCBLIT_8x1; - }else{ - blitter = NCBLIT_1x1; - } + blitter = ncplot_defblitter(notc); } bool degrade_blitter = !(opts && (opts->flags & NCPLOT_OPTION_NODEGRADE)); auto bset = lookup_blitset(¬c->tcache, blitter, degrade_blitter);