desiredGlyphNames = ['bell','bell-off','apple','arrow-down','arrow-left','arrow-right','arrow-up','arrow-up-bold-circle','file-document-box','attachment','bullhorn','music','cake-variant','bookmark','brush','camera','check-circle','checkbox-blank-outline','checkbox-marked-outline','chevron-down','chevron-left','chevron-right','chevron-up','clock-outline','content-duplicate','close','arrow-collapse','comment-alert','comment-multiple-outline','swap-horizontal','delete','do-not-disturb','download','earth','pencil','email','cloud-upload','arrow-expand','export','facebook','file','file-document','folder','message-text-outline','github-face','google-plus','chart-bar','view-grid','help-circle-outline','history','home','microphone-off','import','email','information','instagram','account-card-details','thumb-up','link-variant','linkedin','format-list-bulleted','map-marker','lock','key','image','menu','menu-down','menu-left','menu-right','menu-up','call-merge','forum','microsoft','minus','shield','cursor-move','message-plus','open-in-new','file-document','credit-card-outline','pinterest','plus','poll','message','format-quote-close','radiobox-blank','radiobox-marked','star-half','reddit','subdirectory-arrow-right','refresh','clipboard-text','reply','alert-octagon','drawing-box','rss','content-save','magnify','account-search','magnify-plus','settings','share-variant','cart','sort','soundcloud','camcorder-box-off','spotify','star','star-outline','star-half','chart-areaspline','steam','pin','tag-multiple','toggle-switch-off','toggle-switch','trophy','tumblr','twitch','twitter','thumb-down','lock-open','upload','account','account-multiple','video','vimeo','alert','alert','eye','web','comment-alert','whatsapp','youtube']
font = fontforge.activeFont()
for glyph in list(font.selection.byGlyphs):
glyphNotUsed = (glyph.glyphname not in desiredGlyphNames)
if glyphNotUsed:
glyph.clear()