简体   繁体   English

如何在 VS Code 编辑器中指定粗体?

[英]How to specify bold font in VS Code editor?

How to specify a bold font in VS Code's settings.json ?如何在 VS Code 的settings.json指定粗体 For example, I have Envy Code R and Envy Code R Bold (exact names shown in windows' font viewer) installed on my windows machine, and while例如,我在我的 Windows 机器上安装了Envy Code REnvy Code R Bold (在 Windows 的字体查看器中显示的确切名称),而

"editor.fontFamily": "Envy Code R"

setting works fine,设置工作正常,

"editor.fontFamily": "Envy Code R Bold"

doesn't work (a fallback font is used instead).不起作用(改为使用后备字体)。

Is that possible to do at all?这有可能吗? There are no any other font settings like fontWeight or fontStyle .没有任何其他字体设置,如fontWeightfontStyle I also tried specifying other fonts with bold variants to no avail.我也尝试用粗体指定其他字体无济于事。 VS Code 0.10.11 here. VS Code 0.10.11在这里。

在您的settings.json .vscode中添加以下行:

"editor.fontWeight": "bold"

This is a bug with Atom: https://github.com/atom/atom/issues/3790 这是Atom的一个错误: https//github.com/atom/atom/issues/3790

A workaround is to strip spaces and add a hyphen between the font name and the weight. 解决方法是剥离空格并在字体名称和权重之间添加连字符。

Envy Code R Bold == EnvyCodeR-Bold

ref: https://github.com/Microsoft/vscode/issues/381#issuecomment-163356103 参考: https//github.com/Microsoft/vscode/issues/381#issuecomment-163356103

Here is what I did trying to solve the same issue on a Mac.这是我尝试在 Mac 上解决相同问题时所做的工作。 I installed the font on my Mac the usual way:我以通常的方式在 Mac 上安装了字体:

  • double-click on the .ttf file and click on Install Font双击.ttf文件,然后单击Install Font

The font had some variants, I wanted to use one of them on vs-code.字体有一些变体,我想在 vs-code 上使用其中之一。

When you install the font on your Mac an application called Font Book pops up (see screenshot).当您在 Mac 上安装字体时,会弹出一个名为Font Book的应用程序(参见屏幕截图)。

  • Click on the i icon highlighted in the screenshot, it will give you the information of the Postscript name of the font.单击屏幕截图中突出显示的i图标,它将为您提供字体Postscript name的信息。
  • copy-paste this value (the Postscript name value) into vs-code's settings -> Editor: Font Family as your first item in the list.将此值( Postscript name值)复制粘贴到 vs-code 的设置 -> Editor: Font Family作为列表中的第一项。

Mac 字体书应用程序

Result:结果:

在 vs-code 中添加字体的结果

Alternative way: 替代方式:

On MAC go to Code -> Preferences -> Settings or press shortcut CMD + , 在MAC上转到代码 - > 首选项 - > 设置或按快捷键CMD +

In search bar just write font and you should find: 在搜索栏中只需编写字体,您应该找到:

Editor: Font Weight 编辑:字体重量

And from there you can choose your font weight from 100 to 900 从那里你可以选择从100到900的字体重量

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

相关问题 如何在 Visual Studio 编辑器中禁用字体平滑? - How to disable font smoothing in Visual Studio editor? Windows API选择粗体字体 - Windows API select bold font 如何在 Windows 上为 Mercurial 指定不同的编辑器? - How do I specify a different editor for Mercurial on Windows? 如何为通过CreateWindow创建的窗口指定字体? - How can I specify a font for a window created through CreateWindow? 使用Arial粗体字体出现意外的边距 - Unexpected margin using Arial font in bold 在Windows中,字体显示为斜体,但是在Linux中,字体始终显示为粗体 - In Windows font shows Italic, but linux it always show bold 如何使用十六进制编辑器删除突出显示的代码行? - How do I remove the highlighted line of code with a hex editor? 如何手动编写和执行 Windows .exe(使用十六进制编辑器的机器代码)? - How to write and executable Windows .exe manually (machine code with Hex editor)? 如何使Visual Studio 2010成为Expression Blend 4中的默认代码编辑器 - How to make Visual Studio 2010 the default code editor in Expression Blend 4 如何在Windows的Objective C中使用jEdit编辑器进行编码 - How can I use jEdit editor to code in Objective C on Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM