/*I've asked some time ago if there was a way to get a list of all*/ /*fonts installed on a roxen server. I got no answer, and so I tried*/ /*to do something myself. This is what I came up with. It's a pretty*/ /*simple pike script which uses the server's facilities to get an*/ /*exact listing of all the fonts, along with an example text.*/ /*It has some configurable options, but it's not anything special.*/ /*To work it requires that you have a graphic_text module installed*/ /*on the virtual server it's run on, and of course pike scripts support.*/ /*------------------ BEGIN ----------------------*/ /* * This code is (C) 1997 Francesco Chemolli * It comes with NO WARRANTY of any kind, either implicit or explicit. * Use at your own risk! * * This pike script can be used to get a listing of all the fonts installed * on your roxen server. I tested it with Roxen/1.0alpha4 and Roxen/1.1 * Be warned: since it generates an example text for each font, it could * well hang your server for a while: on my P100 Linux box, it takes * about a minute to list 180 fonts. * * Release 1.2: minor changes, namely better exception handling and * changed font sorting to ignore foundry names. */ string version="$Id: listfonts.pike,v 1.2 1997/01/02 11:02:17 kinkie Exp $"; inherit "roxenlib"; string default_text="ABCGT abcgt 1390 !$%"; string|mapping parse (object id) { array fonts, fontnames; mixed tmp,err; int num=0,j; string text=default_text; if (id->variables->text) text=id->variables->text; string retval= sprintf ( "Fonts availible" "" "
" "
Text to use: " "" " Split? " "

" "" "
plain text%s\n", id->not_query, text, ((id->variables->split && sizeof(id->variables->split))?" selected":""), text ); int num; err = catch { fonts=id->conf->modules->graphic_text->enabled->list_fonts(); }; if (!fonts||err) return "Sorry

Sorry

I couldn't retrieve" "the fonts installed on your system.

Possible causes are:

    " "
  • You don't have the graphic text module enabled" "
  • Your fonts directory is set wrongly
  • You have assigned a name" "to your graphic_text_module
  • the module is disabled
"; fontnames=allocate(sizeof(fonts)); for (j=0;jvariables->split) id->variables->split=""; foreach (fonts,tmp) { num++; retval += "
"+tmp; retval += "variables->split+" fg=\"#000000\" bg=\"#cccccc\" font=\""+tmp+"\">"+ text+"\n"; } return retval+ "
default" "ABCGT abcgt 1390 !$%" "

Total: "+num+" fonts.

"; return retval; }