From bf18f4b671881860200214753813e35fa82d70ca Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 25 Jun 2021 11:50:54 +0200 Subject: [PATCH 1/2] glyph-util: add three more emojis to emoji list --- src/basic/locale-util.c | 10 +++++++++- src/basic/locale-util.h | 3 +++ src/test/test-locale-util.c | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c index fd6b01cfaa..007e3a091e 100644 --- a/src/basic/locale-util.c +++ b/src/basic/locale-util.c @@ -375,6 +375,9 @@ const char *special_glyph(SpecialGlyph code) { [SPECIAL_GLYPH_DEPRESSED_SMILEY] = ":-[", [SPECIAL_GLYPH_LOCK_AND_KEY] = "o-,", [SPECIAL_GLYPH_TOUCH] = "O=", /* Yeah, not very convincing, can you do it better? */ + [SPECIAL_GLYPH_RECYCLING] = "~", + [SPECIAL_GLYPH_DOWNLOAD] = "\\", + [SPECIAL_GLYPH_SPARKLES] = "*", }, /* UTF-8 */ @@ -421,7 +424,12 @@ const char *special_glyph(SpecialGlyph code) { [SPECIAL_GLYPH_LOCK_AND_KEY] = "\360\237\224\220", /* ๐Ÿ” (actually called: CLOSED LOCK WITH KEY) */ /* This emoji is a single character cell glyph in Unicode, and two in ASCII */ - [SPECIAL_GLYPH_TOUCH] = "\360\237\221\206", /* ๐Ÿ‘† (actually called: BACKHAND INDEX POINTING UP */ + [SPECIAL_GLYPH_TOUCH] = "\360\237\221\206", /* ๐Ÿ‘† (actually called: BACKHAND INDEX POINTING UP) */ + + /* These three emojis are single character cell glyphs in Unicode and also in ASCII. */ + [SPECIAL_GLYPH_RECYCLING] = "\u267B\uFE0F ", /* โ™ป๏ธ (actually called: UNIVERSAL RECYCLNG SYMBOL) */ + [SPECIAL_GLYPH_DOWNLOAD] = "\u2935\uFE0F ", /* โคต๏ธ (actually called: RIGHT ARROW CURVING DOWN) */ + [SPECIAL_GLYPH_SPARKLES] = "\u2728", /* โœจ */ }, }; diff --git a/src/basic/locale-util.h b/src/basic/locale-util.h index df259d1bbd..f50d2c8500 100644 --- a/src/basic/locale-util.h +++ b/src/basic/locale-util.h @@ -69,6 +69,9 @@ typedef enum SpecialGlyph { SPECIAL_GLYPH_DEPRESSED_SMILEY, SPECIAL_GLYPH_LOCK_AND_KEY, SPECIAL_GLYPH_TOUCH, + SPECIAL_GLYPH_RECYCLING, + SPECIAL_GLYPH_DOWNLOAD, + SPECIAL_GLYPH_SPARKLES, _SPECIAL_GLYPH_MAX, _SPECIAL_GLYPH_INVALID = -EINVAL, } SpecialGlyph; diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c index 972423e2fa..e22481b1b6 100644 --- a/src/test/test-locale-util.c +++ b/src/test/test-locale-util.c @@ -89,7 +89,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(SPECIAL_GLYPH_TOUCH + 1 == _SPECIAL_GLYPH_MAX); + assert_cc(SPECIAL_GLYPH_SPARKLES + 1 == _SPECIAL_GLYPH_MAX); log_info("/* %s */", __func__); @@ -120,6 +120,9 @@ static void dump_special_glyphs(void) { dump_glyph(SPECIAL_GLYPH_DEPRESSED_SMILEY); dump_glyph(SPECIAL_GLYPH_LOCK_AND_KEY); dump_glyph(SPECIAL_GLYPH_TOUCH); + dump_glyph(SPECIAL_GLYPH_RECYCLING); + dump_glyph(SPECIAL_GLYPH_DOWNLOAD); + dump_glyph(SPECIAL_GLYPH_SPARKLES); } int main(int argc, char *argv[]) { From 30763a32b240fe2c561095441b1e50638a1a4d5b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 30 Dec 2020 21:49:10 +0100 Subject: [PATCH 2/2] util: add one more helper for generating colored check mark glyphs This one is useful for a outputs with a slightly more "positive" outlook, i.e. where only the checkmarks are shown but the crossmarks are replaced by spaces. (Usecase: a larger table with many checkmarks, where the red crossmarks might just be too much negative noise) --- src/basic/locale-util.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/basic/locale-util.h b/src/basic/locale-util.h index f50d2c8500..3430eb6ee1 100644 --- a/src/basic/locale-util.h +++ b/src/basic/locale-util.h @@ -98,3 +98,7 @@ static inline void locale_variables_freep(char*(*l)[_VARIABLE_LC_MAX]) { static inline const char *special_glyph_check_mark(bool b) { return b ? special_glyph(SPECIAL_GLYPH_CHECK_MARK) : special_glyph(SPECIAL_GLYPH_CROSS_MARK); } + +static inline const char *special_glyph_check_mark_space(bool b) { + return b ? special_glyph(SPECIAL_GLYPH_CHECK_MARK) : " "; +}