-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
monitor: Use UTF-8 instead of ACS (#77)
Some terminal emulators such as PuTTY or the macOS terminal don't have full VT100 ACS support. For this reason, the RTS2 monitor borders and lines are not rendered properly. Some applications rely on using directly the equivalent UTF-8 character, making sure the terminal supports UTF-8 encoding. This way, the monitor appareance is consistent between terminal emulators.
- Loading branch information
Showing
14 changed files
with
105 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <ncursesw/ncurses.h> | ||
#include <unordered_map> | ||
#include <string> | ||
|
||
namespace rts2ncurses { | ||
|
||
class Utf8Chars { | ||
private: | ||
std::unordered_map<std::string, cchar_t> charMap; | ||
|
||
public: | ||
Utf8Chars() { | ||
initUtf8(); | ||
} | ||
|
||
void initUtf8() { | ||
setChar("HLINE", L"\u2500", A_NORMAL); | ||
setChar("VLINE", L"\u2502", A_NORMAL); | ||
setChar("ULCORNER", L"\u250c", A_NORMAL); | ||
setChar("URCORNER", L"\u2510", A_NORMAL); | ||
setChar("LLCORNER", L"\u2514", A_NORMAL); | ||
setChar("LRCORNER", L"\u2518", A_NORMAL); | ||
setChar("BULLET", L"\u2022", A_NORMAL); | ||
setChar("DIAMOND", L"\u2666", A_NORMAL); | ||
setChar("BTEE", L"\u2534", A_NORMAL); | ||
setChar("TTEE", L"\u252c", A_NORMAL); | ||
} | ||
|
||
void setChar(const std::string& name, const wchar_t* wch, attr_t attr) { | ||
cchar_t ch; | ||
setcchar(&ch, wch, attr, 0, NULL); | ||
charMap[name] = ch; | ||
} | ||
|
||
const cchar_t& getChar(const std::string& name) { | ||
return charMap.at(name); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters