[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pnet-developers] [bugs #11074] Font.SizeInPoints fails with NullReferen
From: |
Thong Nguyen |
Subject: |
[Pnet-developers] [bugs #11074] Font.SizeInPoints fails with NullReferenceException |
User-agent: |
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MyIE2; Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.40607) |
This mail is an automated notification from the bugs tracker
of the project: DotGNU Portable.NET.
/**************************************************************************/
[bugs #11074] Full Item Snapshot:
URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=11074>
Project: DotGNU Portable.NET
Submitted by: Thong Nguyen
On: Sun 11/21/2004 at 01:33
Category: None
Severity: 1 - None
Item Group: None
Resolution: None
Privacy: Public
Assigned to: None
Status: Open
Summary: Font.SizeInPoints fails with NullReferenceException
Original Submission: The following program fails with a NullReferenceException:
using System;
using System.Drawing;
public class Test
{
public static void Main()
{
Font font = new Font("Arial", 10, GraphicsUnit.Pixel);
Console.WriteLine(font.SizeInPoints);
}
}
Note that it only fails if the GraphicsUnit is Pixel (or World).
The reason for failure is that Font.SizeInPoints tries to dereference the
Font.toolkit field which is null. The solution is to use
ToolkitManager.Toolkit instead of Font.toolkit but I thought I would submit
this as a bug because there may be some esoteric reason as to why there is a
local "toolkit" field in font which doesn't seem to be used much but is a
source of problems for fonts when created in certain ways.
The other solution would be to set Font.toolkit to ToolkitManager.Toolkit if no
toolkit is provided in the Font constructor.
Comments and suggestions would be helpful..
For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=11074>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pnet-developers] [bugs #11074] Font.SizeInPoints fails with NullReferenceException,
Thong Nguyen <=