예제 #1
0
        public static int LoadFont(Stream fontStream)
        {
            IntPtr num = Marshal.AllocCoTaskMem((int)fontStream.Length);

            byte[] numArray = new byte[fontStream.Length];
            fontStream.Read(numArray, 0, (int)fontStream.Length);
            Marshal.Copy(numArray, 0, num, (int)fontStream.Length);
            uint pcFonts = 0;

            ThemeResolutionService.AddFontMemResourceEx(num, (uint)numArray.Length, IntPtr.Zero, ref pcFonts);
            ThemeResolutionService.customFonts.AddMemoryFont(num, (int)fontStream.Length);
            fontStream.Close();
            Marshal.FreeCoTaskMem(num);
            return((int)pcFonts);
        }