1
0
mirror of https://github.com/tabler/tabler-icons.git synced 2025-08-31 09:32:04 +02:00

fix outline script

This commit is contained in:
codecalm
2021-01-20 23:16:00 +01:00
parent f33b59eaad
commit 612f6b4c6b
2 changed files with 2 additions and 2 deletions

View File

@@ -1,28 +0,0 @@
import os
import fontforge
# svg2ttf library does not support fill-rule="evenodd" so after converting icons to outlineStroke we fix path directions to work with "nonzero"
# more: https://github.com/tabler/tabler-icons/issues/13 - thanks for awesome suggestions in the issue
print ("Running fontforge to fix svg outline directions!")
def files(path):
for file in os.listdir(path):
if os.path.isfile(os.path.join(path, file)):
yield file
# refer to https://fontforge.org/docs/scripting/python/fontforge.html for documentation
# inspiration from https://github.com/FontCustom/fontcustom/blob/master/lib/fontcustom/scripts/generate.py
font = fontforge.font()
for file in files("./icons-outlined"):
print (f"Correcting outline for {file}")
glyph = font.createChar(123, file)
glyph.importOutlines("./icons-outlined/" + file)
glyph.correctDirection()
glyph.export("./icons-outlined/" + file)
glyph.clear()
print ("Finished fixing svg outline directions!")