Skip to content

fontlab_glyport.plugins.loader

loader

Load a plugin class into a host and unload it deterministically (R025-R027).

load_plugin(cls, env) creates the instance the SDK way (alloc().init() then loadPlugin()) and registers what its protocol needs:

  • FilterWithoutDialog: a FILTER_MENU item running filter(layer, True, {}) on the selected layers inside one undo group.
  • FilterWithDialog: a FILTER_MENU item that snapshots the selected layers, opens the plugin's view in a host dialog (setup() previews), keeps the result on Apply and restores the snapshots on Cancel, in one undo group.
  • PalettePlugin: a host panel with theView().
  • ReporterPlugin: a VIEW_MENU toggle "Show <title>"; while on, painters for each hook the plugin defines (foreground/background, active/inactive). If the host refuses before-native drawing (FontLab R054), background hooks paint in the post-native overlay. REPORTER_BACKGROUND_AS_OVERLAY records "background drawn as overlay" in the execution receipt: ink is above the native outlines, rather than below them.
  • SelectTool: register_tool; its foreground/background paint while it is active. FileFormatPlugin: register_file_format.
  • GeneralPlugin: nothing; its start() adds menus through Glyphs.menu.

A register_* call the host cannot honour (UnsupportedCapability) becomes a diagnostic; the rest of the plugin stays loaded. A failure in init/loadPlugin gives a failed handle with everything registered so far removed (R027). unload() removes tokens newest first, once.

Classes

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
load_plugin function (cls: type, env: PluginEnv) -> PluginHandle Instantiate <code>cls</code><code> (bound to </code><code>env</code>) and register it with the host.