9

通过 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
            },
            { ...

我在 Windows Terminal Preview 中得到了相同的行为,这应该是最不“前沿”的版本。

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

4

4 回答 4

37

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

  1. Cascadia Code为所有用户安装

在此处输入图像描述

  1. 像这样更改 settings.json 中的“fontFace”属性
    打开 settings.json 的快捷方式:Ctrl+Shift+,(逗号)

在此处输入图像描述

这是要复制的代码

"profiles": {
   "defaults": {
      "fontFace": "Cascadia Code PL"
      // Put settings here that you want to apply to all profiles.
    }
}

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

于 2020-10-25T10:30:31.510 回答
4

将 fontFace 从“Iosevka Nerd Font”更改为“Iosevka”;fontFace 属性需要一个字体系列,据我所知,这不在文档中,我只是在 WT github 上阅读此问题后才发现它

于 2020-08-07T04:31:54.700 回答
2

从对我在 Windows 终端的 GitHub 页面上打开的问题 (#6606) 的评论中,我被引导到另一个 fontFace 问题,如果您重新打开 WT,选择另一种字体就不会坚持,(不是我遇到的问题)。

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

这适用于 MesloLGL NF,但不适用于 Iosevka NF。

于 2020-06-24T04:48:48.407 回答
1

我想在 WSL 的 WindowsTerminal 中安装 MesloLGS NF Regular 作为 Powerlevel10k 的推荐字体: https ://github.com/romkatv/powerlevel10k/blob/master/font.md

为了使它工作,我必须:

  1. 正如@hakan-fıstık 在他的回答中所示,为所有用户安装它。
  2. 将 settings.json 中的“fontFace”更改为“MesloLGS NF”(提供字体的全名无法正常工作)。
  3. 请务必更改字体大小(更改字体可能会变大):https ://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-appearance
于 2021-03-07T12:37:27.513 回答