1
0

Remove overlap

This commit is contained in:
2026-03-02 12:10:36 +01:00
parent bc140a1513
commit 3e82a3ccd7
4 changed files with 66 additions and 17 deletions

28
scripts/overlaps.py Normal file
View File

@@ -0,0 +1,28 @@
"""
FontForge: Remove overlapping contours
───────────────────────────────────────
Merges overlapping contours into clean outlines for all glyphs.
Also corrects winding direction, which can get flipped after overlap removal.
This fixes rendering issues on devices (e.g. Kobo) that struggle with
overlapping paths, especially when applying synthetic bold/weight scaling.
Run inside FontForge (or via build.py which sets `f` before running this).
"""
import fontforge
f = fontforge.activeFont()
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# APPLY
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
f.selection.all()
f.removeOverlap()
f.correctDirection()
count = sum(1 for g in f.glyphs() if g.isWorthOutputting())
print(f" Removed overlaps and corrected direction for {count} glyphs")
print("Done.")