fontParts icon indicating copy to clipboard operation
fontParts copied to clipboard

Can we make `font.insertGlyph` return that glyph

Open ryanbugden opened this issue 1 year ago • 0 comments

It would be useful to be able to store the just-inserted glyph into a variable on the fly.

f = CurrentFont()
new_glyph = f.insertGlyph(f['a'], 'b')
new_glyph.moveBy((999,999))

Currently, these are the options:

  1. With insertGlyph
f = CurrentFont()
f.insertGlyph(f['a'], 'b')
new_glyph = f['b']
new_glyph.moveBy((999,999))
  1. With newGlyph
f = CurrentFont()
new_glyph = f.newGlyph('b')
new_glyph.appendGlyph(f['a'])
new_glyph.width = f['a'].width
new_glyph.moveBy((999,999))
  1. The best way probably, but not really documented:
f = CurrentFont()
new_glyph = f['b'] = f['a']

ryanbugden avatar May 09 '24 02:05 ryanbugden