can I script the FontLab "save as" behavior?

butterick's picture

Using python in Fontlab, I understand how to save a currently open VFB, or save a currently open VFB under a different name.

What I don't understand is how to get the "save as" behavior: keep the current VFB & its windows open, but give it a new filename.

twardoch's picture

fl.font.file_name = "your new path"

fl.font.Save("your new path")


butterick's picture

Yep, I already tried that. What happens is that FL saves a duplicate of my open font at "your new path." But the filename on the open font doesn't change (and thus if I hit "save" again, any changes go into the old file.)

twardoch's picture

How about:
fl.font.file_name = "your new path"


butterick's picture

That works. Thanks.

Does a fontindex of -1 have a predictable result in other functions that ask for a fontindex, or is this a special behavior of UpdateFont()?

butterick's picture

Can also be done through Robofab

new_file_path = [whatever you want]

twardoch's picture

fl.UpdateFont(-1) is synonymous with fl.UpdateFont(fl.ifont) in this case, but it's not universal behavior, I think. Actually, using fl.UpdateFont(fl.ifont) is more elegant to use than fl.UpdateFont(-1).

Thomas Phinney's picture

Geez. Amusingly, what I *need* is the behavior Matthew B was trying to avoid. Here I was going through some extra contortions to get this behavior. Re-reading this just enabled me to drop a bunch of lines of code as unnecessary. :)

Syndicate content Syndicate content