#!/usr/bin/env fontforge -script

if ($argc <= 1)
  Print("usage: fontforge -script renamer.pe foobar.ttf")
  Quit(0)
endif

# open font
Open($1)

# rename
version = "1.046." + Strftime("%Y%m%d",0,'C')
weight = GetTTFName(0x409,2)
copyright = GetTTFName(0x409,0)
newfilename = 'rounded-'+$fontname
SetFontNames(newfilename, 'Rounded '+$familyname, 'Rounded '+$fullname, weight, copyright, version)

## save font
Generate(newfilename + ".ttf", "", 0x84)
Print("Generate:" + newfilename + ".ttf")