kateliev / TypeRig

Proxy API and Font Development Toolkit for FontLab
https://kateliev.github.io/TypeRig/
BSD 3-Clause "New" or "Revised" License
48 stars 3 forks source link

[Add] New glyph creation / Glyph Duplicate #22

Closed kateliev closed 4 years ago

kateliev commented 4 years ago

Investigate issues and ways of new glyph creation/generation and duplicating.

kateliev commented 4 years ago

@twardoch - this now works!

pFont.newGlyph(glyph_name, layers=[], unicode_int=None): Creates new glyph and adds it to the font Args:

  • glyph_name (str): New glyph name
  • layers (list(str) or list(flLayer)): List of layers to be added to the new glyph
  • unicode_int (int): Unicode int of the new glyph Returns:
  • pGlyph

pFont.newGlyphFromRecipe(glyph_name, recipe, layers=[], unicode_int=None, rtl=False): Generate new glyph (glyph_name) using String Recipe (recipe) Args:

  • glyph_name (str): New glyph name
  • recipe (str): Glyph composition recipe using OLD Fontlab syntax (ex. A+acute=Aacute)
  • layers (list(str)): List of layer names to be added
  • unicode_int (int): Unicode int of the new glyph
  • rtl (bool): Right to left Returns:
  • pGlyph

pFont.duplicateGlyph(src_name, dst_name, dst_unicode=None, references=True): Duplicates a glyph and adds it to the font Args:

  • src_name, dst_name (str): Source and destination names
  • dst_unicode (int): Unicode int of the new glyph
  • references (bool): Keep existing element references (True) or decompose (False) Returns:
  • pGlyph