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 afontParts.base.BaseFont, it will be wrapped.
Added in version 0.6.0: Support for initializing from an existing
fontParts.base.BaseFontinstance.
Examples:
>>> from smufolib import Font >>> font = Font("path/to/MyFont.ufo")
>>> from fontParts.fontshell import RFont >>> font = Font(RFont())
- 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
Fontobject’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()
- 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
Fontor aGlyph. 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, andsuffix) 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
importIDprior to using this class with an existing font for the first time.This object is typically accessed through a
FontorGlyph:>>> 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]
-
- Parameters:
name – SMuFL-specific canonical glyph name.
Example:
>>> font.smufl.findGlyph("accidentalFlat") <Glyph 'uniE260' ['accidentalFlat'] ('public.default') at ...>
- 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
namerepresents a recommended glyph (i.e., listed in the glyphnames.json metadata file), it will be assigned a correspondingnameandunicode. Otherwise,namewill be used ifglyph.nameisNone.- Parameters:
name – The name of the glyph to create.
clear – Whether to clear any preexisting glyph with the specified
namebefore creation. Defaults toTrue
- Returns:
The newly created
Glyphinstance.
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
startandenddecimal codepoint.The
glyphskey 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 aname) 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:
PermissionError – If
ranges.editableis disabled.ValueError – If
startorendpartially or completely overlap with an existing range whenoverrideExistingisFalse.
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
spacesisTrue, 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
Glyphobjects.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.anchorsattribute 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.strictis enabled, only SMuFL-specific class names are allowed. SeeCLASS_NAMESfor the fullsetof specified names.Added in version 0.7.0: Distinction between strict, SMuFL-specific vs. lenient, custom class names.
- Raises:
AttributeError – If attempting to access attribute from font.
ValueError – If attempting to set a name not specified in
CLASS_NAMESwhenclasses.strictis enabled.
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
Glyphobject.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
EngravingDefaultsobject.- 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
Fontobject.Example:
>>> smufl.font <Font 'MyFont Regular' path='/path/to/MyFont.ufo' at ...>
- property glyph: Glyph | None
The parent
Glyphobject.Example:
>>> smufl.glyph <Glyph 'uniE050' ['gClef'] ('public.default') at ...>
- property isLigature: bool
Return
Trueif 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
Trueif 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
Trueif 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
Trueif 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
Trueif 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
Trueif 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
Layerobject.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
Smuflobject is used:When accessed from a
Font(e.g, font.smufl.name), it returns the SMuFL font name, equivalent tofont.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.nameandGlyph.nameattributes.
- property ranges: tuple[Range, ...] | None
SMuFL ranges covered by font or glyph.
This property behaves differently depending on the context in which the
Smuflobject is used:When accessed from a
Font, (e.g.,font.smufl.ranges) it returns atupleof allRangeobjects covered by the font.When accessed from a
Glyph(e.g.,glyph.smufl.ranges), it returns a singletontuplecontaining the glyph’s correspondingRangeobject.
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'
- 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
Smuflclass.
- GLYPH_ATTRIBUTES: set[str] = {'classes', 'description', 'name'}
Names of glyph-specific attributes of the
Smuflclass.
- 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
EngravingDefaultsobject is essentially adictwith 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 andautois enabled. SeeENGRAVING_DEFAULTS_MAPPINGfor 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
calculateEngravingDefaultsscript.- Parameters:
smufl – Parent
Smuflobject.auto – Whether to calculate engraving defaults automatically. Defaults to
engravingDefaults.autoconfiguration.
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.autois 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
dictof all available settings and their values.Example:
>>> engravingDefaults.items() {'arrowShaftThickness': 46, 'barlineSeparation': 72, ...}
- keys() list[str][source]
Return sorted
listof 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
spacesisTrue, 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
EngravingDefaultsordictof attribute names mapped to values. Defaults toNone.**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
dictobject.:>>> other = {"arrowShaftThickness": 35, "barlineSeparation": 68} >>> engravingDefaults.update(other) >>> engravingDefaults.items() {'arrowShaftThickness': 35, 'barlineSeparation': 68, ...}
Update with other
EngravingDefaultsobject.:>>> 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
listof all available settings values.Order corresponds to
keys().Example:
>>> engravingDefaults.values() [46, 72, ...]
- property auto: bool
Whether to calculate engraving defaults automatically.
When
True, engraving defaults are calculated automatically from font measurements. WhenFalse, all values must be set explicitly.Automatically calculated values are overridden by any explicitly set defaults, regardless of the
autosetting.Example:
>>> engravingDefaults.auto = False >>> engravingDefaults.auto False
- property barlineSeparation: int | float | None
Distance between multiple barlines when locked together.
- property font: Font | None
Parent
Fontobject.Example:
>>> engravingDefaults.font <Font 'MyFont Regular' path='/path/to/MyFont.ufo' at ...>
- property glyph: Glyph | None
Parent
Glyphobject.Example:
>>> engravingDefaults.glyph <Glyph 'uniE050' ['gClef'] ('public.default') at ...>
- property layer: Layer | None
Parent
Layerobject.Example:
>>> engravingDefaults.layer <Layer 'public.default' at ...>
- property legerLineExtension: int | float | None
Extension length of a leger line beyond the notehead.
- property octaveLineThickness: int | float | None
Thickness of dashed lines used for octave indications.
- 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 smufl: Smufl | None
Parent
smufl.Smuflobject.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 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
- 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
Glyphrelates to SMuFL-defined glyph ranges. Specified range data is sourced frommetadata.paths.ranges, falling back tometadata.fallbacks.rangesif the former is unavailable.Like
FontorLayer, this object behaves like a collection ofGlyphinstances. However, membership checks are based onSmufl.namerather thanGlyph.name.Ranges are read-only by default. Editability is controlled globally via the
ranges.editableconfiguration setting. New custom ranges may be added usingSmufl.newRange(). This data will be stored in the font’sLibobject.Added in version 0.7.0: Support for optional editability.
- Parameters:
smufl – The range’s parent
Smuflobject.
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()
- 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
Fontobject.Example:
>>> range.font <Font 'MyFont Regular' path='/path/to/MyFont.ufo' at ...>
- property glyph: Glyph | None
Parent
Glyphobject.Example:
>>> range.glyph <Glyph 'uniE050' ['gClef'] ('public.default') at ...>
- property glyphs: tuple[Glyph, ...] | None
Glyphobjects 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
Layerobject.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
Smuflobject.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