I know that this is about gimp, but as many people use ImageMagick next
to gimp when using it in scripts, I thought it might be of interest.
This is a pretty elaborate process which I do only once every 5 years or
so. (Guessing here, because it is now the second time I do it)
I make wallpapers like
http://houghi.org/shots/slides/wppbr_scp_004_celebrities_elisha_cuthbert_02.php
For I put the name up in a semi-random order. I do however use different
fonts (selected at random).
I have used the fonts for so long, I got bored of some of them, so I
decided to select new ones and here is the process of how I did this.
1) I went to http://www.1001fonts.com/
and downloaded all the fonts I
thought would look good. Other sites are http://www.creamundo.com
and
http://cooltext.com/Fonts.
There are many more.
Basicilay just download any fonts from anywhere. I downloaded some 174
different fonts.
Read http://www.imagemagick.org/Usage/
and scroll down to "Font Usage"
I unpack all the files and put them in one directory. inside
/usr/share/fonts and next I run `updatedb` (might need to be installed)
as root.
I then run `imagick_type_gen ~/.magick/type.xml` which can be downloaded
from the URL above. Now the most im****tand part comes into play.
Checking the fonts. The fonts are sometimes free, sometimes shareware
and sometime trialware. This means that not always all letters are
shown correctly.
To test this I will use the wording "the quick brown fox jumps over the
lazy-dog" in both upper and lower case. Note the hyphen in lazy-dog. I
am only using it for names and thse will have hyphens in them sometimes.
If you use any other characters, check them as well.
What I want to do is first look at all fonts to see if I want to use it
or not. For this I will write these names that I want to use to a file.
To do this, I also use ImageMagick, xv and a small script:
#!/bin/bash
#set -x
TMP="`mktemp`.gif"
LABEL1="the quick brown fox jumps over the lazy-dog"
LABEL2=`echo $LABEL1|tr 'a-z' 'A-Z' `
LABEL="${LABEL1}\n${LABEL2}"
for FONT in `convert -list font|awk '{print $1}'|grep -vE
'^Name|^-|^Path'|less`
do
convert -font $FONT -pointsize 72 label:"$LABEL" $TMP
DISPLAY=:0.0 xv -geometry 10x -nodecor $TMP &
read -s -n1 -p "$FONT : " KEY
if [ "$KEY" = "y" ]
then
echo $FONT >> ~/fontlist.txt
fi
echo ""
killall xv
done
rm $TMP
For each lettertype that I select Y, a line will be added to the file
~/fontlist.txt as this is what I will use as a basis for my scripts.
Next I sort fontlist.txt and recheck the fonts again. Many will look
very similar and those I take out as well. e.g. Makisupa and
Makisupa-Regular
I then add `FONTS="` at the beginning and `"` at the end of the file. I
can now source this.
e.g. in a script where I want to select the fonts, I just add
.. /fontlist.txt
(Do not forget the dot)
Now I have this file, I can do something like the following. You can
obviously do whatever you like with it.
#!/bin/bash
.. ~/fontlist.txt
FONT=($FONTS)
NUM_FONT=${#FONT[*]}
FONT=${FONT[$((RANDOM%NUM_FONT))]}
echo $FONT
This will select a random font each time. Or as a oneliner with shorter
names:
.. ~/fontlist.txt;F=($FONTS); N=${#F[*]};F=${F[$((RANDOM%N))]};echo $F
This ends todays lesson. :-D
houghi
--
But I will accept the rules that you feel necessary to your freedom. I am
free, no matter what rules surround me. If I find them tolerable, I
tolerate them; if I find them too obnoxious, I break them. I am free
because I know that I alone am morally responsible for everything I do.


|