diff --git a/handwrite/svgtottf.py b/handwrite/svgtottf.py index 65e504c..db2858d 100644 --- a/handwrite/svgtottf.py +++ b/handwrite/svgtottf.py @@ -1,3 +1,4 @@ +import itertools import json import os import sys @@ -141,12 +142,8 @@ def set_kerning(self, table): kerning_table = table.get("table", False) if not kerning_table: raise ValueError("Kerning offsets not found in the config file.") - flatten_list = ( - lambda y: [x for a in y for x in flatten_list(a)] - if type(y) is list - else [y] - ) - offsets = [0 if x is None else x for x in flatten_list(kerning_table)] + flattened_kerning_table = list(itertools.chain.from_iterable(kerning_table)) + offsets = [0 if x is None else x for x in flattened_kerning_table] self.font.addKerningClass("kern", "kern-1", rows, cols, offsets) def generate_font_file(self, filename, outdir, config_file):