Make space width / space usage in front of units consistent

Correct. Well, I did change it in gnome tweaks tool, but that does change gsettings under the hood.

Apparently, yes. For some reason my debian oldstable has a font named “System-ui” but it appearently is just a dummy and not a real font. fontconfig then substitutes the font with what it thinks might be fitting best: That Vera font (for future reference: the command FC_DEBUG=4 anki is helpful to debug font stuff).

I did think about creating a dummy font myself, naming it “system-ui”, installing it in debian sid (development version) and see if I can reproduce the anki issue there, too. But didn’t look into that yet.

Yes, oldstable is debian 11 bullseye.

As a matter of fact, that’s exactly what happend! Nice catch! I verified using fc-match -s "System-ui" in debian sid and fontconfig now thinks the best font is NotoSans-Regular.ttf: "Noto Sans" "Regular".

I couldn’t get “Noto Sans” font to work with fontconfig yet, though. It really likes the Vera one…

Nevertheless, I think you proofed that this is a font issue in oldstable. Thanks!

I tried playing with a Debian 11 VM and couldn’t get fontconfig to play nice either.

I know I was putting config files in the correct place because fc-match would give me an error message if I had a typo.

It apparently just decided “No. I don’t respect your opinion. My font choice is better” :joy:

1 Like

Same here.

Maybe symlinking the noto font with the vera font and vice versa could fool fontconfig.

But considering debian changed it’s default font in a future release (after oldstable) and there are a lot of distros (like ubuntu) which are based on debian and thus will likely have the change as well, I don’t really fell like investigating this further.

As long as the problem is fixed and not on ankis side, that is. And that does seem to be the case.

Many languages have their own rules about punctuation, spaces before and after that punctuation, and indeed what to use as a symbol for punctuation.

Check that for each language you are using, before you start crafting content.

That’s probably too much to ask for. Localization functions should handle it instead, which is what rossgb opted to do:

The second commit fully hands off the formatting to Intl.NumberFormat to make sure the percentage sign is handled correctly for different languages.

See this:

1 Like

I know I said I wouldn’t investigate further, but here I am…

Debian sid has a System-ui font too. I have to remove the --bs-font-sans-serif property inherited from html :root, [data-bs-theme=light] in the stats screen or else the font won’t be applied correctly.

This is the view with a strange system font set but the css property in stats unchanged:


You can see in the buttons and the title that some things are applied. It’s also obvious that most text is not applied.

Here is the view with strange system font set and the css property disabled:

Does this really work with other operating systems? If even the latest debian sid (debian sid is not stable, it is the development version) has this problem, then I expect the debian derivatives (which are a lot) to have the same issue as well.

Also: if I set system-ui as the font in templates, it does in fact not use the weird font I chose:

And since my system has a System-ui font I tried that one as well. It is different than the system-ui font:

But none of them apply that weird font I actually set (that you can see in the user interface). If I do comment out the only mention of font-family in my card template, it is applied there as well:

So… does that mean system-ui doesn’t do what it’s supposed to do? Can anyone of you maybe check on another operating system if system font is actually applied for you (maybe @Danika_Dakika or @rossgb if available)?

Other things I want to mention:

  1. Dark vs. Light Theme makes no difference.
  2. The following do not adjust to my system font:
    A) The stats screen.
    B) The deck options screen.
    C) The import screen.
  3. The following do adjust to my system font:
    A) Settings screen.
    B) Deck overview screen.
    C) Screen that appears if you click on a deck in deck overview.
    D) The about screen.
    E) The export screen.
    F) Deck browser (well, mostly. The buttons “fields…”, “cards…” and “preview…” do not change and the field description doesn’t change either. The contents of the fields doesn’t change but that is expected due to the fact that they are hardcoded when you create a field).
    G) The addon screen.
    H) The edit note types screen, including its reorder fields screen (where the font can be set, field can be set as search field ect).
    I) The change profile screen.

It’s not really a fair comparison because there is no official way to change the system UI font on Windows 11 any more (you have to do registry hacking).

Here is me doing it anyway in a VM for science:

N.B. The “default CSS” font (used in the deck browser) is actually hard-coded for Windows and MacOS.

The MacOS one isn’t even the actual default system UI font any more.

The “other OS” branch just inherits the font used in the parent Qt widget (self.font().family())

See here:

1 Like

This is what happens e.g. in the deck overview, which works fine. E.g. it might give font-family: "Cantarell", sans-serif which is always correct, even if I change the font on my system (the “Cantarell” part changes).

But in the screens that misbehave that html font family from above is overwritten in body by

system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"

That is a bug then, isn’t it?

Is there a reason why? Or is this because of the lack of font changing capabilities within the OS?

I’m still hesitant to call it an Anki bug.

I think it is technically a better value for font-family as it gives more reliable fallbacks. It should probably be used on the deck browser screen etc. too.

I think it is just an unfortunate outcome of Linux having multiple different ways to set the default font.
e.g. If you installed KDE on your debian machine it probably will not care about gsettings. It might also use fontconfig.

If we really wanted to force it to work how you expect we could prepend self.font().family() to the bootstrap font list in python, but I’m not really a fan of that.

From a quick search Windows stopped letting you change the system font with Windows 8. They have used Segoe UI as the default since Windows Vista.

It looks like modern MacOS also does not let you change the system font (I don’t know if older versions allowed it). MacOS has used a few fonts over the years. They used Helvetica Neue back in Yosemite (10.10) but they have been using variants of San Francisco for a while now.

With Linux/BSD/??? who knows what the default will be. It entirely depends on the distro.