无法在 Windows 终端中更改 fontFace

Tom*_*ton 8 powershell json windows-terminal

通过 settings.json 尝试自定义 Windows 终端。我发现了一个profiles.json,它非常接近新的约定,粘贴到settings.json时可以工作(我知道这是因为主题改变了)。问题是对“fontFace”的更改没有任何效果。我正在尝试为一些电力线的东西使用书呆子字体,在 ConEmu 中运行的 Powershell 中工作,但不在 Windows 终端中使用。这是 settings.json 的相关部分:

{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",

    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings

    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,

    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,

    // A profile specifies a command to execute paired with information about how it should look and feel.
    // Each one of them will appear in the 'New Tab' dropdown,
    //   and can be invoked from the commandline with `wt.exe -p xxx`
    // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    "profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
            "cursorShape": "vintage",
            "fontFace": "Iosevka Nerd Font"
        },
        "list":
        [
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false,
                "fontFace": "Iosevka Nerd Font",
                "colorScheme": "PowerShellTom",
                "useAcrylic": true,
                "acrylicOpacity": 0.8
            },
            { ...
Run Code Online (Sandbox Code Playgroud)

我在 Windows Terminal Preview 中得到了相同的行为,这应该是“出血边缘”最少的版本。

即使为“fontFace”尝试非书呆子字体也没有效果,但是,“fontSize”会起作用。

Hak*_*tık 27

对于来自SCOTT HANSELMAN 文章的人(尤其是来自第三步的人)

  1. Cascadia Code为所有用户安装

在此处输入图片说明

  1. 像这样更改 settings.json 中的“fontFace”属性

在此处输入图片说明

这是要复制的代码

"profiles": {
   "defaults": {
      "fontFace": "Cascadia Code PL"
      // Put settings here that you want to apply to all profiles.
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我完成这项工作的唯一方法(2 小时后或尝试后)

  • 这应该被接受为答案 (4认同)
  • 打开settings.json的快捷方式:Ctrl+Shift+,(逗号) (2认同)

Tom*_*ton 3

从我在 Windows Terminal 的 GitHub 页面上打开的问题 (#6606) 的评论中,我被引导到另一个 fontFace 问题,即如果重新打开 WT,则选择另一种字体将无法保留(不完全是我遇到的问题)。

无论如何,当前的解决方案是卸载您想要使用的任何字体,然后右键单击并选择“为所有用户安装”。双击文件打开示例视图,然后使用两个按钮下方找到的字体名称。按照 settings.json 文件中的方式使用字体名称中的空格。

这对 MesloLGL NF 有效,但对 Iosevka NF 无效。