Re: multiple values for FONT similar to font-family

23.01.2015, 01:20, "Tab Atkins Jr." <>:
> On Thu, Jan 22, 2015 at 2:17 PM, Marat Tanalin <> wrote:
>> 23.01.2015, 01:02, "Tab Atkins Jr." <>:
>>> On Thu, Jan 22, 2015 at 11:40 AM, Marat Tanalin <> wrote:
>>>> What would probably be a real solution is to have in CSS something like Font Loading API in JS:
>>> 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. */


Received on Thursday, 22 January 2015 22:55:22 UTC