locale-util: add special glyph support for check marks/cross marks

This commit is contained in:
Lennart Poettering 2018-10-22 16:37:10 +02:00
parent 4e96eb682c
commit 52ecf1958d
3 changed files with 10 additions and 1 deletions

View File

@ -369,6 +369,8 @@ const char *special_glyph(SpecialGlyph code) {
[MDASH] = "-",
[ELLIPSIS] = "...",
[MU] = "u",
[CHECK_MARK] = "+",
[CROSS_MARK] = "-",
},
/* UTF-8 */
@ -383,6 +385,8 @@ const char *special_glyph(SpecialGlyph code) {
[MDASH] = "\342\200\223", /* */
[ELLIPSIS] = "\342\200\246", /* … */
[MU] = "\316\274", /* μ */
[CHECK_MARK] = "\342\234\223", /* ✓ */
[CROSS_MARK] = "\342\234\227", /* ✗ */
},
};

View File

@ -49,6 +49,8 @@ typedef enum {
MDASH,
ELLIPSIS,
MU,
CHECK_MARK,
CROSS_MARK,
_SPECIAL_GLYPH_MAX
} SpecialGlyph;

View File

@ -65,7 +65,7 @@ static void test_keymaps(void) {
#define dump_glyph(x) log_info(STRINGIFY(x) ": %s", special_glyph(x))
static void dump_special_glyphs(void) {
assert_cc(MU + 1 == _SPECIAL_GLYPH_MAX);
assert_cc(CROSS_MARK + 1 == _SPECIAL_GLYPH_MAX);
log_info("/* %s */", __func__);
@ -80,6 +80,9 @@ static void dump_special_glyphs(void) {
dump_glyph(ARROW);
dump_glyph(MDASH);
dump_glyph(ELLIPSIS);
dump_glyph(MU);
dump_glyph(CHECK_MARK);
dump_glyph(CROSS_MARK);
}
int main(int argc, char *argv[]) {