+2005-10-07 Peter Dennis Bartok <pbartok@novell.com>
+
+ * FontFamily.cs: Use Marshal.PtrToStringUni to do the string
+ conversion, it's less overhead than StringBuilder. (Part of the
+ bugfix for #74871 and #75534)
+
+ * gdipFunctions: Changed signature for GdipGetFamilyName to just
+ have an IntPtr for the buffer
+
2005-10-04 Peter Dennis Bartok <pbartok@novell.com>
* Graphics.cs, FontFamily.cs: Calling GC.SuppressFinalize from Dispose,
{
if (nativeFontFamily != IntPtr.Zero) {
int language = 0;
- StringBuilder sBuilder = new StringBuilder (GDIPlus.FACESIZE * UnicodeEncoding.CharSize);
- Status status = GDIPlus.GdipGetFamilyName (nativeFontFamily, sBuilder, language);
+ IntPtr buffer;
+
+ buffer = Marshal.AllocHGlobal(GDIPlus.FACESIZE * UnicodeEncoding.CharSize);
+ Status status = GDIPlus.GdipGetFamilyName (nativeFontFamily, buffer, language);
GDIPlus.CheckStatus (status);
- name = sBuilder.ToString();
+ name = Marshal.PtrToStringUni(buffer);
}
}
internal static extern Status GdipCreateFontFamilyFromName (
[MarshalAs(UnmanagedType.LPWStr)] string fName, IntPtr collection, out IntPtr fontFamily);
- [DllImport ("gdiplus.dll", CharSet=CharSet.Unicode)]
- internal static extern Status GdipGetFamilyName(IntPtr family, StringBuilder fName, int language);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetFamilyName(IntPtr family, IntPtr fName, int language);
[DllImport ("gdiplus.dll")]
internal static extern Status GdipGetGenericFontFamilySansSerif (out IntPtr fontFamily);