[why]
When the file specified to be patched is not a font file the patcher run errors out with an out of index runtime error:
Traceback (most recent call last):
File "/home/fini/extra/git/nerd-fonts/font-patcher", line 2155, in <module>
main()
File "/home/fini/extra/git/nerd-fonts/font-patcher", line 2147, in main
patcher.generate(sourceFonts)
File "/home/fini/extra/git/nerd-fonts/font-patcher", line 415, in generate
sourceFont = sourceFonts[0]
~~~~~~~~~~~^^^
IndexError: list index out of range
[how]
Do not assume that the specified file will be a font file but rather check if fontforge detects a font in the file and error out if there is no font found.
[x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan.
Issue number where discussion took place: #xxx
[ ] If this contains a font/glyph add its origin as background info below (e.g. URL)
[ ] Verified the license of any newly added font, glyph, or glyph set. License is: xxx
What does this Pull Request (PR) do?
Prevent a runtime error in certain situations and instead prints an understandable explanation why processing can not continue.
[why] When the file specified to be patched is not a font file the patcher run errors out with an out of index runtime error:
[how] Do not assume that the specified file will be a font file but rather check if fontforge detects a font in the file and error out if there is no font found.
Fixes: #1647
Reported-by: Kristopher James Kent kris@kjkent.dev
Requirements / Checklist
What does this Pull Request (PR) do?
Prevent a runtime error in certain situations and instead prints an understandable explanation why processing can not continue.
How should this be manually tested?
Any background context you can provide?
What are the relevant tickets (if any)?
Screenshots (if appropriate or helpful)