internal static bool FontToIFont(Font source, System.Windows.Forms.UnsafeNativeMethods.IFont target) { bool flag = false; string name = target.GetName(); if (!source.Name.Equals(name)) { target.SetName(source.Name); flag = true; } float num = ((float) target.GetSize()) / 10000f; float sizeInPoints = source.SizeInPoints; if (sizeInPoints != num) { target.SetSize((long) (sizeInPoints * 10000f)); flag = true; } System.Windows.Forms.NativeMethods.LOGFONT logFont = new System.Windows.Forms.NativeMethods.LOGFONT(); System.Windows.Forms.IntSecurity.ObjectFromWin32Handle.Assert(); try { source.ToLogFont(logFont); } finally { CodeAccessPermission.RevertAssert(); } if (target.GetWeight() != logFont.lfWeight) { target.SetWeight((short) logFont.lfWeight); flag = true; } if (target.GetBold() != (logFont.lfWeight >= 700)) { target.SetBold(logFont.lfWeight >= 700); flag = true; } if (target.GetItalic() != (0 != logFont.lfItalic)) { target.SetItalic(0 != logFont.lfItalic); flag = true; } if (target.GetUnderline() != (0 != logFont.lfUnderline)) { target.SetUnderline(0 != logFont.lfUnderline); flag = true; } if (target.GetStrikethrough() != (0 != logFont.lfStrikeOut)) { target.SetStrikethrough(0 != logFont.lfStrikeOut); flag = true; } if (target.GetCharset() != logFont.lfCharSet) { target.SetCharset(logFont.lfCharSet); flag = true; } return flag; }