简体   繁体   English

如何为 Visual Studio Code 设置字体连字?

[英]How do i setup font ligatures for Visual Studio Code?

I am setting up fonts ligatures for my VSCode using these two lines.我正在使用这两行为我的 VSCode 设置字体连字。

"editor.fontFamily": "'Fira Code'",
"editor.fontLigatures": true,

But it still looks the same as before.但它看起来仍然和以前一样。

I have tried to disable all of my installed extensions but it didn't work.我试图禁用所有已安装的扩展程序,但没有奏效。

Here is my full settings:这是我的完整设置:

{
  "workbench.iconTheme": "material-icon-theme",
  "workbench.colorTheme": "Material Theme Darker High Contrast",
  "editor.formatOnSave": true,
  "explorer.confirmDelete": false,
  "editor.suggestSelection": "first",
  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  "window.zoomLevel": 0,
  "editor.fontSize": 16, //!=
  "editor.fontFamily": "'Fira Code'",
  "editor.fontLigatures": true,
  "explorer.confirmDragAndDrop": false
}

I want fully functional font ligatures as on this page: How i want it to look .我想要功能齐全的字体连字,如本页所示:我希望它看起来如何 Instead I am getting basic text with some font.相反,我得到了一些字体的基本文本。

Step #1 : Install Fira Code.第 1 步安装Fira 代码。

Step #2 : Set the font in VSCode settings:第 2 步:在 VSCode 设置中设置字体:

"editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,

Step #3 : Restart/reload VSCode.第 3 步:重新启动/重新加载 VSCode。

That's about it.就是这样。

It doesn't seem you didn't have the Fira font installed in your PC.您的 PC 中似乎没有安装 Fira 字体。 Please follow this step if you are using MacOS.如果您使用的是 MacOS,请按照此步骤操作。

Open terminal and run these commands.打开终端并运行这些命令。

brew tap homebrew/cask-fonts
brew cask install font-fira-code

And try to restart VsCode.并尝试重新启动 VsCode。

Or if you are on other OS (Windows or Linux) follow this step.或者,如果您使用的是其他操作系统(Windows 或 Linux),请按照此步骤操作。 https://github.com/tonsky/FiraCode/wiki/Installing https://github.com/tonsky/FiraCode/wiki/Installing

Hopefully, this might be helpful.希望这可能会有所帮助。

Since VS Code 1.40, editor.fontLigatrues supports string settings, that is useful for fonts that support different stylistic sets:从 VS Code 1.40 开始, editor.fontLigatrues支持字符串设置,这对于支持不同风格集的字体很有用:

ie: IE:

  • "editor.fontLigatures": "'ss09', 'zero', 'onum'",
  • "editor.fontLigatures": "'ss01'",

You can read more about feature tags here (but the support depends on the font in question):您可以在此处阅读有关功能标签的更多信息(但支持取决于相关字体):

https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags

如果您使用的是 macOS,有时您需要重新启动计算机才能使 Visual Studio Code 的连字生效。

我解决了我的问题,把 Fira 代码放在没有“”的地方

For those with a different version of VS Code you can try to press key combination of control and comma ( Ctrl + , ) to open your settings tab and then after search for font ligatures对于使用不同版本 VS Code 的用户,您可以尝试按 control 和逗号的组合键( Ctrl + , )打开设置选项卡,然后在搜索字体连字后

搜索结果

After this click on Edit in settings.json .在此之后单击settings.json 中的编辑

Then set editor.fontLigatures=true .然后设置editor.fontLigatures=true

最后看

After completing this step then you'll be good to go.完成此步骤后,您就可以开始了。

Install FiraCode font-family for Mac 'Computer' but not 'User'为 Mac“计算机”而不是“用户”安装 FiraCode 字体系列

How to install and remove fonts on your Mac--Apple support如何在 Mac 上安装和删除字体--Apple 支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM