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.70 1997/09/11 21:15:17 js Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.71 1997/09/12 06:14:32 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:18:    "Graphics text",    "Defines a few new containers, which all render text to gifs "    "using the image module in pike.\n<p>"    "<b>&lt;gh1&gt;</b> to <b>&lt;gh6&gt;:</b> Headers<br>\n"    "<b>&lt;gh&gt;:</b> Header<br>\n"    "<b>&lt;gtext&gt;:</b> Graphical text<br>\n"    "<b>&lt;anfang&gt;:</b> Make the first character a "    "graphical one. Not all that useful, really.<br>\n"    "<br>\n"    "<b>Common arguments:</b>\n <pre>" +  " verbatim Do not try to be typographically correct\n"    " bg=color Use this background, default taken from the\n"    " &lt;body&gt; tag, if any\n"    " fg=color Use this foreground, default taken from the\n"    " &lt;body&gt; tag, if any\n"    " nfont=fnt Use this font. The fonts can be found in the\n"    " directory specified in the configuration\n"    " interface.\n"    " If no font is specified, the one from the\n"    " define 'nfont' is used, or if there is no\n"    " define, the default font will be used.\n"
Roxen.git/server/modules/graphics/graphic_text.pike:794:    res += sprintf("%%%02x", in[i]);    }    if(strlen(res) < strlen(option)) return url_cache[in]=res;    return url_cache[in]=option;   }      int args_restored = 0;   void restore_cached_args()   {    args_restored = 1; +  object privs = Privs("Reading gtext argument list");    object o = open(".gtext_args_"+hash(mc->name), "r");    if(o)    {    string data = o->read();    catch {    object q;    if(sizeof(indices(q=Gz)))    data=q->inflate()->inflate(data);    };    catch {
Roxen.git/server/modules/graphics/graphic_text.pike:817:    if (cached_args && sizeof(cached_args)) {    number = sort(indices(cached_args))[-1]+1;    } else {    cached_args = ([]);    number = 0;    }   }      void save_cached_args()   { +  int on; +  on = number;    restore_cached_args(); -  +  object privs = Privs("Saving gtext argument list"); +  if(on > number) number=on;    object o = open(".gtext_args_"+hash(mc->name), "wct");    string data=encode_value(cached_args);    catch {    object q;    if(sizeof(indices(q=Gz)))    data=q->deflate()->deflate(data);    };    o->write(data);   }   
Roxen.git/server/modules/graphics/graphic_text.pike:1092:    res += ({ "<img _parsed=1 border=0 alt=\""+replace(word,"\"","'")    +"\" src=\""+pre+quote(word)+"\" width="+    size[0]+" height="+size[1]+" "+ea+">\n"    });    }    if(lp) res+=({ "</a>"+post });    return res*"";    }       array size = write_text(num,gt,1,id); +  if(!size) { +  return ("<font size=+1><b>Missing font or other similar error -- " +  "failed to render text</b></font>"); +  }    if(magic)    {    string res = "";    if(!arg->fg) arg->fg=defines->link||"#0000ff";    arg = mkmapping(indices(arg), values(arg));    if(arg->fuzz)    {    if(arg->fuzz != "fuzz")    arg->glow = arg->fuzz;    else
Roxen.git/server/modules/graphics/graphic_text.pike:1189:      string tag_fix_color(string tagname, mapping args, object id, object file,    mapping defines)   {    int changed;       if(!id->misc->colors)    id->misc->colors = ({ ({ defines->fg, defines->bg, tagname }) });    else    id->misc->colors += ({ ({ defines->fg, defines->bg, tagname }) }); - // perror("Push color "+tagname+"\n"); + #undef FIX   #define FIX(X,Y) if(args->X){defines->Y=args->X;if(args->X[0]!='#'){args->X=ns_color(parse_color(args->X));changed = 1;}}       FIX(bgcolor,bg);    FIX(text,fg);    FIX(color,fg); -  if(changed)return ("<"+tagname+" "+make_args(args)+">"); +  if(changed) return ("<"+tagname+" "+make_args(args)+">");    return 0;   }      string pop_color(string tagname,mapping args,object id,object file,    mapping defines)   {    array c = id->misc->colors;    sscanf(tagname, "/%s", tagname);    while(c && sizeof(c))    {    if(c[-1][2]==tagname)    {    defines->fg = c[-1][0];    defines->bg = c[-1][1]; - // perror("Pop color "+tagname+" ("+ - // (sizeof(id->misc->colors)-sizeof(c)+1)+")\n"); +     break;    }    c = c[..sizeof(c)-2];    }    id->misc->colors = c;   }      mapping query_tag_callers()   {    return ([ "gtext-id":tag_gtext_id, ]) | (query("speedy")?([]):
Roxen.git/server/modules/graphics/graphic_text.pike:1235:    "tr":tag_fix_color,    "td":tag_fix_color,    "layer":tag_fix_color,    "ilayer":tag_fix_color,    "/td":pop_color,    "/tr":pop_color,    "/font":pop_color,    "/body":pop_color,    "/table":pop_color,    "/layer":pop_color, -  "/ilayer":pop_color, ])); +  "/ilayer":pop_color, +  ]));   }         mapping query_container_callers()   {    return ([ "anfang":tag_graphicstext,    "gh":tag_graphicstext,    "gh1":tag_graphicstext, "gh2":tag_graphicstext,    "gh3":tag_graphicstext, "gh4":tag_graphicstext,    "gh5":tag_graphicstext, "gh6":tag_graphicstext,    "gtext":tag_graphicstext, ]);   } -  -  -  -  +