[Mono-bugs] [Bug 80680][Min] Changed - Graphics.MeasureString results differ for string containing only blanks
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Jan 30 18:24:42 EST 2007
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 sebastien at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=80680
--- shadow/80680 2007-01-30 18:13:35.000000000 -0500
+++ shadow/80680.tmp.21272 2007-01-30 18:24:42.000000000 -0500
@@ -2,16 +2,16 @@
Product: Mono: Class Libraries
Version: 1.2
OS: GNU/Linux [Other]
OS Details:
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Minor
Component: Sys.Drawing.
-AssignedTo: mono-bugs at ximian.com
+AssignedTo: sebastien at ximian.com
ReportedBy: gert.driesen at pandora.be
QAContact: mono-bugs at ximian.com
TargetMilestone: ---
URL:
Cc:
Summary: Graphics.MeasureString results differ for string containing only blanks
@@ -45,6 +45,54 @@
(more or less)
Actual result:
17
120
+
+------- Additional Comments From sebastien at ximian.com 2007-01-30 18:24 -------
+A small modification to your sample shows that MS trims extra spaces
+(if more than one is present).
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+public class Test {
+ static void Main () {
+ Form form = new Form ();
+ Graphics g = form.CreateGraphics ();
+ Font font = new Font (FontFamily.GenericSansSerif, 10);
+ string s = String.Empty;
+ for (int i=0; i < 20; i++) {
+ SizeF size = g.MeasureString (s, font);
+ Console.WriteLine ("{0}. H {1}, W {2}", i, size.Height,
+size.Width);
+ s+=" ";
+ }
+ }
+}
+
+0. H 0, W 0
+1. H 16.75781, W 4.444444
+2. H 16.75781, W 4.444444
+3. H 16.75781, W 4.444443
+4. H 16.75781, W 4.444442
+5. H 16.75781, W 4.444442
+6. H 16.75781, W 4.44444
+7. H 16.75781, W 4.44444
+8. H 16.75781, W 4.444438
+9. H 16.75781, W 4.444437
+10. H 16.75781, W 4.444437
+11. H 16.75781, W 4.444433
+12. H 16.75781, W 4.444429
+13. H 16.75781, W 4.444429
+14. H 16.75781, W 4.444425
+15. H 16.75781, W 4.444421
+16. H 16.75781, W 4.444417
+17. H 16.75781, W 4.444417
+18. H 16.75781, W 4.44441
+19. H 16.75781, W 4.44441
+
+Strangely the Width isn't exactly the same at each iteration. Anyway
+thanks for the sample code.
+
More information about the mono-bugs
mailing list