示例#1
0
        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);
        }
示例#2
0
        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);
        }