Normalize font variant naming for google fonts (#7083)

This commit is contained in:
Andrey Antukh 2025-08-07 11:14:40 +02:00 committed by GitHub
parent 9562d2f1f0
commit 8f5f88743b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -22,6 +22,7 @@
- Fix issue where multiple dropdown menus could be opened simultaneously on the dashboard page [Taiga #11500](https://tree.taiga.io/project/penpot/issue/11500)
- Fix font size/variant not updated when editing a text [Taiga #11552](https://tree.taiga.io/project/penpot/issue/11552)
- Fix issue where Alt + arrow keys shortcut interferes with letter-spacing when moving text layers [Taiga #11552](https://tree.taiga.io/project/penpot/issue/11771)
- Fix consistency issues on how font variants are visualized [Taiga #11499](https://tree.taiga.io/project/penpot/us/11499)
## 2.9.0 (Unreleased)

View File

@ -16,15 +16,15 @@
[variant files]
(cond
(= "regular" variant)
{:id "regular" :name "regular" :weight "400" :style "normal" :ttf-url (get files "regular")}
{:id "regular" :name "400" :weight "400" :style "normal" :ttf-url (get files "regular")}
(= "italic" variant)
{:id "italic" :name "italic" :weight "400" :style "italic" :ttf-url (get files "italic")}
{:id "italic" :name "400 Italic" :weight "400" :style "italic" :ttf-url (get files "italic")}
:else
(when-let [[id weight style] (re-find #"^(\d+)(.*)$" variant)]
{:id id
:name variant
:name (str/trim (str weight " " (str/capital style)))
:weight weight
:style (if (str/empty? style) "normal" style)
:ttf-url (get files id)})))