protected void LoadFonts()
{
try
{
//copied from http://dotnet-coding-helpercs.blogspot.com/
unsafe
{
var fonts = new List<byte[]>();
fonts.Add(Resource1.LiberationMono_Regular);
fonts.Add(Resource1.LiberationSans_Regular);
foreach (var buffer in fonts)
{
fixed (byte* pFontData = buffer)
{
uint dummy = 0;
_fontCollection.AddMemoryFont((IntPtr)pFontData, buffer.Length);
AddFontMemResourceEx((IntPtr)pFontData, (uint)buffer.Length, IntPtr.Zero, ref dummy);
}
}
}
//opting to leave the form alone for the moment, because these fonts aren't especially awesome
//this.Font = new Font(_fontCollection.Families[1], 9);
//however, we absolutely need a monospaced font here for this to look correct.
txtLogConsole.Font = new Font(_fontCollection.Families[0], 8f);
}
catch (Exception ex)
{
this.DisplayException("Error Loading Embedded Font", ex);
}
}