【发布时间】:2015-10-15 08:48:13
【问题描述】:
这与其说是一个编码问题,不如说是关于 Visual Studio 代码编辑器的问题。我想做的是在编辑器中使用源代码专业版,但我不知道将字体设置更改为什么。谢谢!
【问题讨论】:
标签: settings visual-studio-code
这与其说是一个编码问题,不如说是关于 Visual Studio 代码编辑器的问题。我想做的是在编辑器中使用源代码专业版,但我不知道将字体设置更改为什么。谢谢!
【问题讨论】:
标签: settings visual-studio-code
如有必要,请先在您的机器上安装字体。然后,在您的用户设置 JSON 文件(File > Preferences > User Settings)中,像这样覆盖 editor.fontFamily:
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Source Code Pro"
}
如果首次安装字体时 VSCode 已经打开,您可能需要重新启动它。
【讨论】:
"editor.fontLigatures": true,
按照 Nacimota 的回答,安装自定义字体(使用 Windows 10 以下示例)请阅读教程 here。
对我来说,这是从我的任务栏中搜索“字体”然后单击顶部结果的问题。从那里我拖动了“target/TTF”目录中的所有文件,该目录是根据 Source Code Pro 教程生成的。
【讨论】:
这是在 Windows 的 VSCode 1.30.2 中测试的:
font-family
转到文本编辑器 => 字体系列 => 更改值(带空格的字体系列名称可能需要单引号)。示例:
'Fira Code', Consolas, 'Courier New', monospace
启用字体连字(如果需要)
注意:在第1步之后,您也可以按Open Settings(右上角)直接编辑json设置。示例:
{
"editor.fontFamily": "'Fira Code', Consolas, 'Courier New', monospace",
"editor.fontLigatures": true
}
【讨论】:
我必须为“所有用户”安装字体,否则 VSCode 将无法识别它。完全在黑暗中拍摄,但这就是为我解决的问题。
【讨论】:
安装其他人提到的字体后,进入设置并在 JSON 中编辑字体,然后您可以看到为终端和编辑器编辑字体的选项。如果字体名称中有空格,请不要忘记在字体名称中添加引号。
我的看起来像这样
{
"workbench.colorTheme": "GitHub Dark Dimmed",
"workbench.iconTheme": "material-icon-theme",
"editor.formatOnSave": true,
"explorer.confirmDelete": false,
"go.toolsManagement.autoUpdate": true,
"git.autofetch": true,
"redhat.telemetry.enabled": false,
},
"workbench.startupEditor": "none",
"terminal.integrated.fontFamily": "'Source Code Pro for Powerline'",
"window.zoomLevel": -1,
"files.autoSave": "afterDelay",
"editor.fontFamily": "'Source Code Pro Semibold for Powerline', 'Source Code Pro for Powerline', Menlo, Monaco, 'Courier New', monospace",
"editor.formatOnPaste": true
}
【讨论】: