varietywalls / variety

Wallpaper downloader and manager for Linux systems
http://peterlevi.com/variety
GNU General Public License v3.0
1.21k stars 146 forks source link

stroke and 'strokewidth' do not reset for each entry in clock_filter #647

Open breem42 opened 1 year ago

breem42 commented 1 year ago

Variety 0.8.5, Raspberry Pi, GNOME

I was hoping to get a clock and date with a very fat white outline of the text that did not overwhelm the actual characters of the clock and date. So I had clock_filter as follows:

clock_filter = "-density 100 -font `fc-match -f '%{file[0]}' '%CLOCK_FONT_NAME'` -pointsize %CLOCK_FONT_SIZE -gravity SouthEast -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '35' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+126] '%H:%M' -fill '#00000000' -stroke '#ffffff' -strokewidth '35' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+138] '%H:%M' -fill '#fe97b5' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+138] '%H:%M' -font `fc-match -f '%{file[0]}' '%DATE_FONT_NAME'` -pointsize %DATE_FONT_SIZE -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '25' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+20] '%B %d, %Y' -fill '#00000000' -stroke '#ffffff' -strokewidth '25' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+30] '%B %d, %Y' -fill '#948cd5' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+30] '%B %d, %Y'"

I was expecting a larger blobby white outline of each character, and the text of the date and time in front of that blobby white. But the strokes were also applied to the pink (#fe97b5) and purple (#948cd5) text. Apparently, the next time the fill is specified, the stroke and strokewidth are left the same as they were last time.

If, however, I add -strokewidth '0' a couple times, I get the desired result. Like so:

clock_filter = "-density 100 -font `fc-match -f '%{file[0]}' '%CLOCK_FONT_NAME'` -pointsize %CLOCK_FONT_SIZE -gravity SouthEast -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '35' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+126] '%H:%M' -fill '#00000000' -stroke '#ffffff' -strokewidth '35' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+138] '%H:%M' -fill '#fe97b5' -strokewidth '0' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+138] '%H:%M' -font `fc-match -f '%{file[0]}' '%DATE_FONT_NAME'` -pointsize %DATE_FONT_SIZE -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '25' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+20] '%B %d, %Y' -fill '#00000000' -stroke '#ffffff' -strokewidth '25' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+30] '%B %d, %Y' -fill '#948cd5' -strokewidth '0' -annotate 0x0+[%HOFFSET+30]+[%VOFFSET+30] '%B %d, %Y'"

Here are the relevant lines from the log file. First the old clock_filter:

INFO: 2023-09-22 16:50:57,092: build_imagemagick_clock_cmd() 'Applying clock filter: -density 100 -font `fc-match -f '%{file[0]}' 'Crewniverse:Bold:120'` -pointsize 120 -gravity SouthEast -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '35' -annotate 0x0+30+131 '16:50' -fill '#00000000' -stroke '#ffffff' -strokewidth '35' -annotate 0x0+30+143 '16:50' -fill '#fe97b5' -annotate 0x0+30+143 '16:50' -font `fc-match -f '%{file[0]}' 'Crewniverse:Bold:45'` -pointsize 45 -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '25' -annotate 0x0+30+25 'September 22, 2023' -fill '#00000000' -stroke '#ffffff' -strokewidth '25' -annotate 0x0+30+35 'September 22, 2023' -fill '#948cd5' -annotate 0x0+30+35 'September 22, 2023''
INFO: 2023-09-22 16:50:57,093: build_imagemagick_clock_cmd() 'ImageMagick clock cmd: convert '/media/pi/stuff/Steven Universe Title Cards/Stephen Universe S03E15 - Alone at Sea.jpg' -scale 1920x1080^ -density 100 -font `fc-match -f '%{file[0]}' 'Crewniverse:Bold:120'` -pointsize 120 -gravity SouthEast -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '35' -annotate 0x0+30+131 '16:50' -fill '#00000000' -stroke '#ffffff' -strokewidth '35' -annotate 0x0+30+143 '16:50' -fill '#fe97b5' -annotate 0x0+30+143 '16:50' -font `fc-match -f '%{file[0]}' 'Crewniverse:Bold:45'` -pointsize 45 -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '25' -annotate 0x0+30+25 'September 22, 2023' -fill '#00000000' -stroke '#ffffff' -strokewidth '25' -annotate 0x0+30+35 'September 22, 2023' -fill '#948cd5' -annotate 0x0+30+35 'September 22, 2023' /home/pi/.config/variety/wallpaper/wallpaper-clock-0005bb4035cdbe187d08c717b41f8240.jpg'

Now the new clock_filter with -strokewidth '0':

INFO: 2023-09-22 17:03:03,711: build_imagemagick_clock_cmd() 'Applying clock filter: -density 100 -font `fc-match -f '%{file[0]}' 'Crewniverse:Bold:120'` -pointsize 120 -gravity SouthEast -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '35' -annotate 0x0+30+126 '17:03' -fill '#00000000' -stroke '#ffffff' -strokewidth '35' -annotate 0x0+30+138 '17:03' -fill '#fe97b5' -strokewidth '0' -annotate 0x0+30+138 '17:03' -font `fc-match -f '%{file[0]}' 'Crewniverse:Bold:45'` -pointsize 45 -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '25' -annotate 0x0+30+20 'September 22, 2023' -fill '#00000000' -stroke '#ffffff' -strokewidth '25' -annotate 0x0+30+30 'September 22, 2023' -fill '#948cd5' -strokewidth '0' -annotate 0x0+30+30 'September 22, 2023''
INFO: 2023-09-22 17:03:03,712: build_imagemagick_clock_cmd() 'ImageMagick clock cmd: convert '/media/pi/stuff/Steven Universe Title Cards/Stephen Universe S05E12 - Jungle Moon.jpg' -scale 1920x1080^ -density 100 -font `fc-match -f '%{file[0]}' 'Crewniverse:Bold:120'` -pointsize 120 -gravity SouthEast -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '35' -annotate 0x0+30+126 '17:03' -fill '#00000000' -stroke '#ffffff' -strokewidth '35' -annotate 0x0+30+138 '17:03' -fill '#fe97b5' -strokewidth '0' -annotate 0x0+30+138 '17:03' -font `fc-match -f '%{file[0]}' 'Crewniverse:Bold:45'` -pointsize 45 -fill '#a0e6ff' -stroke '#a0e6ff' -strokewidth '25' -annotate 0x0+30+20 'September 22, 2023' -fill '#00000000' -stroke '#ffffff' -strokewidth '25' -annotate 0x0+30+30 'September 22, 2023' -fill '#948cd5' -strokewidth '0' -annotate 0x0+30+30 'September 22, 2023' /home/pi/.config/variety/wallpaper/wallpaper-clock-d2653b5270d510dc161ccba96b9d6583.jpg'

I spent a long time figuring this out, and it might be helpful to the next person if they could assume that the strokewidth is zero each time a font is specified. If this is too much hassle to implement, it might be a useful tip to add to the documentation.