Skip to main content

FontParts based library for SMuFL font scripting

Project description

SMufoLib is a small Python library designed to aid in font development specific to the Standard Music Font Layout (SMuFL).

The objects in SMufoLib are wrapped around FontParts, the replacement for RoboFab, still in development.

Documentation

SMufoLib’s documentation is presently limited to its docstrings. However, the library should be easy to grasp for anyone familiar with FontParts and SMuFL in addition to Python.

Installation

SMufoLib requires Python 3.7 or later. It is listed in the Python Package Index (PyPI) and can be installed with pip:

$ python -m pip install smufolib

Configuration

Project specific settings are defined in smufolib.cfg. This file is located inside the smufolib folder in python site packages by default, but can be moved to the home folder or a specific location defined in the environment variable SMUFOLIB_CFG or as INI_FILEPATH inside config.py.

The file is divided between the following sections:

Font Paths

Filesystem (or URL) paths to various font-related files.

SMuFL Paths

Filesystem (or URL) paths to various SMuFL-related files.

The options in this section are primarily intended to serve as fallback values for SMuFL URLs.

SMuFL URLs

Specific URL paths to various SMuFL-related files.

As mentioned above, fallback values for this section (e.g., in the event of a connection failure) can be provided in the SMuFL Paths section.

A note about interpolation

Interpolation strings ${option} and ${section:option} may be used to refer to an option in the current or specific foreign section respectively. This is particularly useful when specifying pathnames:

[Font Paths]
directory = ~/Documents/UFO
ufo = ${directory}/my_font.ufo (result: ~/Documents/UFO/my_font.ufo)
...
[SMuFL Paths]
...
classes.json = ${Font Paths:directory}/classes.json
(result: ~/Documents/UFO/classes.json)

For more information, see: https://docs.python.org/3/library/configparser.html#interpolation-of-values

Engraving Defaults

Values for SMuFLs engravingDefaults metadata structure. Values left empty will be calculated automatically. See help for smufolib.engraving.getEngravingDefaults.

Mark Color

Color values for glyph.rGlyph.markColor.

Scripts

SMufoLib comes bundled with several useful functions and scripts for building SMuFL metadata files, extracting engraving defaults, exporting/importing annotation and more.

Scripts may be run via the Python interpreter or directly from the console, passing in any arguments in the familiar manner to each platform.

As an example, check for missing or superflous SMuFL anchors with checkAnchors directly from console as follows:

$ checkAnchors --mark True

Or with regular python:

from bin import checkAnchors

checkAnchors(mark=True)

Project details


Download files

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

Source Distribution

smufolib-0.0.3.tar.gz (20.8 kB view hashes)

Uploaded Source

Built Distribution

smufolib-0.0.3-py3-none-any.whl (27.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page