Fonts: Difference between revisions
Artoria2e5 (talk | contribs) →Use custom font substitutions: it's nicer, true, but it's also more similar/correct. |
Artoria2e5 (talk | contribs) Make the lead graf look somewhat complete. On mobile, all sections are folded by default and only the lede is visible, so it gotta have something. |
||
Line 1: | Line 1: | ||
NixOS handles fonts like it handles many different parts of the system: they are not in | NixOS handles fonts like it handles many different parts of the system: they are not in an environment unless explicitly marked to be part of it. This guide covers the installation, configuration and troubleshooting of fonts. | ||
== Installing fonts on NixOS == | == Installing fonts on NixOS == | ||
Line 9: | Line 9: | ||
'''Note''': for 23.05 or older, <code>fonts.packages</code> is called <code>fonts.fonts</code> instead. | '''Note''': for 23.05 or older, <code>fonts.packages</code> is called <code>fonts.fonts</code> instead. | ||
For example: | ''For example:'' | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
Line 45: | Line 45: | ||
This is useful for quick font experiments. | This is useful for quick font experiments. | ||
Example: Install <code>SourceCodePro-Regular</code>. | ''Example'': Install <code>SourceCodePro-Regular</code>. | ||
<syntaxhighlight lang="bash">font=$(nix-build --no-out-link '<nixpkgs>' -A source-code-pro)/share/fonts/opentype/SourceCodePro-Regular.otf | <syntaxhighlight lang="bash">font=$(nix-build --no-out-link '<nixpkgs>' -A source-code-pro)/share/fonts/opentype/SourceCodePro-Regular.otf | ||
cp $font ~/.local/share/fonts | cp $font ~/.local/share/fonts | ||
Line 55: | Line 55: | ||
== Configuring fonts == | == Configuring fonts == | ||
The nixos key [https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=fonts.fontconfig <code>fonts.fontconfig</code>] handles the fontconfig options. Some options are nicely wrapped in nix; there's always <code>localConf</code> to go straight to the XML. | The nixos key [https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=fonts.fontconfig <code>fonts.fontconfig</code>] (click to see the full list!) handles the fontconfig options. Some options are nicely wrapped in nix; there's always <code>localConf</code> to go straight to the XML. | ||
=== Set multiple fonts for different languages === | === Set multiple fonts for different languages === |