Question

I printed my first curses program.

I suddenly get curious whether the round corners are possible in Curses UI. Is it possible to draw round corners? If it supports Unicode, and if it's possible to print some character like;

  ╭╮ ╰╯(U+256D~2570)

 it would be possible. Should I change the source code...? Or is there some API to change that characters?

enter image description here

Was it helpful?

Solution

ncurses uses a table (from terminfo/termcap) which tells ncurses how to map the "alternate" character set to the terminal's set of graphic characters.

If you want to change this you will need to alter the terminfo/termcap entry for your terminal.

See the terminfo man page for details of the terminfo file format. In particular look at the "Line Graphics" section.

OTHER TIPS

Ncurses since version-5.3 has functions for setting the borders of a window specifically accepting wide (unicode) characters, called:

int border_set( const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, const cchar_t *bl, const cchar_t *br );
int wborder_set( WINDOW *win, const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, const cchar_t *bl, const cchar_t *br);

The border_set and wborder_set functions draw a border around the edges of the current or specified window. These functions do not change the cursor position, and do not wrap.

which use cchar_t:

cchar_t References a string of wide characters (___source___)

#define CCHARW_MAX 5
typedef struct
{
    attr_t  attr;
    wchar_t chars[CCHARW_MAX];
}
cchar_t;

instead of the chtype which border and wborder functions use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top