Skip to main content

Fontforge plugin helper

A collection of common routines for Fontforge plugins

This module is intended to be called from Fontforge plugins. This module itself is not a Fontforge plugin.

Install

pip3 install fontforge_plugin_helper

Usage

Hook-related features

fontforge_plugin_helper.addSystemHook()

def myNewFontHook(font):
    do_something


def myLoadFontHook(font):
    do_something


def fontforge_plugin_init(**kw):
    fontforge_plugin_helper.addSystemHook('newFontHook', myNewFontHook)
    fontforge_plugin_helper.addSystemHook('loadFontHook', myLoadFontHook)

fontforge_plugin_helper.addFontGenerateHook()

def myPreGenerationHook(font):
    do_something


def myPostGenerationHook(font):
    do_something


def myNewOrLoadFontHook(font):
    fontforge_plugin_helper.addFontGenerateHook(font,
                                                'generateFontPreHook',
                                                myPreGenerationHook)
    fontforge_plugin_helper.addFontGenerateHook(font,
                                                'generateFontPostHook',
                                                myPostGenerationHook)


def fontforge_plugin_init(**kw):
    fontforge_plugin_helper.addSystemHook('newFontHook', myNewOrLoadFontHook)
    fontforge_plugin_helper.addSystemHook('loadFontHook', myNewOrLoadFontHook)

fontforge_plugin_helper.generationHookSetter()

def myPreGenerationHook(font):
    do_something


def myPostGenerationHook(font):
    do_something


def fontforge_plugin_init(**kw):
    fontforge_plugin_helper.addSystemHook(
        'newFontHook',
        fontforge_plugin_helper.generationHookSetter(
            myPreGenerationHook,
            myPostGenerationHook,
        )
    )
    fontforge_plugin_helper.addSystemHook(
        'loadFontHook',
        fontforge_plugin_helper.generationHookSetter(
            myPreGenerationHook,
            None,  # if not needed
        )
    )

Translation-related features

class fontforge_plugin_helper.Translations

tr = fontforge_plugin_helper.Translations()

def spam(u, font):
    pass

def fontforge_plugin_init(**kw):
    tr.set('fr', '_Open', '_Ouvrir')
    tr.setTranslations('fr', {
        '_Open': '_Ouvrir',
        '_Close': '_Fermer',
        '_MyMenu': '_MonMenu',
    })
    tr.setTranslations('de', {
        '_Open': 'Ö_ffnen',
        '_Close': 'S_chließen',
        '_MyMenu': '_MeinMenü',
    })
    fontforge.registerMenuItem(
        callback=spam,
        context="Font",
        name=tr.get('_MyMenu')
    )

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fontforge_plugin_helper-0.3.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fontforge_plugin_helper-0.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file fontforge_plugin_helper-0.3.0.tar.gz.

File metadata

  • Download URL: fontforge_plugin_helper-0.3.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fontforge_plugin_helper-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b3108abf6b04454678b1b47e3508ca5f308db24dc782458828b9e64444b45c20
MD5 4e5915e156acd65f8db4e7a5c633fbe1
BLAKE2b-256 51e3abb141baa8a1018acb35f062f03d124695c29fddc48742848f138b3584b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for fontforge_plugin_helper-0.3.0.tar.gz:

Publisher: python-publish.yml on MihailJP/fontforge-plugin-helper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fontforge_plugin_helper-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fontforge_plugin_helper-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 202c00b65b86f3c43e5a9e9fc4b81c8508ae6a442ce82070e25e24b3dcd6e7ce
MD5 bb201db3803bc64442c4110361597804
BLAKE2b-256 9caafbb6df27ace9e3d317b0468094cfcde4c38799c216ea89fa35f86968e711

See more details on using hashes here.

Provenance

The following attestation bundles were made for fontforge_plugin_helper-0.3.0-py3-none-any.whl:

Publisher: python-publish.yml on MihailJP/fontforge-plugin-helper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page