Skip to content

Commit c0935ae

Browse files
committed
Include icons that do not exist in all sets
1 parent f69adfd commit c0935ae

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

update/update_repo.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import re
2222
import requests
2323
import time
24-
from typing import NamedTuple, Sequence, Tuple
24+
from typing import NamedTuple, Set, Sequence, Tuple
2525
from zipfile import ZipFile
2626

2727

@@ -38,7 +38,7 @@
3838
flags.DEFINE_integer("icon_limit", 0, "If > 0, the max # of icons to process.")
3939

4040

41-
_METADATA_URL = "http://fonts.google.com/metadata/icons"
41+
_METADATA_URL = "http://fonts.google.com/metadata/icons?incomplete=1"
4242

4343

4444
class Asset(NamedTuple):
@@ -56,6 +56,7 @@ class Icon(NamedTuple):
5656
category: str
5757
version: int
5858
sizes_px: Tuple[int, ...]
59+
stylistic_sets: Set[str]
5960

6061

6162
_ICON_ASSETS = (
@@ -114,12 +115,15 @@ def _version_key(icon: Icon):
114115

115116

116117
def _icons(metadata):
118+
all_sets = set(metadata["families"])
117119
for raw_icon in metadata["icons"]:
120+
unsupported = set(raw_icon["unsupported_families"])
118121
yield Icon(
119122
raw_icon["name"],
120123
raw_icon["categories"][0],
121124
raw_icon["version"],
122125
tuple(raw_icon["sizes_px"]),
126+
all_sets - unsupported,
123127
)
124128

125129

@@ -228,8 +232,11 @@ def main(_):
228232
num_changed += 1
229233
for size_px in icon.sizes_px:
230234
for stylistic_set in stylistic_sets:
235+
if stylistic_set not in icon.stylistic_sets:
236+
continue
237+
231238
pattern_args = _pattern_args(metadata, stylistic_set)
232-
pattern_args["icon"] = (icon,)
239+
pattern_args["icon"] = icon
233240
pattern_args["size_px"] = size_px
234241

235242
for asset in _ICON_ASSETS:

0 commit comments

Comments
 (0)