From 67861acdf3f02f2bb3529c1d34fe161d07d1bea9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 7 Jan 2020 10:51:50 +0100 Subject: [PATCH] locale-util: extend comments on unicode glyph use, and drop mdash (that actually was an ndash) Let's add the actual unicode names of the glyphs we use. Let's also add in comments what the width expectations of these glyphs are on the console. Also, remove the "mdash" definition. First of all it wasn't used, but what's worse the glyph encoded was actually an "ndash"... Fixes: #14075 --- src/basic/locale-util.c | 37 ++++++++++++++++++++++--------------- src/basic/locale-util.h | 5 ++--- src/test/test-locale-util.c | 1 - 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c index 457280df9f..dc62511935 100644 --- a/src/basic/locale-util.c +++ b/src/basic/locale-util.c @@ -342,12 +342,11 @@ const char *special_glyph(SpecialGlyph code) { [SPECIAL_GLYPH_TRIANGULAR_BULLET] = ">", [SPECIAL_GLYPH_BLACK_CIRCLE] = "*", [SPECIAL_GLYPH_BULLET] = "*", - [SPECIAL_GLYPH_ARROW] = "->", - [SPECIAL_GLYPH_MDASH] = "-", - [SPECIAL_GLYPH_ELLIPSIS] = "...", [SPECIAL_GLYPH_MU] = "u", [SPECIAL_GLYPH_CHECK_MARK] = "+", [SPECIAL_GLYPH_CROSS_MARK] = "-", + [SPECIAL_GLYPH_ARROW] = "->", + [SPECIAL_GLYPH_ELLIPSIS] = "...", [SPECIAL_GLYPH_ECSTATIC_SMILEY] = ":-]", [SPECIAL_GLYPH_HAPPY_SMILEY] = ":-}", [SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = ":-)", @@ -359,26 +358,34 @@ const char *special_glyph(SpecialGlyph code) { /* UTF-8 */ [true] = { + /* The following are multiple glyphs in both ASCII and in UNICODE */ [SPECIAL_GLYPH_TREE_VERTICAL] = "\342\224\202 ", /* │ */ [SPECIAL_GLYPH_TREE_BRANCH] = "\342\224\234\342\224\200", /* ├─ */ [SPECIAL_GLYPH_TREE_RIGHT] = "\342\224\224\342\224\200", /* └─ */ [SPECIAL_GLYPH_TREE_SPACE] = " ", /* */ + + /* Single glyphs in both cases */ [SPECIAL_GLYPH_TRIANGULAR_BULLET] = "\342\200\243", /* ‣ */ [SPECIAL_GLYPH_BLACK_CIRCLE] = "\342\227\217", /* ● */ [SPECIAL_GLYPH_BULLET] = "\342\200\242", /* • */ - [SPECIAL_GLYPH_ARROW] = "\342\206\222", /* → */ - [SPECIAL_GLYPH_MDASH] = "\342\200\223", /* – */ - [SPECIAL_GLYPH_ELLIPSIS] = "\342\200\246", /* … */ - [SPECIAL_GLYPH_MU] = "\316\274", /* μ */ + [SPECIAL_GLYPH_MU] = "\316\274", /* μ (actually called: GREEK SMALL LETTER MU) */ [SPECIAL_GLYPH_CHECK_MARK] = "\342\234\223", /* ✓ */ - [SPECIAL_GLYPH_CROSS_MARK] = "\342\234\227", /* ✗ */ - [SPECIAL_GLYPH_ECSTATIC_SMILEY] = "\360\237\230\207", /* 😇 */ - [SPECIAL_GLYPH_HAPPY_SMILEY] = "\360\237\230\200", /* 😀 */ - [SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = "\360\237\231\202", /* 🙂 */ - [SPECIAL_GLYPH_NEUTRAL_SMILEY] = "\360\237\230\220", /* 😐 */ - [SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY] = "\360\237\231\201", /* 🙁 */ - [SPECIAL_GLYPH_UNHAPPY_SMILEY] = "\360\237\230\250", /* 😨 */ - [SPECIAL_GLYPH_DEPRESSED_SMILEY] = "\360\237\244\242", /* 🤢 */ + [SPECIAL_GLYPH_CROSS_MARK] = "\342\234\227", /* ✗ (actually called: BALLOT X) */ + + /* Single glyph in Unicode, two in ASCII */ + [SPECIAL_GLYPH_ARROW] = "\342\206\222", /* → (actually called: RIGHTWARDS ARROW) */ + + /* Single glyph in Unicode, three in ASCII */ + [SPECIAL_GLYPH_ELLIPSIS] = "\342\200\246", /* … (actually called: HORIZONTAL ELLIPSIS) */ + + /* These smileys are a single glyph in Unicode, and three in ASCII */ + [SPECIAL_GLYPH_ECSTATIC_SMILEY] = "\360\237\230\207", /* 😇 (actually called: SMILING FACE WITH HALO) */ + [SPECIAL_GLYPH_HAPPY_SMILEY] = "\360\237\230\200", /* 😀 (actually called: GRINNING FACE) */ + [SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = "\360\237\231\202", /* 🙂 (actually called: SLIGHTLY SMILING FACE) */ + [SPECIAL_GLYPH_NEUTRAL_SMILEY] = "\360\237\230\220", /* 😐 (actually called: NEUTRAL FACE) */ + [SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY] = "\360\237\231\201", /* 🙁 (actually called: SLIGHTLY FROWNING FACE) */ + [SPECIAL_GLYPH_UNHAPPY_SMILEY] = "\360\237\230\250", /* 😨 (actually called: FEARFUL FACE) */ + [SPECIAL_GLYPH_DEPRESSED_SMILEY] = "\360\237\244\242", /* 🤢 (actually called: NAUSEATED FACE) */ }, }; diff --git a/src/basic/locale-util.h b/src/basic/locale-util.h index 78abbafd8f..1df8ac4cb0 100644 --- a/src/basic/locale-util.h +++ b/src/basic/locale-util.h @@ -46,12 +46,11 @@ typedef enum { SPECIAL_GLYPH_TRIANGULAR_BULLET, SPECIAL_GLYPH_BLACK_CIRCLE, SPECIAL_GLYPH_BULLET, - SPECIAL_GLYPH_ARROW, - SPECIAL_GLYPH_MDASH, - SPECIAL_GLYPH_ELLIPSIS, SPECIAL_GLYPH_MU, SPECIAL_GLYPH_CHECK_MARK, SPECIAL_GLYPH_CROSS_MARK, + SPECIAL_GLYPH_ARROW, + SPECIAL_GLYPH_ELLIPSIS, _SPECIAL_GLYPH_FIRST_SMILEY, SPECIAL_GLYPH_ECSTATIC_SMILEY = _SPECIAL_GLYPH_FIRST_SMILEY, SPECIAL_GLYPH_HAPPY_SMILEY, diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c index 28d90be896..f49cc6371e 100644 --- a/src/test/test-locale-util.c +++ b/src/test/test-locale-util.c @@ -81,7 +81,6 @@ static void dump_special_glyphs(void) { dump_glyph(SPECIAL_GLYPH_BLACK_CIRCLE); dump_glyph(SPECIAL_GLYPH_BULLET); dump_glyph(SPECIAL_GLYPH_ARROW); - dump_glyph(SPECIAL_GLYPH_MDASH); dump_glyph(SPECIAL_GLYPH_ELLIPSIS); dump_glyph(SPECIAL_GLYPH_MU); dump_glyph(SPECIAL_GLYPH_CHECK_MARK);