Skip to content

Commit

Permalink
Fix bug when requesting italic gfonts (#5623)
Browse files Browse the repository at this point in the history
  • Loading branch information
dewet22 committed Oct 29, 2023
1 parent 01a1614 commit f36ec7c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions esphome/components/font/__init__.py
Expand Up @@ -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():
Expand Down

0 comments on commit f36ec7c

Please sign in to comment.