You are not logged in.
Hi guys
I am looking for selecting some fonts I could use under qcad (or any other cad software).
The first step I would like is to have all font listed and, ie under LIbreoffice document, an example of each font "abcdefghijklmnopqrstuvbwxyz 123456789 + name of the font" written in the font such that I could visualize.
the next step, that I found over the web would be: libreoffice ==> pdf ==> inkscape ==> dxf
I looked at programs like gnome-font-view or waterfall but nothing that can list all the fonts installed on the computer.
Any hint?
thank you in advance
Brice
Offline
man fc-list
http://www.imagemagick.org/Usage/text/
Offline
I was just working on a script using fc-list as well, but I was using the output to create a latex document which would print samples of all fonts on the system. But I ran into so many corner cases that resulted in failure that I realized that either they weren't corners, or I was in a octacismyrihedron (80,000 sided shape). So I gave up on it.
The imagemagic approach seems much better, but it doesn't seem to recognize *any* fonts on my system:
$ convert -background transparent -fill blue -font Terminus -pointsize 48 label:Test test.png
convert: unable to read font `Terminus' @ warning/annotate.c/RenderType/960.
I get the same error for countless other fonts and generic patterns including Serif and serif (as well as Candice in case it was some builtin imagemagick font).
EDIT: -family instead of -font appears to work, EDIT 2: nope, not reliably at all. It failed on Terminus which fc-list provides. More failing corners. After testing 88 family names from fc-list, only 22 of them were accepted by imagemagic's 'convert', all the others failed. I have not checked the images to see how many of those 22 actually appear to resemble the font versus some fallback - I just checked the images, many of them looked like a fallback font. I confirmed with md5sums: there were only 7 unique images created. So 7 out of 88 isn't good (well, probably 6 actual correct results and one fallback font).
Seth, do you have a way for this to actually do something useful?
Last edited by Trilby (2020-05-04 19:28:30)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Doesn't seem to work for bitmap fonts (otb) and also pcf :-(
("Terminus TTF" works and using -family will resolve the font file, but fails on a different position in RenderFreetype")
Probably the same issue you were facing before.
Offline
wahooo guys, you pushed me but that's good
for i in $(convert -list font | grep Font | cut -d':' -f2); do convert -font $i -pointsize 72 label:123456789 $i.gif;done
with that in a folder I can get a gif for each font containing what I was mainly looking for: numbers
Now I still have to mod the script to get all in one file and add the font name in the label.
BR
Offline
convert -list font
*headdesk* yup, that's what we needed! It seems imagemagick uses hyphens in place of spaces which is covers most of the previously failing cases.
Note that you can put newlines in the "label" which could include the font name, e.g.,:
convert -list font | sed -n 's/ *Font: //p' | while read font; do
convert -background transparent -fill blue -font "$font" -pointsize 72 "label:$font\nABCDEFG\n123456789" "$font.png"
done
From there, another imagemagic command could tile all those individual images into one large one ... you'd have some choices on layout: do you want a large number of images all stacked vertically for scrolling, or do you want a more tiled / grid layout?
How would a web page preview work:
cat <<'EOF'
<!DOCTYPE html>
<html>
<head>
<style>
img { width: 15rem; hieght: auto; object-fit: contain; margin: 1rem; }
</style>
</head>
<body>
EOF
convert -list font | sed -n 's/ *Font: //p' | while read font; do
convert -background transparent -fill blue -font "$font" -pointsize 72 "label:$font\nABCDEFG\n123456789" "$font.png"
echo '<img src="'$font.png'">'
done
cat <<'EOF'
</body>
</html>
EOF
This generates the files and html (on stdout) that will present them all together.
Last edited by Trilby (2020-05-04 19:52:45)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
for i in $(convert -list font | grep Font | cut -d':' -f2); do convert -font $i -pointsize 72 label:123456789_abcdefghijklmnopqrstuvwxyz_"$i" $i.gif;done
coming closer...
Offline
@Trilby: I missed your post
vertical stack would be OK for scrolling!
Offline
How about this:
#!/bin/sh
tmp=$(mktemp -d fonts.XXXXXX)
printf '\033[32;1m=>\033[0;1m Processing fonts\033[0m\n'
convert -list font | sed -n 's/ *Font: //p' | while read font; do
printf ' \033[1m-> \033[0m%s\n' "$font"
convert -font "$font" -pointsize 72 "label:$font\n123456789\nabcdefghijklmnopqrstuvwxyz\n" "$tmp/$font.png"
done
printf '\033[32;1m=>\033[0;1m Creating single image\033[0m\n'
convert -append $tmp/*.png allfonts.png
printf '\033[32;1m=>\033[0;1m Cleaning temp files\033[0m\n'
rm -rf $tmp
EDIT: it creates a file "allfonts.png" in the current directory.
Last edited by Trilby (2020-05-04 20:57:49)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
[brice@TuxBox:fonts]$ mkdir tmp
[brice@TuxBox:fonts]$ mv *.gif tmp/
[brice@TuxBox:fonts]$ convert -append tmp/*.gif allfonts.gif
Aborted (core dumped)
[brice@TuxBox:fonts]$
Offline