Does the current version of the MivaScript graphics library render fonts, True Type or any other?
If not, it seems I will still have to use PHP.
If not, it seems I will still have to use PHP.
<MvCOMMENT> Test file: gdImageStringFT.mv Links: http://www.boutell.com/gd/manual2.0.33.html#gdImageStringFT http://www.mivascript.com/item/mivascript-functions/gdImageStringFT.html http://extranet.miva.com/forums/showthread.php?115047-MivaScript-Gd-Library-Font-Rendering gdImageStringFT( im, brect var, fg, fontlist, ptsize, angle, x, y, string ) Parameters im = Image the text will be appended to brect = Array of the bounding rectangle surrounding the text The user-supplied int brect[8] array is filled on return from gdImageStringFT with the 8 elements representing the 4 corner coordinates of the bounding rectangle (the smallest rectangle that completely surrounds the rendered string and does not intersect any pixel of the rendered string). fg = Font color fontlist = Font family ptsize = Font point size angle = Angle in which the text is displayed. (Values accepted in radians) x = The horizontal position of where the text will be written y = The vertical position of where the text will be written string = The text to be appended to the image </MvCOMMENT> <MvASSIGN NAME="g.module_library_utilities" VALUE="/mm5/5.00/lib/util.mvc"> <MvCOMMENT> Create an image </MvCOMMENT> <MvASSIGN NAME="l.width" VALUE="180"> <MvASSIGN NAME="l.height" VALUE="60"> <MvASSIGN NAME="l.image" VALUE="{ gdImageCreate( l.width, l.height ) }"> <MvCOMMENT> Set color (background = first allocated) </MvCOMMENT> <MvASSIGN NAME="l.bg" VALUE="{ gdImageColorAllocate( l.image, 200, 200, 240) }"> <MvASSIGN NAME="l.fg" value="gdImageColorAllocate( l.image, 0, 0, 0 )" /> <MvCOMMENT> Set the font Note </MvCOMMENT> <MvASSIGN NAME="l.font" VALUE="Nimbus Mono L:regular" /> <MvASSIGN NAME="l.font" VALUE="times:bold:italic" /> <MvASSIGN NAME="l.font" VALUE="Commercial Script.ttf" /> <MvASSIGN NAME="l.ptsize" VALUE="12" /> <MvASSIGN NAME="l.angle" VALUE="0" /> <MvASSIGN NAME="l.x" VALUE="10" /> <MvASSIGN NAME="l.y" VALUE="10" /> <MvASSIGN NAME="l.text" VALUE="Ray Yates" /> <MvASSIGN NAME="l.err" VALUE="{ gdImageStringFT( l.image, l.brect, l.fg, l.font, l.ptsize, l.angle, l.x, l.y, l.text ) }" /> <MvASSIGN NAME="l.void" VALUE="{ [g.module_library_utilities].Image_gdSaveToFile_Type( l.image, 'png', '/temp.png', 'script' ) }"> <MvASSIGN NAME="l.void" VALUE="{ gdImageDestroy( l.image ) }" /> <!DOCTYPE html> <html> <head> <title>gdImageStringFT Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <MvEVAL EXPR="{ 'l.err = ' $ l.err $ ' <br>' }"><br> <img src="/temp.png"><br> </body> </html>
<MvCOMMENT> Test file: gdImageStringFT.mv Links: http://www.boutell.com/gd/manual2.0.33.html#gdImageStringFT http://www.mivascript.com/item/mivascript-functions/gdImageStringFT.html http://extranet.miva.com/forums/showthread.php?115047-MivaScript-Gd-Library-Font-Rendering gdImageStringFT( im, brect var, fg, fontlist, ptsize, angle, x, y, string ) Parameters im = Image the text will be appended to brect = Array of the bounding rectangle surrounding the text The user-supplied int brect[8] array is filled on return from gdImageStringFT with the 8 elements representing the 4 corner coordinates of the bounding rectangle (the smallest rectangle that completely surrounds the rendered string and does not intersect any pixel of the rendered string). fg = Font color fontlist = Font family ptsize = Font point size angle = Angle in which the text is displayed. (Values accepted in radians) x = The horizontal position of where the text will be written y = The vertical position of where the text will be written string = The text to be appended to the image </MvCOMMENT> <MvASSIGN NAME="g.module_library_utilities" VALUE="/mm5/5.00/lib/util.mvc"> <MvCOMMENT> Create an image </MvCOMMENT> <MvASSIGN NAME="l.width" VALUE="180"> <MvASSIGN NAME="l.height" VALUE="60"> <MvASSIGN NAME="l.image" VALUE="{ gdImageCreate( l.width, l.height ) }"> <MvCOMMENT> Set color (background = first allocated) </MvCOMMENT> <MvASSIGN NAME="l.bg" VALUE="{ gdImageColorAllocate( l.image, 200, 200, 240) }"> <MvASSIGN NAME="l.fg" value="gdImageColorAllocate( l.image, 0, 0, 0 )" /> <MvCOMMENT> Set the font Note </MvCOMMENT> <MvASSIGN NAME="l.font" VALUE="Nimbus Mono L:regular" /> <MvASSIGN NAME="l.font" VALUE="times:bold:italic" /> <MvASSIGN NAME="l.font" VALUE="Commercial Script.ttf" /> <MvASSIGN NAME="l.ptsize" VALUE="12" /> <MvASSIGN NAME="l.angle" VALUE="0" /> <MvASSIGN NAME="l.x" VALUE="10" /> <MvASSIGN NAME="l.y" VALUE="10" /> <MvASSIGN NAME="l.text" VALUE="Ray Yates" /> <MvASSIGN NAME="l.err" VALUE="{ gdImageStringFT( l.image, l.brect, l.fg, l.font, l.ptsize, l.angle, l.x, l.y, l.text ) }" /> <MvASSIGN NAME="l.void" VALUE="{ [g.module_library_utilities].Image_gdSaveToFile_Type( l.image, 'png', '/temp.png', 'script' ) }"> <MvASSIGN NAME="l.void" VALUE="{ gdImageDestroy( l.image ) }" /> <!DOCTYPE html> <html> <head> <title>gdImageStringFT Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <MvEVAL EXPR="{ 'l.err = ' $ l.err $ ' <br>' }"><br> <img src="/temp.png"><br> </body> </html>
<MvASSIGN NAME = "l.fg" VALUE = "{ gdImageColorAllocate( l.image, 0, 0, 0 ) }" />
<MvASSIGN NAME="l.err" VALUE="{ gdImageStringFT( l.image, l.brect, l.fg, l.font, l.ptsize, l.angle, l.x, l.y, l.text ) }" /> <MvIF EXPR="{ l.err }"> <MvASSIGN NAME = "l.gd_error_message" VALUE = "{ gdLastError() }"> </MvIF>
<MIVA STANDARDOUTPUTLEVEL=""> <MvASSIGN NAME="l.font" VALUE="{ g.font }"> <MvASSIGN NAME="l.font_size" VALUE="{ encodeentities(g.font_size) }"> <MvASSIGN NAME="l.angle" VALUE="{ 0 }"> <MvASSIGN NAME="l.text" VALUE="{ encodeentities(g.text) }"> <MvIF EXPR="{ gdImageStringFT(l.NULL, l.brect, 0, l.font, l.font_size, 0.0, 0, 0, l.text) }"> <MvEVAL EXPR="{ gdLastError() $ '<br>' }"> <MvEXIT> </MvIF> <MvASSIGN NAME="l.width" VALUE="{ l.brect[3] - l.brect[7] + 6 }"> <MvASSIGN NAME="l.height" VALUE="{ l.brect[4] - l.brect[8] + 6 }"> <MvASSIGN NAME="l.img_ptr" VALUE="{ gdImageCreate( l.width, l.height ) }"> <MvASSIGN NAME="l.background" VALUE="{ gdImageColorAllocateAlpha( l.img_ptr, 255, 255, 255, 127) }"> <MvASSIGN NAME="l.color" VALUE="{ gdImageColorAllocate( l.img_ptr, 60, 60, 60 ) }"> <MvASSIGN NAME="l.x" VALUE="{ 3 - l.brect[7] }"> <MvASSIGN NAME="l.y" VALUE="{ 3 - l.brect[8] }"> <MvASSIGN NAME="l.brect" VALUE=""> <MvIF EXPR="{ gdImageStringFT(l.img_ptr, l.brect, l.color, l.font, l.font_size, l.angle, l.x, l.y, l.text ) }"> <MvEVAL EXPR="{ gdLastError() $ '<br>' }"> <MvEXIT> </MvIF> <MvASSIGN name="l.ok" VALUE="{ miva_output_header('Content-Type','image/png') }"> <MvASSIGN name="l.ok" VALUE="{ miva_output_header('Expires','0')}"> <MvASSIGN name="l.ok" VALUE="{ miva_output_header('Cache-Control','no-cache, must-revalidate') }"> <MvASSIGN name="l.ok" VALUE="{ miva_output_header('Pragma','no-cache') }"> <MvASSIGN NAME="l.ok" VALUE="{ gdImagePngOutput( l.img_ptr ) }"> <MvASSIGN NAME="l.var" VALUE="{ gdImageDestroy( l.img_ptr ) }"> <MvEXIT>
Comment