ChordPro / chordpro

Reference implementation of the ChordPro standard for musical lead sheets.
Other
323 stars 51 forks source link

Fontconfig does not flag invalid font names. #429

Closed spakarl closed 1 month ago

spakarl commented 1 month ago

Using Chordpro core 6.060 on Windows 11.

I want to use a very popular font. It is the german DIN font. Microsoft has implemented a similar font in Windows - where it is called "Bahnschrift". But this is one TTF-File with many Subfonts inside. I did not find any way to use it under chordpro. So I looked for some other implementation for the font that is contained in one TTF file for every subfont. I found a good candidate in Google Fonts. It is called Barlow. But unfortunately there seems to be a problem with Chordpro when I try to use that font. I receive the following error message.

PS C:\Users\charlys\Music\ChordPro> .\generate-pdf.ps1
This is ChordPro core 6.060
Config[0]: <builtin>
Config[1]: C:/Program Files/ChordPro.ORG/ChordPro/lib/ChordPro/res/config/guitar.json
Config[2]: surface.json
Config[3]: fonts5.json
Processing song ./Losing my Religion.cho...
Parsers at start of ./Losing my Religion.cho:
Processed song...
Generating PDF G:\Meine Ablage\Musik\Noten\PDF/Losing my Religion - Keyboard - Am.pdf...
1 Can't call method "isvirtual" on an undefined value at C:/Program Files/ChordPro.ORG/ChordPro/script/../lib/PDF/API2/Content.pm line 1621.

fonts5.json surface.json

sciurius commented 1 month ago

The error message indicates a problem with reading the font information. It could be as easy as a missing font file.

Can you run chordpro with additional --define debug.fonts=2 argument?

spakarl commented 1 month ago

Yes sure.

output.txt Losing my Religion.cho.txt

sciurius commented 1 month ago

Ah, found it. It's the line (fonts5.json):

      italic: Barlow-Italic

It is missing the .ttf.

I'll be the first to admit that this should be detected, so I leave this issue open.

spakarl commented 1 month ago

Thank you so much!