From 40542b8b20d2af9cd7cf9ebc7542037d2c472c5e Mon Sep 17 00:00:00 2001 From: Nick Doiron Date: Wed, 15 Jan 2025 09:33:31 -0600 Subject: [PATCH] source Arabic from newer repo --- scripts/get-fonts.py | 25 ++++++++++++++++++------- style/fonts.mss | 4 ++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/scripts/get-fonts.py b/scripts/get-fonts.py index 31c394984c..d0c991054a 100755 --- a/scripts/get-fonts.py +++ b/scripts/get-fonts.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # This script downloads several Noto fonts from https://github.com/notofonts/noto-fonts # That repo was archived in 2023 and is no longer updated. -# Additional fonts can be found on https://notofonts.github.io +# Fonts in the NEWER_REPO list are downloaded from Noto's CDN or individual repos. import os import requests @@ -17,13 +17,19 @@ except FileExistsError: warnings.warn("Font directory already exists") +# Fonts to source from CDN linked by https://notofonts.github.io +# Includes updates after 2023. +NEWER_REPO = [ + "NotoSansArabic", +] + # Fonts to download in regular, bold, and italic REGULAR_BOLD_ITALIC = ["NotoSans"] # Fonts to download in regular and bold REGULAR_BOLD = [ "NotoSansAdlamUnjoined", - "NotoSansArabicUI", + "NotoSansArabic", "NotoSansArmenian", "NotoSansBalinese", "NotoSansBamum", @@ -90,13 +96,18 @@ "NotoSansYi", ] - # Attempt to download the font from repos in this order def findFontUrls(fontName, modifier): - return [ - f"https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/{fontName}/{fontName}-{modifier}.ttf", - # currently only sourcing from one repo - ] + if fontName in NEWER_REPO: + subDir = fontName.replace("NotoSans", "").replace("UI", "").lower() + return [ + f"https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/{fontName}/hinted/ttf/{fontName}-{modifier}.ttf", + f"https://notofonts.github.io/{subDir}/fonts/{fontName}/hinted/ttf/{fontName}-{modifier}.ttf", + ] + else: + return [ + f"https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/{fontName}/{fontName}-{modifier}.ttf", + ] def downloadToFile(urls, destination, dir=FONTDIR): diff --git a/style/fonts.mss b/style/fonts.mss index e4ca039cdc..5196e7f5c3 100644 --- a/style/fonts.mss +++ b/style/fonts.mss @@ -58,7 +58,7 @@ A regular style. */ @book-fonts: "Noto Sans Regular", "Noto Sans Adlam Unjoined Regular", - "Noto Sans Arabic UI Regular", + "Noto Sans Arabic Regular", "Noto Sans Armenian Regular", "Noto Sans Balinese Regular", "Noto Sans Bamum Regular", @@ -129,7 +129,7 @@ regular text and can be used for emphasis. Fallback is a regular style. */ @bold-fonts: "Noto Sans Bold", "Noto Sans Adlam Unjoined Bold", - "Noto Sans Arabic UI Bold", + "Noto Sans Arabic Bold", "Noto Sans Armenian Bold", "Noto Sans Balinese Bold", "Noto Sans Bamum Bold",