[Mono-list] On-fly image creation problem

Slava Petrenko slava at z.org.ua
Sat Feb 18 18:23:51 EST 2006


Hi,

I have such a code, and web app with that code I run from command line
with xsp:

        protected Bitmap createImageFromText(
            string text
            )
        {
            Bitmap bmp = new Bitmap( 1, 1 );
            int iWidth = 0;
            int iHeight = 0;

            // Create the Font object for the image text drawing.
            Font fnt = new Font( "Arial", 20,
                        System.Drawing.FontStyle.Regular,
                        System.Drawing.GraphicsUnit.Point );

            // Create a graphics object to measure the text's width and
height.
            Graphics gr = Graphics.FromImage( bmp );

            // This is where the bitmap size is determined.
            iWidth = ( int ) gr.MeasureString( text, fnt ).Width;
            iHeight = ( int ) gr.MeasureString( text, fnt ).Height * 2;



At this point I have such values:
iWidth = -2147483648 (negative value)
iHeight = 8

If I run web app with apache + mod_mono then after line

Bitmap bmp = new Bitmap( 1, 1 );

I have "Internal Server Error"


I use SuSe 9.3 with recent mono's rpms taken from mono-project.com

Thanks for any help, 
Slava.




More information about the Mono-list mailing list