-
Notifications
You must be signed in to change notification settings - Fork 106
check/colorfont_tables: update conditions #3889
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
Changes from all commits
052a58f
bc69d64
103ebc9
c835f73
ceb0a1e
7c8c3ae
22ccc8a
a4150e9
4289267
1e940b6
724b09e
e2927b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6220,34 +6220,43 @@ def com_google_fonts_check_metadata_category_hint(family_metadata): | |
| @check( | ||
| id = "com.google.fonts/check/colorfont_tables", | ||
| rationale = """ | ||
| No one color font format supports all major user agents, but the combination | ||
| of COLR & SVG tables is pretty good. | ||
| Colr v0 fonts are widely supported in most browsers so they do not require | ||
| an SVG color table. However, Colr v1 is only well supported in Chrome so | ||
| we need to add an SVG table to these fonts. | ||
|
|
||
| A smart server could prune away one or the other based on user agent, | ||
| and a dumb server will at least have something that works. | ||
|
|
||
| Fonts that do not pass this check can be fixed with the maximum_color tool | ||
| available at https://github.com/googlefonts/nanoemoji | ||
| To add an SVG table, run the maximum_color tool in Nano Emoji, | ||
| https://github.com/googlefonts/nanoemoji | ||
| """, | ||
| proposal = 'https://github.com/googlefonts/fontbakery/issues/3886' | ||
| ) | ||
| def com_google_fonts_check_colorfont_tables(ttFont): | ||
| """Fonts must have neither or both the tables 'COLR' and 'SVG '.""" | ||
| SUGGESTED_FIX = ("To fix this, please run the font through the maximum_color tool" | ||
| " that installs as part of the nanoemoji package" | ||
| " (https://github.com/googlefonts/nanoemoji)") | ||
| if 'COLR' in ttFont.keys() and 'SVG ' not in ttFont.keys(): | ||
| yield FAIL,\ | ||
| Message('missing-table', | ||
| "This is a color font (it has a 'COLR' table)" | ||
| " but it lacks an 'SVG ' table. " + SUGGESTED_FIX) | ||
| elif 'COLR' not in ttFont.keys() and 'SVG ' in ttFont.keys(): | ||
| yield FAIL,\ | ||
| Message('missing-table', | ||
| "This is a color font (it has a 'SVG ' table)" | ||
| " but it lacks an 'COLR' table. " + SUGGESTED_FIX) | ||
| else: | ||
| yield PASS, "Looks good!" | ||
| """Check font has the expected color font tables""" | ||
| if "COLR" in ttFont: | ||
| colr_table = ttFont["COLR"] | ||
| if colr_table.version == 0 and "SVG " in ttFont: | ||
| yield FAIL, Message( | ||
| "drop-svg", | ||
| "Font has a COLR v0 table, which is already widely supported, " | ||
| "so the SVG table isn't needed." | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adobe CC does not support COLR table (and probably will not do any time soon, given the Adobe’s history with SVG table), so if a font for GF want to also support Adobe CC, do you want to force it to ship to versions?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm fair enough.. I would demote that check to a WARNING, saying that COLRv0-only is OK for browser use, unless you really need SVG support for desktop apps that don't support COLR. They probably want to keep things simple and not allow too many options when onboarding new color fonts. /cc @rsheeter
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @khaledhosny maybe file a separate issue so we can discuss there |
||
| ) | ||
| return | ||
| elif colr_table.version == 1 and "SVG " not in ttFont: | ||
| yield FAIL, Message( | ||
| "add-svg", | ||
| "Font has COLRv1 but no SVG table; for CORLv1, we require " | ||
| "that an SVG table is present to support environments where " | ||
| "the former is not supported yet." | ||
| ) | ||
| return | ||
| elif "SVG " in ttFont: | ||
| if "COLR" not in ttFont: | ||
| yield FAIL, Message( | ||
| "add-colr", | ||
| "Font only has an SVG table. Please add a COLR table as well. " | ||
| ) | ||
| return | ||
| yield PASS, "Looks Good!" | ||
|
|
||
|
|
||
|
|
||
| @check( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.