[英](How) can I use native Android fonts in the browser simply by css without web fonts?
I'm trying to make a web app without the use of web fonts to keep browser requests at an absolute minimum. 我正在尝试制作一个不使用Web字体的Web应用程序,以将浏览器请求保持在绝对最低限度。
At the same time, I'm trying to use only "good-looking" slim fonts for Headings etc. 与此同时,我试图只使用标题“好看”的超薄字体等。
This is basically no problem: iOS and Mac OS have HelveticaNeue-UltraLight natively, and Windows (Phone) has Segoe UI (WP) Light. 这基本上没问题:iOS和Mac OS本身都有HelveticaNeue-UltraLight,Windows(Phone)有Segoe UI(WP)Light。
The fonts do not look the same, but they give a similar overall style and I don't have to use a single webfont. 字体看起来不一样,但它们提供了类似的整体风格,我不必使用单个webfont。 All can be addressed directly via css "font-family".
所有都可以通过css“font-family”直接解决。
Is there a way to get a similar appearance on Android? 有没有办法在Android上获得类似的外观? Android has Roboto Light, which would perfectly serve my requirements, but it seems impossible to simply address this via css styles without webfonts.
Android有Roboto Light,它可以完美地满足我的要求,但似乎不可能通过没有webfonts的css样式来解决这个问题。
You can use 您可以使用
font-family: "HelveticaNeue-UltraLight", "Segoe UI", "Roboto Light", sans-serif;
Each OS try use font from this list in course. 每个操作系统尝试使用此列表中的字体。 When the browser finds a font that is present in the system, it will start to use it.
当浏览器找到系统中存在的字体时,它将开始使用它。 iOS will use the font "HelveticaNeue-UltraLight" and ignore other.
iOS将使用字体“HelveticaNeue-UltraLight”而忽略其他字体。 Android will use the font "Roboto Light" ...
Android将使用“Roboto Light”字体...
Use: 使用:
font-family: sans-serif-light;
Edit: Apparently, this only works on HTC devices. 编辑:显然,这只适用于HTC设备。 But it's a start.
但这是一个开始。
Edit2: Looks like Google has changed this with the recent Android 4.4 update, because now it works on my Nexus 7 as well. 编辑2:看起来谷歌已经使用最新的Android 4.4更新改变了这一点,因为现在它也适用于我的Nexus 7。 Not sure about other devices though.
但不确定其他设备。
Download Roboto
and link to it in css like this: 下载
Roboto
并在css中链接到它,如下所示:
@font-face {
font-family: 'Roboto Thin';
src: url('roboto/Roboto-Thin.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.