Skip to content

Instantly share code, notes, and snippets.

@weiweihuanghuang
Created May 1, 2016 20:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save weiweihuanghuang/4c401d7b1c4ff0efd479be2358e1d890 to your computer and use it in GitHub Desktop.
Activate Default Features
#MenuTitle: Activate Default Features
# -*- coding: utf-8 -*-
__doc__="""
Activate these default features
"""
import GlyphsApp
Font = Glyphs.font
editTab = Font.currentTab
featureList = ['calt', 'liga']
editTab.selectedFeatures().extend(featureList)
Glyphs.redraw()
editTab.graphicView().reflow()
editTab.graphicView().layoutManager().updateActiveLayer()
editTab._updateFeaturePopup()
@schriftgestalt
Copy link

schriftgestalt commented May 2, 2016

With the Glyphs 2.3 you can do it like this:

import GlyphsApp

Font = Glyphs.font
editTab = Font.currentTab

featureList = ['calt', 'liga']

selectedFeatures = set(editTab.features)
selectedFeatures.update(featureList)
editTab.features = list(selectedFeatures)

And I extended it a bit, so from 2.3 (886) it is even easier:

import GlyphsApp

Font = Glyphs.font
editTab = Font.currentTab

featureList = ['calt', 'liga']
editTab.features.extend = featureList

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment