Skip to content

Commit

Permalink
Fix Roboto Flex download.
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Sep 19, 2024
1 parent e73b8d3 commit 80b4fc2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/opentype_variations.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@

path = Path(__file__).with_name(f"{DEFAULT_FONT}.ttf")
if not path.exists():
url = f"https://fonts.google.com/download?family={quote(DEFAULT_FONT)}"
url = ("https://github.com/googlefonts/roboto-flex/"
"releases/download/3.200/roboto-flex-fonts.zip")
member = (
"roboto-flex-fonts/fonts/variable/"
"RobotoFlex[GRAD,XOPQ,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC,opsz,slnt,wdth,wght].ttf")
print(f"Downloading {url} to {path}")
tmpfile, _ = urlretrieve(url)
with ZipFile(tmpfile) as zfd:
for member in zfd.namelist():
if (member.startswith(DEFAULT_FONT.replace(" ", "")) and
member.endswith(".ttf")):
path.write_bytes(zfd.read(member))
break
path.write_bytes(zfd.read(member))


def generate_font(family, size, axes):
Expand Down

0 comments on commit 80b4fc2

Please sign in to comment.