var2stat 0.2.1__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- var2stat-0.2.3/.release-please-manifest.json +1 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/CHANGELOG.md +14 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/PKG-INFO +1 -1
- {var2stat-0.2.1 → var2stat-0.2.3}/pyproject.toml +1 -1
- {var2stat-0.2.1 → var2stat-0.2.3}/src/var2stat/config.py +1 -1
- {var2stat-0.2.1 → var2stat-0.2.3}/src/var2stat/generate.py +10 -19
- var2stat-0.2.1/.release-please-manifest.json +0 -1
- {var2stat-0.2.1 → var2stat-0.2.3}/.github/workflows/publish.yml +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/.github/workflows/release.yml +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/.gitignore +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/.python-version +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/LICENSE +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/README.md +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/release-please-config.json +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/src/var2stat/__init__.py +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/src/var2stat/__main__.py +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/src/var2stat/schema.json +0 -0
- {var2stat-0.2.1 → var2stat-0.2.3}/uv.lock +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{".":"0.2.3"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.3](https://github.com/decipher3114/Var2Stat/compare/var2stat-v0.2.2...var2stat-v0.2.3) (2026-06-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* use correct url for schema ([e263cc3](https://github.com/decipher3114/Var2Stat/commit/e263cc38b17dc8720e147f36dfe8f692a8abb490))
|
|
9
|
+
|
|
10
|
+
## [0.2.2](https://github.com/decipher3114/Var2Stat/compare/var2stat-v0.2.1...var2stat-v0.2.2) (2026-05-13)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* use standard naming convention ([48697b2](https://github.com/decipher3114/Var2Stat/commit/48697b204f2c4f58cdfae5e1d9f4e971673b9c07))
|
|
16
|
+
|
|
3
17
|
## [0.2.1](https://github.com/decipher3114/Var2Stat/compare/var2stat-v0.2.0...var2stat-v0.2.1) (2026-05-13)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -7,7 +7,7 @@ from typing import Any, Dict
|
|
|
7
7
|
import click
|
|
8
8
|
from fontTools.ttLib import TTFont
|
|
9
9
|
|
|
10
|
-
SCHEMA_URL = "https://raw.githubusercontent.com/decipher3114/Var2Stat/refs/heads/main/var2stat/
|
|
10
|
+
SCHEMA_URL = "https://raw.githubusercontent.com/decipher3114/Var2Stat/refs/heads/main/src/var2stat/schema.json"
|
|
11
11
|
_SCHEMA_PATH = Path(__file__).resolve().with_name("schema.json")
|
|
12
12
|
|
|
13
13
|
WEIGHT_NAMES: Dict[int, str] = {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
import os
|
|
5
|
-
import re
|
|
6
5
|
from pathlib import Path
|
|
7
6
|
from typing import Any, Dict
|
|
8
7
|
|
|
@@ -50,24 +49,16 @@ def remove_variation_tables(font: TTFont) -> None:
|
|
|
50
49
|
del font[table]
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
def canonicalize(value: str, fallback: str) -> str:
|
|
53
|
+
"""Canonicalize a string for filenames/PostScript names.
|
|
54
54
|
|
|
55
|
+
Removes all non-alphabetic characters (spaces, '-', '_', digits, punctuation, etc.).
|
|
56
|
+
"""
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
# Convert all non-alphanumeric characters (including spaces) into '_',
|
|
58
|
-
# and collapse runs via the regex '+'.
|
|
59
|
-
canonical = _CANONICAL_FILENAME_RE.sub("_", (value or "").strip()).strip("_")
|
|
58
|
+
canonical = "".join(ch for ch in (value or "").strip() if ch.isalpha())
|
|
60
59
|
return canonical or fallback
|
|
61
60
|
|
|
62
61
|
|
|
63
|
-
def canonicalize_font_name(font_name: str) -> str:
|
|
64
|
-
return canonicalize_name_for_filename(font_name, fallback="Font")
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def canonicalize_variant(variant: str) -> str:
|
|
68
|
-
return canonicalize_name_for_filename(variant, fallback="Variant")
|
|
69
|
-
|
|
70
|
-
|
|
71
62
|
def encode(record, text: str) -> bytes:
|
|
72
63
|
# platform-aware encoding
|
|
73
64
|
if record.platformID == 3: # Windows
|
|
@@ -101,7 +92,7 @@ def update_font_names(
|
|
|
101
92
|
record.string = encode(record, full_name)
|
|
102
93
|
|
|
103
94
|
elif record.nameID == 6: # PostScript name
|
|
104
|
-
ps_name = f"{font_name
|
|
95
|
+
ps_name = f"{canonicalize(font_name, 'Font')}-{canonicalize(variant_name, 'Variant')}"
|
|
105
96
|
record.string = encode(record, ps_name)
|
|
106
97
|
|
|
107
98
|
# Update OS/2 weight class
|
|
@@ -167,9 +158,9 @@ def generate_variant(
|
|
|
167
158
|
update_font_names(static_font, font_name, variant_name, resolved_axes)
|
|
168
159
|
|
|
169
160
|
# Save font
|
|
170
|
-
canonical_font_name =
|
|
171
|
-
canonical_variant_name =
|
|
172
|
-
output_filename = f"{canonical_font_name}
|
|
161
|
+
canonical_font_name = canonicalize(font_name, fallback="Font")
|
|
162
|
+
canonical_variant_name = canonicalize(variant_name, fallback="Variant")
|
|
163
|
+
output_filename = f"{canonical_font_name}-{canonical_variant_name}.ttf"
|
|
173
164
|
static_font.save(os.path.join(output_folder, output_filename))
|
|
174
165
|
|
|
175
166
|
return True
|
|
@@ -180,7 +171,7 @@ def generate_variant(
|
|
|
180
171
|
|
|
181
172
|
|
|
182
173
|
def resolve_output_directory(font_name: str) -> str:
|
|
183
|
-
canonical_font_name =
|
|
174
|
+
canonical_font_name = canonicalize(font_name, fallback="Font")
|
|
184
175
|
os.makedirs(canonical_font_name, exist_ok=True)
|
|
185
176
|
return canonical_font_name
|
|
186
177
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{".":"0.2.1"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|