How to edit the font metrics parameters with a Python script?


#1

I know how to edit the following parameters in Fontlab via Python but I don’t know how to make it in Glyphs. Can anyone help me with it?

TIA.

  • Ascender
  • Descender
  • typoAscender
  • typoLineGap
  • typoDescender
  • hheaAscender
  • hheaDecender
  • hheaLineGap
  • winAscent
  • winDescent

R.


#2

Look at where each one is set in the UI of Glyphs. For example, ascender and descender are per master, so you would set that for the master. Take a look at https://docu.glyphsapp.com/#gsfontmaster
Others may be set as customParameters in the appropriate spot, e.g., master, instance, font. Untested code follows:

font = Glyphs.font
master = font.masters[0] 
master.ascender = 870.0