我做了一个自定义字体,想在网站上测试它,所以我写了这个书签。我使用 Simple HTTP Server 应用程序在手机上托管了字体和样式表。
javascript:(function()
{ var head = document.getElementsByTagName('HEAD')[0];
var link=document.createElement('link');
link.rel = 'stylesheet'; link.href = 'http://192.???.?.????:????/elle/stylesheet.css';
link.type ='text/css'; link.charset = 'UTF-8';
head.appendChild(link);
document.body.style.fontFamily = "'elle-2aregular', sans-serif, georgia";
})()
样式表
@font-face {
font-family: 'elle-2aregular';
src:url('http://192.???.?.????:????/elle/elle.woff2') format('woff2'),
url('http://192.???.1.????:????/elle/elle.woff') format('woff');
font-weight: normal;
font-style: normal;
}