brown.core.music_font

classes

permalink view source

MusicFont (Font)

A SMuFL compliant music font

__init__ (family_name, size, weight=None, italic=False) permalink view source

arguments:

family_name (str): The font family name

size (Unit): The size (height) of the font

weight (int): The font weight on a 0-100 scale, where 50 is normal, lower numbers are lighter, and higher are darker. If None (the default), a normal weight will be used.

italic (bool): Whether or not the font is italicized

properties

em_size: Unit The em size for the font. permalink view source

overriden from Font

read-only.

engraving_defaults: dict The SMuFL engraving defaults information for this font permalink view source

read-only.

inherited properties

ascent: GraphicUnit The ascent of the font. permalink view source

The ascent is the vertical distance between the font baseline and the highest any font characters reach.

read-only.

inherited from Font

descent: GraphicUnit The descent of the font. permalink view source

The ascent is the vertical distance between the font baseline and the lowest any font characters reach.

read-only.

inherited from Font

inherited class methods

deriving (cls, existing_font, family_name=None, size=None, weight=None, italic=None) permalink view source

Derive a Font from an existing one, overriding the given properties.

arguments:

existing_font (Font): An existing font.

family_name (str):

size (int):

weight (int):

italic (bool):

All properties not passed in args/kwargs will be copied from the existing Font.

inherited from Font

methods

glyph_info (glyph_name, alternate_number=None) permalink view source

Collect and return all known metadata about a glyph.

arguments:

glyph_name (str): The canonical name of the glyph

alternate_number (int or None): A glyph alternate number

returns:

None: If the glyph is not available in the font dict: A collection of all known metadata about the glyph

inherited methods

bounding_rect_of (string) permalink view source

Approximate the bounding rect of a string in this font.

arguments:

string (str): The string to derive the rect from

returns:

Rect[Unit]: a bounding rectangle.

inherited from Font