如何“安装”字体以在 Visual Studio Code 中使用?

lui*_*fer 14 mono fonts

我有这个漂亮的单声道字体https://github.com/tonsky/FiraCode,我想在 Ubuntu 的 Visual Studio Code 中使用它。

我下载了字体文件 (.ttf),我知道要使字体在系统范围内可用,我必须将其复制到/usr/share/fonts,所以我将这些文件复制到/usr/share/fonts/truetype/fira-code

我注意到复制后的权限是750,所以我chmoded到755

现在我转到 Visual Studio Code 首选项并告诉它我将使用“Fira Code”,然后什么也不做。例如,如果我将其更改为“DejaVu Sans Mono”,它将使用该字体。

这样做,我也看不到 LibreOffice 中的字体

失败后,我.fonts在我的家中创建了一个目录并复制了 .ttf 文件,结果相同。(我按照这里的说明进行操作:https : //itsfoss.com/install-fonts-ubuntu-1404-1410/

复制这里的字体,我在 LibreOffice 中看到它们,但我不能在 Visual Studio Code 中使用它们

所以看起来最有某种“字体注册表”可以说,你如何在 Ubuntu 中正确安装字体文件?

Geo*_*sen 23

要设置这种漂亮的字体,请使用以下步骤

  1. 这里下载字体

  2. 解压并在ttf文件夹中双击每个文件并install从出现的对话框中选择

  3. 设置 VSCode:

    1. 打开 File -> Preferences -> Settings
    2. 在点击右上角{}user settings(settings.json)将开放
    3. 添加以下几行:

      "editor.fontFamily": "'Fira Code'",
      "editor.fontLigatures": true,
      
      Run Code Online (Sandbox Code Playgroud)
      • 注意:我必须注释掉font family entry我可以通过反转过程切换回的正常情况。
    4. 要更改字体粗细,请添加以下任何行但不是全部

      "editor.fontWeight": "300" // Light
      "editor.fontWeight": "400" // Regular
      "editor.fontWeight": "500" // Medium
      "editor.fontWeight": "600" // Bold
      
      Run Code Online (Sandbox Code Playgroud)
  4. 重新开始并享受。

    在此处输入图片说明

我的示例用户 settings.json

{
    "files.autoSave": "onFocusChange",
    "editor.minimap.enabled": false,
    "workbench.iconTheme": "material-icon-theme",
    "vsicons.projectDetection.autoReload": true,
    "workbench.editor.enablePreview": false,
    "workbench.editor.enablePreviewFromQuickOpen": false,
    // "editor.fontFamily": "'Noto Mono', 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
    "breadcrumbs.enabled": true,
    "typescript.updateImportsOnFileMove.enabled": "always",
    "git.enableSmartCommit": true,
    "java.home": "/usr/lib/jvm/java-8-oracle",
    // "editor.fontLigatures": true,
    "editor.fontFamily": "'Fira Code', 'Noto Mono', 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
    "editor.fontLigatures": true,
    // "editor.fontWeight": "300", // Light
    // "editor.fontWeight": "400", // Regular
    // "editor.fontWeight": "500", // Medium
    // "editor.fontWeight": "600" // Bold
}
Run Code Online (Sandbox Code Playgroud)