Skip to content

Commit

Permalink
feat: manually download fonts instead of yarn
Browse files Browse the repository at this point in the history
- the npm packages are outdated
- we do not need anything besides woff2
  • Loading branch information
nijel committed Dec 19, 2024
1 parent 0df8d23 commit 8199f22
Show file tree
Hide file tree
Showing 87 changed files with 93 additions and 228 deletions.
9 changes: 9 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@
"renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s+appVersion: (?<currentValue>.*)\\s"
]
},
{
"customType": "regex",
"fileMatch": [
"^scripts/fonts\\.toml$"
],
"matchStrings": [
"renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s+version = (?<currentValue>.*)\\s"
]
},
{
"customType": "regex",
"fileMatch": [
Expand Down
81 changes: 0 additions & 81 deletions .github/workflows/yarn-update.yml

This file was deleted.

29 changes: 29 additions & 0 deletions scripts/fonts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[source-code-woff2]
destination = "weblate_web/static/vendor/font-source/WOFF2/TTF"
extract = [
"WOFF2/TTF/SourceCodePro-Bold.ttf.woff2",
"WOFF2/TTF/SourceCodePro-ExtraLight.ttf.woff2",
"WOFF2/TTF/SourceCodePro-It.ttf.woff2",
"WOFF2/TTF/SourceCodePro-Medium.ttf.woff2",
"WOFF2/TTF/SourceCodePro-Regular.ttf.woff2",
"WOFF2/TTF/SourceCodePro-Semibold.ttf.woff2"
]
url = "https://github.com/adobe-fonts/source-code-pro/releases/download/{version_quoted}/WOFF2-source-code-pro-{version_underscore}.zip"
# renovate: datasource=github-releases depName=adobe-fonts/source-code-pro
version = "2.042R-u/1.062R-i/1.026R-vf"

[source-sans-woff2]
destination = "weblate_web/static/vendor/font-source/WOFF2/TTF"
extract = [
"WOFF2/TTF/SourceSans3-Black.ttf.woff2",
"WOFF2/TTF/SourceSans3-BoldIt.ttf.woff2",
"WOFF2/TTF/SourceSans3-Bold.ttf.woff2",
"WOFF2/TTF/SourceSans3-ExtraLight.ttf.woff2",
"WOFF2/TTF/SourceSans3-It.ttf.woff2",
"WOFF2/TTF/SourceSans3-Light.ttf.woff2",
"WOFF2/TTF/SourceSans3-Regular.ttf.woff2",
"WOFF2/TTF/SourceSans3-Semibold.ttf.woff2"
]
url = "https://github.com/adobe-fonts/source-sans/releases/download/{version}/WOFF2-source-sans-{version}.zip"
# renovate: datasource=github-releases depName=adobe-fonts/source-sans
version = "3.052R"
29 changes: 29 additions & 0 deletions scripts/update-fonts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python3

import tomllib
from io import BytesIO
from pathlib import Path, PurePath
from urllib.parse import quote
from zipfile import ZipFile

import requests

with open("scripts/fonts.toml", "rb") as handle:
FONTS = tomllib.load(handle)

for name, font in FONTS.items():
print(f"Processing {name}...")
url = font["url"].format(
version_quoted=quote(font["version"], safe=""),
version_underscore=font["version"].replace("/", "_").replace("-vf", "vf"),
**font,
)
destination = Path(font["destination"])
print(f"Download {url}...")
response = requests.get(url, timeout=30)
response.raise_for_status()
with ZipFile(BytesIO(response.content)) as zipfile:
for filename in font["extract"]:
output = destination / PurePath(filename).name
print(f"Writing out {output}...")
output.write_bytes(zipfile.read(filename))
34 changes: 0 additions & 34 deletions scripts/yarn-update

This file was deleted.

1 change: 0 additions & 1 deletion scripts/yarn/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/yarn/modernizr-config.json

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/yarn/package.json

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/yarn/yarn.lock

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
70 changes: 14 additions & 56 deletions weblate_web/static/vendor/font-source/source-code-pro.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ font-display: swap;
font-weight: 200;
font-style: normal;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-ExtraLight.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-ExtraLight.otf.woff') format('woff'),
url('./OTF/SourceCodePro-ExtraLight.otf') format('opentype'),
url('./TTF/SourceCodePro-ExtraLight.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-ExtraLight.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -16,10 +13,7 @@ font-display: swap;
font-weight: 200;
font-style: italic;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-ExtraLightIt.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-ExtraLightIt.otf.woff') format('woff'),
url('./OTF/SourceCodePro-ExtraLightIt.otf') format('opentype'),
url('./TTF/SourceCodePro-ExtraLightIt.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-ExtraLightIt.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -28,10 +22,7 @@ font-display: swap;
font-weight: 300;
font-style: normal;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-Light.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-Light.otf.woff') format('woff'),
url('./OTF/SourceCodePro-Light.otf') format('opentype'),
url('./TTF/SourceCodePro-Light.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-Light.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -40,10 +31,7 @@ font-display: swap;
font-weight: 300;
font-style: italic;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-LightIt.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-LightIt.otf.woff') format('woff'),
url('./OTF/SourceCodePro-LightIt.otf') format('opentype'),
url('./TTF/SourceCodePro-LightIt.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-LightIt.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -52,10 +40,7 @@ font-display: swap;
font-weight: 400;
font-style: normal;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-Regular.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-Regular.otf.woff') format('woff'),
url('./OTF/SourceCodePro-Regular.otf') format('opentype'),
url('./TTF/SourceCodePro-Regular.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-Regular.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -64,10 +49,7 @@ font-display: swap;
font-weight: 400;
font-style: italic;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-It.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-It.otf.woff') format('woff'),
url('./OTF/SourceCodePro-It.otf') format('opentype'),
url('./TTF/SourceCodePro-It.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-It.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -76,10 +58,7 @@ font-display: swap;
font-weight: 500;
font-style: normal;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-Medium.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-Medium.otf.woff') format('woff'),
url('./OTF/SourceCodePro-Medium.otf') format('opentype'),
url('./TTF/SourceCodePro-Medium.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-Medium.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -88,10 +67,7 @@ font-display: swap;
font-weight: 500;
font-style: italic;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-MediumIt.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-MediumIt.otf.woff') format('woff'),
url('./OTF/SourceCodePro-MediumIt.otf') format('opentype'),
url('./TTF/SourceCodePro-MediumIt.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-MediumIt.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -100,10 +76,7 @@ font-display: swap;
font-weight: 600;
font-style: normal;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-Semibold.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-Semibold.otf.woff') format('woff'),
url('./OTF/SourceCodePro-Semibold.otf') format('opentype'),
url('./TTF/SourceCodePro-Semibold.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-Semibold.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -112,10 +85,7 @@ font-display: swap;
font-weight: 600;
font-style: italic;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-SemiboldIt.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-SemiboldIt.otf.woff') format('woff'),
url('./OTF/SourceCodePro-SemiboldIt.otf') format('opentype'),
url('./TTF/SourceCodePro-SemiboldIt.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-SemiboldIt.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -124,10 +94,7 @@ font-display: swap;
font-weight: 700;
font-style: normal;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-Bold.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-Bold.otf.woff') format('woff'),
url('./OTF/SourceCodePro-Bold.otf') format('opentype'),
url('./TTF/SourceCodePro-Bold.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-Bold.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -136,10 +103,7 @@ font-display: swap;
font-weight: 700;
font-style: italic;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-BoldIt.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-BoldIt.otf.woff') format('woff'),
url('./OTF/SourceCodePro-BoldIt.otf') format('opentype'),
url('./TTF/SourceCodePro-BoldIt.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-BoldIt.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -148,10 +112,7 @@ font-display: swap;
font-weight: 900;
font-style: normal;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-Black.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-Black.otf.woff') format('woff'),
url('./OTF/SourceCodePro-Black.otf') format('opentype'),
url('./TTF/SourceCodePro-Black.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-Black.ttf.woff2') format('woff2');
}

@font-face{
Expand All @@ -160,8 +121,5 @@ font-display: swap;
font-weight: 900;
font-style: italic;
font-stretch: normal;
src: url('./WOFF2/TTF/SourceCodePro-BlackIt.ttf.woff2') format('woff2'),
url('./WOFF/OTF/SourceCodePro-BlackIt.otf.woff') format('woff'),
url('./OTF/SourceCodePro-BlackIt.otf') format('opentype'),
url('./TTF/SourceCodePro-BlackIt.ttf') format('truetype');
src: url('./WOFF2/TTF/SourceCodePro-BlackIt.ttf.woff2') format('woff2');
}
Loading

0 comments on commit 8199f22

Please sign in to comment.