Almost perfect
This commit is contained in:
8
build.py
8
build.py
@@ -36,9 +36,9 @@ ITALIC_VF = os.path.join(SRC_DIR, "Newsreader-Italic-VariableFont_opsz,wght.ttf
|
|||||||
|
|
||||||
VARIANTS = [
|
VARIANTS = [
|
||||||
# (output_name, source_vf, wght, opsz)
|
# (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-Bold", REGULAR_VF, 550, 9),
|
||||||
("Readerly-Italic", ITALIC_VF, 430, 9),
|
("Readerly-Italic", ITALIC_VF, 425, 9),
|
||||||
("Readerly-BoldItalic", ITALIC_VF, 550, 9),
|
("Readerly-BoldItalic", ITALIC_VF, 550, 9),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -171,7 +171,8 @@ def main():
|
|||||||
# Step 2: Apply vertical scale (opens TTF, saves as SFD)
|
# Step 2: Apply vertical scale (opens TTF, saves as SFD)
|
||||||
print("\n── Step 2: Scale lowercase ──\n")
|
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(
|
clear_code = "\n".join(
|
||||||
f'if {g!r} in f:\n'
|
f'if {g!r} in f:\n'
|
||||||
@@ -188,6 +189,7 @@ def main():
|
|||||||
script = build_per_font_script(ttf_path, sfd_path, [
|
script = build_per_font_script(ttf_path, sfd_path, [
|
||||||
("Clearing problematic glyphs", clear_code),
|
("Clearing problematic glyphs", clear_code),
|
||||||
("Scaling Y", scale_code),
|
("Scaling Y", scale_code),
|
||||||
|
("Condensing X", condense_code),
|
||||||
])
|
])
|
||||||
run_fontforge_script(script)
|
run_fontforge_script(script)
|
||||||
|
|
||||||
|
|||||||
31
scripts/condense.py
Normal file
31
scripts/condense.py
Normal 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.")
|
||||||
Reference in New Issue
Block a user