14

I recently switched to Arch Linux from Ubuntu, and so to ease the switch, I've installed the GTK themes used by Ubuntu and switched to the Ubuntu font family across the system. However, there is a minor flaw with the clocks in the GNOME interface, such that all of the colons : are replaced with tricolons , which is starting to bother me a lot.

Clock at top of screen

Lock screen clock

Clocks app

Could this possibly be caused by an improperly set locale setting, or is this likely a bug that I need to file on GNOME?

Edit 1: I installed the Ubuntu font family from ttf-ubuntu-font-family in the Arch repos.

Joseph
  • 1,341
  • 2
  • 16
  • 33

1 Answers1

16

Well, this question sounded interesting to me so I did some digging...

Here is the gnome-clocks source code. From world-item.vala:

public string time_label {
    owned get {
        return Utils.WallClock.get_default ().format_time (date_time);
    }
}

Ok. From Utils.vala:

public string format_time (GLib.DateTime date_time) {
    string time = date_time.format (format == Format.TWELVE ? "%I:%M %p" : "%H:%M");

    // Replace ":" with ratio, space with thin-space, and prepend LTR marker
    // to force direction. Replacement is done afterward because date_time.format
    // may fail with utf8 chars in some locales
    time = time.replace (":", "\xE2\x80\x8E\xE2\x88\xB6");

    if (format == Format.TWELVE) {
        time = time.replace (" ", "\xE2\x80\x89");
    }

    return time;
}

Seems weird to me personally, but alright, : is replaced by "\xE2\x80\x8E\xE2\x88\xB6".

I ran this on my system: $ echo -e "\xE2\x80\x8E\xE2\x88\xB6" and got:

Run it on yours and see what you get.

According to this website, the above sequence also converts to :. But what is :? Copy it from the website and paste it here. Result:

U+200E : LEFT-TO-RIGHT MARK [LRM]
U+2236 : RATIO

And now it's up to you to find out whether your font prints RATIO as a tricolon or if your locale is messed up and UTF-8 is handled incorrectly. I'm not on GNOME right now but I think you can enter U+2236 in the global GNOME search to look it up and copy it. If it results in a tricolon then I'd suggest to change your font and try again, if it results in a colon then it's definitely your font, if not most likely your locale/UTF-8 setup.

Edit: In any textbox (e.g. the search on superuser) press CTRL+SHIFT+u, then enter 2236 and press enter. If it's a tricolon I'd blame your font.

Edit2: I found an ubuntu font tester online and did the above mentioned key-combo on it. It results in a normal : colon for me. I double-checked, it is the RATIO character...

Can you please do me a favor and run the following command: fc-match "∶" - Make sure to copy it as the colon (tricolon?) is the RATIO character. If it outputs the right (ubuntu) font then either that ubuntu font test website is wrong or drunk me is out of ideas...

Edit3: Another easy way to check if it's the font or not: If the above echo command's result gives you a tricolon, try changing the terminal font and see if it becomes a colon. If you do get a colon on first try, change the font of the terminal to the same as the system font and see if it becomes a tricolon...

Edit4: Trying the Ubuntu font here with the u+2236 character shows that indeed the Ubuntu font doesn't even contain the ratio symbol, so whichever font your system falls back to causes this issue.

confetti
  • 2,407
  • 3
  • 22
  • 41
  • 3
    I fail to understand why exactly GNOME does this weird change from `:` to `RATIO`, if anyone wants to enlighten me.... – confetti Mar 01 '21 at 02:58
  • Hmm... this is interesting. When I enter in a U+2236 character, it does output as a tricolon, so the font in the Arch repos must be bad. I'll try installing it from a downloaded copy and see if it fixes it. – Joseph Mar 01 '21 at 03:38
  • Don't forget to run the `fc-match` command to confirm whether or not it's even trying to output using the font you want. – confetti Mar 01 '21 at 03:39
  • I ran that command, and it output Verdana (the Microsoft font), but if I run `fc-match -a "∶" | grep Ubuntu`, it outputs Ubuntu. – Joseph Mar 01 '21 at 03:43
  • That's weird. Trying [this](https://www.azfonts.net/families/verdana.html) font tester, Verdana doesn't even seem to have the tricolon/ratio character. Do you have LibreOffice writer installed or anything similar? You could write a U+2236 in there and set the font to the Ubuntu one, just to make absolutely sure whether the font itself is bad or not. – confetti Mar 01 '21 at 03:49
  • I used the Font Manager app and found that it is caused by Lucida Sans Unicode. Ubuntu doesn't even have U+2236. Now to figure out how to replace that as the fallback... – Joseph Mar 01 '21 at 03:53
  • I've also found [this issue](https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3049) someone opened to push to move towards colons as opposed to U+2236 characters. – Joseph Mar 01 '21 at 04:06
  • 4
    If it were a UTF-8 problem, you wouldn't get _any_ single Unicode character -- most likely you would see six garbage characters, one for each byte. It's a font issue. – u1686_grawity Mar 01 '21 at 09:04
  • 2
    Also, `fc-match` does not take characters. It takes font patterns, and it thinks you're specifying the `"∶"` _as a font name._ Since you don't have a font named "∶", it'll give you whatever sans-serif fonts it has configured. You'll probably need something like `FC_DEBUG=4 pango-view -q --text="∶" |& awk -F\" '/family: /{m=$2} END{print m}'` to determine what font is being used. – u1686_grawity Mar 01 '21 at 09:06
  • gucharmap is a great tool to check a character in a font – oldherl Mar 01 '21 at 09:33
  • @user1686 - Duh, you're right of course. I was thinking something else last night. Anyway, you are correct. I don't know why in the Ubuntu font tester it still works and looks like a colon to me (I guess browser falls back to another font? Shouldn't happen on a font test page imo.) - But checking [here](https://www.1001fonts.com/ubuntu-font.html) proves that you're right. – confetti Mar 01 '21 at 11:45
  • 3
    I was curious about the motivation for the change. It appears to be introduced way back in this commit but sadly without explanation: https://gitlab.gnome.org/GNOME/gnome-clocks/-/commit/d72e612ef6bf75a3e3cc286a731ef1f9abb34830 Although in searching for that I found this UX question about the same behaviour in Windows: https://ux.stackexchange.com/questions/122248/should-u2236-ratio-be-used-as-a-time-separator-instead-of-u003a-colon Perhaps it was done with the same (honestly, somewhat dubious-sounding) typographical motivations as in Windows? – Weeble Mar 01 '21 at 16:24