Roxen.git / server / font_handlers / imagedir.pike

version» Context lines:

Roxen.git/server/font_handlers/imagedir.pike:1:   #include <config.h>   #include <stat.h> - constant cvs_version = "$Id: imagedir.pike,v 1.5 2000/09/16 20:43:31 nilsson Exp $"; + constant cvs_version = "$Id: imagedir.pike,v 1.6 2000/09/16 21:07:38 per Exp $";      constant name = "Image directory fonts";   constant doc = ("Handles a directory with images (in almost any format), each "    "named after the character they will represent. Characters "    "with codes larger than 127 or less than 48 are encoded like "    "0xHEX where HEX is the code in hexadecimal. There must be a "    "file named 'fontname' in the directory, the first line of "    "that file is used as the name of the font");      inherit FontHandler;
Roxen.git/server/font_handlers/imagedir.pike:44:       static mapping(string:Image.Image) load_char( string c )    {    if( c[0] == 0x120 ) return smallspacechar;    if(!files)    files = get_dir( path ) - ({ "fontname" });       array possible = ({ encode_char(c) })+    glob(encode_char( c )+".*", files);    sort( map(possible,strlen), possible ); +  catch {    foreach( possible, string pf )    if( mapping r = Image._load( path+pf ) )    return r; -  +  };    if( c == " " ) return spacechar;    return nullchar;    }    mapping(string:mapping(string:Image.Image)) char_cache = ([]);    static mapping(string:Image.Image) write_char( string c )    {    if( char_cache[ c ] ) return char_cache[ c ];    return char_cache[ c ] = load_char( c );    }