mirror of
https://github.com/slavfox/Cozette.git
synced 2026-03-11 08:54:33 +00:00
v.1.21.0-woff - Fix OS/2 tables, add woff/woff2 export
This commit is contained in:
parent
4d99930da0
commit
4732909e86
3 changed files with 55 additions and 31 deletions
|
|
@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog], and this project adheres to
|
||||
[Semantic Versioning].
|
||||
|
||||
## [1.21.0-woff]
|
||||
|
||||
Fixed OS/2 tables and added woff/woff2 formats.
|
||||
|
||||
## [1.21.0]
|
||||
|
||||
The BQN update, brought to you by [dariof4](https://github.com/dariof4)!
|
||||
|
|
@ -2218,8 +2222,9 @@ Still broken on Windows.
|
|||
|
||||
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
|
||||
[semantic versioning]: https://semver.org/spec/v2.0.0.html
|
||||
[unreleased]: https://github.com/slavfox/Cozette/compare/v.1.21.0...HEAD
|
||||
[1.20.1]: https://github.com/slavfox/Cozette/compare/v.1.20.1...v.1.21.0
|
||||
[unreleased]: https://github.com/slavfox/Cozette/compare/v.1.21.0-woff...HEAD
|
||||
[1.21.0-woff]: https://github.com/slavfox/Cozette/compare/v.1.21.0...v.1.21.0-woff
|
||||
[1.21.0]: https://github.com/slavfox/Cozette/compare/v.1.20.1...v.1.21.0
|
||||
[1.20.1]: https://github.com/slavfox/Cozette/compare/v.1.20.0...v.1.20.1
|
||||
[1.20.0]: https://github.com/slavfox/Cozette/compare/v.1.19.3...v.1.20.0
|
||||
[1.19.3]: https://github.com/slavfox/Cozette/compare/v.1.19.2-hidpi2...v.1.19.3
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ A bitmap programming font optimized for coziness.
|
|||
- [Roadmap](#roadmap)
|
||||
- [Recommended alternatives](#recommended-alternatives)
|
||||
- [Character map](#character-map)
|
||||
- [Building](#building)
|
||||
- [Contributors](#contributors)
|
||||
- [License](#license)
|
||||
- [License](#license--acknowledgements)
|
||||
|
||||
# About Cozette
|
||||
|
||||
|
|
|
|||
74
build.py
74
build.py
|
|
@ -5,6 +5,7 @@ from pathlib import Path
|
|||
from shlex import quote
|
||||
from shutil import rmtree
|
||||
from typing import Optional, Sequence, cast
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
import crayons # type: ignore
|
||||
|
||||
|
|
@ -103,35 +104,52 @@ def fix_ttf(ttfpath: Path, name: str):
|
|||
if line.startswith("Version "):
|
||||
version = line.split()[1]
|
||||
break
|
||||
script = "; ".join(
|
||||
[
|
||||
f'Open("{ttfpath}")',
|
||||
"SelectWorthOutputting()",
|
||||
"RemoveOverlap()",
|
||||
"CorrectDirection()",
|
||||
"ScaleToEm(2048)",
|
||||
'RenameGlyphs("AGL with PUA")',
|
||||
'Reencode("unicode")',
|
||||
f'SetTTFName(0x409, 3, "{name}")',
|
||||
f'SetTTFName(0x409, 5, "{version}")',
|
||||
f'SetTTFName(0x409, 8, "Slavfox")',
|
||||
f'SetTTFName(0x409, 9, "Slavfox")',
|
||||
f'SetTTFName(0x409, 11, "https://github.com/slavfox/Cozette")',
|
||||
f'SetTTFName(0x409, 13, "MIT")',
|
||||
'SetTTFName(0x409, 14, "https://opensource.org/licenses/MIT")',
|
||||
f'Generate("{name}.dfont")',
|
||||
f'Generate("{name}.otf")',
|
||||
f'Generate("{name}.ttf")',
|
||||
]
|
||||
)
|
||||
|
||||
with NamedTemporaryFile() as sfd:
|
||||
subprocess.run(
|
||||
[f"fontforge -c '"
|
||||
f"f = open(\"{ttfpath}\"); "
|
||||
f"f.os2_version = 4; "
|
||||
f"f.os2_weight_width_slope_only = True; "
|
||||
f"f.save(\"{sfd.name}\")'"],
|
||||
cwd=BUILD_DIR,
|
||||
shell=True,
|
||||
check=True,
|
||||
)
|
||||
script = ";\n".join(
|
||||
[
|
||||
f'Open("{sfd.name}")',
|
||||
"SelectWorthOutputting()",
|
||||
"RemoveOverlap()",
|
||||
"CorrectDirection()",
|
||||
"ScaleToEm(2048)",
|
||||
'RenameGlyphs("AGL with PUA")',
|
||||
'Reencode("unicode")',
|
||||
f'SetTTFName(0x409, 3, "{name}")',
|
||||
f'SetTTFName(0x409, 5, "{version}")',
|
||||
f'SetTTFName(0x409, 8, "Slavfox")',
|
||||
f'SetTTFName(0x409, 9, "Slavfox")',
|
||||
f'SetTTFName(0x409, 11, "https://github.com/slavfox/Cozette")',
|
||||
f'SetTTFName(0x409, 13, LoadStringFromFile({repr(str((REPO_ROOT / "LICENSE").resolve()))}))',
|
||||
'SetTTFName(0x409, 14, "https://github.com/slavfox/Cozette/blob/master/LICENSE")',
|
||||
f'Generate("{name}.dfont")',
|
||||
f'Generate("{name}.otf")',
|
||||
f'Generate("{name}.ttf")',
|
||||
f'Generate("{name}.woff")',
|
||||
f'Generate("{name}.woff2")',
|
||||
]
|
||||
)
|
||||
with NamedTemporaryFile(mode="w+", suffix=".pe") as f:
|
||||
print(f.name)
|
||||
f.write(script)
|
||||
f.flush()
|
||||
f.seek(0)
|
||||
subprocess.run(
|
||||
[f"fontforge -script {f.name}"],
|
||||
cwd=BUILD_DIR,
|
||||
shell=True,
|
||||
check=True,
|
||||
)
|
||||
# No idea why this doesn't work without shell=True
|
||||
subprocess.run(
|
||||
[f"fontforge -lang ff -c {quote(script)}"],
|
||||
cwd=BUILD_DIR,
|
||||
shell=True,
|
||||
check=True,
|
||||
)
|
||||
ttfpath.unlink()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue