优化多种Google Web字体 [英] Optimizing Multiple Google Web Fonts

查看:268
本文介绍了优化多种Google Web字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Google加载自定义字体时,它们为您提供了一种优化它们的方法: https: //developers.google.com/webfonts/docs/getting_started#Optimizing_Requests

When loading custom fonts from Google they offer a way for you to optimize them: https://developers.google.com/webfonts/docs/getting_started#Optimizing_Requests

意味着如果您仅将自定义字体用作标题,而不是加载整个字体,则可以告诉它需要什么字母,这样就不必加载整个字体字母.到目前为止一切顺利.

Meaning if you are you using a custom font for just a header, rather than loading the whole font, you can tell it what letters you need so not to load the entire font alphabet. So far so good.

但是,在示例中,它只有一种字体样式.你怎么做到两个?

However, in the example it only has one font style. How do you do it with two?

例如,我正在使用它来加载字体样式:

For instance I'm using this to load to styles of a font:

我通常使用400表示很多文本,但400italic仅用于一个短标题.

The normal 400 I use for a lot of text, but the 400italic is only used for one short header.

如果我这样做:

它会像我想要的那样加载整个400,而只是加载400italic的样本标头"吗?还是会做其他事情?

Will it load the entire 400 and just the "sample header" for 400italic like I want or will it do something else?

推荐答案

如果您要进行字符子集设置,并尝试将多个字体组合到一个CSS请求中,则指定的字符必须是所有必需字符之间的并集所有字体.

If you're doing character subsetting and trying to combine multiple fonts into one CSS request, then the specified characters need to be the union of all the required characters between all the fonts.

在这里看看: http://jsbin.com/welcome/22005/edit

<link href="http://fonts.googleapis.com/css?family=Inconsolata|Skranji&text=ABCDHIJK" rel="stylesheet">

以上两件事.我们需要两种字体(Inconsolate和Skranji),并指定两种字体都应使用A-K字符.如果您只需要A-D,又需要H-K,则必须将以上内容分成两个不同的CSS请求.

Two things going above. We're asking for two fonts (Inconsolate and Skranji) and specifying that both fonts should serve characters A-K. If you only need A-D for one, and H-K for another, then you'll have to split the above into two distinct CSS requests.

这篇关于优化多种Google Web字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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