From 59f547726603f6f967a9ade180cf03ee76a35304 Mon Sep 17 00:00:00 2001 From: Slavfox Date: Mon, 12 Jun 2023 15:47:20 +0200 Subject: [PATCH] v.1.19.2-hidpi2 HiDpi fixes --- .github/workflows/main.yml | 6 +++++- CHANGELOG.md | 10 +++++++++- build.py | 23 ++++++++++++++++------- cozette_builder/hidpi.py | 2 +- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dfb5947..5fde417 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,9 +27,13 @@ jobs: - name: Build fonts run: | pipenv --python /bin/python install; pipenv run python build.py fonts + - name: Save version + id: version + run: | + echo "version=${GITHUB_REF#refs/tags/}" | tr . - >> $GITHUB_OUTPUT - name: Zip fonts run: | - mv build CozetteFonts; cp ./LICENSE CozetteFonts/LICENSE; zip -r CozetteFonts.zip CozetteFonts + mv build CozetteFonts; cp ./LICENSE CozetteFonts/LICENSE; zip -r CozetteFonts-${{ steps.version.outputs.version }}.zip CozetteFonts - uses: ncipollo/release-action@v1 with: artifacts: "CozetteFonts.zip,CozetteFonts/*" diff --git a/CHANGELOG.md b/CHANGELOG.md index bb57519..f77d006 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ 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.19.2-hidpi2] + +### Changed + +- TTF fonts now build from the fontforge sfd sources +- Fixed rendering of hidpi fonts in terminals + ## [1.19.2-hidpi] ### Added @@ -2098,7 +2105,8 @@ 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.19.2-hidpi...HEAD +[unreleased]: https://github.com/slavfox/Cozette/compare/v.1.19.2-hidpi2...HEAD +[1.19.2-hidpi2]: https://github.com/slavfox/Cozette/compare/v.1.19.2-hidpi...v.1.19.2-hidpi2 [1.19.2-hidpi]: https://github.com/slavfox/Cozette/compare/v.1.19.2...v.1.19.2-hidpi [1.19.2]: https://github.com/slavfox/Cozette/compare/v.1.19.1...v.1.19.2 [1.19.1]: https://github.com/slavfox/Cozette/compare/v.1.19.0...v.1.19.1 diff --git a/build.py b/build.py index 0f97a73..01c2360 100644 --- a/build.py +++ b/build.py @@ -8,7 +8,7 @@ from typing import Optional, Sequence, cast import crayons # type: ignore -from cozette_builder.changeloggen import get_changelog +from cozette_builder.changeloggen import get_changelog, get_last_ver from cozette_builder.hidpi import double_size from cozette_builder.imagegen import ( add_margins, @@ -59,8 +59,8 @@ def fontforge(open: Path, generate: Sequence[Generate]): script = "; ".join( [ f'Open("{open}")', - 'RenameGlyphs("AGL with PUA")', - 'Reencode("unicode")', + # 'RenameGlyphs("AGL with PUA")', + # 'Reencode("unicode")', ] + [str(gen) for gen in generate] ) @@ -91,6 +91,12 @@ def gen_bitmap_formats() -> Path: def fix_ttf(ttfpath: Path, name: str): print(crayons.yellow(f"Generating TTF for {name}...")) + version = "1.0" + with SFDPATH.open() as f: + for line in f.readlines(): + if line.startswith("Version "): + version = line.split()[1] + break script = "; ".join( [ f'Open("{ttfpath}")', @@ -101,8 +107,11 @@ def fix_ttf(ttfpath: Path, name: str): 'RenameGlyphs("AGL with PUA")', 'Reencode("unicode")', f'SetTTFName(0x409, 3, "{name}")', - f'SetTTFName(0x409, 11, "")', - 'SetTTFName(0x409, 13, "MIT")', + 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")', @@ -159,10 +168,10 @@ def gen_variants(bdf_path: Path): check=True, ) subprocess.run( - bnp_invoc_ttf("CozetteVector", "ttf") + [bdf_path], check=True + bnp_invoc_ttf("CozetteVector", "ttf") + [SFDPATH], check=True ) subprocess.run( - bnp_invoc_ttf("CozetteVectorBold", "ttf") + ["-b", bdf_path], + bnp_invoc_ttf("CozetteVectorBold", "ttf") + ["-b", SFDPATH], check=True, ) print(crayons.yellow("Fixing TTF variants...")) diff --git a/cozette_builder/hidpi.py b/cozette_builder/hidpi.py index 50c7557..0f24d4a 100644 --- a/cozette_builder/hidpi.py +++ b/cozette_builder/hidpi.py @@ -46,7 +46,7 @@ scale_lines = [ "FIGURE_WIDTH", "AVG_LOWERCASE_WIDTH", "AVG_UPPERCASE_WIDTH" "DWIDTH", - # "SWIDTH", + "DWIDTH", "BBX", "QUAD_WIDTH", ]