[Mono-bugs] [Bug 416489] New: FontDialog. Font Property set does not work with GraphicsUnit.Pixel

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Aug 12 02:02:04 EDT 2008


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


           Summary: FontDialog.Font Property set does not work with
                    GraphicsUnit.Pixel
           Product: Mono: Class Libraries
           Version: 2.0
          Platform: x86-64
        OS/Version: SLES 10
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: carsten.sponsel at astrum-it.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


It seems that setting the Font Property of FontDialog does not work correctly
if the source Font has the Unit GraphicsUnit.Pixel. 
If the FontDialog's Font-Setter is initialized with a Pixel-based Font, a
following call to the FontDialog's Font-Getter returns a wrong result.

In principle, I use this code:
FontDialog FntDlg = new FontDialog ();

FntDlg.Font = SourceFont;  // SourceFont.Unit ==  GraphicsUnit.Pixel


System.Console.WriteLine ("Source Font: " + SourceFont.Name 
                           + " size = " + SourceFont.Size 
                           + " Unit = " + SourceFont.Unit 
                           + " SizeInPoints = " + SourceFont.SizeInPoints);

System.Console.WriteLine ("FontDialog.Font: " + FntDlg.Font.Name 
                           + " size = " + FntDlg.Font.Size 
                           + " Unit = " + FntDlg.Font.Unit 
                           + " SizeInPoints = " + FntDlg.Font.SizeInPoints);


Here are some example outputs:

Source Font: Albany AMT size = 8 Unit = Pixel SizeInPoints = 6
FontDialog.Font: Albany AMT size = 8 Unit = Point SizeInPoints = 8

Source Font: Albany AMT size = 9.333333 Unit = Pixel SizeInPoints = 7
FontDialog.Font: Albany AMT size = 9 Unit = Point SizeInPoints = 9

Source Font: Albany AMT size = 10.66667 Unit = Pixel SizeInPoints = 8
FontDialog.Font: Albany AMT size = 10 Unit = Point SizeInPoints = 10

Source Font: Albany AMT size = 13 Unit = Pixel SizeInPoints = 9.75
FontDialog.Font: Albany AMT size = 6 Unit = Point SizeInPoints = 6

Source Font: Albany AMT size = 13.33333 Unit = Pixel SizeInPoints = 9.999999
FontDialog.Font: Albany AMT size = 6 Unit = Point SizeInPoints = 6

Source Font: Albany AMT size = 14.66667 Unit = Pixel SizeInPoints = 11
FontDialog.Font: Albany AMT size = 14 Unit = Point SizeInPoints = 14

Source Font: Albany AMT size = 21.33333 Unit = Pixel SizeInPoints = 16
FontDialog.Font: Albany AMT size = 6 Unit = Point SizeInPoints = 6


SizeInPoints should be the same for SourceFont and FontDialog.Font - but the
shown behaviour is very strange.

In .NET the FontDialog converts the FontSize from Pixel to Point and is
initialized with correct size when opening the FontDialog.


-- 
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