是否指定了"Roboto"?在“系统字体栈"中实际做什么? [英] Does specifying "Roboto" in a "system font stack" actually do anything?

查看:55
本文介绍了是否指定了"Roboto"?在“系统字体栈"中实际做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CSS的最新趋势是使用系统"字体堆栈,该堆栈利用为用户的操作系统设计的字体.通常情况如下:

A recent trend in CSS is to use a "system" font stack, which utilizes fonts designed for the user's operating system. Typically this looks something like this:

body {
    font-family: -apple-system, BlinkMacSystemFont,"Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell,"Helvetica Neue", sans-serif;
}

这种字体库已被Medium,W​​ordpress,Github,Bootstrap,Booking.com等采用.所有这些都包括适用于Android版本4及更高版本的"Roboto".向上.我的问题是,为什么?如果从此堆栈中删除了机器人",将会发生什么?

This type of font-stack has been adopted by Medium, Wordpress, Github, Bootstrap, Booking.com and many others. All of them include "Roboto" for Android version 4 & up. My question is, why? What would happen if "Roboto" was removed from this stack?

根据我的测试,即使您在Android设备上切换系统字体(在设置中),浏览器的默认"sans-serif"字体也始终是Roboto.

From my testing, even when you switch system fonts on an android device (in settings), the browsers default "sans-serif" font is always Roboto.

有没有可用的设备或浏览器未将Roboto设置为默认的sans-serif字体?如果不是,为什么Roboto完全包含在这些字体堆栈中?

Is there any device or browser out there that does not set Roboto as the default sans-serif font when it's available? If not, why is Roboto included in these font stacks at all?

推荐答案

...为什么Roboto完全包含在这些字体堆栈中?

... why is Roboto included in these font stacks at all?

答案很简单: 确保 .

The answer is quite simple: to make sure.

这是您应如何翻译:

如果通过自己的或加载的CSS @ font-face s将 Roboto 字体家族安装在系统上(或浏览器能够应用它),则应该当上述字体家族均无法成功解析时,可以使用.

If Roboto font family is installed on the system (or the browser is capable of applying it) from either own or loaded CSS @font-faces, it should be used when none of the afore mentioned font families resolve successfully.

是否有任何当前设备直到 Roboto 才真正制造出来,这是否重要,因为大多数设备在默认情况下会在堆栈中更早地解析相同的字体,因为它是默认系统字体?不是真的.因为没人知道明年会推出什么新设备,而在堆栈中指定 Roboto 可能会受益.

Does it matter if any current device doesn't actually make it until Roboto because most resolve the same font earlier in the stack, since it's default system font? Not really. Because nobody knows what new device might get launched next year and that one might benefit from specifying Roboto in the stack.

考虑到对页面可能造成的影响, font-family 实际上不是您应该优化应用程序的地方.此外,字体系列列表的长度可以为1km.从第一个可解析的字体开始的所有内容都将被忽略,因此从技术角度来看,它实际上是相当便宜的.

Considering the possible impact on the page, font-family is really not the place where you should optimize your app. Besides, the font family list can be 1km long. Everything past the first font that resolves is ignored, so it's, actually quite cheap from a technical point of view.

这篇关于是否指定了"Roboto"?在“系统字体栈"中实际做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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