W3C home > Mailing lists > Public > www-style@w3.org > October 2015

Re: [css-fonts] font-weight-adjust

From: Jonathan Kew <jfkthame@gmail.com>
Date: Mon, 19 Oct 2015 12:34:34 +0100
To: Florian Rivoal <florian@rivoal.net>
Cc: www-style@w3.org
Message-ID: <5624D54A.9060902@gmail.com>
On 19/10/15 10:28, Florian Rivoal wrote:
> > I wonder if it'd be better to just use @font-face to construct a 
> "virtual family" that handles the mappings you want:
> >
> >   @font-face {
> >     font-family: my-favorite-font;
> >     font-weight: 400;
> >     src: url(MyFavorite.woff), url(MyFallback-Semibold.woff);
> >   }
> >   @font-face {
> >     font-family: my-favorite-font;
> >     font-weight: 600;
> >     src: url(MyFavoriteBold.woff), url(MyFallback-Extrabold.woff);
> >   }
> >
> > This allows you to collect whichever combinations of faces you like 
> and map them to a given font-weight value for your virtual family. And 
> adding unicode-range will allow you to optimize downloads and to 
> manage more precisely what happens in areas of character coverage overlap.
>
> That only works if the various font files you're linking to only 
> support a single weight each. But if the normal and semibold versions 
> of MyFallback are in the same font file, then you are back to square 
> one. Even if we assume all authors are technically able to split a 
> font file into multiple ones containing only 1 weight each (which is a 
> stretch), not all font licenses allow you to do that.

I'm not sure there's a problem here, is there? If the weights of 
MyFallback are all in the same font file (e.g. a .TTC collection), 
you'll need to specify which of the weights you want loaded (regardless 
of which weight-mapping approach is used), so just do that here:

    @font-face {
      font-family: my-favorite-font;
      font-weight: 400;
      src: url(MyFavorite.woff), url(MyFallback.ttc#1);
    }
    @font-face {
      font-family: my-favorite-font;
      font-weight: 600;
      src: url(MyFavoriteBold.woff), url(MyFallback.ttc#3);
    }

or something like that. (OK, I'm not sure that any browser has yet 
implemented support for fragment identifiers to select faces out of .TTC 
collections. But in principle, this should work. And I suspect getting 
implementers to support this will be easier than getting support for new 
font-weight-adjust property.)

Or are you thinking of MyFallback as being a locally-installed (system) 
font, rather than a linked @font-face resource? In that case, the 
file-level packaging is unimportant; just use @font-face with local() 
sources to select the individual faces by name:

    @font-face {
      font-family: my-favorite-font;
      font-weight: 400;
      src: url(MyFavorite.woff), local("MyFallback Medium");
    }
    @font-face {
      font-family: my-favorite-font;
      font-weight: 600;
      src: url(MyFavoriteBold.woff), local("MyFallback Extrabold");
    }

JK
Received on Monday, 19 October 2015 11:35:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:57 UTC