Branch: Tag:

2001-07-10

2001-07-10 18:46:18 by Martin Nilsson <mani@lysator.liu.se>

Fixed [bug 1863 (#1863)]. Also added some privacy.

Rev: server/modules/graphics/graphic_text.pike:1.268

1:   // This is a roxen module. Copyright © 1996 - 2000, Roxen IS.   //    - constant cvs_version="$Id: graphic_text.pike,v 1.267 2001/07/08 17:03:39 nilsson Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.268 2001/07/10 18:46:18 nilsson Exp $";      #include <module.h>   inherit "module";
565:      // -------------------- Image cache functions --------------------    - roxen.ImageCache image_cache; - string compat_level; + private roxen.ImageCache image_cache; + private string compat_level; + private int magic_counter;      string status() {    array s=image_cache->status();
591:    compat_level = conf->query("compat_level");   }    - constant nbsp = Roxen.iso88591["&nbsp;"]; - constant replace_from = indices( Roxen.iso88591 )+ ({"&ss;","&lt;","&gt;","&amp;",}); - constant replace_to = values( Roxen.iso88591 ) + ({ nbsp, "<", ">", "&", }); + private constant nbsp = Roxen.iso88591["&nbsp;"]; + private constant replace_from = indices( Roxen.iso88591 )+ ({"&ss;","&lt;","&gt;","&amp;",}); + private constant replace_to = values( Roxen.iso88591 ) + ({ nbsp, "<", ">", "&", });      #define simplify_text( from ) replace(from,replace_from,replace_to)    - mixed draw_callback(mapping args, string text, RequestID id) + private Image.Image|mapping draw_callback(mapping args, string text, RequestID id)   {    array data;    Image.Font font;
774:      // -------------- helpfunctions to gtext tags and containers -----------------    - constant filearg=({"background","texture","alpha","magic-texture","magic-background","magic-alpha"}); - constant textarg=({"afont", + private constant filearg = ({ +  "background", +  "texture",    "alpha", -  +  "magic-texture", +  "magic-background", +  "magic-alpha" + }); +  + private constant textarg = ({ +  "afont", +  "alpha",    "bevel",    "bgcolor",    "bgturbulence",
822:    "yspacing",    "border",    -  /* generic argcache arguments */ +  // generic argcache arguments    "crop",    "format",    "quant",
830:    "fs",    "*-*",    "gamma", -  +    });    - constant theme=({"fgcolor","bgcolor","font"}); + private constant theme = ({ "fgcolor", "bgcolor", "font" });    - constant hreffilter=(["split":1,"magic":1,"noxml":1,"alt":1]); + private constant hreffilter = ([ "split":1, "magic":1, "noxml":1, "alt":1 ]);    - mapping mk_gtext_arg(mapping arg, RequestID id) + private mapping mk_gtext_arg(mapping arg, RequestID id)   {    mapping p=([]); //Picture rendering arguments.   
921:    return p;   }    - string fix_text(string c, mapping m, RequestID id) { + private string fix_text(string c, mapping m, RequestID id) {       if(m->nowhitespace)    {
998:    }   }    - string do_gtext(mapping arg, string c, RequestID id) + private string do_gtext(mapping arg, string c, RequestID id)   {    if((c-" ")=="") return "";   
1095:       if(!id->supports->images) return sprintf(lp,arg->alt);    -  string sn="gtext"+id->misc->gtext_mi++; +  string sn = "gtext" + (magic_counter++ % 65535);    if(!id->supports->js_image_object) {    return (!input)?    ("<a"+ea+"href=\""+url+"\">"+Roxen.make_tag("img",arg+(["name":sn]),xml)+"</a>"):
1135:    return sprintf(lp,Roxen.make_tag("img",arg,xml));   }    - array(string) simpletag_gh(string t, mapping m, string c, RequestID id) { + private array(string) simpletag_gh(string t, mapping m, string c, RequestID id) {    int i;    if(sscanf(t, "%s%d", t, i)==2 && i>1)    m->scale = (string)(1.0 / ((float)i*0.6));