# Make space width / space usage in front of units consistent

**URL:** <https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798>\
**Category:** Help\
**Created:** [January 1, 2025, 1:06am UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798 "2025-01-01T01:06:29Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [January 4, 2025, 2:52am UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/21 "2025-01-04T02:52:54Z")

</div>

> [@rossgb](#):
>
> You changed one of them (gsettings?) which is used by your DE and the native Qt components.

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

> [@rossgb](#):
>
> Qt WebView chose to use another one (fontconfig?) which defaulted to the dodgy Vera font

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.

> [@rossgb](#):
>
> debian oldstable (debian 11?)

Yes, oldstable is debian 11 bullseye.

> [@rossgb](#):
>
> It could technically work the same way on newer versions of debian. Newer versions of debian might just have changed the fontconfig defaults to something like Noto Sans instead of Vera so you didn’t notice.

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!

---

<div class="post-metadata">

**Author:** ![rossgb](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/rossgb/32/23908_2.png) [@rossgb](https://forums.ankiweb.net/u/rossgb)\
**Post date:** [January 4, 2025, 3:08am UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/22 "2025-01-04T03:08:48Z")

</div>

> [@Anon\_0000](#):
>
> I couldn’t get “Noto Sans” font to work with fontconfig yet, though. It really likes the Vera one…

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” 😂

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [January 4, 2025, 3:43am UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/23 "2025-01-04T03:43:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![matta](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/matta/32/5126_2.png) [@matta](https://forums.ankiweb.net/u/matta)\
**Post date:** [January 6, 2025, 8:07am UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/24 "2025-01-06T08:07:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [January 6, 2025, 8:18am UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/25 "2025-01-06T08:18:39Z")

</div>

> [@matta](#):
>
> 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:

> <https://github.com/ankitects/anki/pull/3677>
>
> \- Always show fractional parts of numbers even if they are 0 (91.0% not 91%).
> … \> This makes the numbers line up nicer across rows.
> \- Show "N/A" for percentages instead of 0% when there are 0 total reviews.
> \> I feel showing 0% in this case can be a bit misleading.
> \>
> \> e.g.
> \> You have not reviewed any mature cards today.
> \> You look at the "all" table and see it shows 0% for mature today.
> \> You might assume that you saw mature cards but failed all of them.
> 
> \<table\>
> \<thead\>
> \<tr\>
> \<th\>Before\</th\>
> \<th\>After\</th\>
> \</tf\>
> \</thead\>
> 
> \<tbody\>
> \<tr\>
> \<td\>
> \<img src="https://github.com/user-attachments/assets/feb03329-8a0d-4132-a985-d4495bd10448" /\>
> \</td\>
> 
> \<td\>
> \<img src="https://github.com/user-attachments/assets/24e678c8-144f-4b13-9bb0-5b5a2f3359ab" /\>
> \</td\>
> \</tr\>
> \</tbody\>
> \</table\>

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [January 6, 2025, 1:04pm UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/26 "2025-01-06T13:04:17Z")

</div>

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:

 ![anki](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/d/9/d93746d82326617b229c4743ec170e7bfad462d3.png)  
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:

 ![anki](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/8/a/8a5abc7f66fb92c05f6f2afe112043b3db26944f.jpeg)

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:

 ![anki](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/7/8/78e29388b5ed4462bb76c2463c6b9598ad27bb75.jpeg)

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

 ![anki](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/a/3/a3e6f425a96478636dfece657b9bc990c0d7fc81.jpeg)

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:

 ![anki](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/1/b/1bcc280075f0bb5e3eb108e7b79ab262c5934fbc.jpeg)

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.

---

<div class="post-metadata">

**Author:** ![rossgb](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/rossgb/32/23908_2.png) [@rossgb](https://forums.ankiweb.net/u/rossgb)\
**Post date:** [January 6, 2025, 1:33pm UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/27 "2025-01-06T13:33:23Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/9/2/920d78ca6847abf003e2d6ccae9c9989ca2a3d52.png)

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:

> <https://github.com/ankitects/anki/blob/f1a5808d83e809b41d1299d2245ca9f8a7ddb5b7/qt/aqt/webview.py#L495-L547>

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [January 6, 2025, 1:41pm UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/28 "2025-01-06T13:41:44Z")

</div>

> [@rossgb](#):
>
> The “other OS” branch just inherits the font used in the parent Qt widget (`self.font().family()`)

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

```auto
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?

> [@rossgb](#):
>
> N.B. The “default CSS” font (used in the deck browser) is actually hard-coded for Windows and MacOS.

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

---

<div class="post-metadata">

**Author:** ![rossgb](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/rossgb/32/23908_2.png) [@rossgb](https://forums.ankiweb.net/u/rossgb)\
**Post date:** [January 6, 2025, 2:18pm UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/29 "2025-01-06T14:18:11Z")

</div>

> [@Anon\_0000](#):
>
> But in the screens that misbehave that html font family from above is overwritten in `body` by
> 
> ```auto
> 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?

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.

> [@Anon\_0000](#):
>
> Is there a reason why? Or is this because of the lack of font changing capabilities within the OS?

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [February 5, 2025, 2:18pm UTC](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798/30 "2025-02-05T14:18:52Z")

</div>

Closed on February 5, 2025, 2:18pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

[Previous page](https://forums.ankiweb.net/t/make-space-width-space-usage-in-front-of-units-consistent/53798.md?page=1)
