add notcurses_canbraille() capability test

pull/1338/head
nick black 3 years ago
parent 7e4e3b71f8
commit 6b126f4049
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1,6 +1,9 @@
This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 2.1.9 (not yet released)
* Add `notcurses_canbraille()` capability predicate.
* 2.1.8 (2021-02-03):
* The `notcurses-tetris` binary has been renamed `nctetris`.
* The new function `channel_set_palindex()` has been added.

@ -300,6 +300,12 @@ bool notcurses_canutf8(const struct notcurses* nc);
// Can we blit to Sixel? This requires being built against libsixel.
bool notcurses_cansixel(const struct notcurses* nc);
// Can we draw sextants? This requires Unicode 13.
bool notcurses_cansextants(const struct notcurses* nc);
// Can we draw Braille? The Linux console cannot.
bool notcurses_canbraille(const struct notcurses* nc);
```
## Direct mode

@ -28,6 +28,8 @@ notcurses_capabilities - runtime capability detection
**bool notcurses_cansextant(const struct notcurses* ***nc***);**
**bool notcurses_canbraille(const struct notcurses* ***nc***);**
**bool notcurses_cansixel(const struct notcurses* ***nc***);**
# DESCRIPTION
@ -64,7 +66,8 @@ UTF-8 encoding, and the locale was successfully loaded.
that the terminal can properly render Unicode 13 sextants.
**notcurses_cansixel** returns **true** if the terminal advertises
support for Sixel.
support for Sixel. **notcurses_canbraille** returns **true** if Braille
is expected to work on the terminal.
# BUGS

@ -1228,6 +1228,9 @@ API bool notcurses_canutf8(const struct notcurses* nc);
// Can we reliably use Unicode 13 sextants?
API bool notcurses_cansextant(const struct notcurses* nc);
// Can we reliably use Unicode Braille?
API bool notcurses_canbraille(const struct notcurses* nc);
// Can we blit to Sixel?
API bool notcurses_cansixel(const struct notcurses* nc);

@ -2053,6 +2053,10 @@ bool notcurses_cansextant(const notcurses* nc){
return nc->tcache.sextants && nc->tcache.utf8;
}
bool notcurses_canbraille(const notcurses* nc){
return nc->tcache.braille && nc->tcache.utf8;
}
bool notcurses_canfade(const notcurses* nc){
return nc->tcache.CCCflag || nc->tcache.RGBflag;
}

@ -146,6 +146,9 @@ TEST_CASE("Plot") {
}
SUBCASE("BraillePlot") {
if(!notcurses_canbraille(nc_)){
return;
}
ncplane_options nopts = {
.y = 1, .x = 1, .rows = 6, .cols = 50,
.userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0,
@ -250,6 +253,9 @@ TEST_CASE("Plot") {
}
SUBCASE("BraillePlot1Row") {
if(!notcurses_canbraille(nc_)){
return;
}
ncplane_options nopts = {
.y = 1, .x = 1, .rows = 1, .cols = 25,
.userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0,

Loading…
Cancel
Save