neoscore.core.has_music_font
- class neoscore.core.has_music_font.HasMusicFont[source]
Bases:
object
A mixin for classes which have an associated staff measurement.
This is useful for integration with SMuFL fonts, where glyphs and their metadata are measured relative to a staff space.
A naive and slow implementation of the
music_font
property is provided which returns the nearest music found in the object’s ancestors. Subclasses will often want to override this.- static find_music_font(obj: PositionedObject) MusicFont [source]
Return the music font from
obj
or its nearest ancestor with one.This checks
obj
and then its ancestors for whether they have amusic_font
attribute, returning the first value found. If no font is found, this raises aNoAncestorWithMusicFontError
.