From f96a839bcf79e3e6b86dfc87627d9b8db47f2bde Mon Sep 17 00:00:00 2001 From: Dewet Diener Date: Sun, 29 Oct 2023 19:05:18 +0000 Subject: [PATCH] Fix bug when requesting italic gfonts (#5623) --- esphome/components/font/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/esphome/components/font/__init__.py b/esphome/components/font/__init__.py index 2bd6beeaeb..7e34dff22d 100644 --- a/esphome/components/font/__init__.py +++ b/esphome/components/font/__init__.py @@ -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():