Skip to content

Commit 3e8b027

Browse files
committed
Fixed Sync anchor to create not copy GSAnchor items; also remove no longer needed anchors, restructured to Anchors folder
1 parent 9845c56 commit 3e8b027

5 files changed

+35
-30
lines changed
File renamed without changes.

Diff for: Anchors/sync_anchors_to_other_masters.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/python
2+
# -*- coding: utf8 -*-
3+
#MenuTitle: Sync anchors to other masters
4+
#
5+
# Copy anchors and their position from this master to all others
6+
7+
def syncAnchorsToOtherMasters(layer):
8+
glyph = layer.parent
9+
anchors = layer.anchors
10+
anchorsNames = [a.name for a in anchors]
11+
12+
if not anchors:
13+
return
14+
15+
for l in glyph.layers:
16+
if l != layer:
17+
layeranchors = [la.name for la in l.anchors]
18+
19+
# add missing anchors in other layers
20+
for a in anchors:
21+
if a.name not in layeranchors:
22+
# TODO position new anchors smartly; either relative to original, or as per set_default_anchors.py
23+
l.anchors = [GSAnchor(a.name, NSPoint(a.x, a.y)) for a in anchors]
24+
25+
# remove anchors in layer that are not in source
26+
l.anchors = [a for a in l.anchors if a.name in anchorsNames]
27+
28+
font = Glyphs.fonts[0]
29+
selection = font.selectedLayers[0]
30+
31+
if selection:
32+
syncAnchorsToOtherMasters(selection)

Diff for: copy_selected_layer_to_other_layers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def kerningOccurances(glyph, master):
3333
for value in masterKerning[key]:
3434
if value == glyph.id or value == glyph.leftKerningKey or value == glyph.rightKerningKey:
3535
print "glyph %s appears as second in kern pair" % glyph.name
36-
36+
3737
if key not in syncKernings:
3838
syncKernings[key] = {}
3939
syncKernings[key][value] = masterKerning[key][value]
@@ -83,7 +83,7 @@ def isGlyphKernGroup(glyph, group):
8383
print kerningOccurances(glyph, masterId)
8484
kerns = kerningOccurances(glyph, masterId)
8585
if kerns:
86-
for left in kerns:
86+
for left in kerns:t
8787
for right in kerns[left]:
8888
if isGlyphKernGroup(glyph, left) or isGlyphKernGroup(glyph, right):
8989
print "remove kerning pair %s : %s" % (left, right)

Diff for: sync_anchors_to_other_masters.py

-27
This file was deleted.

Diff for: sync_masters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
# -*- coding: utf8 -*-
3-
#MenuTitle: Sync masters from first to second font
3+
#MenuTitle: Sync master meta from first to second font
44
#
55
# Adds (full copy) or updates (omits italicAngle, stems, guides) the font masters of the current active font to the second font
66
source = Glyphs.fonts[0]

0 commit comments

Comments
 (0)