Created
July 27, 2019 16:57
-
-
Save mekkablue/a7b55d06cefe083b14662bd0a0b082c2 to your computer and use it in GitHub Desktop.
Move Scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MenuTitle: Move glyph down 1 unit | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
Moves the current glyph(s) down by 1 unit. | |
Similar to ctrl-cmd-left/right. | |
Suggested shortcut: ctrl-cmd-downarrow. | |
""" | |
yDiff = -1 | |
Font = Glyphs.font | |
selectedLayers = Font.selectedLayers | |
def process( thisLayer ): | |
for thisPath in thisLayer.paths: | |
for thisNode in thisPath.nodes: | |
thisNode.y += yDiff | |
for thisComp in thisLayer.components: | |
newPosition = NSPoint( thisComp.position.x, thisComp.position.y + yDiff ) | |
thisComp.position = newPosition | |
Font.disableUpdateInterface() | |
for thisLayer in selectedLayers: | |
print "Moving down", thisLayer.parent.name | |
process( thisLayer ) | |
Font.enableUpdateInterface() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MenuTitle: Move glyph down 10 units | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
Moves the current glyph(s) down by 10 units. | |
Similar to shift-ctrl-cmd-left/right. | |
Suggested shortcut: shift-ctrl-cmd-downarrow. | |
""" | |
yDiff = -10 | |
Font = Glyphs.font | |
selectedLayers = Font.selectedLayers | |
def process( thisLayer ): | |
for thisPath in thisLayer.paths: | |
for thisNode in thisPath.nodes: | |
thisNode.y += yDiff | |
for thisComp in thisLayer.components: | |
newPosition = NSPoint( thisComp.position.x, thisComp.position.y + yDiff ) | |
thisComp.position = newPosition | |
Font.disableUpdateInterface() | |
for thisLayer in selectedLayers: | |
print "Moving down (x10)", thisLayer.parent.name | |
process( thisLayer ) | |
Font.enableUpdateInterface() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MenuTitle: Move glyph up 1 unit | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
Moves the current glyph(s) up by 1 unit. | |
Similar to ctrl-cmd-left/right. | |
Suggested shortcut: ctrl-cmd-uparrow. | |
""" | |
yDiff = 1 | |
Font = Glyphs.font | |
selectedLayers = Font.selectedLayers | |
def process( thisLayer ): | |
for thisPath in thisLayer.paths: | |
for thisNode in thisPath.nodes: | |
thisNode.y += yDiff | |
for thisComp in thisLayer.components: | |
newPosition = NSPoint( thisComp.position.x, thisComp.position.y + yDiff ) | |
thisComp.position = newPosition | |
Font.disableUpdateInterface() | |
for thisLayer in selectedLayers: | |
print "Moving up", thisLayer.parent.name | |
process( thisLayer ) | |
Font.enableUpdateInterface() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MenuTitle: Move glyph up 10 units | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
Moves the current glyph(s) up by 10 units. | |
Similar to shift-ctrl-cmd-left/right. | |
Suggested shortcut: shift-ctrl-cmd-uparrow. | |
""" | |
yDiff = 10 | |
Font = Glyphs.font | |
selectedLayers = Font.selectedLayers | |
def process( thisLayer ): | |
for thisPath in thisLayer.paths: | |
for thisNode in thisPath.nodes: | |
thisNode.y += yDiff | |
for thisComp in thisLayer.components: | |
newPosition = NSPoint( thisComp.position.x, thisComp.position.y + yDiff ) | |
thisComp.position = newPosition | |
Font.disableUpdateInterface() | |
for thisLayer in selectedLayers: | |
print "Moving up (x10)", thisLayer.parent.name | |
process( thisLayer ) | |
Font.enableUpdateInterface() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment