-- @titre Copier le crénage vers les autres masters -- @title Copy kerning to the other masters -- @categorie espacer -- @resume Recopie les paires de crénage du premier master dans tous les autres, mêmes valeurs. Un bon départ pour une fonte à plusieurs graisses, à affiner ensuite master par master. -- @summary Copies the kerning pairs of the first master into all the others, same values. A good start for a multi-weight font, to refine master by master afterwards. -- Fontista · bibliothèque de scripts · https://fontista.thinkspark.dev/scripts.html local OVERWRITE = false -- true: replace pairs that already exist in the other masters local en = lang == "en" local src = font.masters[1].id local k = kerning(src) local n = 0 for i = 2, #font.masters do local dst = font.masters[i].id local existing = kerning(dst) for left, row in pairs(k) do for right, v in pairs(row) do if OVERWRITE or not (existing[left] and existing[left][right]) then kern(dst, left, right, v) n = n + 1 end end end end print(#font.masters < 2 and (en and "Only one master: nothing to copy." or "Un seul master : rien à copier.") or string.format(en and "%d pair(s) copied" or "%d paire(s) copiée(s)", n))