如何将所选的新字体添加到Visual Studio代码中? [英] How do I add a new font of my choice into Visual Studio code?
问题描述
我在编码方面还很陌生,并且正在努力解决以下问题。
我已经在网上进行了无数次搜索,以了解如何将VScode中的字体更改为不同的字体以匹配需要完成的项目中使用的字体。
I am fairly new at coding and I'm struggling with the following issue. I have searched numerous times online on how to change the fonts in VScode to different fonts to match the fonts being used on the project I need to complete.
我已经在stackoverflow上看过这篇文章,但是在回答了问题之后,我仍然看不到我选择的字体,进入文件>首选项>用户设置并覆盖 editor.font-family :
如何在Visual Studio代码中使用自定义字体
I looked at this post on stackoverflow already but after doing what the answer says, I still cannot see the fonts I selected and I cannot use them after going into "file > preferences > user settings" and overriding "editor.font-family": How to use custom font in visual studio code
我已将以下字体下载到了桌面上已经。这些是我想插入到正在工作的网站中的字体。
I have downloaded the following fonts on to my desktop already. Here are the fonts I would like to insert into the site I am working on.
- titilliumtext14l-600wt.otf
- OpenSans-Semibold.ttf
- OpenSans-Regular.ttf
- Myriad-Pro_31655.ttf
- titilliumtext14l-600wt.otf
- OpenSans-Semibold.ttf
- OpenSans-Regular.ttf
- Myriad-Pro_31655.ttf
以下是默认设置
//通过将设置放入设置文件来覆盖设置。
//请参见 http://go.microsoft.com/fwlink/?LinkId = 808995 用于最常用的设置。
{
// Overwrite settings by placing them into your settings file. // See http://go.microsoft.com/fwlink/?LinkId=808995 for the most commonly used settings. {
//编辑器
// Controls the font family.
"editor.fontFamily": "Consolas, 'Courier New', monospace",
// Controls the font weight.
"editor.fontWeight": "normal",
// Controls the font size in pixels.
"editor.fontSize": 14,
我不确定是否有必要包括我的 main.css中的内容,但这只是为了以防万一。
I'm not sure if it is necessary to include what I have in my "main.css" but here it is just in case.
/** Fonts **/
@font-face {
font-family: Titillium, Arial, sans-serif;
src: url('../assets/fonts/gotham-thin-webfont.eot');
src: url('../assets/fonts/gotham-thin-webfont.eot?#iefix') format('embedded-opentype'),
url('../assets/fonts/gotham-thin-webfont.woff2') format('woff2'),
url('../assets/fonts/gotham-thin-webfont.woff') format('woff'),
url('../assets/fonts/gotham-thin-webfont.ttf') format('truetype'),
url('../assets/fonts/gotham-thin-webfont.svg#gotham_thinregular') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: Archivo Narrow, Arial, sans-serif;
src: url('../assets/fonts/gotham-black-webfont.eot');
src: url('../assets/fonts/gotham-black-webfont.eot?#iefix') format('embedded-opentype'),
url('../assets/fonts/gotham-black-webfont.woff2') format('woff2'),
url('../assets/fonts/gotham-black-webfont.woff') format('woff'),
url('../assets/fonts/gotham-black-webfont.ttf') format('truetype'),
url('../assets/fonts/gotham-black-webfont.svg#gotham_blackregular') format('svg');
font-weight: bold;
font-style: normal;
}
/** Global **/
html, body{
background-color:#fff;
color:#000;
font-family: Titillium web, Arial, sans-serif;
overflow-x:hidden;
font-weight:light;
}
h1, h2, h3, h4, h5{
font-family:latoregular;
}
h1{
font-size: 50px;
font-weight:bold;
color: #fff;
}
h2{
font-size: 24px;
color: #000;
font-family: sans-serif;
}
h2 span, h3 span{
color:#ff8200;
}
h3{
font-size:24px;
}
h4{
font-size:18px;
}
h5{
font-weight: bold;
font-size:20px;
font-family:latoregular;
font-weight:lighter;
margin-bottom: 40px;
}
p{
font-size: 16px;
line-height: 2.0;
}
谢谢您的时间。
推荐答案
如有必要,请先在计算机上安装字体。然后,在您的用户设置JSON文件(文件>首选项>用户设置)中,像这样覆盖 editor.fontFamily
:
First install the font on your machine if necessary. Then, in your user settings JSON file (File > Preferences > User Settings), override editor.fontFamily
like so:
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Source Code Pro"
}
如果VSCode字体已经打开,则可能需要重新启动VSCode。首先安装。
You may need to restart VSCode if it was already open when the font was first installed.
这篇关于如何将所选的新字体添加到Visual Studio代码中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!