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.7 2000/12/31 23:54:53 nilsson Exp $"; + constant cvs_version = "$Id: imagedir.pike,v 1.8 2001/01/02 18:30:00 nilsson 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:129:    }    return rr;    }       array text_extents( string what )    {    Image.Image o = write( what );    return ({ o->xsize(), o->ysize() });    }    -  void create( string _path, int _size ) +  void set_x_spacing( int|float value ) { +  if(value!=1.0) ::set_x_spacing(value); +  } +  +  void set_y_spacing( int|float value ) { +  if(value!=1.0) ::set_y_spacing(value); +  } +  +  void create( string _path, int _size, int xpad, int ypad )    {    path = _path;    size = _size; -  +  x_spacing = xpad; +  y_spacing = ypad;    }   }      mapping font_list;   mapping meta_data;   static string font_name( string what )   {    if(!meta_data) meta_data=([]);    mapping _meta_data=([]);    Parser.HTML()->    add_containers( ([ "name":lambda(string t, mapping m, string c) {    what=c; return ""; },    "meta":lambda(string t, mapping m, string c) {    _meta_data[m->name]=c; }, -  +  "xpad":lambda(string t, mapping m, string c) { +  _meta_data->xpad = (int)c; }, +  "ypad":lambda(string t, mapping m, string c) { +  _meta_data->ypad = (int)c; },    ]) )->finish(what);       what=(lower_case( replace(what," ","_") )/"\n")[0]-"\r";    if(sizeof(_meta_data)) meta_data[what]=_meta_data;    return what;   }      void update_font_list()   {    font_list = ([]);
Roxen.git/server/font_handlers/imagedir.pike:208:    return ({ "nn" });   }      Font open( string name, int size, int bold, int italic )   {   #ifdef THREADS    object key = lock->lock();   #endif    if( !font_list ) update_font_list();    if( font_list[ name ] ) -  return myFont( font_list[name], size ); +  return myFont( font_list[name], size, +  meta_data[name]->xpad, meta_data[name]->ypad );   }         void create()   {    roxen.getvar( "font_dirs" )    ->add_changed_callback( lambda(Variable.Variable v){    font_list = 0;    } );   }