Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fonts can be less painful #116

Open
jstma opened this issue May 21, 2023 · 0 comments
Open

Fonts can be less painful #116

jstma opened this issue May 21, 2023 · 0 comments

Comments

@jstma
Copy link

jstma commented May 21, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant