Fix bug when requesting italic gfonts (#5623)

This commit is contained in:
Dewet Diener 2023-10-29 19:05:18 +00:00 committed by GitHub
parent 01a16141f1
commit f36ec7c726
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -137,11 +137,10 @@ def validate_weight_name(value):
def download_gfonts(value):
wght = value[CONF_WEIGHT]
if value[CONF_ITALIC]:
wght = f"1,{wght}"
name = f"{value[CONF_FAMILY]}@{value[CONF_WEIGHT]}"
url = f"https://fonts.googleapis.com/css2?family={value[CONF_FAMILY]}:wght@{wght}"
name = (
f"{value[CONF_FAMILY]}:ital,wght@{int(value[CONF_ITALIC])},{value[CONF_WEIGHT]}"
)
url = f"https://fonts.googleapis.com/css2?family={name}"
path = _compute_gfonts_local_path(value)
if path.is_file():