public static bool SaveToStream(BinaryWriter outputWriter, Font font) { FontStorage storage = new FontStorage(string.Empty, font); if (!storage.Write(outputWriter)) { Debug.Assert(false, "Cannot write a font file!"); return(false); } return(true); }
public static bool SaveToFile(string filePath, Font font) { FontStorage storage = new FontStorage(filePath, font); using (FileStream outputStream = new FileStream(filePath, FileMode.Create, FileAccess.Write)) { using (BinaryWriter outputWriter = new BinaryWriter(outputStream, storage.Encoding)) { if (!storage.Write(outputWriter)) { Debug.Assert(false, "Cannot write a font file!"); return(false); } } } return(true); }