使用谷歌字体并仅包含 [A-Z] 和 '&' [英] Use a google font and include only [A-Z] and '&'

查看:31
本文介绍了使用谷歌字体并仅包含 [A-Z] 和 '&'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用谷歌字体并让它只加载 [A-Z]& &符号字符?

Is there a way to use a google font and have it load only [A-Z] and the & ampersand character?

我想这样做是为了减小大小并缩短加载时间,因为我只会使用基本的拉丁数字和字母.

I would like to do this to reduce size and improve load time, since I will only use basic latin numbers and letters.

如果必须,我可以自己托管字体并且操作字体包是合法的,但不确定是否需要自托管以及如何操作谷歌的字体包.

I can host the font myself if I must and it is legal to manipulate the font package, but am not sure if self-hosting is necessary and how to manipulate google's font package.

我像这样指定了A-Z:

http://fonts.googleapis.com/css?family=Inconsolata&text=ABCDEFGHIJKLMNOPQRSTUVWXYZ

但是指定 & 很麻烦.这两个都不起作用:

but specifying & is troublesome. Both of these don't work:

<link href='http://fonts.googleapis.com/css?family=Inconsolata&text=ABC&amp;' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Inconsolata&text=ABC&' rel='stylesheet' type='text/css'>

推荐答案

在包含 google 字体时无法指定字符范围.唯一的方法是像这样指定每个字符:

There is no way to specify character ranges when including google fonts. The only way to do it is to specify each character like this:

http://fonts.googleapis.com/css?family=Inconsolata&text=ABCDEFGHIJKLMNOPQRSTUVWXYZ

这篇关于使用谷歌字体并仅包含 [A-Z] 和 '&amp;'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆