- From: Marat Tanalin <mtanalin@yandex.ru>
- Date: Fri, 23 Jan 2015 01:54:23 +0300
- To: Tab Atkins Jr. <jackalmage@gmail.com>
- Cc: Onur TOPAL <o_topal@yahoo.com>, "www-style@w3.org" <www-style@w3.org>
23.01.2015, 01:20, "Tab Atkins Jr." <jackalmage@gmail.com>: > On Thu, Jan 22, 2015 at 2:17 PM, Marat Tanalin <mtanalin@yandex.ru> wrote: >> š23.01.2015, 01:02, "Tab Atkins Jr." <jackalmage@gmail.com>: >>> šOn Thu, Jan 22, 2015 at 11:40 AM, Marat Tanalin <mtanalin@yandex.ru> wrote: >>>> ššWhat would probably be a real solution is to have in CSS something like Font Loading API in JS: >>>> >>>> ššhttp://www.w3.org/TR/css-font-loading/ >>> šThat's called "the @font-face rule". >> šSo how exactly the @font-face rule allows to apply different styles depending on what exact font is available and applied? > > It doesn't. šBut @font-face is the CSS version of the Font Loading > API, *because the Font Loading API is the JS version of @font-face*. Homo Logicus detected? In a constructive way, with the Font Loading API in JS, we can do something like this [1]: document.fonts.load('1em open_sansregular') .then(function() { document.documentElement.className += ' open-sans-loaded'; }); and only apply font-dependent styles if the font is really available. We can't do that via pure CSS for now. To achieve a similar goal via pure CSS, we could have a media query like this: @media (font-family: open_sansregular) { /* Styles applied if `open_sansregular` font-family is available. */ } [1] https://dev.opera.com/articles/better-font-face/
Received on Thursday, 22 January 2015 22:55:22 UTC