]>
code.delx.au - refind/blob - fonts/mkfont.sh
3 # Program to generate a PNG file suitable for use as a rEFInd font
4 # To obtain a list of available font names, type:
6 # convert -list font | less
8 # The font used MUST be a monospaced font; searching for the string
9 # "Mono" will turn up most suitable candidates.
12 # ./mkfont.sh font-name font-size font-Y-offset bitmap-filename.png
14 # This script is part of the rEFInd package. Version numbers refer to
15 # the rEFInd version with which the script was released.
19 # 0.6.6 - Initial release
21 if [[ $# != 4 ]] ; then
22 echo "Usage: $0 font-name font-size y-offset bitmap-filename.png"
23 echo " font-name: Name of font (use 'convert -list font | less' to get list)"
24 echo " NOTE: Font MUST be monospaced!"
25 echo " font-size: Font size in points"
26 echo " y-offset: pixels font is shifted (may be negative)"
27 echo " bitmap-filename.png: output filename"
32 Convert
=`which convert 2> /dev/null`
33 if [[ ! -x $Convert ]] ; then
34 echo "The 'convert' program is required but could not be found. It's part of the"
35 echo "ImagMagick program, usually installed in the 'imagemagick' package."
41 let CellWidth
=(${Height}*6+5)/10
42 #let CellWidth=(${Height}*5)/10
43 let Width
=${CellWidth}*96
44 echo "Creating ${Width}x${Height} font bitmap...."
45 $Convert -size ${Width}x
${Height} xc
:transparent
-gravity NorthWest
-font $1 -pointsize $2 \
46 -draw "text 0,$3 ' !\"#\$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~?'" $4