Can't make Lucida font work with home-manager

Context: When I go on a website that requires a font from the Lucida font family, I get this kind of result:
example
This is most annoying, as xkcd uses this font everywhere, and so as is the website is quite ugly…


So, I have tried the usual way (with home-manager, because I use it):

  • ensure nixpkgs.config.allowUnfree = true;
  • ensure fonts.fontconfig.enable = true;
  • add xorg.fontbhlucidatypewriter100dpi to home.packages

I then run home-manager switch, it all runs fine but the font is nowhere to be found. I try to reload the font cache with fc-cache -f, but it doesn’t do any good. I try rebooting my machine, still nothing.


I have looked for the font with the Font software (packaged with Gnome), but it doesn’t find it. And the websites are still ugly. Does anyone have a hint on what to do?


EDIT: in further investigation I have found that

$ fc-match Lucida
luRS08-ISO8859-1.pcf.gz: "Lucida" "Sans"
$ fc-match LucidaTypewriter
luRS08-ISO8859-1.pcf.gz: "LucidaTypewriter" "Sans"

but I don’t really know what that could mean…

Did you ever solve this? Seeing the same thing here today.

These are the only font related settings I think I have https://github.com/LunNova/nixos-configs/blob/13b710fa2d43934f217c809c8e989320abe8ab7d/modules/fonts.nix

Unfortunately, I haven’t figured out a proper way of making these font work. So I simply not installed them, and they are replaced automatically by the system by an other correctly-working font.
For instance, xkcd now renders with Tex Gyre. It’s the most convenient workaround I have found.

What exactly is the issue here? AFAICT, that’s the desired font.

Note that xorg.fontbhlucidatypewriter100dpi is an ancient bitmap font that is freely redistributable and comes with some distributions of Xorg. It just looks that bad, that’s the font.

If you want it properly scalable and antialiased, you’ll have to acquire a license for an outline version of Lucida. It’s unfree.
It’s bundled with the Oracle JDK I believe (at least that’s the case for Lucida Sans Typewriter), so that might be a way to at least get it for free. It’s also in M$ Office but I don’t think you’re allowed to use it outside of it.

I guess the issue is just that xorg.fontbhlucidatypewriter100pdi is ugly… Switching to Wayland, and thus preventing this font from being installed, successfully “patches” this bug :slight_smile:

Here’s a workaround which works for X users: https://github.com/LunNova/nixos-configs/blob/a3bf6c1a2f838b629ff07d834968ba74d91c3704/modules/fonts.nix

This seems related to 553580 - Non installed font used instead of fallback font and as far as I can tell is not a firefox (nor nix) specific issue

1 Like

Fixed in Remove ancient unfree bitmap fonts from fonts.defaultXFonts by LunNova · Pull Request #164050 · NixOS/nixpkgs · GitHub which is in nixos-unstable.