Roxen.git / server / modules / graphics / graphic_text.pike

version» Context lines:

Roxen.git/server/modules/graphics/graphic_text.pike:1: - constant cvs_version="$Id: graphic_text.pike,v 1.94 1997/12/19 17:41:37 grubba Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.95 1997/12/23 11:13:25 per Exp $";   constant thread_safe=1;      #include <module.h>   inherit "module";   inherit "roxenlib";      #if efun(_static_modules)   # define map_array Array.map   import Image;   # define Image image
Roxen.git/server/modules/graphics/graphic_text.pike:622: Inside #if defined(QUANT_DEBUG) and #if efun(color_name)
   for(int i=0; i<sizeof(from); i++)    perror("%d: %s\n", i, color_name(from[i]));   #endif   }   #endif      int number=0;      mapping find_cached_args(int num);    - constant nbsp = sprintf("%c",160); + constant nbsp = iso88591["&nbsp;"];    -  + constant replace_from = indices( iso88591 )+ ({"&ss;","&lt;","&gt;","&amp",}); + constant replace_to = values( iso88591 ) + ({ nbsp, "<", ">", "&", }); +  + #define simplify_text( from ) replace(from,replace_from,replace_to) +    array(int)|string write_text(int _args, string text, int size,    object id)   {    string key = base_key+_args;    array err;    err = catch    {    object img;    mapping args = find_cached_args(_args);    if(!args)    {    args=(["fg":"black","bg":"white"]);    text="Please reload this page";    }       if(!args->verbatim)    { -  text = replace(text, nbsp, "&nbsp;"); -  text = replace(text,({ "&nbsp;","&ss;","&lt;","&gt;","&amp;"}), -  ({" ",nbsp,"<", ">", "&" })); +  text = replace(text, nbsp, " "); +  text = simplify_text( text );    string res="",nspace="",cspace="";    foreach(text/"\n", string line)    {    cspace="";nspace="";    foreach(line/" ", string word)    {    string nonum;    if(strlen(word) &&    (nonum = replace(word,    ({"1","2","3","4","5","6","7","8","9","0","."}),