Objects

Base Objects

SMufoLib’s lowest-level classes subclass the reference implementation of the FontParts API. Only those objects and members that are explicitly overridden are documented here. For a complete reference to all inherited attributes and methods, see the FontParts documentation.

class Font(pathOrObject: str | Font | BaseFont | None = None)[source]

SMufoLib environment implementation of fontParts.base.BaseFont.

Parameters:

pathOrObject

The source used to initialize the font.

  • If None, a new, empty font will be created.

  • If a str, it is interpreted as a path to an existing UFO file.

  • If an unwrapped native font object (e.g., a defcon.Font) or a fontParts.base.BaseFont, it will be wrapped.

Added in version 0.6.0: Support for initializing from an existing fontParts.base.BaseFont instance.

Examples:

>>> from smufolib import Font
>>> font = Font("path/to/MyFont.ufo")  
>>> from fontParts.fontshell import RFont
>>> font = Font(RFont())  
property smufl: Smufl

Font-specific instance of Smufl.

class Glyph(*args, **kwargs)[source]

SMufoLib environment implementation of fontParts.base.BaseGlyph.

Changed in version 0.6.0: The __repr__ now includes the canonoical SMuFL glyph name (if present) in square brackets.

This object is typically accessed through a Font object’s inherent glyph dictionary. To instantiate the SMuFL glyph named U+E050 (gClef):

>>> glyph = font["uniE050"]

A glyph may also be instantiated independently and assigned to a font or glyph later:

>>> glyph = Glyph()  
property smufl: Smufl

Glyph-specific instance of Smufl.

class Layer(*args, **kwargs)[source]

SMufoLib environment implementation of fontParts.base.BaseLayer.

Core Objects

The following classes handle SMufoLib’s metadata collection, storage and manipulation.

Caution

These classes use fontParts.base.BaseLib to store property settings. Editing these keys directly may cause problems.

class Smufl(*args, **kwargs)[source]

SMuFL metadata interface for fonts and glyphs.

This class provides structured access to SMuFL-related metadata and utility methods for interacting with both font-level and glyph-level data. It may be accessed from either a Font or a Glyph. Font-level attributes are available in both cases, thanks to consistent parent access patterns in FontParts.

About Glyph Naming

Attributes dealing with ligatures (isLigature, componentGlyphs, componentNames) and stylistic alternates (isSalt, isSet, alternates, base, and suffix) depend on strict adherence to the descriptive naming schemes stipulated in the Adobe Glyph List Specification, and followed by the SMuFL standard (see Section 6 for more information).

Tip

To avoid having to set all the glyph identification attributes manually, it is advisable to run the script importID prior to using this class with an existing font for the first time.

Parameters:
  • font – Parent Font object.

  • glyph – Parent Glyph object.

This object is typically accessed through a Font or Glyph:

>>> smufl = font.smufl
>>> glyph = font["uniE050"]
>>> smufl = glyph.smufl

It may also be instantiated independently and assigned to a font or glyph later:

>>> smufl = Smufl()  
classMembers(className: str) tuple[Glyph, ...][source]

Return all glyphs in the font that belong to the given SMuFL class.

Added in version 0.6.0.

Parameters:

className – The name of the SMuFL glyph class to search for.

Example:

>>> glyph.smufl.classMembers("accidentalsStandard")  
(<Glyph 'uniE260' ['accidentalFlat'] ('public.default') at ...>,
<Glyph 'uniE266' ['accidentalTripleFlat'] ('public.default') at ...>,
<Glyph 'uniE267' ['accidentalNaturalFlat'] ('public.default') at ...>)
findGlyph(name: str) Glyph | None[source]

Find Glyph object from name.

Parameters:

name – SMuFL-specific canonical glyph name.

Example:

>>> font.smufl.findGlyph("accidentalFlat")  
<Glyph 'uniE260' ['accidentalFlat'] ('public.default') at ...>
keys()[source]

Return a view of the canonical SMuFL glyph names in the font.

naked()[source]

Return the wrapped defcon object.

This method is useful if you need to bypass the wrapper and interact directly with the underlying defcon object (e.g., for compatibility with other libraries).

Example:

>>> smufl.glyph.naked()  
<defcon.objects.glyph.Glyph object at 0x...>
newGlyph(name: str, clear: bool = True) Glyph | None[source]

Create a new glyph in the font and return it.

This method is a SMuFL-specific implementation of Font.newGlyph.

If name represents a recommended glyph (i.e., listed in the glyphnames.json metadata file), it will be assigned a corresponding name and unicode. Otherwise, name will be used if glyph.name is None.

Parameters:
  • name – The name of the glyph to create.

  • clear – Whether to clear any preexisting glyph with the specified name before creation. Defaults to True

Returns:

The newly created Glyph instance.

Example:

>>> glyph = font.smufl.newGlyph("brace")
newRange(name: str, start: int, end: int, description: str, overrideExisting: bool = False) None[source]

Add SMuFL range to font.

This method defines a SMuFL range in the font’s metadata using a start and end decimal codepoint.

The glyphs key in the resulting metadata is computed dynamically and reflects the current glyphs in the font that fall within the specified range. It will update automatically as glyphs are added (and assigned a name) or removed.

Parameters:
  • name – A unique identifier for the range.

  • start – The starting unicode codepoint of the range.

  • end – The ending unicode codepoint of the range.

  • description – A human-readable description of the range.

  • overrideExisting – Whether to replace an existing range if any part of the new range overlap with it. Defaults to False.

Raises:

Example:

>>> font.smufl.newRange(  
...     "myRange", 0xF500, 0xF50F, "A Range of custom glyphs."
... )
raiseNotImplementedError()[source]

This exception needs to be raised frequently by the base classes. So, it’s here for convenience.

round() None[source]

Round font units to integers.

Method applies to the following attributes:

If spaces is True, values are left unchanged.

Examples:

>>> font.smufl.spaces = True
>>> glyph.smufl.advanceWidth
0.922
>>> glyph.smufl.round()
>>> glyph.smufl.advanceWidth
0.922
>>> font.smufl.spaces = False
>>> glyph = font["uniE050"]
>>> glyph.smufl.advanceWidth
230.5
>>> glyph.smufl.round()
>>> glyph.smufl.advanceWidth
231
toSpaces(value: int | float) float | None[source]

Convert font units to staff spaces based on font UPM size.

The inverse of toUnits().

Parameters:

value – Value to convert.

Example:

>>> font.info.unitsPerEm = 2048
>>> font.smufl.toSpaces(512)
1.0
toUnits(value: int | float, rounded=True) int | float | None[source]

Convert staff spaces to font units based on font UPM size.

The inverse of toSpaces(). The result is always rounded.

Parameters:
  • value – Value to convert.

  • rounded – Whether to round result to nearest integer.

Example:

>>> font.info.unitsPerEm = 2048
>>> font.smufl.toSpaces(2)
1024
property advanceWidth: int | float | None

Glyph advance width.

This property is equivalent to Glyph.width.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050"]
>>> glyph.smufl.advanceWidth = 230.5
>>> glyph.smufl.advanceWidth
230.5
property alternateGlyphs: tuple[Glyph, ...] | None

Alternates of the current glyph as Glyph objects.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050"]
>>> glyph.smufl.alternateGlyphs  
(<Glyph 'uniE050.ss01' ['gClefSmall'] ('public.default') at ...>,)
property alternateNames: tuple[str, ...] | None

Alternates of the current glyph by name.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050"]
>>> glyph.smufl.alternateNames
('gClefSmall',)
property alternates: tuple[dict[str, str], ...] | None

Alternates of the current glyph as metadata stubs.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050"] # gClef
>>> glyph.smufl.alternates
({'codepoint': 'U+F472', 'name': 'gClefSmall'},)
property anchors: dict[str, tuple[int | float, int | float]] | None

SMuFL-specific glyph anchors as Cartesian coordinates.

This property is read-only. Use the Glyph.anchors attribute to set glyph anchors.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE240"]
>>> glyph.smufl.anchors  
{'graceNoteSlashNE': (321, -199),
'graceNoteSlashSW': (-161, -614),
'stemUpNW': (0, -10)}
property bBox: dict[str, tuple[int | float, int | float]] | None

Glyph bounding box as Cartesian coordinates.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050"]
>>> glyph.smufl.bBox
{'bBoxSW': (0, -634), 'bBoxNE': (648, 1167)}
property base: Glyph | None

Base glyph of the current glyph.

If the current glyph is not an alternate (i.e., a stylistic variant), the glyph itself is returned.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050.ss01"]  
>>> glyph.smufl.base
<Glyph 'uniE050' ['gClef'] ('public.default') at ...>
property classes: tuple[str, ...] | None

SMuFL-specific class memberships.

If classes.strict is enabled, only SMuFL-specific class names are allowed. See CLASS_NAMES for the full set of specified names.

Added in version 0.7.0: Distinction between strict, SMuFL-specific vs. lenient, custom class names.

Raises:

Example:

>>> glyph = font["uniE260"]
>>> glyph.smufl.classes
('accidentals', 'accidentalsSagittalMixed',
'accidentalsStandard', 'combiningStaffPositions')
property codepoint: str | None

Unicode codepoint as formatted string.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050"]
>>> glyph.smufl.codepoint
'U+E050'
property componentGlyphs: tuple[Glyph, ...] | None

Ligature components by Glyph object.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> ligature = font["uniE26A_uniE260_uniE26B"]
>>> ligature.smufl.componentGlyphs  
(<Glyph 'uniE26A' ['accidentalParensLeft'] ('public.default') at ...>,
<Glyph 'uniE260' ['accidentalFlat'] ('public.default') at ...>,
<Glyph 'uniE26B' ['accidentalParensRight'] ('public.default') at ...>)
property componentNames: tuple[str | None, ...] | None

Ligature components by name.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> ligature = font["uniE26A_uniE260_uniE26B"]
>>> ligature.smufl.componentNames
('accidentalParensLeft', 'accidentalFlat', 'accidentalParensRight')
property description: str | None

SMuFL-specific human-readable glyph description.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE260"]
>>> glyph.smufl.description = "Flat"
>>> glyph.smufl.description
'Flat'
property designSize: int | None

The optimum point size in integral decipoints.

Example:

>>> font.smufl.designSize = 20
>>> font.smufl.designSize
20
property engravingDefaults: EngravingDefaults

The font’s EngravingDefaults object.

Raises:

AttributeError – If attempting to access attribute from glyph.

Example:

>>> font.smufl.engravingDefaults  
<EngravingDefaults in font 'MyFont Regular' path='/path/to/MyFont.ufo'
auto=True at ...>
property font: Font | None

The parent Font object.

Example:

>>> smufl.font  
<Font 'MyFont Regular' path='/path/to/MyFont.ufo' at ...>
property glyph: Glyph | None

The parent Glyph object.

Example:

>>> smufl.glyph  
<Glyph 'uniE050' ['gClef'] ('public.default') at ...>
property isLigature: bool

Return True if glyph is ligature.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> ligature = font["uniE26A_uniE260_uniE26B"]
>>> ligature.smufl.isLigature
True
>>> glyph = font["uniE260"]
>>> glyph.smufl.isLigature
False
property isMember: bool

Return True if glyph is either recommended or optional.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050"]
>>> glyph.smufl.isMember
True
>>> glyph = font["space"]
>>> glyph.smufl.isMember
False
property isOptional: bool

Return True if glyph is optional.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050.ss01"]
>>> glyph.smufl.isOptional
True
>>> glyph = font["uniE050"]
>>> glyph.smufl.isOptional
False
property isRecommended: bool

Return True if glyph is recommended.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050"]
>>> glyph.smufl.isRecommended
True
>>> glyph = font["uniE050.ss01"]
>>> glyph.smufl.isRecommended
False
property isSalt: bool

Return True if glyph is stylistic alternate.

Glyph names with either ".alt" and ".salt" suffix are accepted. See Note about glyph naming.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE062.salt01"]
>>> glyph.smufl.isSalt
True
>>> glyph = font["uniE050.ss01"]
>>> glyph.smufl.isSalt
False
property isSet: bool

Return True if glyph is stylistic set member.

See Note about glyph naming.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050.ss01"]
>>> glyph.smufl.isSet
True
>>> glyph = font["uniE062.salt01"]
>>> glyph.smufl.isSet
False
property layer: Layer | None

The parent Layer object.

This property is read-only.

Example:

>>> smufl.layer  
<Layer 'public.default' at ...>
property name: str | None

SMuFL-specific canonical font or glyph name.

This property behaves differently depending on the context in which the Smufl object is used:

  • When accessed from a Font (e.g, font.smufl.name), it returns the SMuFL font name, equivalent to font.info.familyName.

  • When accessed from a Glyph (e.g, glyph.smufl.name), it returns the canonical SMuFL glyph name.

Examples:

>>> font.smufl.name = "MyFont"
>>> font.smufl.name
'MyFont'
>>> glyph = font["uniE050"]
>>> glyph.smufl.name = "gClef"
>>> glyph.smufl.name
'gClef'
property names: dict[str, str] | None

Mapping of canonical SMuFL names to corresponding glyph names.

Deprecated since version 0.7.0.

This property is read-only. Its content is updated through the Smufl.name and Glyph.name attributes.

property ranges: tuple[Range, ...] | None

SMuFL ranges covered by font or glyph.

This property behaves differently depending on the context in which the Smufl object is used:

  • When accessed from a Font, (e.g., font.smufl.ranges) it returns a tuple of all Range objects covered by the font.

  • When accessed from a Glyph (e.g., glyph.smufl.ranges), it returns a singleton tuple containing the glyph’s corresponding Range object.

This property is read-only.

Examples:

>>> font.smufl.ranges  
(<Range 'clefs' (U+E050-U+E07F) editable=False at ...>,
...
<Range 'multiSegmentLines' (U+EAA0-U+EB0F) editable=False at ...>)
>>> glyph = font["uniE050"]
>>> glyph.smufl.ranges
(<Range 'clefs' (U+E050-U+E07F) editable=False at ...>,)
property sizeRange: tuple[int, int] | None

The optimum size range in integral decipoints.

Example:

>>> font.smufl.sizeRange = (16, 24)
>>> font.smufl.sizeRange
(16, 24)
property spaces: bool

Set state of measurement to staff spaces.

Example:

>>> glyph = font["uniE050"]
>>> font.smufl.spaces = True
>>> glyph.smufl.advanceWidth
0.922
>>> font.smufl.spaces = False
>>> glyph.smufl.advanceWidth
230.5
property suffix: str | None

Suffix of the current glyph.

This property is read-only.

Raises:

AttributeError – If attempting to access attribute from font.

Example:

>>> glyph = font["uniE050.ss01"]
>>> glyph.smufl.suffix
'ss01'
property version: float | None

SMuFL-specific font version number.

Example:

>>> font.smufl.version = 2.2
>>> font.smufl.version
2.2
ANCHOR_NAMES: set[str] = {'cutOutNE', 'cutOutNW', 'cutOutSE', 'cutOutSW', 'graceNoteSlashNE', 'graceNoteSlashNW', 'graceNoteSlashSE', 'graceNoteSlashSW', 'nominalWidth', 'noteheadOrigin', 'numeralBottom', 'numeralTop', 'opticalCenter', 'repeatOffset', 'splitStemDownNE', 'splitStemDownNW', 'splitStemUpSE', 'splitStemUpSW', 'stemDownNW', 'stemDownSW', 'stemUpNW', 'stemUpSE'}

Names of glyph anchors specified by the SMuFL standard.

CLASS_NAMES: set[str] = {'accidentals', 'accidentals24EDOArrows', 'accidentals53EDOTurkish', 'accidentals72EDOWyschnegradsky', 'accidentalsAEU', 'accidentalsArabic', 'accidentalsHelmholtzEllis', 'accidentalsJohnston', 'accidentalsPersian', 'accidentalsSagittalAthenian', 'accidentalsSagittalDiacritics', 'accidentalsSagittalMixed', 'accidentalsSagittalPromethean', 'accidentalsSagittalPure', 'accidentalsSagittalTrojan', 'accidentalsSims', 'accidentalsStandard', 'accidentalsSteinZimmermann', 'accidentalsStockhausen', 'articulations', 'articulationsAbove', 'articulationsBelow', 'clefs', 'clefsC', 'clefsF', 'clefsG', 'combiningStaffPositions', 'dynamics', 'forTextBasedApplications', 'multiGlyphForms', 'noteheadSetCircleX', 'noteheadSetCircled', 'noteheadSetDefault', 'noteheadSetDiamond', 'noteheadSetDiamondOld', 'noteheadSetHeavyX', 'noteheadSetLargeArrowDown', 'noteheadSetLargeArrowUp', 'noteheadSetNamesPitch', 'noteheadSetNamesSolfege', 'noteheadSetPlus', 'noteheadSetRoundLarge', 'noteheadSetRoundSmall', 'noteheadSetSacredHarp', 'noteheadSetSlashHorizontalEnds', 'noteheadSetSlashVerticalEnds', 'noteheadSetSlashed1', 'noteheadSetSlashed2', 'noteheadSetSquare', 'noteheadSetTriangleDown', 'noteheadSetTriangleLeft', 'noteheadSetTriangleRight', 'noteheadSetTriangleUp', 'noteheadSetWithX', 'noteheadSetX', 'noteheads', 'octaves', 'ornaments', 'parenthesesNotehead', 'pauses', 'pausesAbove', 'pausesBelow', 'rests', 'stemDecorations', 'wigglesArpeggiato', 'wigglesArpeggiatoDown', 'wigglesArpeggiatoUp', 'wigglesCircularMotion', 'wigglesQuasiRandom', 'wigglesTrill', 'wigglesVibrato', 'wigglesVibratoVariable'}

Names of glyph classes included in the SMuFL specification.

FONT_ATTRIBUTES: set[str] = {'designSize', 'engravingDefaults', 'sizeRange', 'spaces'}

Names of font-specific attributes of the Smufl class.

GLYPH_ATTRIBUTES: set[str] = {'classes', 'description', 'name'}

Names of glyph-specific attributes of the Smufl class.

class EngravingDefaults(*args, **kwargs)[source]

SMuFL engraving default settings.

This object contains properties and methods pertained to SMuFL’s engravingDefaults metadata structure, defining recommended defaults for line widths etc., according to the specification.

The EngravingDefaults object is essentially a dict with each engraving default setting exposed as a read/write property.

Changed in version 0.5.0: If a value is unassigned (or explicitly set to None), the attribute will be calculated automatically from the corresponding glyph in the font, provided that glyph exists and auto is enabled. See ENGRAVING_DEFAULTS_MAPPING for a complete list of attributes and their default corresponding glyphs and assigned ruler functions.

Tip

Optionally, values may be explicitly set using glyph-based calculations provided by the calculateEngravingDefaults script.

Parameters:
  • smufl – Parent Smufl object.

  • auto – Whether to calculate engraving defaults automatically. Defaults to engravingDefaults.auto configuration.

This object is typically accessed through a font’s Smufl metadata interface:

>>> engravingDefaults = font.smufl.engravingDefaults
>>> glyph = font["uniE050"]
>>> engravingDefaults = glyph.smufl.engravingDefaults

It may also be instantiated independently and assigned to a font later:

>>> engravingDefaults = EngravingDefaults()  
clear() None[source]

Clear all engraving default settings.

If engravingDefaults.auto is enabled, values will fall back to automatically calculated values after being cleared.

Example:

>>> engravingDefaults.items()
{'arrowShaftThickness': 46, 'barlineSeparation': 72, ...}
>>> engravingDefaults.clear()
>>> engravingDefaults.items()
{'arrowShaftThickness': None, 'barlineSeparation': None, ...}
items() dict[str, int | float | tuple[str, ...] | None][source]

Return dict of all available settings and their values.

Example:

>>> engravingDefaults.items()  
{'arrowShaftThickness': 46, 'barlineSeparation': 72, ...}
keys() list[str][source]

Return sorted list of all available settings names.

Example:

>>> engravingDefaults.keys()  
['arrowShaftThickness', 'barlineSeparation', ...]
naked()[source]

Return the wrapped defcon object.

This method is useful if you need to bypass the wrapper and interact directly with the underlying defcon object (e.g., for compatibility with other libraries).

Example:

>>> engravingDefaults.glyph.naked()  
<defcon.objects.glyph.Glyph object at 0x...>
raiseNotImplementedError()[source]

This exception needs to be raised frequently by the base classes. So, it’s here for convenience.

round() None[source]

Round font units to integers.

Method applies to the following attributes:

If spaces is True, values are left unchanged.

Example:

>>> engravingDefaults.spaces = True
>>> engravingDefaults.stemThickness = 0.12
>>> engravingDefaults.round()
>>> engravingDefaults.stemThickness
0.12
>>> engravingDefaults.spaces = False
>>> engravingDefaults.stemThickness = 30.5
>>> engravingDefaults.round()
>>> engravingDefaults.stemThickness
31
update(other: EngravingDefaults | dict[str, int | float | list[str] | tuple[str, ...] | None] | None = None, **kwargs: int | float | list[str] | tuple[str, ...] | None) None[source]

Update settings attributes with other object or values.

Parameters:
  • other – Other EngravingDefaults or dict of attribute names mapped to values. Defaults to None.

  • **kwargs – Attribute names and values to update as keyword arguments.

An object may be updated in a few different ways:

>>> engravingDefaults.items()  
{'arrowShaftThickness': 46, 'barlineSeparation': 72, ...}

# Update with dict object.:

>>> other = {"arrowShaftThickness": 35, "barlineSeparation": 68}
>>> engravingDefaults.update(other)
>>> engravingDefaults.items()  
{'arrowShaftThickness': 35, 'barlineSeparation': 68, ...}

Update with other EngravingDefaults object.:

>>> other = otherFont.smufl.engravingDefaults
>>> other.items()
{'arrowShaftThickness': 52, 'barlineSeparation': 75, ...}
>>> engravingDefaults.update(other)
>>> engravingDefaults.items()  
{'arrowShaftThickness': 52, 'barlineSeparation': 75, ...}

Update with keyword arguments:

>>> engravingDefaults.update(arrowShaftThickness=46, barlineSeparation=72)
>>> engravingDefaults.items()  
{'arrowShaftThickness': 46, 'barlineSeparation': 72, ...}
values() list[int | float | tuple[str, ...]][source]

Return a list of all available settings values.

Order corresponds to keys().

Example:

>>> engravingDefaults.values()  
[46, 72, ...]
property arrowShaftThickness: int | float | None

Thickness of arrow shafts.

property auto: bool

Whether to calculate engraving defaults automatically.

When True, engraving defaults are calculated automatically from font measurements. When False, all values must be set explicitly.

Automatically calculated values are overridden by any explicitly set defaults, regardless of the auto setting.

Example:

>>> engravingDefaults.auto = False
>>> engravingDefaults.auto
False
property barlineSeparation: int | float | None

Distance between multiple barlines when locked together.

property beamSpacing: int | float | None

Distance between primary and secondary beams.

property beamThickness: int | float | None

Thickness of a beam.

property bracketThickness: int | float | None

Thickness of bracket lines grouping staves.

property dashedBarlineDashLength: int | float | None

Length of dashes in a dashed barline.

property dashedBarlineGapLength: int | float | None

Gap length between dashes in a dashed barline.

property dashedBarlineThickness: int | float | None

Thickness of a dashed barline.

property font: Font | None

Parent Font object.

Example:

>>> engravingDefaults.font  
<Font 'MyFont Regular' path='/path/to/MyFont.ufo' at ...>
property glyph: Glyph | None

Parent Glyph object.

Example:

>>> engravingDefaults.glyph  
<Glyph 'uniE050' ['gClef'] ('public.default') at ...>
property hBarThickness: int | float | None

Thickness of the H-bar in a multi-bar rest.

property hairpinThickness: int | float | None

Thickness of crescendo/diminuendo hairpins.

property layer: Layer | None

Parent Layer object.

Example:

>>> engravingDefaults.layer  
<Layer 'public.default' at ...>
property legerLineExtension: int | float | None

Extension length of a leger line beyond the notehead.

property legerLineThickness: int | float | None

Thickness of a leger line.

property lyricLineThickness: int | float | None

Thickness of lyric extension lines for melismas.

property octaveLineThickness: int | float | None

Thickness of dashed lines used for octave indications.

property pedalLineThickness: int | float | None

Thickness of lines used for piano pedaling.

property repeatBarlineDotSeparation: int | float | None

Horizontal distance between dots and barline in repeats.

property repeatEndingLineThickness: int | float | None

Thickness of brackets indicating repeat endings.

property slurEndpointThickness: int | float | None

Thickness at the end of a slur.

property slurMidpointThickness: int | float | None

Thickness at the midpoint of a slur.

property smufl: Smufl | None

Parent smufl.Smufl object.

Example:

>>> engravingDefaults.smufl  
<Smufl in glyph 'uniE050' ['gClef'] ('public.default') at ...>
property spaces: bool

Whether to set state of measurement to staff spaces.

Example:

engravingDefaults.stemThickness = 25 >>> engravingDefaults.spaces = True >>> engravingDefaults.stemThickness 0.1 >>> engravingDefaults.spaces = False >>> engravingDefaults.stemThickness 25

property staffLineThickness: int | float | None

Thickness of each staff line.

property stemThickness: int | float | None

Thickness of a stem.

property subBracketThickness: int | float | None

Thickness of sub-bracket lines for related staves.

property textEnclosureThickness: int | float | None

Thickness of boxes drawn around text instructions.

property textFontFamily: tuple[str] | None

Preferred text font families for pairing with this music font

property thickBarlineThickness: int | float | None

Thickness of a thick barline.

property thinBarlineThickness: int | float | None

Thickness of a thin barline.

property thinThickBarlineSeparation: int | float | None

Distance between thin and thick barlines when locked together.

property tieEndpointThickness: int | float | None

Thickness at the end of a tie.

property tieMidpointThickness: int | float | None

Thickness at the midpoint of a tie.

property tupletBracketThickness: int | float | None

Thickness of brackets around tuplet numbers.

ENGRAVING_DEFAULTS_ATTRIBUTES: dict[str, str] = {'arrowShaftThickness': 'Thickness of arrow shafts.', 'barlineSeparation': 'Distance between multiple barlines when locked together.', 'beamSpacing': 'Distance between primary and secondary beams.', 'beamThickness': 'Thickness of a beam.', 'bracketThickness': 'Thickness of bracket lines grouping staves.', 'dashedBarlineDashLength': 'Length of dashes in a dashed barline.', 'dashedBarlineGapLength': 'Gap length between dashes in a dashed barline.', 'dashedBarlineThickness': 'Thickness of a dashed barline.', 'hBarThickness': 'Thickness of the H-bar in a multi-bar rest.', 'hairpinThickness': 'Thickness of crescendo/diminuendo hairpins.', 'legerLineExtension': 'Extension length of a leger line beyond the notehead.', 'legerLineThickness': 'Thickness of a leger line.', 'lyricLineThickness': 'Thickness of lyric extension lines for melismas.', 'octaveLineThickness': 'Thickness of dashed lines used for octave indications.', 'pedalLineThickness': 'Thickness of lines used for piano pedaling.', 'repeatBarlineDotSeparation': 'Horizontal distance between dots and barline in repeats.', 'repeatEndingLineThickness': 'Thickness of brackets indicating repeat endings.', 'slurEndpointThickness': 'Thickness at the end of a slur.', 'slurMidpointThickness': 'Thickness at the midpoint of a slur.', 'staffLineThickness': 'Thickness of each staff line.', 'stemThickness': 'Thickness of a stem.', 'subBracketThickness': 'Thickness of sub-bracket lines for related staves.', 'textEnclosureThickness': 'Thickness of boxes drawn around text instructions.', 'textFontFamily': 'Preferred text font families for pairing with this music font.', 'thickBarlineThickness': 'Thickness of a thick barline.', 'thinBarlineThickness': 'Thickness of a thin barline.', 'thinThickBarlineSeparation': 'Distance between thin and thick barlines when locked together.', 'tieEndpointThickness': 'Thickness at the end of a tie.', 'tieMidpointThickness': 'Thickness at the midpoint of a tie.', 'tupletBracketThickness': 'Thickness of brackets around tuplet numbers.'}

Names and descriptions of engraving defaults as specified in the SMuFL standard.

class Range(smufl: Smufl | None = None, _internal: bool = True)[source]

SMuFL range-related metadata.

This object provides access to metadata describing how a Glyph relates to SMuFL-defined glyph ranges. Specified range data is sourced from metadata.paths.ranges, falling back to metadata.fallbacks.ranges if the former is unavailable.

Like Font or Layer, this object behaves like a collection of Glyph instances. However, membership checks are based on Smufl.name rather than Glyph.name.

Ranges are read-only by default. Editability is controlled globally via the ranges.editable configuration setting. New custom ranges may be added using Smufl.newRange(). This data will be stored in the font’s Lib object.

Added in version 0.7.0: Support for optional editability.

Parameters:

smufl – The range’s parent Smufl object.

This object is typically accessed through a glyph’s Smufl metadata interface:

>>> glyph = font["uniE050"]
>>> range = glyph.smufl.ranges[0]

You may also instantiate it independently and assign it to a glyph later:

>>> range = Range()  
keys()[source]

Return a view of the canonical SMuFL glyph names in the range.

property description: str | None

Human-readable description of the glyph’s affiliated SMuFL range.

Example:

>>> range.description
'Clefs'
property end: int | None

End unicode of the glyph’s affiliated SMuFL range.

Example:

>>> range.end
57471
property font: Font | None

Parent Font object.

Example:

>>> range.font  
<Font 'MyFont Regular' path='/path/to/MyFont.ufo' at ...>
property glyph: Glyph | None

Parent Glyph object.

Example:

>>> range.glyph  
<Glyph 'uniE050' ['gClef'] ('public.default') at ...>
property glyphs: tuple[Glyph, ...] | None

Glyph objects of the glyph’s affiliated SMuFL range.

Example:

>>> range.glyphs  
(<Glyph 'uniE050' ['gClef'] ('public.default') at ...>,
...
<Glyph 'uniE07F' ['clefChangeCombining'] ('public.default') at ...>)
property layer: Layer | None

Parent Layer object.

Example:

>>> range.layer  
<Layer 'public.default' at ...>
property name: str | None

Unique identifier of the glyph’s affiliated SMuFL range.

Example:

>>> range.name
'clefs'
property smufl: Smufl | None

Parent Smufl object.

Example:

>>> range.smufl  
<Smufl in glyph 'uniE050' ['gClef'] ('public.default') at ...>
property start: int | None

Start unicode of the glyph’s affiliated SMuFL range.

Example:

>>> range.start
57424
property strEnd: str | None

End of the glyph’s affiliated SMuFL range as Unicode string.

Example:

>>> range.strEnd
'U+E07F'
property strStart: str | None

Start of the glyph’s affiliated SMuFL range as Unicode string.

Example:

>>> range.strStart
'U+E050'