json 无法在Windows终端中更改字体

x33g5p2x  于 2023-02-17  发布在  Windows
关注(0)|答案(5)|浏览(135)

尝试通过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终端预览中得到了同样的行为,这应该是最不“出血边缘”的版本。
即使尝试使用非书呆子字体“fontFace”也没有效果,但是,“fontSize”将起作用。

nbysray5

nbysray51#

对于来自SCOTT HANSELMAN article (especially from the third step)的用户
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个小时或尝试)

7bsow1i6

7bsow1i62#

将fontFace从“Iosevka Nerd字体”更改为仅“Iosevka”;fontFace属性需要一个font family,据我所知,文档中没有这个属性,我只是在阅读WTGithub上的this issue之后才发现它

zzoitvuj

zzoitvuj3#

我想安装MesloLGS NF Regular作为WSL的WindowsTerminal中Powerlevel 10 k的推荐字体:https://github.com/romkatv/powerlevel10k/blob/master/font.md
为了让它工作,我必须:
1.为所有用户安装它,如@hakan-fıstık在他的回答中所示。
1.将settings.json中的“fontFace”更改为“MesloLGS NF”(提供字体的全名无法正常工作)。
1.确保更改字体大小(更改字体可能会使字体变大):https://learn.microsoft.com/en-us/windows/terminal/customize-settings/profile-appearance

rta7y2nd

rta7y2nd4#

从一个评论到我在Windows终端的GitHub页面上打开的问题,(#6606),我被引导到另一个fontFace问题,如果你重新打开WT,选择另一种字体将不会坚持(不完全是我遇到的问题)。
无论如何,当前的解决方案是卸载您要使用的字体,然后右键单击并选择“Install for all users”。双击文件打开示例视图,并使用两个按钮下方的字体名称。使用与settings.json文件中相同的字体名称中的空格。
这适用于MesloLGL NF,但不适用于Iosevka NF。

bwitn5fc

bwitn5fc5#

根据我的经验,手动编辑“settings.json”文件会产生比它解决的问题更多的问题。编辑终端默认字体的最简单方法如下:
1.打开设置
1.在侧边栏的“配置文件”标题下选择Ubuntu
1.向下滚动到“附加设置”并选择“外观”
1.在文本标题下,将“字体"属性更改为您喜欢的字体x1c 0d1x
1.打开“settings.json”以查看更改
1.您应该看到选择字体所需的格式-如果您希望手动编辑json文件,则应遵循

1.保存更改并退出

相关问题