Is there a way to reset transformations for components?

I have rotated and slanted all the glyphs in the font view. There are lots of components that are affected by transforming twice. Because both the source is rotated and slanted, and the component is subjected to the same treatment. So I want to reset transformations only for the components.

The easiest would be to write a script.
Are you in Glyphs 2 or 3?

Glyphs 3. I don’t think I can write a script with a very little python knowledge. I’ll try, thanks.

Not exactly what you’re looking for but this may be a step to get there…this script: Mekkablue → Components → New Tab with Transformed Components

If it’s a manageable amount of components to reset, you could run that script and go through it manually.

Alternatively, opening the script in a text editor will help understand how to search transformed components in the font, and with some perseverance (and reading the api and looking at other similar scripts) you can figure out a script.

For normal components (not corners, caps, etc.) the following does the job:

for layer in Font.selectedLayers:
	for component in layer.components:
		component.transform = ((1, 0, 0, 1, 0, 0))

@gor.jious I tried that one and was editing the glyphs manually but there are decent amount of glyphs :smiley: Also when I use this script it works as expected but the glyphs are shown with its other masters even though the other masters are not transformed. (Bonus there is a glitch)


Anyways thanks for the suggestion and the tips!

@FlorianPircher It works perfectly. Thank you so much

How about a reset specifically for corners?
For example: if “_corner.something” is placed in an outline and x=-100%

Looks like corners are accessed in layer.hints and I see it printing with this but the error is 'GSHint' object has no attribute 'transform'

for hint in layer.hints:
	print (hint)
	hint.transform = ((1, 0, 0, 1, 0, 0))

Is there another way to reset the corners?

It is hint.scale.

And components have individual scale, rotate and slant properties. It is a bit safer to use those, specially if you combine uneven scaling with slanting.

1 Like

Thanks for the hint;-)

for hint in layer.hints:
	print (hint)
    # changes x to 100% and y to 100%
	hint.scale = (1.0, 1.0)
1 Like