Work-Sans/sources/tools/old/NAMEpatch.py
weiweihuanghuang 616f74fb43 Update Build
2018-11-15 16:18:09 +08:00

20 lines
517 B
Python
Executable File

import os
import sys
from fontTools.ttLib import TTFont
from fontTools.ttx import makeOutputFileName
inputTTF = sys.argv[1]
# open the source file and read it
font = TTFont(inputTTF)
extension = os.path.splitext(inputTTF)[1]
# Remove space in nameID 6
if 'name' in font:
name = font['name']
for i, eachName in enumerate(name.names):
if eachName.nameID == 6:
eachName.string = eachName.string.replace(' ', '')
outputTTF = makeOutputFileName(inputTTF, '', extension)
font.save(outputTTF)