Is it possible to apply RMX Tuner filter to slant some glyphs using python?
I have tried coding it like so with the help of Chat GPT:
# Import the necessary modules
from GlyphsApp import *
from GlyphsApp.plugins import *
# Access the current font and the selected glyphs
font = Glyphs.font
selected_glyphs = [x.parent for x in font.selectedLayers]
# Iterate through all masters in the font
italic_masters = []
for master in font.masters:
# Check if the master's font name contains 'italic'
if 'italic' in master.name.lower():
italic_masters.append(master.name)
# Print all masters with 'italic' in their name
print("Italic masters:", ", ".join(italic_masters))
# Proceed with applying the RMX Tuner filter
for master in font.masters:
if 'italic' in master.name.lower():
# Create an RMX Tuner filter instance
rmx_tuner_filter = NSClassFromString("RMXFilter").alloc().init()
# Configure the RMX Tuner filter settings
rmx_tuner_filter.settings = {
'RMXFilterPreset': 'RMX Tuner',
'angle': 10
}
# Apply the RMX Tuner filter only to selected glyphs in the master
for glyph in selected_glyphs:
layer = glyph.layers[master.id]
rmx_tuner_filter.processLayer_withArguments_(layer, None)
# Print a message to indicate the filter has been applied
print("RMX Tuner filter applied to selected glyphs in master:", master.name)
But it doesn’t work. Here’s the original prompt with what I want to do in plain English:
– In Glyphs App scripting, I want to apply RMX Tuner filter to all Masters containing italic in its fontName with a slant value of 10 only on selected Glyphs.