Fonts/zh-cn: Difference between revisions

ZhX589 (talk | contribs)
Created page with "== 配置字体 =="
ZhX589 (talk | contribs)
Created page with "=== 在 <code>fonts.fontconfig.defaultFonts.monospace</code> 中可以使用哪些字体名称? ==="
 
(7 intermediate revisions by the same user not shown)
Line 154: Line 154:
== 配置字体 ==
== 配置字体 ==


<div lang="en" dir="ltr" class="mw-content-ltr">
NixOS 的 [https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=fonts.fontconfig <code>fonts.fontconfig</code>] 配置项(点击查看完整列表!)用于处理 fontconfig 选项。部分选项已被 nix 很好地封装;此外始终可以使用 <code>localConf</code> 直接编写 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.
</div>


<span lang="en" dir="ltr" class="mw-content-ltr">=== Set multiple fonts for different languages ===</span>
=== 为不同语言设置多种字体 ===
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
If you want to use other languages alongside English, you may want to set appropriate fonts for each language in your whole OS. For example, a Persian speaker might want to use the
If you want to use other languages alongside English, you may want to set appropriate fonts for each language in your whole OS. For example, a Persian speaker might want to use the
Line 195: Line 193:
</div>
</div>


<span lang="en" dir="ltr" class="mw-content-ltr">=== Use custom font substitutions ===</span>
=== 使用自定义字体替换 ===


<div lang="en" dir="ltr" class="mw-content-ltr">
有时,由于不恰当的替换,文档可能会出现字距不佳或字间距难以阅读的问题。
Sometimes, documents may appear to have bad kerning or hard-to-read letter spacing, due to a bad substitution.
例如,Okular 可能在“文档属性”对话框中显示已将 DejaVu Sans Mono(一种无衬线字体)替换为 "NewCenturySchlbk"。运行 <code>fc-match NewCenturySchlbk</code> 会显示类似信息。
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.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
将此添加到您的 <code>/etc/nixos/configuration.nix</code> 中,应能促使其改用更相似(且更美观)的衬线字体 ''Schola'' 作为替代:
Adding this to your <code>/etc/nixos/configuration.nix</code> should prompt it to use the more similar (and nicer) serif ''Schola'' font instead:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{{File|3=fonts = {
{{File|3=fonts = {
   packages = with pkgs; [ gyre-fonts ];
   packages = with pkgs; [ gyre-fonts ];
Line 219: Line 212:
   };
   };
};|name=/etc/nixos/configuration.nix|lang=nix}}
};|name=/etc/nixos/configuration.nix|lang=nix}}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
有关 XML 配置语言的更多信息和示例:
For more information and examples on the xml configuration language:
</div>


* https://www.mankier.com/5/fonts-conf
* https://www.mankier.com/5/fonts-conf
Line 229: Line 219:
* https://wiki.archlinux.org/index.php/Font_configuration/Examples
* https://wiki.archlinux.org/index.php/Font_configuration/Examples


<div lang="en" dir="ltr" class="mw-content-ltr">
有关合适的替代字体列表:
For a list of suitable replacement fonts:
</div>
* https://wiki.archlinux.org/title/Metric-compatible_fonts
* https://wiki.archlinux.org/title/Metric-compatible_fonts


<span lang="en" dir="ltr" class="mw-content-ltr">== Troubleshooting ==</span>
== 故障排除 ==


<span lang="en" dir="ltr" class="mw-content-ltr">=== What font names can be used in <code>fonts.fontconfig.defaultFonts.monospace</code>? ===</span>
=== <code>fonts.fontconfig.defaultFonts.monospace</code> 中可以使用哪些字体名称? ===


<span lang="en" dir="ltr" class="mw-content-ltr">Those that fontconfig will understand. This can be queried from a font file using <code>fc-query</code>.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Those that fontconfig will understand. This can be queried from a font file using <code>fc-query</code>.</span>