- From: Florian Rivoal <florian@rivoal.net>
- Date: Wed, 21 Oct 2015 20:28:16 +0900
- To: Jonathan Kew <jfkthame@gmail.com>
- Cc: www-style@w3.org
> On 19 Oct 2015, at 20:34, Jonathan Kew <jfkthame@gmail.com> wrote: > > 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.) I was not aware of this possibility, and I agree it would solve the problem. Are specifications already clear about this, or is it something we should write down? - Florian
Received on Wednesday, 21 October 2015 11:28:48 UTC