2022-07-07 22:40:50 +03:00
|
|
|
#MenuTitle: Copy global guides from roman to italic masters
|
2020-03-23 03:03:13 +03:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import GlyphsApp
|
|
|
|
import copy
|
|
|
|
|
|
|
|
Glyphs.clearLog()
|
|
|
|
font = Glyphs.font
|
|
|
|
|
2022-07-07 22:40:50 +03:00
|
|
|
romanMasters = [m for m in font.masters if m.italicAngle == 0.0]
|
|
|
|
#print(romanMasters)
|
2020-03-23 03:03:13 +03:00
|
|
|
|
2022-07-07 22:40:50 +03:00
|
|
|
def find_matching_roman(im):
|
|
|
|
wght = im.axes[0]
|
|
|
|
opsz = im.axes[2]
|
|
|
|
for rm in romanMasters:
|
|
|
|
if wght == rm.axes[0] and opsz == rm.axes[2]:
|
|
|
|
return rm
|
2020-03-23 03:03:13 +03:00
|
|
|
|
2022-07-07 22:40:50 +03:00
|
|
|
for im in font.masters:
|
|
|
|
if im.italicAngle == 0.0:
|
|
|
|
continue
|
|
|
|
rm = find_matching_roman(im)
|
|
|
|
if rm is None:
|
|
|
|
raise Exception("rm not found (im=%r)" % im.name)
|
|
|
|
print(im.name, '<-', rm.name)
|
|
|
|
im.guides = [copy.copy(g) for g in rm.guides]
|