-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Passing a font in through --tittleTtfFile is a bit painful. It can be less painful by having a default font.
Lilypond installations will have the following fonts available.
C059, Century SchoolBook URW, Century Schoolbook L, TeX Gyre Schola, DejaVu Serif, …, serif
Pillow needs a file name so we could use one of those fonts by default with ImageFont.truetype('C059-Roman.otf', 20) which works on Linux (Ubuntu 20.04). I don't know if it works on other platforms. If it does, a simple change is required:
if options.titleAtStart and options.titleTtfFile is None:
progress("No font specified with --title-ttf=FONT-FILE, using default font.")
options.titleTtfFile = 'C059-Roman.otf' # should be available via lilypond
# Test font loading here, before continuing
testFont = ImageFont.truetype(options.titleTtfFile)
if testFont is None:
fatal("Must specify --title-ttf=FONT-FILE with --title-at-start")
I can't test windows or mac so I don't know if that file is available on those platforms too or if Pillow can find it.
Another option could be to add 'C059-Roman.otf' to the ly2video repo (it's only 96KB), but then using it becomes tricky. I think it needs to be copied to the /tmp/ly2video.../ directory for Pillow to see it. Otherwise you need an absolute path to the file.