What is the easiest way to copy kerning from one master to another using a script? (I know that I can manually copy all values from the Kerning Panel, but I need a method to use in a script.)
You know how to work with Python dicts, right? Font.kerning[Font.masters[0].id]
contains the kerning for the first master. A
Yes, I know, but I thought there might be an easier way to copy and paste the kerning data.
I found a solution
Font.kerning[mid0]=Font.kerning[mid1]
How can it get simpler?
This code seems to copy and maintain kerning across different font masters.
If a kerning pair is deleted in master 0, it will also be deleted in master 1.
Font.kerning[Font.masters[1].id] = Font.kerning[Font.masters[0].id]
EDIT :
It work using copy.deepcopy
import copy
source_kerning = Font.kerning[Font.masters[0].id]
dest_kerning = Font.kerning[Font.masters[1].id]
source_copy = copy.deepcopy(source_kerning)
Font.kerning[Font.masters[1].id] = source_copy