2006-08-11 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Fri, 11 Aug 2006 19:15:26 +0000 (19:15 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Fri, 11 Aug 2006 19:15:26 +0000 (19:15 -0000)
* Font.cs: Remove the, now unrequired, FaceNameOffset field and
use the object size instead of the structure size when copying.

svn path=/trunk/mcs/; revision=63654

mcs/class/System.Drawing/System.Drawing/ChangeLog
mcs/class/System.Drawing/System.Drawing/Font.cs

index 431f83f2232347daa950d9b7066a8abaf0fcba34..693a9c80fb962e6b826950da119c2b9d39b5899b 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-11  Sebastien Pouliot  <sebastien@ximian.com> 
+
+       * Font.cs: Remove the, now unrequired, FaceNameOffset field and
+       use the object size instead of the structure size when copying.
+
 2006-08-11  Sebastien Pouliot  <sebastien@ximian.com>
 
        * Font.cs: Added more checks to ToLogFont and fixed it's behaviour
index 841fc226c04340469dbe40fc303ecf03e7684b91..46bcc4f0ac0efd9a1c38e589cb605c2aea7b4e0a 100644 (file)
@@ -50,7 +50,6 @@ namespace System.Drawing
 
                private const byte DefaultCharSet = 1;
                private static int CharSetOffset = -1;
-               private static int FaceNameOffset = -1;
 
                private void CreateFont (string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical)
                {
@@ -653,8 +652,8 @@ namespace System.Drawing
 
                        // note: there is no exception if 'logFont' isn't big enough
                        Type lf = typeof (LOGFONT);
-                       int size = Marshal.SizeOf (lf);
-                       if (Marshal.SizeOf (logFont) >= size) {
+                       int size = Marshal.SizeOf (logFont);
+                       if (size >= Marshal.SizeOf (lf)) {
                                Status status;
                                IntPtr copy = Marshal.AllocHGlobal (size);
                                try {
@@ -672,7 +671,6 @@ namespace System.Drawing
 
                                if (CharSetOffset == -1) {
                                        CharSetOffset = (int) Marshal.OffsetOf (lf, "lfCharSet");
-                                       FaceNameOffset = (int) Marshal.OffsetOf (lf, "lfFaceName");
                                }
 
                                // note: Marshal.WriteByte(object,*) methods are unimplemented on Mono