Slant Only Paths and Anchors without Slanting Components

Georg you will have to change the way Glyphs handles layers. If I have selected layers in the layers palette, and run a transformation on them, then that should obviously be applied to all the selected layers. I don’t have time to do each one individually, nor have I got time for writing a script for each function so that I can apply it to more than one layer at a time.

NB: Selecting glyphs in the Font View is no better – mostly I want to run transformations (or scripts) on a subset of layers – not all of the layers.

Made it even nicer. Now you are prompted to enter an angle.

#MenuTitle: Skew selected layers, but not components
#Created by Georg S., Sebastian Carewe, Claus E.S.
# -*- coding: utf-8 -*-
__doc__="""
Skews the selected layers of the selected glyph(s), but does not slant the components.
"""

import GlyphsApp
import math
from AppKit import NSAffineTransform

def slantLayers(layers, angle):
	Font.disableUpdateInterface()
	slantHeight = layers[0].slantHeight()
	transform = NSAffineTransform.new()
	slant = math.tan(skewAngle * math.pi / 180.0)
	transform.shearXBy_atCenter_(slant, -slantHeight)

	for layer in layers:
		layer.transform_checkForSelection_(transform, False)

	Font.enableUpdateInterface()

palettes = Font.parent.windowController().panelSidebarViewController().valueForKey_("paletteInstances")
for palette in palettes:
	if "GlyphsPaletteLayers" in palette.__class__.__name__:
		break
selectedRows = palette.layersList().selectedRowIndexes()
layers = palette.allSelectedLayers_(selectedRows)

from robofab.interface.all.dialogs import AskString
skewAngle = float(AskString("Enter skew angle"))
slantLayers(layers, skewAngle)

# EOF

This kind of tone is not very helpful.

Concerning your NB, what do you mean by selecting glyphs in font view not being useful?

Excuse my exasperation, but the issue will only get worse as users increasingly have to deal with many layers.

Regarding my NB. I had actually thought that selecting a glyph in the Font View, and then doing a skew (from the sidebar) on it would skew all the layers of that glyph. I just tested it to make sure, and no, that also only operates on the visible master. That is why I don’t understand what George wrote: “Selected Layers doesn’t refers to the selection in the layer panel. It is the selection from the font/edit view.” What is he referring to?

I agree that the selection of layers in the sidebar should be taken into account and reflected in Font.selectedLayers.

Concerning the selection in font view: the “glyphs” you select are considered in conjunction with the selected master. Personally I find this makes sense, as I most often don’t want to apply a transformation to all layers of a glyph.

You can easily modify a script to go through all layers by additionally cycling through layer.parent.layers.

I’ve had similar issues when processing brace layers, I found a way around that by running through all the layers and detecting whether it was the right brace layer. It was more work certainly.

Allow me to add another aspect to this. I think Georg, when he wrote “Selected Layers doesn’t refers to the selection in the layer panel. It is the selection from the font/edit view.” perhaps meant the selection you can do with ‘Select all Layers’ pointer, on multiple layers that are made visible together, and having enabled the ‘Keep Layer Selections in Sync’ will enable me to make operations on the selected outlines. Well I just tried selecting several outlines from a number of layers, and then applying a skew. Lo and behold that also only operated on the active layer. By now I don’t even know that selections across multiple layers will let me do – what is this functionality for?