mirror of
https://github.com/slavfox/Cozette.git
synced 2026-03-11 08:54:33 +00:00
Merge pull request #185 from WhyNotHugo/fix-bold-family
Make Regular and Bold fonts variants
This commit is contained in:
commit
67d08e60a2
1 changed files with 16 additions and 1 deletions
17
build.py
17
build.py
|
|
@ -106,6 +106,16 @@ def fix_ttf(ttfpath: Path, name: str):
|
|||
if line.startswith("Version "):
|
||||
version = line.split()[1]
|
||||
break
|
||||
|
||||
if name.endswith("Bold"):
|
||||
family_name = name.removesuffix("Bold")
|
||||
style_name = "Bold"
|
||||
weight = 700
|
||||
else:
|
||||
family_name = name
|
||||
style_name = "Regular"
|
||||
weight = 400
|
||||
|
||||
with NamedTemporaryFile() as sfd:
|
||||
subprocess.run(
|
||||
[
|
||||
|
|
@ -128,13 +138,18 @@ def fix_ttf(ttfpath: Path, name: str):
|
|||
"ScaleToEm(2048)",
|
||||
'RenameGlyphs("AGL with PUA")',
|
||||
'Reencode("unicode")',
|
||||
f'SetTTFName(0x409, 3, "{name}")',
|
||||
f'SetTTFName(0x409, 1, "{family_name}")',
|
||||
f'SetTTFName(0x409, 2, "{style_name}")',
|
||||
f'SetTTFName(0x409, 3, "{family_name} {style_name}")', # Unique font identifier
|
||||
f'SetTTFName(0x409, 4, "{family_name} {style_name}")', # Full font name
|
||||
f'SetTTFName(0x409, 5, "{version}")',
|
||||
f'SetTTFName(0x409, 6, "{family_name}-{style_name}")', # PostScript name
|
||||
f'SetTTFName(0x409, 8, "Ines <ines@moonwit.ch>")',
|
||||
f'SetTTFName(0x409, 9, "Ines <ines@moonwit.ch>")',
|
||||
f'SetTTFName(0x409, 11, "https://github.com/the-moonwitch/Cozette")',
|
||||
f'SetTTFName(0x409, 13, LoadStringFromFile({repr(str((REPO_ROOT / "LICENSE").resolve()))}))',
|
||||
'SetTTFName(0x409, 14, "https://github.com/the-moonwitch/Cozette/blob/master/LICENSE")',
|
||||
f'SetOS2Value("Weight", {weight})',
|
||||
f'Generate("{name}.dfont")',
|
||||
f'Generate("{name}.otf")',
|
||||
f'Generate("{name}.ttf")',
|
||||
|
|
|
|||
Loading…
Reference in a new issue