FontForge supports a plugin mechanism for extending its functionality.
Plugins are shared libraries that can be loaded at runtime. When fontforge starts up (actually, when it loads its preferences) it will automatically load all files that look like shared libraries and that live in the two directories:
Most of what I once expected to do with plugins I now do with python scripts.
Currently none of my pre-built packages contain any plugins. If you want to play with them you must grab a source distribution, build it, and install it. Having done that type the following:
$ cd plugins $ make install
FontForge currently supports two types of plugins:
(Actually I suppose there is a third type. When it loads a plugin FF calls an initialization routine. I suppose the plugin could just start running and doing things without ever returning to fontforge).
I once expected to add
(but I did that in python instead).
When FontForge loads a plugin it calls a routine
FontForgeInit(void). This routine is responsible for registering the
plugin with FontForge, and then returning to allow FontForge to continue.
FontForge provides two registration routines:
AddEncoding(char *name,int (*enc_to_uni)(int), int (*uni_to_enc)(int))
This will return 0 if it failed (if you tried to replace a built in encoding for example), 1 if it added the encoding, 2 if it replaced a previous plugin with that name.
AddScriptingCommand(char *name, void (*UserScriptFunc)(Context *), int needs_font)
This will return 0 if it failed (if you tried to replace a built in scripting command for example), 1 if it added the command, 2 if it replaced a previous plugin with that name.
You may register more than one thing in from
For example, many encodings have an EUC form and an ISO-2022 form and it
makes sense for one plugin to handle both.
FontForgeInit should return 1 if it succeeds, and 0 if it fails.
If it fails FontForge will dlclose() the library.
When you write your plugin you should include "plugins.h" from the fontforge directory.
Look in the plugins subdirectory for an example on how to create, build & install a plugin.