Custom css

Fixing Weirdly Spaced Numbers in Red Panda Console on Firefox (Linux)

If you're using Red Panda Console in Firefox on Linux and the message value viewer looks like this — with characters spaced out in a strange, almost proportional way:

 

...you've hit a font fallback issue. Here's what's going on and how to fix it.

The cause

Red Panda's message viewer uses the Monaco Editor, which requests "Droid Sans Mono" as its primary monospace font.

When Firefox can't find the requested font, it falls back through its own chain and lands on Noto Sans Mono, which has known rendering quirks at small sizes on Linux — producing the spaced-out glyphs you see.

Chromium doesn't have this problem because it uses a different font matching strategy.

You can confirm the issue by opening DevTools → Inspector → Fonts tab on one of the affected elements. If it shows "Noto Sans Mono" as the rendered font, this fix applies to you.

The fix

We can use fontconfig to rewrite font requests on the fly — pointing both Droid Sans Mono and Noto Sans Mono requests at a font that renders cleanly, like JetBrains Mono.

First, make sure JetBrains Mono is installed:

sudo apt install fonts-jetbrains-mono

Then create ~/.config/fontconfig/fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test name="family">
      <string>Droid Sans Mono</string>
    </test>
    <edit name="family" mode="assign" binding="strong">
      <string>JetBrains Mono</string>
    </edit>
  </match>

  <match target="pattern">
    <test name="family">
      <string>Noto Sans Mono</string>
    </test>
    <edit name="family" mode="assign" binding="strong">
      <string>JetBrains Mono</string>
    </edit>
  </match>

  <alias>
    <family>monospace</family>
    <prefer>
      <family>JetBrains Mono</family>
      <family>Hack</family>
      <family>DejaVu Sans Mono</family>
    </prefer>
  </alias>
</fontconfig>

Rebuild the font cache:

fc-cache -fv

Verify the aliases are working:

fc-match "Droid Sans Mono"
fc-match "Noto Sans Mono"

Both should return JetBrainsMono-Regular.ttf.

Restart Firefox completely and reload Red Panda — the message viewer should now render with clean, properly-spaced monospace text.

Why <match binding="strong"> and not <alias>

An <alias> only applies when the requested font is missing. Since Noto Sans Mono is actually installed, an alias for it would be ignored. <match> with binding="strong" forces the substitution even when the requested font exists — which is exactly what we need to override Firefox's fallback choice.

Side effects to be aware of

This config rewrites every request for Noto Sans Mono system-wide to JetBrains Mono. For code and most UI use cases this is an upgrade, but if you rely on Noto Sans Mono's broader CJK coverage for specific apps, you may want to narrow the rule or drop the Noto Sans Mono match entirely.

Ingen kommentarer:

Send en kommentar

Fixing Weirdly Spaced Numbers in Red Panda Console on Firefox (Linux) If you're using Red Panda Console in Firefox on Linux and the me...