timetoshare.font#

The fonts that draw, and the one table that measures, every text of a drawing.

docs/drawing.md draws every text in DejaVu Sans 2.37 and every code point DejaVu Sans does not map and Noto Music 2.004 does in Noto Music, chiefly the Musical Symbols, Byzantine Musical Symbols and Ancient Greek Musical Notation blocks; a code point neither maps takes DejaVu Sans’s glyph 0. A text is measured from one table of advance widths covering both fonts in DejaVu Sans’s units. The TrueType files, their licences and the table are bundled with the package.

timetoshare.font.FONT_FILES = ('DejaVuSans.ttf', 'NotoMusic-Regular.ttf')#

The bundled TrueType files in fallback order: the text font, DejaVu Sans 2.37, then the music font, Noto Music 2.004, which draws what DejaVu Sans does not map. Each file’s licence lies beside it as DejaVuSans-LICENSE and NotoMusic-LICENSE.

timetoshare.font.font_paths()[source]#

Return the paths of the bundled TrueType files, in FONT_FILES order.

timetoshare.font.font_metrics()[source]#

Return the metrics that measure every text of a drawing.

The members are DejaVu Sans’s units_per_em, ascender, descender (a positive depth) and fallback (the advance of glyph 0, counted for a code point the table does not hold), and advances, keyed by the code point in decimal: the advance of every code point DejaVu Sans maps, and of every code point Noto Music maps and DejaVu Sans does not, scaled to DejaVu Sans’s units per em and rounded to the nearest integer, ties to even. The result is cached and shared; treat it as read-only.