[Mono-bugs] [Bug 327039] New: MeasureString behaves differently on win and linux

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Sep 21 04:17:32 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=327039

           Summary: MeasureString behaves differently on win and linux
           Product: Mono: Class Libraries
           Version: 1.2
          Platform: PC
        OS/Version: Kubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: bart.jansen at etro.vub.ac.be
         QAContact: mono-bugs at ximian.com
          Found By: ---


Description of Problem:

Given a particular string and a font, measureString provides different results
on lin and win.  On linux, the returned width is smaller than it is actually
is.


Steps to reproduce the problem:
1. run the code below

 public class Form1 : Form
    {
        public Form1()
        {
         ;
        }

        // on windows: w1 : 70,08897 w2: 75
        // on linux: w1 :67 w2: 76 
        protected override void OnPaint(PaintEventArgs e)
        {
            string testString = "hello world";
            Font f = new Font("arial", 10);
            float w1 = e.Graphics.MeasureString(testString, f).Width;
            float w2 = TextRenderer.MeasureText(testString, f).Width;
            Console.WriteLine("w1 : " + w1.ToString() + " w2: " +
w2.ToString());
            base.OnPaint(e);
        }
    }


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list