1
0

Almost perfect

This commit is contained in:
2026-03-02 03:31:28 +01:00
parent cdcc0942c7
commit 1ef62915f7
2 changed files with 36 additions and 3 deletions

View File

@@ -36,9 +36,9 @@ ITALIC_VF = os.path.join(SRC_DIR, "Newsreader-Italic-VariableFont_opsz,wght.ttf
VARIANTS = [
# (output_name, source_vf, wght, opsz)
("Readerly-Regular", REGULAR_VF, 430, 9),
("Readerly-Regular", REGULAR_VF, 425, 9),
("Readerly-Bold", REGULAR_VF, 550, 9),
("Readerly-Italic", ITALIC_VF, 430, 9),
("Readerly-Italic", ITALIC_VF, 425, 9),
("Readerly-BoldItalic", ITALIC_VF, 550, 9),
]
@@ -171,7 +171,8 @@ def main():
# Step 2: Apply vertical scale (opens TTF, saves as SFD)
print("\n── Step 2: Scale lowercase ──\n")
scale_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "scale.py"))
scale_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "scale.py"))
condense_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "condense.py"))
clear_code = "\n".join(
f'if {g!r} in f:\n'
@@ -188,6 +189,7 @@ def main():
script = build_per_font_script(ttf_path, sfd_path, [
("Clearing problematic glyphs", clear_code),
("Scaling Y", scale_code),
("Condensing X", condense_code),
])
run_fontforge_script(script)

31
scripts/condense.py Normal file
View File

@@ -0,0 +1,31 @@
"""
FontForge: Condense all glyphs horizontally
────────────────────────────────────────────
Applies a horizontal scale to all glyphs, reducing set width.
Run inside FontForge (or via build.py which sets `f` before running this).
"""
import fontforge
import psMat
f = fontforge.activeFont()
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# CONFIGURATION
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SCALE_X = 0.95
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# APPLY
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
mat = psMat.scale(SCALE_X, 1.0)
f.selection.all()
f.transform(mat, ("round",))
count = sum(1 for g in f.glyphs() if g.isWorthOutputting())
print(f" Condensed {count} glyphs by X={SCALE_X:.0%}")
print("Done.")