Fonts: Difference between revisions

imported>Artturin
No edit summary
imported>R-k-b
add an example to fix bad font substition
Line 69: Line 69:
};
};
</syntaxhighlight>
</syntaxhighlight>
=== Use custom font substitutions ===
Sometimes, documents may appear to have bad kerning or hard-to-read letter spacing, due to a bad substitution.
For example, Okular may show in the ''Document Properties'' dialog that it has substituted DejaVu Sans Mono (a sans-serif font) in place of "NewCenturySchlbk". <code>fc-match NewCenturySchlbk</code> would display similiar info.
Adding this to your <code>/etc/nixos/configuration.nix</code> should prompt it to use the nicer serif *Schola* font instead:
<syntaxhighlight lang="nix">
fonts = {
  fonts = with pkgs; [ gyre-fonts ];
  fontconfig = {
    localConf = ''
      <!-- use a less horrible font substition for pdfs such as https://www.bkent.net/Doc/mdarchiv.pdf -->
      <match target="pattern">
        <test qual="any" name="family"><string>NewCenturySchlbk</string></test>
        <edit name="family" mode="assign" binding="same"><string>TeX Gyre Schola</string></edit>
      </match>
    '';
  };
};
</syntaxhighlight>
For more information and examples on the xml configuration language:
* https://linux.die.net/man/5/fonts-conf
* https://wiki.archlinux.org/index.php/Font_configuration
* https://wiki.archlinux.org/index.php/Font_configuration/Examples


== Troubleshooting ==
== Troubleshooting ==