fontforge/fontforge — pull request #71 by monkeyiq (2012-09-07 15:36:00+00:00)
Title: v2: When saving, force a .sfd or .sfdir extension

This is an update to the pull/22:
https://github.com/fontforge/fontforge/pull/22

The new code pushes the solution a little higher, having the dialog function maintain the previous value of the entry box so that the filename filter function gets the chance to do smarter things like blocking attempts to delete the . char which would render an existing valid extension invalid.

---

Because a user might be new to fontforge, they might mistakenly use the save or save as menu option to try to create a font file like a ttf. This patch forces a valid extension in the save/save as dialog so that the file will not mistakenly be produced as .otf, .ttf etc.

The core of the patch is the new GFileChooserInputFilenameFuncType function which can optionally be set to alter the filename that is input as the user types it.

A new string function that might be interesting is u_copynallocm() which copies the first n characters but allocates m characters in the new string. Handy for copy(), concat(), use(), free() types scenarios.