Here is what I used in the past, it was for a web application, so probably not quite what you want. The Font ttf file was stored in the database. You will need to replace [FONTASBYTEARRAY] with the actual byte [].
There is probably a much better way to get the ttf file into a font object, but this should help get you started.
using System; using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Text; using System.Runtime.InteropServices; namespace Utility { public class Font { public string GetFont(byte[] [FONTASBYTEARRAY]) { PrivateFontCollection fc = new PrivateFontCollection(); IntPtr pointer = Marshal.UnsafeAddrOfPinnedArrayElement([FONTASBYTEARRAY], 0); fc.AddMemoryFont(pointer, Convert.ToInt32([FONTASBYTEARRAY].Length)); System.Drawing.Font f = new System.Drawing.Font(fc.Families[0], 10); FontFamily ff = f.FontFamily; return ff.Name; } } }
source share