fonts - 如何在没有管理员权限的情况下在VS Code(Windows)中使用自定义字体来安装字体?

标签 fonts visual-studio-code vscode-settings

我的工作PC(Windows 7)没有管理员权限,因此无法在系统中安装自定义字体(Fira Code)。有没有一种方法可以在不安装VS Code的情况下使用此类字体?

最佳答案

查找此问题的丑陋解决方法:使用webfont。

  • 打开菜单
  • 中的“帮助”->“切换开发者工具”
  • 在js代码下方粘贴并在DevTools控制台中执行以设置“Fira Code”字体。

  • var styleNode = document.createElement('style'); 
    styleNode.type = "text/css"; 
    var styleText = document.createTextNode(`
        @font-face{
            font-family: 'Fira Code';
            src: url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/eot/FiraCode-Regular.eot') format('embedded-opentype'),
                 url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/woff2/FiraCode-Regular.woff2') format('woff2'),
                 url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/woff/FiraCode-Regular.woff') format('woff'),
                 url('https://raw.githubusercontent.com/tonsky/FiraCode/master/distr/ttf/FiraCode-Regular.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
        }`); 
    styleNode.appendChild(styleText); 
    document.getElementsByTagName('head')[0].appendChild(styleNode);
    
  • 确保“Fira代码”是“字体系列”设置中的第一个参数。
  • 启用字体连字设置,否则“> =”不会传输到“≥”
  • 在DevTools的Sources选项卡中
  • (可选),使用代码创建一个新的代码段,然后右键单击新创建的文件以运行。重新启动应用程序后,就可以保留它。
  • 关于fonts - 如何在没有管理员权限的情况下在VS Code(Windows)中使用自定义字体来安装字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52286889/

    相关文章:

    c# - 自定义字体 Monodevelop

    html - 如何在 Visual Studio Code 中格式化保存 HTML-Eex 文件?

    在 VS Code 中找不到 Git

    python - 如何在 VSCode 中禁用所有 python linting

    html - 我可以用文本精确设置div和div之间的距离吗?

    java - 如何仅更改 swing 应用程序的所有字体的大小?

    css - 更改谷歌字体的字体名称以匹配 svg 中的定义

    git - 在 Visual Studio 代码中检测 git 子文件夹

    VSCode 中的 JavaFX-11 : Error: Could not find or load main class Files\Java\javafx-sdk-11. 0.2\lib

    python - 功能建议中这些符号的含义是什么?