我的工作PC(Windows 7)没有管理员权限,因此无法在系统中安装自定义字体(Fira Code)。有没有一种方法可以在不安装VS Code的情况下使用此类字体?
最佳答案
查找此问题的丑陋解决方法:使用webfont。
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);
关于fonts - 如何在没有管理员权限的情况下在VS Code(Windows)中使用自定义字体来安装字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52286889/