-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support OT-SVG with CSS var(--color0, ...) and color palettes from CPAL table #422
Comments
Actually, it turns out that OT-SVG font with CSS color variables like "var(--color0, ...)" and a CPAL table does not seem to be working in Safari either, which is the only one I was hoping that it'd work. We already know that FireFox does not support Here's two test Bungee Color fonts, one is a COLRv0 font, the other is an OT-SVG font, with fill attributes using the CSS custom property notation ( BungeeColorSVG-multiple-palettes.zip /cc @litherum |
Please try the Ventura / iOS 16 betas. |
Thanks @litherum! I just tried with Safari 16.1 from macOS Ventura 13.0 Beta 6 and it's working 👍 |
This is Nabla OT-SVG font (converted from COLRv1 using our maximum_color tool) inside Safari 16.1 on macOS Ventura showing off its alternate CPAL palettes: |
This PR re-runs the maximum_color tool on Nabla v1.002 using the latest nanoemoji v0.15.0, which adds support for converting a COLR/CPAL font with multiple color palettes (such as Nabla) to an OT-SVG table that contains color variables referencing those CPAL palettes. This allows to select alternative font palettes or customize colors within those via CSS on the latest Safari on iOS 16 and macOS Ventura (beta). https://github.com/googlefonts/nanoemoji/releases/tag/v0.15.0 googlefonts/nanoemoji#422 Note that the font with combined COLR + SVG tables is now 45KB larger, all from the additional var(--colors) in the SVG table (the other tables didn't change), i.e. from 1,598,000 bytes to 1,643,616 bytes (less than 3% increase).
This PR re-runs the maximum_color tool on Nabla v1.002 using the latest nanoemoji v0.15.0, which adds support for converting a COLR/CPAL font with multiple color palettes (such as Nabla) to an OT-SVG table that contains color variables referencing those CPAL palettes. This allows to select alternative font palettes or customize colors within those via CSS on the latest Safari on iOS 16 and macOS Ventura (beta). https://github.com/googlefonts/nanoemoji/releases/tag/v0.15.0 googlefonts/nanoemoji#422 Note that the font with combined COLR + SVG tables is now 45KB larger, all from the additional var(--colors) in the SVG table (the other tables didn't change), i.e. from 1,598,000 bytes to 1,643,616 bytes (less than 3% increase).
In addition to the inlined SVG colors (constant names "yellow" or hex #ABCDEF) which we do support, and the special
currentColor
keyword, which we don't yet (cf. #405), OT-SVG table also allows to define color variables (viaCSS var()
function) that reference color palettes defined in the CPAL table, thus allowing to change the colors by selecting among multiple color palettes (e.g. light vs dark, etc.).We need to support this both ways: 1) in maximum_color when converting OT-SVG => COLR, and 2) when converting a COLR font with multiple CPAL palettes to OT-SVG (#421).
The text was updated successfully, but these errors were encountered: