如何在 Google WebFont Loader 中调整样式
我有这段代码可以异步加载 Google 字体以避免渲染阻塞,我在结束代码的 之前就有了它。
<script type="text/javascript">
WebFontConfig = {
google: {
families: ['Poppins:300,400,500,600,700']
}
};
(function(d) {
var wf = d.createElement('script'),
s = d.scripts[0];
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
wf.async = true;
s.parentNode.insertBefore(wf, s);
})(document);
</script>
问题是数字的宽度不同?风格? 我希望 TextArea 中的所有数字都相同,而不是如下所示: Imgur
PS:我正在使用 Poppins,如果我以常见的方式加载字体(<链接href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
) 此错误确实不会发生。
我从 Google WebFont Loader 获取的代码
I have this code that asynchronously loads Google Fonts to avoid render blocking, I have it before ending the </body>
of my code.
<script type="text/javascript">
WebFontConfig = {
google: {
families: ['Poppins:300,400,500,600,700']
}
};
(function(d) {
var wf = d.createElement('script'),
s = d.scripts[0];
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
wf.async = true;
s.parentNode.insertBefore(wf, s);
})(document);
</script>
The problem is that the numbers have different widths? styles?
I want all the numbers to be the same in my TextArea and not look like this:
Imgur
PS: I am using Poppins and if I load the fonts in a common way (<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
) this error does not happen.
The code I took from Google WebFont Loader
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论