[Mono-bugs] [Bug 69793][Wis] New - Graphics.DrawString hangs when the rectangle passed in is too small

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 22 Nov 2004 08:49:35 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by rkumar@novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=69793

--- shadow/69793	2004-11-22 08:49:35.000000000 -0500
+++ shadow/69793.tmp.14691	2004-11-22 08:49:35.000000000 -0500
@@ -0,0 +1,61 @@
+Bug#: 69793
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Sys.Drawing.
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: rkumar@novell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Graphics.DrawString hangs when the rectangle passed in is too small
+
+Description of Problem:
+Graphics.DrawString method hangs if passed rectangle has 0 height or has a
+width that is much less than font.Height.
+
+Steps to reproduce the problem:
+1. Try to compile and run following program,
+
+
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+                                                                          
+                      
+public class sd {
+        public static void Main (string [] args) {
+                Bitmap bmp = new Bitmap (100, 100);
+                Graphics g = Graphics.FromImage (bmp);
+                Font font = new Font ("Arial", 20);
+                Console.WriteLine ("fint ht: "+ font.Height);
+                //Rectangle rect = new Rectangle (0, 0, font.Height,
+font.Height/3); // this works
+                //Rectangle rect = new Rectangle (0, 0, 0, font.Height/3);
+// this works
+                Rectangle rect = new Rectangle (0, 0, 10, 0); // this hangs
+                //Rectangle rect = new Rectangle (0, 0, font.Height/2-1,
+font.Height); // this hangs
+                g.DrawString ("hello", font, Brushes.Red, rect);
+                bmp.Save ("drawstr.png", ImageFormat.Png);
+        }
+}
+
+Actual Results:
+For the two commented cases, it works and it hangs for the other two cases.
+
+Expected Results:
+MS S.D runs all these cases without any problem.
+
+How often does this happen? 
+Always
+
+Additional Information:
+For a Font size of 10 pts, it starts hanging when rectangle width is less
+than or equal to font.Height/2-2. I've Cairo-HEAD, libgdiplus-HEAD.