w3c / epub-specs

Shared workspace for EPUB 3 specifications.
Other
306 stars 60 forks source link

Variable Fonts #2545

Closed davelab6 closed 1 year ago

davelab6 commented 1 year ago

https://twitter.com/KyriosityTweets/status/1636896943162142720?t=8BX4CnPRWTTrDroqNPKeAw&s=19 prompted me to check the epub spec and indeed it seems variable fonts are not supported.

Apologies that I'm a big ol' newbie to this, but what would the process be to develop support?🥳

VF has been a standardized and widely implemented font technology since 2016, so I was pretty surprised to hear that epub doesn't support it, given it's web platform basis 😅

mattgarrish commented 1 year ago

The link you posted seems to go to a missing page so I'm not sure why you're saying they're not supported. EPUB supports OpenType fonts, although that doesn't necessarily mean that reading systems will render variable fonts as intended.

If the problem is support in reading systems, then maybe this is an issue for testing.

davelab6 commented 1 year ago

That's odd, here's a screenshot I just took :)

Screenshot_20230320-222858

Where would I set the equivalent of font-variation-settings CSS property, and font-optical-sizing?

mattgarrish commented 1 year ago

Where would I set the equivalent of font-variation-settings CSS property, and font-optical-sizing?

In a CSS style sheet for the xhtml page, or any other way you would for the web generally. EPUBs are just packaged web content.

There aren't any restrictions on what CSS properties you can use, but, again, there could very likely be support issues in the wild, just like with browser support for anything new(-ish). I've never personally tried using variable fonts, so I don't have any insight into which reading systems do or do not support their rendering.

But unless there's something specifically that epubcheck flags as an error (unable to link to/import the fonts, unable to list them in the manifest, invalid CSS, etc.), it doesn't sound like the EPUB specification needs to be changed to allow their use.

As for how to improve support, EPUB is currently going through the W3C standardization process so there's a testing group checking support for features. I'm not sure if this is in scope (they're not testing every aspect of every technology that can be used), but it would be one way to expose support issues. The other, of course, is to test manually and open bugs against the major reading systems that don't support rendering.

There was an idea of creating a bug tracker for logging issues against all reading systems but it doesn't look like it panned out. Maybe someone involved can speak to it.

dauwhe commented 1 year ago

The EPUB spec uses the CSS Snapshot as a guide to what CSS should be supported by reading systems. This allows EPUB to evolve as the underlying web standards evolve.

This snapshot includes CSS Fonts Level 3, which does not include variable fonts. Those are defined in Level 4, which is still under development.

davelab6 commented 1 year ago

That explains it! Any ballpark timeline for L4?

mattgarrish commented 1 year ago

It sounds like we can close this issue with no action required. You can include OpenType variable fonts in an EPUB and reference the CSS properties, so nothing needs fixing from an authoring perspective. And because we reference the latest CSS snapshot, it will automatically be recommended to support Level 4 Fonts when that spec becomes stable.

davelab6 commented 1 year ago

Excellent, thank you for explaining