[CLUE-Tech] Font List and Removal?
Matt Gushee
mgushee at havenrock.com
Tue Apr 6 23:11:59 MDT 2004
On Tue, Mar 16, 2004 at 08:19:10PM -0700, Dave Price wrote:
>
> I have ttf fonts working fine on my system, except that I
> put _way_too_many_ on there.
>
> Is there a nice way to get a list of font names (and maybe samples) so
> that I can do some deleting?
Well, here I am catching up on CLUE-Tech after a long absence. I'm
amazed that noone has responded to this question yet. Maybe you've found
answers already, but just in case you haven't, here are a few tips:
First of all, I'm not aware of any tool that will do it all. Maybe I'll
write that program some day (TUFT--The Ultimate Font Tool?), but it's
kind of a low priority ;-). Anyway:
* There's always xlsfonts, to get all the fonts available through X.
But maybe that doesn't qualify as "nice." And it won't tell you
which fonts are TrueType.
* If you know which directory the font files are in, the "spadmin"
program that comes with OpenOffice will let you browse all the
fonts graphically--but it won't match up the font family names
with file names.
* Or you could probably do something with the FreeType tools ... you
might have them installed already: ftinfo, ftdump, ftview, etc.
It wouldn't be too hard to write a script using ftinfo that would
correlate font family names and/or other info with filenames.
* Or you could use the following code, which will give you a
command-line tool that takes an input directory and an output
directory, and for every ".ttf" file in the input directory it
creates a PNG image with the font file name rendered in that font
at 24pt. The catch is that you have to download and compile some
stuff, but if your machine and Internet connection are reasonably
fast, it shouldn't take more than an hour altogether.
-- cut below this line --------------------------------------------
(*
fontpix.ml -- a simple utility for generating sample images of
TrueType fonts.
Requirements:
the OCaml distribution :
http://caml.inria.fr/ocaml/distrib-3.07.html
FindLib : http://www.ocaml-programming.de/packages/
GD4O : http://gd4o.sourceforge.net/
Compile:
Byte code: (failed on my system ... not sure why)
ocamlfind ocamlc -package gd -linkpkg -o fontpix fontpix.ml
Native code: (have to compile OCaml w/ native code option)
ocamlfind ocamlopt -package gd -linkpkg -o fontpix fontpix.ml
Usage:
./fontpix <input_dir> <output_dir>
*)
open Gd;;
let fontpic output_dir ttf_file =
let base = Filename.basename ttf_file in
let img = create 256 96 in
let white = img#colors#white
and black = img#colors#black in
ignore (img#string_ft ~fg:black ~fname:ttf_file ~size:24.0 ~angle:0.
~x:24 ~y:54 base);
let img_file = Filename.concat output_dir (base ^ ".png") in
img#save_as_png img_file
let run indir outdir =
let all_files = Sys.readdir indir in
let ttf_files =
List.map
( Filename.concat indir )
( List.filter
( fun fname ->
let len = String.length fname in
(len >= 4) && ((String.sub fname (len - 4) 4) = ".ttf") )
( Array.to_list all_files ) ) in
List.iter (fontpic outdir) ttf_files
let () =
let indir = Sys.argv.(1) and outdir = Sys.argv.(2) in
run indir outdir
-- END - cut above this line ---------------------------------------
--
Matt Gushee When a nation follows the Way,
Englewood, Colorado, USA Horses bear manure through
mgushee at havenrock.com its fields;
http://www.havenrock.com/ When a nation ignores the Way,
Horses bear soldiers through
its streets.
--Lao Tzu (Peter Merel, trans.)
More information about the clue-tech
mailing list