[Mono-bugs] [Bug 57630][Nor] New - Graphics.Measure String gives incorrect results
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 25 Apr 2004 23:00:01 -0400 (EDT)
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 david.mitchell@telogis.com.
http://bugzilla.ximian.com/show_bug.cgi?id=57630
--- shadow/57630 2004-04-25 23:00:01.000000000 -0400
+++ shadow/57630.tmp.24462 2004-04-25 23:00:01.000000000 -0400
@@ -0,0 +1,62 @@
+Bug#: 57630
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details: Redhat 9.0
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Drawing.
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: david.mitchell@telogis.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Graphics.Measure String gives incorrect results
+
+Description of Problem:
+Graphics.MeasureString returns incorrect results
+
+Steps to reproduce the problem:
+1. Compile attachment (mcs -r:System.Drawing textsize.cs)
+2. Run (mono textsize.exe)
+3. Open image file that is created (foo.png)
+
+Actual Results:
+The string 'km' with a red box only around the 'k'. The red box is
+about twice the height of the k
+
+Expected Results:
+A red box around both the k and the m that fits snugly around them.
+(ie the bounding box).
+
+How often does this happen?
+Always
+
+Additional Information:
+
+using System.Drawing;
+using System.Drawing.Imaging;
+
+
+class TextSize {
+ public static void Main(string[] args) {
+ Bitmap bm = new Bitmap(100,100);
+ Graphics g = Graphics.FromImage(bm);
+ Font fnt = new Font("Times", 12);
+ SizeF size = g.MeasureString("km", fnt);
+
+
+ g.DrawString("km", fnt, new SolidBrush(Color.Black), (float) 10.0,
+(float) 10.0);
+ g.DrawRectangle(new Pen(Color.Red),(float) 10.0,(float) 10.0,
+size.Width, size.Height);
+ g.Dispose();
+
+
+ bm.Save("foo.png", ImageFormat.Png);
+ bm.Dispose();
+ }
+}