From 52ecf1958d30e09551b3b7c618e4c9d652c27259 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 22 Oct 2018 16:37:10 +0200 Subject: [PATCH] locale-util: add special glyph support for check marks/cross marks --- src/basic/locale-util.c | 4 ++++ src/basic/locale-util.h | 2 ++ src/test/test-locale-util.c | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c index 9ad51a19725..7e479d605a7 100644 --- a/src/basic/locale-util.c +++ b/src/basic/locale-util.c @@ -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", /* ✗ */ }, }; diff --git a/src/basic/locale-util.h b/src/basic/locale-util.h index 14beece6d8b..ea624e99082 100644 --- a/src/basic/locale-util.h +++ b/src/basic/locale-util.h @@ -49,6 +49,8 @@ typedef enum { MDASH, ELLIPSIS, MU, + CHECK_MARK, + CROSS_MARK, _SPECIAL_GLYPH_MAX } SpecialGlyph; diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c index 3634534782d..6d0f24eeea2 100644 --- a/src/test/test-locale-util.c +++ b/src/test/test-locale-util.c @@ -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[]) { -- 2.47.3