f66860 | 2000-03-02 | Martin Nilsson | |
|
e95416 | 2000-01-02 | Martin Nilsson | |
|
829e72 | 2001-03-13 | Kenneth Johansson | | constant cvs_version="$Id: graphic_text.pike,v 1.261 2001/03/13 10:19:15 kuntri Exp $";
|
ebf60d | 1997-03-08 | Henrik Grubbström (Grubba) | |
|
d47cbf | 1996-12-02 | Per Hedbor | | #include <module.h>
inherit "module";
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
|
654fca | 1999-10-04 | Martin Bähr | |
|
b3281f | 2000-09-10 | Martin Nilsson | | constant module_type = MODULE_TAG;
|
bc0fa0 | 2001-03-08 | Per Hedbor | | constant module_name = "Graphics: Graphic text";
|
76fd09 | 2000-04-06 | Mattias Wingstedt | | constant module_doc =
|
7afcdd | 2000-05-03 | Martin Nilsson | | #"Provides the <tt><gtext></gtext></tt> tag that is used
to generate text into graphical images.";
|
7e471e | 2000-01-05 | Martin Nilsson | | constant thread_safe = 1;
|
0a76aa | 1998-03-27 | David Hedbor | |
|
d47cbf | 1996-12-02 | Per Hedbor | | void create()
{
|
25b332 | 2000-09-19 | Martin Nilsson | | defvar("colorparse", 0, "Parse tags for document colors",
|
82f9da | 2000-09-16 | Per Hedbor | | TYPE_FLAG|VAR_NOT_CFIF,
|
76fd09 | 2000-04-06 | Mattias Wingstedt | | "If set, it will use the <i>HTML color wiretrap</i> module to parse "
|
81129f | 2000-09-11 | Martin Nilsson | | "figure out the document colors by parsing tags that set colors. "
"If you try to disable the <i>HTML color wiretap</i> module while "
"this option is on, it will be readded every time the "
"<i>Graphis text</i> module is reloaded.");
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
|
82f9da | 2000-09-16 | Per Hedbor | | defvar("deflen", 300, "Default maximum length of text",
TYPE_INT|VAR_MORE|VAR_NOT_CFIF,
|
76fd09 | 2000-04-06 | Mattias Wingstedt | | "Per default, it will not be possible to render texts longer than "
"this. This is a safeguard so that a simple RXML error doesn't "
"cause a huge image to be generated. It can be turned of at a per "
"tag bases, with the <i>maxlen</i> attribute.");
|
bfc707 | 1997-01-13 | Per Hedbor | |
|
76fd09 | 2000-04-06 | Mattias Wingstedt | | defvar("ext", 0, "Append format to generated images",
|
82f9da | 2000-09-16 | Per Hedbor | | TYPE_FLAG|VAR_MORE|VAR_NOT_CFIF,
|
17cb46 | 2000-09-28 | Martin Nilsson | | "Append the image format (.gif, .png, .jpg, etc) to the generated "
|
76fd09 | 2000-04-06 | Mattias Wingstedt | | "images. This is not necessary, but might seem nicer.");
|
d47cbf | 1996-12-02 | Per Hedbor | | }
|
f02c0c | 1999-12-11 | Martin Nilsson | | TAGDOCUMENTATION;
|
2e0a35 | 1999-12-09 | Martin Nilsson | | #ifdef manual
|
e59a5a | 2000-03-01 | Kenneth Johansson | | constant gtextargs=#"
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='alpha' value='path'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Use the specified image as an alpha channel, together with the
|
9b0365 | 2001-03-07 | Kenneth Johansson | | background attribute.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='background' value='path'><p>
Specifies the image to use as background.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='tile'><p>
Tiles the background and foreground images if they are smaller than
the actual image.</p>
</attr>
<attr name='mirrortile'><p>
Tiles the background and foreground images around x-axis and y-axis
for odd frames, creating seamless textures.</p>
</attr>
<attr name='bevel' value='width'><p>
Draws a bevel-box around the text.</p>
|
91aa99 | 2000-03-16 | Martin Nilsson | | <ex type=vert>
<gtext bevel=\"2\">Ok</gtext>
</ex>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='bgcolor' value='color'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Sets the background color. Normally taken from the normal HTML tags
|
9b0365 | 2001-03-07 | Kenneth Johansson | | in your document (Currently: body, table, tr or td).</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
<p>If you set the background color, it is probably best to add the
notrans attribute as well.</p>
|
7519ad | 2000-03-16 | Martin Nilsson | | <ex type=vert>
<gtext notrans=\"\" bgcolor=\"pink\">Pink</gtext>
<gtext notrans=\"\" bgcolor=\"#ff0000\">Red</gtext>
<gtext notrans=\"\" bgcolor=\"%50,0,100,0\">%50,0,100,0</gtext>
</ex>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='bgturbulence' value='frequency,color;frequency,color...'><p>
Apply a turbulence effect on the background.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='bold'><p>
|
449805 | 2000-09-13 | Martin Nilsson | | Use a bold version of the font, if available. Can not be used
|
9b0365 | 2001-03-07 | Kenneth Johansson | | together with the black or light attributes.</p>
|
449805 | 2000-09-13 | Martin Nilsson | | <ex type=hor>
<gtext font='lucida'>Aa3</gtext><br />
<gtext font='lucida' bold=''>Aa3</gtext><br />
|
a80441 | 2000-09-22 | Martin Nilsson | | <gtext font='lucida' italic=''>Aa3</gtext><br />
|
449805 | 2000-09-13 | Martin Nilsson | | <gtext font='lucida' bold='' italic=''>Aa3</gtext><br />
</ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='black'><p>
|
449805 | 2000-09-13 | Martin Nilsson | | Use a black, or heavy, version of the font, if available. Can
|
9b0365 | 2001-03-07 | Kenneth Johansson | | not be used together with the bold or light attributes.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='light'><p>
|
449805 | 2000-09-13 | Martin Nilsson | | Use a light version of the font, if available. Can not be used
|
9b0365 | 2001-03-07 | Kenneth Johansson | | together with the bold or black attributes.</p>
|
449805 | 2000-09-13 | Martin Nilsson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='italic'><p>
Use an italic version of the font, if available.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='bshadow' value='distance'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Draw a blured black drop-shadow behind the text. Using 0 as distance
does not currently place the shadow directly below the text. Using
negative values for distance is possible, but you might have to add
|
9b0365 | 2001-03-07 | Kenneth Johansson | | 'spacing'.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | <ex type=vert>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <gtext scale=\"0.8\" fgcolor=\"#FF6600\" bshadow=\"1\"><gtext
bshadow=1></gtext><br />
<gtext scale=\"0.8\" fgcolor=\"#FF6600\" bshadow=\"2\"><gtext
bshadow=2></gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='chisel'><p>
Make the text look like it has been cut into the background.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | <ex type=vert>
|
3ce82d | 2000-09-13 | Martin Nilsson | | <gtext font=\"lucida\" bold=\"\" chisel=\"\" talign=\"center\" tile=\"\"
|
9b0365 | 2001-03-07 | Kenneth Johansson | | opaque=\"70\" fgcolor=\"gold\" bevel=\"2\"
background=\"/internal-roxen-squares\"> Chisel opaque=\"70\"</gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='crop'><p>
Remove all white-space around the image.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='encoding' value='string'><p>
Choose with which charset the text is encoded with.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='fadein' value='blur,steps,delay,initialdelay'><p>
Generates an animated GIF file of a fade-in effect.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='fgcolor' value='color'><p>
Sets the text color.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | <ex type=vert>
|
7519ad | 2000-03-16 | Martin Nilsson | | <gtext fgcolor=\"#0080FF\">#0080FF</gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='font' value='string'><p>
|
449805 | 2000-09-13 | Martin Nilsson | | Selects which font to use. You can get a list of all available fonts
by using the list fonts task in the administration interface, or by
|
9b0365 | 2001-03-07 | Kenneth Johansson | | using the <xref href='../output/emit_fonts.tag' /> plugin.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='fontsize' value='number'><p>
Selects which size of the font that should be used.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='format' value='string'><p>
Set the image format, e.g. \"png\".</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='fs'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Apply floyd-steinberg dithering to the resulting image. Most of the
time it is much better to increase the number of colors, instead of
dithering the image, but sometimes when using very complex background
|
9b0365 | 2001-03-07 | Kenneth Johansson | | images dithering is O.K.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='ghost' value='dist,blur,color'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Apply a ghost effect. Cannot be used together with shadow or magic
|
9b0365 | 2001-03-07 | Kenneth Johansson | | coloring.</p>
<ex type='vert'>
|
91aa99 | 2000-03-16 | Martin Nilsson | | <gtext spacing=\"2\" crop=\"\" ghost=\"1,1,red\">ghost=1,1,red</gtext>
<gtext spacing=\"2\" crop=\"\" ghost=\"1,3,blue\">ghost=1,3,blue</gtext>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <gtext spacing=\"2\" crop=\"\" bshadow=\"1\" opaque=\"90\" ghost=\"-1,1,yellow\">
ghost=-1,1,yellow opaque=90 bshadow=1</gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='glow' value='color'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Apply a 'glow' filter to the image. Quite a CPU eater. Looks much
better on a dark background, where a real 'glow' effect can be
|
9b0365 | 2001-03-07 | Kenneth Johansson | | achieved.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | <ex type=vert>
|
91aa99 | 2000-03-16 | Martin Nilsson | | <gtext glow=\"red\"><gtext glow=red></gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='maxlen' value='number'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Sets the maximum length of the text that will be rendered into an
|
9b0365 | 2001-03-07 | Kenneth Johansson | | image, by default 300.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='move' value='x,y'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Moves the text relative to the upper left corner of the background
|
9b0365 | 2001-03-07 | Kenneth Johansson | | image. This will not change the size of the image.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='narrow'><p>
Use a narroe version of the font, if available.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='notrans'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Do not make the background transparent. Useful when making 'boxes' of
|
9b0365 | 2001-03-07 | Kenneth Johansson | | color around the text.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | <ex type=vert>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <gtext bgcolor=\"red\"><gtext bgcolor=red></gtext><br />
<gtext bgcolor=\"red\" notrans=\"\"><gtext
bgcolor=red notrans></gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='nowhitespace'><p>
Removes all whitespaces before and after the real text.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='opaque' value='percentage'><p>
Sets the 'opaque' value of the color used to draw the text. Default
is 100%. In the example below, notice how the text color mixes with
the two background colors.</p>
|
91aa99 | 2000-03-16 | Martin Nilsson | | <ex type=vert>
<gtext scale=\"0.6\" textbox=\"100,pink,-11\" bgcolor=\"lightblue\"
|
9b0365 | 2001-03-07 | Kenneth Johansson | | notrans=\"\" opaque=\"40\" fgcolor=\"black\"
><Demonstration of opaque text></gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='outline' value='color,extra-radius'><p>
Draw an outline around the text. Quite useful when combined with
textscale.</p>
|
91aa99 | 2000-03-16 | Martin Nilsson | | <ex type=vert>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <gtext xspacing=\"4\" quant=\"128\" textscale=\"red,red,yellow,yellow\"
outline=\"black,1\"
>black, 2 pixels</gtext>
|
91aa99 | 2000-03-16 | Martin Nilsson | | </ex>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='pressed'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Inverts the direction of the bevel box, to make it look like a button
|
9b0365 | 2001-03-07 | Kenneth Johansson | | that is pressed down. The magic modifier will do this automatically.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='quant' value='number'><p>
Quantifies the image with this number of colors. Using a lower number
will decrease the image (file)size, but make the text look more
'edgy', and if you use complex backgrounds or image textures, more
colors will be neded. At most 255 colors can be used, and less than 2
is quite useless. It is advisable to use powers of 2 to optimize the
palette allocation.</p>
|
91aa99 | 2000-03-16 | Martin Nilsson | | <ex type=vert>
<gtext quant=\"2\">A</gtext>
<gtext quant=\"6\">A</gtext>
<gtext quant=\"20\">A</gtext>
<gtext quant=\"200\">A</gtext>
</ex>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='rescale'><p>
Rescale the background to fill the whole image.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='rotate' value='angle'><p>
Rotates the image this number of degrees counter-clockwise.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='scale' value='number'><p>
Sets the scale of the image. Larger than 1.0 is enlargement.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | <ex type=vert>
|
7519ad | 2000-03-16 | Martin Nilsson | | <gtext scale=\"1.0\"><gtext scale=1.0></gtext>
<gtext scale=\"0.5\"><gtext scale=0.5></gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='scolor' value='color'><p>
Use this color for the shadow. Used with the shadow attribute.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='scroll' value='width,steps,delay'><p>
Generate an animated GIF image of the text scrolling.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='shadow' value='intensity,distance'><p>
|
91aa99 | 2000-03-16 | Martin Nilsson | | Draw a blured black drop-shadow behind the text. Using 0 as distance
does not currently place the shadow directly below the text. Using negative
|
9b0365 | 2001-03-07 | Kenneth Johansson | | values for distance is possible,</p>
|
91aa99 | 2000-03-16 | Martin Nilsson | | <ex type=vert>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <gtext scale=\"0.8\" fgcolor=\"blue\" shadow=\"40,0\"><gtext
shadow=40,0></gtext><br />
<gtext scale=\"0.8\" fgcolor=\"blue\" shadow=\"40,2\"><gtext
shadow=40,2></gtext><br />
|
91aa99 | 2000-03-16 | Martin Nilsson | | </ex>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='size' value='width,height'><p>
Set the size of the image.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='spacing' value='number'><p>
Add space around the text.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='talign' value='left|right|center'><p>
Adjust the alignment of the text.</p>
|
4d4ef0 | 2000-09-19 | Kenneth Johansson | | </attr>
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='textbelow' value='color'><p>
|
f2f19d | 2000-03-16 | Martin Stjernholm | | Place the text centered in a box of the given color below the image
|
9b0365 | 2001-03-07 | Kenneth Johansson | | area. Useful together with background to make captions for images.</p>
|
91aa99 | 2000-03-16 | Martin Nilsson | | <ex type=vert>
|
ad409a | 2000-09-16 | Martin Nilsson | | <img src=\"/internal-roxen-roxen\" />
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <gtext scale=\"0.5\" background=\"/internal-roxen-roxen\"
textbelow=\"#c0c0c0\">Roxen</gtext>
|
91aa99 | 2000-03-16 | Martin Nilsson | | </ex>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='textbox' value='opaque,color'><p>
Draw a box with an opaque value below the text of the specified color.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='textscale' value='color,color,color,color'><p>
|
91aa99 | 2000-03-16 | Martin Nilsson | | Apply a color filter to the text. The colors are,
respectively, upper left, lower left, upper right and lower right.
It is probably a good idea to increase the 'quant' value when
|
9b0365 | 2001-03-07 | Kenneth Johansson | | using this argument.</p>
|
91aa99 | 2000-03-16 | Martin Nilsson | | <ex type=vert>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <gtext quant=\"128\" textscale=\"blue,red,black,darkgreen\"
>Blue, red, black, darkgreen</gtext>
|
91aa99 | 2000-03-16 | Martin Nilsson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='texture' value='path'><p>
Uses the specified images as a field texture.</p>
|
ad409a | 2000-09-16 | Martin Nilsson | | <ex type=hor>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <gtext font=\"yikes\" fontsize=\"100\"
texture=\"/internal-roxen-squares\">A</gtext>
|
ad409a | 2000-09-16 | Martin Nilsson | | </ex>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
<attr name=tile>
Tiles the background and foreground images if they are smaller than
the actual image.
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='xpad' value='percentage|integer'><p>
Sets the padding between characters. The value can either be an
relative change, in percent, or an absolute value. Note that
different fonts reacts differently on these values and for some it
will not have any effect at all. This depends on the type of the font
and the font implementation.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <ex type='vert'>
|
ed540b | 2001-01-13 | Martin Nilsson | | <gtext font=\"niquel\"><gtext xpad=-30%></gtext><br />
<gtext xpad=\"4\" font=\"niquel\"><gtext xpad=-10%></gtext><br />
<gtext xpad=\"50%\" font=\"niquel\"><gtext></gtext><br />
|
778545 | 2001-01-02 | Martin Nilsson | | </ex>
</attr>
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='xsize' value='number'><p>
Sets the width.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='xspacing' value='number'><p>
Sets the horizontal spacing.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='ypad' value='percentage'><p>
Sets the padding beteen lines.</p>
|
4d4ef0 | 2000-09-19 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | |
<attr name='ysize' value='number'><p>
Sets the height.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='yspacing' value='number'><p>
Sets the vertical spacing.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>";
|
0d8650 | 2000-09-18 | Kenneth Johansson | |
|
e59a5a | 2000-03-01 | Kenneth Johansson | | constant tagdoc=([
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "anfang":#"<desc cont='cont'><p><short>
Creates an anfang in the beginning of a text.</short> This tag takes
the same attributes as <xref href='gtext.tag' />.</p>
<ex type=vert>
<anfang crop=\"\">This is a beginning<br />
of a very short text,<br />
and here it ends.
</anfang>
</ex>
</desc>
|
03cbf7 | 2000-03-25 | Martin Nilsson | | <noex>"+gtextargs+"</noex>",
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gh":#"<desc cont='cont'><p><short>
Creates a graphical header.</short> <tag>gh</tag> takes the same
attributes as <xref href='gtext.tag' />. <tag>gh</tag> comes in six
flavors, from <tag>gh1</tag> through <tag>gh6</tag> and are the RXML
counterpart to the HTML tags <tag>h1</tag> through <tag>h6</tag>.</p>
|
dbdf72 | 2000-09-18 | Kenneth Johansson | | </desc>
|
03cbf7 | 2000-03-25 | Martin Nilsson | | <noex>"+gtextargs+"</noex>",
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gh1":#"<desc cont='cont'></desc>
|
03cbf7 | 2000-03-25 | Martin Nilsson | | <noex>"+gtextargs+"</noex>",
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gh2":#"<desc cont='cont'></desc>
|
03cbf7 | 2000-03-25 | Martin Nilsson | | <noex>"+gtextargs+"</noex>",
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gh3":#"<desc cont='cont'></desc>
|
03cbf7 | 2000-03-25 | Martin Nilsson | | <noex>"+gtextargs+"</noex>",
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gh4":#"<desc cont='cont'></desc>
|
03cbf7 | 2000-03-25 | Martin Nilsson | | <noex>"+gtextargs+"</noex>",
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gh5":#"<desc cont='cont'></desc>
|
03cbf7 | 2000-03-25 | Martin Nilsson | | <noex>"+gtextargs+"</noex>",
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gh6":#"<desc cont='cont'></desc>
|
03cbf7 | 2000-03-25 | Martin Nilsson | | <noex>"+gtextargs+"</noex>",
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gtext":#"<desc cont='cont'><p><short>
Creates an image with the tag content texts.</short> It is possible to pass
attributes, such as the target attribute, to the resulting tags by including
them in the gtext tag.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </desc>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='alt' value='string'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Sets the alt attribute of the generated <tag>img</tag> tag. By
default the alt attribute will be set to the contents of the
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <tag>gtext</tag> tag.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | <ex type=vert>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <gtext fgcolor=\"blue\" alt=\"Hello!\">Welcome!</gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='border' value='width,color'><p>
Draws a border around the text of the specified width and color.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | <ex type=vert>
|
7519ad | 2000-03-16 | Martin Nilsson | | <gtext fgcolor=\"blue\" border=\"2,red\">Red border</gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='href' value='URL'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Link the image to the specified URL. The link color of the document
will be used as the default foreground rather than the foreground
|
9b0365 | 2001-03-07 | Kenneth Johansson | | color.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='magic' value='message'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Used together with the href attribute to generate a JavaScript that
will highlight the image when the mouse is moved over it. The message
|
9b0365 | 2001-03-07 | Kenneth Johansson | | is shown in the browser's status bar.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | <ex type=vert>
|
7519ad | 2000-03-16 | Martin Nilsson | | <gtext href=\"http://www.roxen.com\" magic=\"Roxen\">www.roxen.com</gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='magic-attribute' value='value'><p>
Same as for any <tag>gtext</tag> attribute, except for the
highlighted image.</p>
<ex type=vert>
|
a54b4d | 2000-06-03 | Martin Nilsson | | <gtext fgcolor=\"blue\" magic-glow=\"yellow\" magic=\"\">Magic attribute</gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='noxml'><p>
Do not terminate the image tag with \"/\".</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='split'>
<p>Make each word into a separate gif image. Useful if you are
writing a large text, and word wrap at the edges of the display is
desired.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <ex type='vert'>
<gtext scale='0.4' split='split'>
Useful if you are writing a large text, and word wrap at the edges
of the display is desired.
</gtext>
</ex>
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <p>This will allow the browser to word-wrap the text, but will
disable certain attributes like <att>magic</att>. Note that the word
wraping functionality of this example cannot be shown as the size of
the browser window is determined by the largest example box. </p>
<ex type='vert'>
|
7519ad | 2000-03-16 | Martin Nilsson | | <gtext scale=\"0.4\" split=\"\">Make each word..</gtext>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='submit'><p>
Creates a submit-button for forms. Does not work together with
<att>split</att> or <att>magic</att> attributes.</p>
|
7519ad | 2000-03-16 | Martin Nilsson | | </attr>"+gtextargs,
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gtext-id":#"<desc tag='tag'><p><short>
|
829e72 | 2001-03-13 | Kenneth Johansson | | Returns an internal URL to an image
get dig en URL som som get dig en bild med de argument du
specificerat om du också lägger på en sträng med den text du vill ha
efter den URLen. Den här tagen är ett DOS-hål och bör avrådas ifrån om
man inte använder den under okntrollerade former som tex ett intranät.
|
9b0365 | 2001-03-07 | Kenneth Johansson | | </short></p>
</desc>
<attr name='href' value='URL'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Link the image to the specified URL. The link color of the document
will be used as the default foreground rather than the foreground
|
9b0365 | 2001-03-07 | Kenneth Johansson | | color.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='short'><p></p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
7519ad | 2000-03-16 | Martin Nilsson | | </attr>"+gtextargs,
|
e59a5a | 2000-03-01 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "gtext-url":#"<desc cont='cont'><p><short>
|
829e72 | 2001-03-13 | Kenneth Johansson | | Returns an internal URL to an image with the specified attributes
applied.</short> <tag>gtext-url</tag> takes the same attributes as
<xref href='gtext.tag' />.</p>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | </desc>
<attr name='href' value='URL'><p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | Link the image to the specified URL. The link color of the document
will be used as the default foreground rather than the foreground
|
9b0365 | 2001-03-07 | Kenneth Johansson | | color.</p>
|
e59a5a | 2000-03-01 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='short'><p>
</p>
|
03cbf7 | 2000-03-25 | Martin Nilsson | | </attr>
<noex>"+gtextargs+"</noex>",]);
|
2e0a35 | 1999-12-09 | Martin Nilsson | | #endif
|
829e72 | 2001-03-13 | Kenneth Johansson | | <gtext-id/> get dig en URL som som get dig en bild med de argument du
specificerat om du också lägger på en sträng med den text du vill ha
efter den URLen. Den här tagen är ett DOS-hål och bör avrådas ifrån om
man inte använder den under okntrollerade former som tex ett intranät.
Eg borde <gtext-id/> gå att stänga av i admininterfacet. *ticketar mig
själv*
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
|
9374e6 | 1999-05-18 | Per Hedbor | | roxen.ImageCache image_cache;
|
e5bad2 | 1998-02-10 | Per Hedbor | |
|
e95416 | 2000-01-02 | Martin Nilsson | | string status() {
array s=image_cache->status();
|
482ba7 | 2000-12-30 | Per Hedbor | | return sprintf("<b>Images in cache:</b> %d images<br />\n"
"<b>Cache size:</b> %s",
s[0], Roxen.sizetostring(s[1]));
|
e95416 | 2000-01-02 | Martin Nilsson | | }
|
7afcdd | 2000-05-03 | Martin Nilsson | | mapping(string:function) query_action_buttons() {
|
a54b4d | 2000-06-03 | Martin Nilsson | | return ([ "Clear cache":flush_cache ]);
}
void flush_cache() {
image_cache->flush();
|
7afcdd | 2000-05-03 | Martin Nilsson | | }
|
7e471e | 2000-01-05 | Martin Nilsson | | void start(int num, Configuration conf)
|
2468b2 | 1997-07-06 | Henrik Grubbström (Grubba) | | {
|
9374e6 | 1999-05-18 | Per Hedbor | | image_cache = roxen.ImageCache( "gtext", draw_callback );
|
23f8eb | 2000-02-16 | Per Hedbor | | roxen.dump( "etc/modules/GText.pmod" );
|
7e471e | 2000-01-05 | Martin Nilsson | | if(query("colorparse")) module_dependencies(conf, ({ "wiretap" }) );
|
2468b2 | 1997-07-06 | Henrik Grubbström (Grubba) | | }
|
c3655b | 1997-01-27 | Per Hedbor | |
|
a54b4d | 2000-06-03 | Martin Nilsson | | constant nbsp = Roxen.iso88591[" "];
constant replace_from = indices( Roxen.iso88591 )+ ({"&ss;","<",">","&",});
constant replace_to = values( Roxen.iso88591 ) + ({ nbsp, "<", ">", "&", });
|
b1ab8d | 1997-12-23 | Per Hedbor | |
#define simplify_text( from ) replace(from,replace_from,replace_to)
|
06583f | 1997-09-03 | Per Hedbor | |
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | mixed draw_callback(mapping args, string text, RequestID id)
|
20ca2b | 1998-01-26 | Per Hedbor | | {
|
f02c0c | 1999-12-11 | Martin Nilsson | | array data;
Image.Font font;
|
38569c | 1999-12-07 | Martin Nilsson | | Image.Image img;
|
9374e6 | 1999-05-18 | Per Hedbor | |
|
6a9b9d | 1999-06-25 | Per Hedbor | | if( objectp( text ) )
{
if( !args->text )
error("Failed miserably to find a text to draw. That's not"
|
8b6ee5 | 1999-07-10 | Peter Bortas | | " good.\n");
|
6a9b9d | 1999-06-25 | Per Hedbor | | id = (object)text;
text = args->text;
}
|
b53017 | 2000-09-19 | Per Hedbor | | if( !mappingp( args ) || !stringp( text ))
return 0;
|
9374e6 | 1999-05-18 | Per Hedbor | | if(!args->verbatim)
|
ba73a2 | 1996-12-10 | Per Hedbor | | {
|
9374e6 | 1999-05-18 | Per Hedbor | | text = replace(text, nbsp, " ");
text = simplify_text( text );
string res="",nspace="",cspace="";
foreach(text/"\n", string line)
|
a5c21b | 1999-05-18 | Peter Bortas | | {
|
38569c | 1999-12-07 | Martin Nilsson | | cspace="";
nspace="";
|
9374e6 | 1999-05-18 | Per Hedbor | | foreach(line/" ", string word)
|
e8c29c | 1997-09-12 | Johan Schön | | {
|
9374e6 | 1999-05-18 | Per Hedbor | | string nonum;
if(strlen(word) &&
(nonum = replace(word,
({"1","2","3","4","5","6","7","8","9","0","."}),
({"","","","","","","","","","",""}))) == "") {
cspace=nbsp+nbsp;
if((strlen(word)-strlen(nonum)<strlen(word)/2) &&
|
38569c | 1999-12-07 | Martin Nilsson | | (upper_case(word) == word))
|
9374e6 | 1999-05-18 | Per Hedbor | | word=((word/"")*nbsp);
}
|
38569c | 1999-12-07 | Martin Nilsson | | else if(cspace!="")
cspace=" ";
|
9374e6 | 1999-05-18 | Per Hedbor | | res+=(nspace==cspace?nspace:" ")+word;
|
38569c | 1999-12-07 | Martin Nilsson | | if(cspace!="")
nspace=cspace;
else
nspace=" ";
|
1cd5eb | 1998-03-20 | Per Hedbor | | }
|
9374e6 | 1999-05-18 | Per Hedbor | | res+="\n";
|
1cd5eb | 1998-03-20 | Per Hedbor | | }
|
9374e6 | 1999-05-18 | Per Hedbor | | text=replace(res[..strlen(res)-2], ({"!","?",": "}),({ nbsp+"!",nbsp+"?",nbsp+": "}));
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | text=replace(replace(replace(text,({". ",". "+nbsp}),
|
9374e6 | 1999-05-18 | Per Hedbor | | ({"\000","\001"})),".","."+nbsp+nbsp),
({"\000","\001"}),({". ","."+nbsp}));
}
|
e8c29c | 1997-09-12 | Johan Schön | |
|
9374e6 | 1999-05-18 | Per Hedbor | | if( args->afont )
|
449805 | 2000-09-13 | Martin Nilsson | | font = resolve_font(args->afont+" "+(args["fontsize"]||32));
|
9374e6 | 1999-05-18 | Per Hedbor | | else
|
a5c21b | 1999-05-18 | Peter Bortas | | {
|
38569c | 1999-12-07 | Martin Nilsson | | int bold=0, italic=0;
|
5fe8d8 | 2000-01-30 | Per Hedbor | | if(args->nfont) args->font = args->nfont;
|
9374e6 | 1999-05-18 | Per Hedbor | | if(args->bold) bold=1;
if(args->light) bold=-1;
if(args->black) bold=2;
if(args->italic) italic=1;
|
778545 | 2001-01-02 | Martin Nilsson | | int|float xpad=0.0;
|
a8b0b8 | 2001-01-01 | Martin Nilsson | | if(args->xpad)
if(args->xpad[-1]=='%')
xpad = (float)args->xpad;
else
xpad = (int)args->xpad;
|
778545 | 2001-01-02 | Martin Nilsson | | int|float ypad=0.0;
|
a8b0b8 | 2001-01-01 | Martin Nilsson | | if(args->ypad)
if(args->ypad[-1]=='%')
ypad = (float)args->ypad;
else
ypad = (int)args->ypad;
|
5fe8d8 | 2000-01-30 | Per Hedbor | | font = get_font(args->font||"default",
|
a1de51 | 2000-03-20 | Martin Nilsson | | (int)args["fontsize"]||32,
|
5fe8d8 | 2000-01-30 | Per Hedbor | | bold,
italic,
|
9374e6 | 1999-05-18 | Per Hedbor | | lower_case(args->talign||"left"),
|
a8b0b8 | 2001-01-01 | Martin Nilsson | | xpad,
ypad);
|
a5c21b | 1999-05-18 | Peter Bortas | | }
|
5fe8d8 | 2000-01-30 | Per Hedbor | | if(!font)
font = resolve_font(0);
|
974b2a | 1997-10-02 | Peter Bortas | |
|
f02c0c | 1999-12-11 | Martin Nilsson | | if (!font)
|
5fe8d8 | 2000-01-30 | Per Hedbor | | error("gtext: No font (tried "+
(args->afont||args->font||args->nfont)+ ")!\n");
|
1a6758 | 1997-09-26 | Henrik Grubbström (Grubba) | |
|
9374e6 | 1999-05-18 | Per Hedbor | |
|
6cd13a | 2000-03-14 | Martin Stjernholm | | [img, Image.Image alpha] = GText.make_text_image(args, font, text, id);
|
9558e3 | 1998-07-04 | Per Hedbor | |
|
e95416 | 2000-01-02 | Martin Nilsson | |
|
a5c21b | 1999-05-18 | Peter Bortas | |
|
9374e6 | 1999-05-18 | Per Hedbor | | if( !args->scroll && !args->fadein )
{
if(!args->notrans)
|
a5c21b | 1999-05-18 | Peter Bortas | | {
|
9374e6 | 1999-05-18 | Per Hedbor | | return ([ "img":img, "alpha":alpha ]);
|
a5c21b | 1999-05-18 | Peter Bortas | | }
|
9374e6 | 1999-05-18 | Per Hedbor | | return img;
}
|
a5c21b | 1999-05-18 | Peter Bortas | |
|
9374e6 | 1999-05-18 | Per Hedbor | | if(args->fadein)
|
a5c21b | 1999-05-18 | Peter Bortas | | {
|
9374e6 | 1999-05-18 | Per Hedbor | | int amount=2, steps=10, delay=10, initialdelay=0, ox;
string res = img->gif_begin();
sscanf(args->fadein,"%d,%d,%d,%d", amount, steps, delay, initialdelay);
if(initialdelay)
|
a5c21b | 1999-05-18 | Peter Bortas | | {
|
f02c0c | 1999-12-11 | Martin Nilsson | | Image.Image foo=Image.Image(img->xsize(),img->ysize(),@parse_color(args->bgcolor));
|
9374e6 | 1999-05-18 | Per Hedbor | | res += foo->gif_add(0,0,initialdelay);
|
a5c21b | 1999-05-18 | Peter Bortas | | }
|
9374e6 | 1999-05-18 | Per Hedbor | | for(int i = 0; i<(steps-1); i++)
{
|
f02c0c | 1999-12-11 | Martin Nilsson | | Image.Image foo=img->clone();
|
742aab | 1999-12-14 | Martin Nilsson | | foo = foo->apply_matrix(GText.make_matrix(( (int)((steps-i)*amount))));
|
9374e6 | 1999-05-18 | Per Hedbor | | res += foo->gif_add(0,0,delay);
|
a5c21b | 1999-05-18 | Peter Bortas | | }
|
f02c0c | 1999-12-11 | Martin Nilsson | | res += img->gif_add(0,0,delay);
|
9374e6 | 1999-05-18 | Per Hedbor | | res += img->gif_end();
data = ({ res, ({ img->xsize(), img->ysize() }) });
|
a5c21b | 1999-05-18 | Peter Bortas | | }
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | else
|
a5c21b | 1999-05-18 | Peter Bortas | | {
|
9374e6 | 1999-05-18 | Per Hedbor | | int len=100, steps=30, delay=5, ox;
string res = img->gif_begin() + img->gif_netscape_loop();
sscanf(args->scroll, "%d,%d,%d", len, steps, delay);
img=img->copy(0,0,(ox=img->xsize())+len-1,img->ysize()-1);
img->paste(img, ox, 0);
for(int i = 0; i<steps; i++)
{
int xp = i*ox/steps;
res += img->copy(xp, 0, xp+len, img->ysize(),
|
b89ccb | 1999-11-28 | Martin Nilsson | | @parse_color(args->bgcolor))->gif_add(0,0,delay);
|
9374e6 | 1999-05-18 | Per Hedbor | | }
res += img->gif_end();
data = ({ res, ({ len, img->ysize() }) });
|
a5c21b | 1999-05-18 | Peter Bortas | | }
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | return
([
"data":data[0],
|
df8c03 | 1999-05-25 | Per Hedbor | | "meta":
|
9374e6 | 1999-05-18 | Per Hedbor | | ([
"xsize":data[1][0],
"ysize":data[1][1],
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | "type":(args->format?id->conf->type_from_filename("x."+args->format):"image/gif"),
|
9374e6 | 1999-05-18 | Per Hedbor | | ])
]);
|
68e030 | 1997-08-19 | Per Hedbor | | }
|
f02c0c | 1999-12-11 | Martin Nilsson | | mapping find_internal(string f, RequestID id)
|
a5c21b | 1999-05-18 | Peter Bortas | | {
|
b53017 | 2000-09-19 | Per Hedbor | | if( strlen(f)>4 && query("ext") && f[-4]=='.')
f = f[..strlen(f)-5];
if( strlen(f) && f[0]=='$' )
{
array id_text = f/"/";
if( sizeof(id_text)==2 )
{
string second_key = roxen->argcache->store( (["":id_text[1]]) );
return image_cache->http_file_answer( id_text[0][1..] +"$"+ second_key, id );
}
|
8b6ee5 | 1999-07-10 | Peter Bortas | | }
|
b53017 | 2000-09-19 | Per Hedbor | | return image_cache->http_file_answer( f, id );
return 0;
|
a5c21b | 1999-05-18 | Peter Bortas | | }
|
d47cbf | 1996-12-02 | Per Hedbor | |
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
|
b89ccb | 1999-11-28 | Martin Nilsson | | constant filearg=({"background","texture","alpha","magic-texture","magic-background","magic-alpha"});
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | constant textarg=({"afont",
"alpha",
"bevel",
|
b89ccb | 1999-11-28 | Martin Nilsson | | "bgcolor",
|
fc9c28 | 2000-01-12 | Martin Nilsson | | "bgturbulence",
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | "black",
"bold",
"bshadow",
"chisel",
"encoding",
"fadein",
|
b89ccb | 1999-11-28 | Martin Nilsson | | "fgcolor",
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | "font",
|
a1de51 | 2000-03-20 | Martin Nilsson | | "fontsize",
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | "ghost",
"glow",
"italic",
"light",
"mirrortile",
|
c3aacd | 1999-12-06 | Peter Bortas | | "move",
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | "narrow",
"nfont",
"notrans",
"opaque",
"outline",
"pressed",
"rescale",
"rotate",
"scale",
"scolor",
"scroll",
"shadow",
"size",
"spacing",
"talign",
"tile",
"textbox",
"textbelow",
"textscale",
"verbatim",
"xpad",
"xsize",
"xspacing",
"ypad",
"ysize",
|
319dec | 2000-03-18 | Per Hedbor | | "yspacing",
"border",
|
d7e7f8 | 2000-03-18 | Per Hedbor | |
"crop",
"format",
"quant",
"dither",
"fs",
"*-*",
"gamma",
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | });
|
7e471e | 2000-01-05 | Martin Nilsson | | constant theme=({"fgcolor","bgcolor","font"});
|
22cbbd | 2000-02-29 | Martin Nilsson | | constant hreffilter=(["split":1,"magic":1,"noxml":1,"alt":1]);
|
d7e7f8 | 2000-03-18 | Per Hedbor | | mapping mk_gtext_arg(mapping arg, RequestID id)
{
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | mapping p=([]);
|
22cbbd | 2000-02-29 | Martin Nilsson | | m_delete(arg,"src");
m_delete(arg,"width");
m_delete(arg,"height");
|
e94a15 | 2000-09-13 | Jonas Wallden | | #if !constant(Image.GIF) || !constant(Image.GIF.encode)
m_delete(arg, "fadein");
m_delete(arg, "scroll");
#endif
if (!arg->format)
#if constant(Image.GIF) && constant(Image.GIF.encode)
arg->format = "gif";
#else
arg->format = "jpg";
#endif
|
8538c1 | 2000-03-18 | Per Hedbor | | foreach(filearg, string tmp)
|
319dec | 2000-03-18 | Per Hedbor | | if(arg[tmp])
{
|
a54b4d | 2000-06-03 | Martin Nilsson | | p[tmp]=Roxen.fix_relative(arg[tmp],id);
|
319dec | 2000-03-18 | Per Hedbor | | m_delete(arg,tmp);
}
|
d47cbf | 1996-12-02 | Per Hedbor | |
|
319dec | 2000-03-18 | Per Hedbor | |
|
b89ccb | 1999-11-28 | Martin Nilsson | |
|
d7e7f8 | 2000-03-18 | Per Hedbor | | array i = indices( arg );
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | foreach(textarg, string tmp)
|
d7e7f8 | 2000-03-18 | Per Hedbor | | foreach( glob( tmp, i ), string a )
{
|
fd79ff | 2000-03-21 | Martin Nilsson | | if(a[0..5]!="magic-") {
p[a]=arg[a];
|
a3e0ac | 2000-09-29 | Martin Nilsson | | i-=({ m_delete(arg,a) });
|
fd79ff | 2000-03-21 | Martin Nilsson | | }
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | }
|
d47cbf | 1996-12-02 | Per Hedbor | |
|
7e471e | 2000-01-05 | Martin Nilsson | | foreach(theme, string tmp)
if( (id->misc->defines[tmp] || id->misc->defines["theme_"+tmp]) && !p[tmp])
p[tmp]=id->misc->defines["theme_"+tmp] || id->misc->defines[tmp];
|
982115 | 2000-03-16 | Martin Nilsson | | if(!p->fgcolor) p->fgcolor="#000000";
if(!p->bgcolor) p->bgcolor="#ffffff";
|
d7e7f8 | 2000-03-18 | Per Hedbor | | if(id->misc->defines->nfont && !p->nfont) p->nfont=id->misc->gtext_nfont;
if(id->misc->defines->afont && !p->afont) p->afont=id->misc->gtext_afont;
if(id->misc->defines->bold && !p->bold) p->bold=id->misc->gtext_bold;
|
7e471e | 2000-01-05 | Martin Nilsson | | if(id->misc->defines->italic && !p->italic) p->italic=id->misc->gtext_italic;
|
d7e7f8 | 2000-03-18 | Per Hedbor | | if(id->misc->defines->black && !p->black) p->black=id->misc->gtext_black;
|
7e471e | 2000-01-05 | Martin Nilsson | | if(id->misc->defines->narrow && !p->narrow) p->narrow=id->misc->gtext_narrow;
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
return p;
|
d47cbf | 1996-12-02 | Per Hedbor | | }
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | string fix_text(string c, mapping m, RequestID id) {
|
b91fd5 | 1996-12-10 | Per Hedbor | |
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | if(m->nowhitespace)
|
b91fd5 | 1996-12-10 | Per Hedbor | | {
|
04cd2a | 2000-02-19 | Martin Nilsson | | c=String.trim_all_whites(c);
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | m_delete(m, "nowhitespace");
}
|
7519ad | 2000-03-16 | Martin Nilsson | | m_delete(m, "noparse");
m_delete(m, "preparse");
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
|
a54b4d | 2000-06-03 | Martin Nilsson | | c=replace(c, Roxen.replace_entities+({" "," ", "\n\n\n", "\n\n", "\r"}),
Roxen.replace_values+({" ", " ", "\n", "\n", ""}));
|
04cd2a | 2000-02-19 | Martin Nilsson | |
|
a3e0ac | 2000-09-29 | Martin Nilsson | | if(m->maxlen)
|
ed540b | 2001-01-13 | Martin Nilsson | | c = c[..(( (int)m_delete(m,"maxlen") || query("deflen"))-1)];
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
return c;
|
b91fd5 | 1996-12-10 | Per Hedbor | | }
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
|
a50b59 | 2000-09-03 | Martin Nilsson | | class TagGTextURL {
inherit RXML.Tag;
constant name = "gtext-url";
constant flags = RXML.FLAG_DONT_REPORT_ERRORS;
class Frame {
inherit RXML.Frame;
array do_return(RequestID id) {
content=fix_text(content,args,id);
mapping p=mk_gtext_arg(args,id);
if(args->href && !p->fgcolor) p->fgcolor=id->misc->gtext_link||"#0000ff";
string ext="";
if(query("ext")) ext="."+(p->format || "gif");
if(!args->short)
|
db053e | 2000-12-05 | Martin Nilsson | | return ({ query_absolute_internal_location(id) +
image_cache->store( ({p,content}), id )+ext });
|
a50b59 | 2000-09-03 | Martin Nilsson | | return ({ "+"+image_cache->store( ({p,content}), id )+ext });
}
}
|
8b6ee5 | 1999-07-10 | Peter Bortas | | }
|
a50b59 | 2000-09-03 | Martin Nilsson | | class TagGTextID {
inherit RXML.Tag;
constant name = "gtext-id";
constant flags = RXML.FLAG_EMPTY_ELEMENT;
class Frame {
inherit RXML.Frame;
array do_return(RequestID id) {
mapping p=mk_gtext_arg(args,id);
if(args->href && !p->fgcolor) p->fgcolor=id->misc->gtext_link||"#0000ff";
if(!args->short)
|
db053e | 2000-12-05 | Martin Nilsson | | return ({ query_absolute_internal_location(id) +
"$"+image_cache->store(p, id)+"/" });
|
a50b59 | 2000-09-03 | Martin Nilsson | | return ({ "+"+image_cache->store(p, id )+"/foo" });
}
}
|
07969c | 1997-02-25 | Per Hedbor | | }
|
a50b59 | 2000-09-03 | Martin Nilsson | | class TagGText {
inherit RXML.Tag;
constant name = "gtext";
constant flags = RXML.FLAG_DONT_REPORT_ERRORS;
class Frame {
inherit RXML.Frame;
array do_return(RequestID id) {
return ({ do_gtext(args, content, id) });
}
}
}
string do_gtext(mapping arg, string c, RequestID id)
|
62d8c4 | 1997-10-16 | Per Hedbor | | {
|
e95416 | 2000-01-02 | Martin Nilsson | | if((c-" ")=="") return "";
|
033c7e | 1997-02-27 | Per Hedbor | |
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | c=fix_text(c,arg,id);
mapping p=mk_gtext_arg(arg,id);
|
d47cbf | 1996-12-02 | Per Hedbor | |
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | string ext="";
if(query("ext")) ext="."+(p->format || "gif");
|
bfc707 | 1997-01-13 | Per Hedbor | |
|
21171e | 2000-08-25 | Martin Nilsson | | string lp="%s", url="", ea=" ";
|
38dca8 | 1996-12-10 | Per Hedbor | |
|
e95416 | 2000-01-02 | Martin Nilsson | | int input=0;
|
38dca8 | 1996-12-10 | Per Hedbor | | if(arg->submit)
{
input=1;
m_delete(arg,"submit");
}
|
bfc707 | 1997-01-13 | Per Hedbor | |
|
d47cbf | 1996-12-02 | Per Hedbor | | if(arg->href)
{
url = arg->href;
|
a54b4d | 2000-06-03 | Martin Nilsson | | lp = replace(Roxen.make_tag("a",arg-hreffilter),"%","%%")+"%s</a>";
|
e95416 | 2000-01-02 | Martin Nilsson | | if(!p->fgcolor) p->fgcolor=id->misc->gtext_link||"#0000ff";
|
094371 | 1997-02-25 | Per Hedbor | | m_delete(arg, "href");
|
d47cbf | 1996-12-02 | Per Hedbor | | }
|
21171e | 2000-08-25 | Martin Nilsson | | foreach( ({ "class", "onClick", "onclick", "onMouseover", "onmouseover",
|
049346 | 2001-01-03 | Martin Nilsson | | "onMouseout", "onmouseout", "target", "accesskey", "charset",
"hreflang", "suppress", "tabindex" }), string name)
|
21171e | 2000-08-25 | Martin Nilsson | | if(arg[name]) {
ea+=name+"=";
if(!has_value(arg[name], "\"")) ea+="\""+arg[name]+"\" ";
else if(!has_value(arg[name], "'")) ea+="'"+arg[name]+"' ";
else ea+="\""+replace(arg[name], "'", "'")+"\" ";
m_delete(arg, name);
}
|
a3e0ac | 2000-09-29 | Martin Nilsson | | int xml=!m_delete(arg, "noxml");
|
21171e | 2000-08-25 | Martin Nilsson | |
|
dd4e59 | 2000-08-21 | Martin Nilsson | | if(!arg->border) arg->border="0";
|
22cbbd | 2000-02-29 | Martin Nilsson | |
|
d47cbf | 1996-12-02 | Per Hedbor | | if(arg->split)
{
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | string res="",split=arg->split;
if(lower_case(split)=="split") split=" ";
|
d47cbf | 1996-12-02 | Per Hedbor | | m_delete(arg,"split");
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | c=replace(c, "\n", " ");
int setalt=!arg->alt;
foreach(c/split-({""}), string word)
|
d47cbf | 1996-12-02 | Per Hedbor | | {
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | string fn = image_cache->store( ({ p, word }),id );
|
9374e6 | 1999-05-18 | Per Hedbor | | mapping size = image_cache->metadata( fn, id, 1 );
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | if(setalt) arg->alt=word;
|
db053e | 2000-12-05 | Martin Nilsson | | arg->src=query_absolute_internal_location(id)+fn+ext;
|
9374e6 | 1999-05-18 | Per Hedbor | | if( size )
{
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | arg->width = (string)size->xsize;
arg->height = (string)size->ysize;
|
1bd5c9 | 1997-09-26 | Henrik Grubbström (Grubba) | | }
|
dd4e59 | 2000-08-21 | Martin Nilsson | | res+=Roxen.make_tag( "img", arg, xml )+" ";
|
d47cbf | 1996-12-02 | Per Hedbor | | }
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | return sprintf(lp,res);
|
d47cbf | 1996-12-02 | Per Hedbor | | }
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
string num = image_cache->store( ({ p, c }), id );
|
6a9b9d | 1999-06-25 | Per Hedbor | | mapping size = image_cache->metadata( num, id, 1 );
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | if(!arg->alt) arg->alt=replace(c,"\"","'");
|
f1be80 | 1998-02-22 | Per Hedbor | |
|
db053e | 2000-12-05 | Martin Nilsson | | arg->src=query_absolute_internal_location(id)+num+ext;
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | if(size) {
|
7e471e | 2000-01-05 | Martin Nilsson | | arg->width=(string)size->xsize;
arg->height=(string)size->ysize;
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | }
if(arg->magic)
|
d47cbf | 1996-12-02 | Per Hedbor | | {
|
a3e0ac | 2000-09-29 | Martin Nilsson | | string magic=replace(m_delete(arg,"magic"), "'", "`");
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
if(p->bevel) p->pressed=1;
|
7519ad | 2000-03-16 | Martin Nilsson | | m_delete(p, "fgcolor");
|
0786ff | 2000-10-19 | Per Hedbor | | foreach(glob("magic-*", indices(arg)), string q)
p[q[6..]]=arg[q];
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
|
7519ad | 2000-03-16 | Martin Nilsson | | if(!p->fgcolor) p->fgcolor=id->misc->defines->theme_alink||
|
22cbbd | 2000-02-29 | Martin Nilsson | | id->misc->defines->alink||"#ff0000";
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | string num2 = image_cache->store( ({ p, c }),id );
|
6a9b9d | 1999-06-25 | Per Hedbor | | size = image_cache->metadata( num2, id );
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | if(size) {
|
7e471e | 2000-01-05 | Martin Nilsson | | arg->width=(string)max(arg->xsize,size->xsize);
arg->height=(string)max(arg->ysize,size->ysize);
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | }
if(!id->supports->images) return sprintf(lp,arg->alt);
|
094371 | 1997-02-25 | Per Hedbor | |
|
e95416 | 2000-01-02 | Martin Nilsson | | string sn="i"+id->misc->gtext_mi++;
|
170253 | 2000-03-15 | Marcus Wellhardh | | if(!id->supports->js_image_object) {
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | return (!input)?
|
21171e | 2000-08-25 | Martin Nilsson | | ("<a"+ea+"href=\""+url+"\">"+Roxen.make_tag("img",arg+(["name":sn]),xml)+"</a>"):
|
dd4e59 | 2000-08-21 | Martin Nilsson | | Roxen.make_tag("input",arg+(["type":"image"]),xml);
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | }
arg->name=sn;
|
a3e0ac | 2000-09-29 | Martin Nilsson | | string res="<script>\n";
|
e95416 | 2000-01-02 | Martin Nilsson | | if(!id->misc->gtext_magic_java) {
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | res += "function i(ri,hi,txt)\n"
"{\n"
" document.images[ri].src = hi.src;\n"
|
3dff86 | 2000-03-20 | Per Hedbor | | " if( txt != 0 )\n"
" setTimeout(\"top.window.status = '\"+txt+\"'\", 100);\n"
|
a3e0ac | 2000-09-29 | Martin Nilsson | | "}";
|
e95416 | 2000-01-02 | Martin Nilsson | | }
id->misc->gtext_magic_java="yes";
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
return
res+
" "+sn+"l = new Image("+arg->width+", "+arg->height+");"+sn+"l.src = \""+arg->src+"\";\n"
|
db053e | 2000-12-05 | Martin Nilsson | | " "+sn+"h = new Image("+arg->width+", "+arg->height+");"+sn+"h.src = \"" +
query_absolute_internal_location(id)+num2+ext+"\";\n"
|
e95416 | 2000-01-02 | Martin Nilsson | | "</script>\n"+
|
21171e | 2000-08-25 | Martin Nilsson | | "<a"+ea+"href=\""+url+"\" "+
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | (input?"onClick='document.forms[0].submit();' ":"")
|
3dff86 | 2000-03-20 | Per Hedbor | | +"onMouseover=\"i('"+sn+"',"+sn+"h,"+((strlen(magic) && magic != "magic")?
"'"+replace(magic,"'","`")+"'":
"0")+"); return true;\" "
"onMouseout=\"document.images['"+sn+"'].src = "+sn+"l.src;\">"
|
dd4e59 | 2000-08-21 | Martin Nilsson | | +Roxen.make_tag("img",arg,xml)+"</a>";
|
d47cbf | 1996-12-02 | Per Hedbor | | }
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
|
ca0f08 | 1997-02-22 | Per Hedbor | | if(input)
|
dd4e59 | 2000-08-21 | Martin Nilsson | | return Roxen.make_tag("input",arg+(["type":"image"]),xml);
|
a3dfd4 | 1999-11-28 | Martin Nilsson | |
|
dd4e59 | 2000-08-21 | Martin Nilsson | | return sprintf(lp,Roxen.make_tag("img",arg,xml));
|
d47cbf | 1996-12-02 | Per Hedbor | | }
|
7519ad | 2000-03-16 | Martin Nilsson | | array(string) simpletag_gh(string t, mapping m, string c, RequestID id) {
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | int i;
if(sscanf(t, "%s%d", t, i)==2 && i>1)
m->scale = (string)(1.0 / ((float)i*0.6));
if(!m->valign) m->valign="top";
|
a50b59 | 2000-09-03 | Martin Nilsson | | return ({ "<p>"+do_gtext(m,c,id)+"</p><br />" });
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | }
|
a50b59 | 2000-09-03 | Martin Nilsson | | class TagAnfang {
inherit RXML.Tag;
constant name = "anfang";
constant flags = RXML.FLAG_DONT_REPORT_ERRORS;
class Frame {
inherit RXML.Frame;
array do_return(RequestID id) {
if(!args->align) args->align="left";
return ({ "<br clear=\"left\" />"+do_gtext(args,content[0..0],id)+content[1..] });
}
}
|
a3dfd4 | 1999-11-28 | Martin Nilsson | | }
|
7519ad | 2000-03-16 | Martin Nilsson | | mapping query_simpletag_callers() {
|
a50b59 | 2000-09-03 | Martin Nilsson | | return ([ "gh1" : ({ RXML.FLAG_DONT_REPORT_ERRORS, simpletag_gh }),
|
cf18f9 | 2000-08-15 | Martin Stjernholm | | "gh2" : ({ RXML.FLAG_DONT_REPORT_ERRORS, simpletag_gh }),
"gh3" : ({ RXML.FLAG_DONT_REPORT_ERRORS, simpletag_gh }),
"gh4" : ({ RXML.FLAG_DONT_REPORT_ERRORS, simpletag_gh }),
"gh5" : ({ RXML.FLAG_DONT_REPORT_ERRORS, simpletag_gh }),
"gh6" : ({ RXML.FLAG_DONT_REPORT_ERRORS, simpletag_gh }),
|
7519ad | 2000-03-16 | Martin Nilsson | | ]);
|
d47cbf | 1996-12-02 | Per Hedbor | | }
|