From d3a78b51338949f0d5998b93813baf1272b477fe Mon Sep 17 00:00:00 2001 From: RjY Date: Fri, 4 Dec 2015 17:46:03 +0000 Subject: [PATCH] titlepic/create_caption: try alternative fonts Do not FTBFS if the user does not have ghostscript / gsfonts installed. Instead try some other fonts commonly installed by Linux distributions. The patch is written to be easily extendable with extra font names, but to be independent of the order of "convert -list font" output. Each listed font is searched for in turn, and the first one found is used. --- graphics/titlepic/create_caption | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/graphics/titlepic/create_caption b/graphics/titlepic/create_caption index 223d6260..d84da10c 100755 --- a/graphics/titlepic/create_caption +++ b/graphics/titlepic/create_caption @@ -1,11 +1,25 @@ #!/bin/sh +find_font() { + local font fontlist + fontlist=$(convert -list font | awk '$1=="Font:" { print $2 }') + for font in "$@" ; do + if echo $fontlist | grep -q $font ; then + echo $font + return + fi + done +} + +font=$(find_font Helvetica-Bold Liberation-Sans-Bold DejaVu-Sans-Condensed-Bold) +if [ -z "$font" ] ; then echo "Cannot find any fonts" ; exit 1 ; fi + draw_with_footer() { input_file=$1; output_file=$2; shift; shift - convert $input_file -fill white -font Helvetica-Bold \ + convert $input_file -fill white -font "$font" \ -pointsize 11 \ -gravity southwest \ -draw "text 5,5 'https://freedoom.github.io/'" \