]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
locale-util: add special glyph support for check marks/cross marks
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Oct 2018 14:37:10 +0000 (16:37 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 16 Nov 2018 14:52:22 +0000 (15:52 +0100)
src/basic/locale-util.c
src/basic/locale-util.h
src/test/test-locale-util.c

index 9ad51a197253c5be31e00c114a015728aac5821d..7e479d605a782027003abad386632bde19c30d37 100644 (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",             /* ✗ */
                 },
         };
 
index 14beece6d8bd6d8e47965e5cd15ffd3f31fdc14a..ea624e99082629db09f66b0e59597ac012d09210 100644 (file)
@@ -49,6 +49,8 @@ typedef enum {
         MDASH,
         ELLIPSIS,
         MU,
+        CHECK_MARK,
+        CROSS_MARK,
         _SPECIAL_GLYPH_MAX
 } SpecialGlyph;
 
index 3634534782dc2986ea2b56e62e68f59d69e807c2..6d0f24eeea253ebedacdd586aa80d95eb884b33a 100644 (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[]) {