コード例 #1
0
 /// <summary>
 /// Initialize Font subsystem.
 /// </summary>
 private static void InitializeFontSystem()
 {
     if (SdlTtf.TTF_Init() != (int)SdlFlag.Success)
     {
         FontException.Generate();
     }
 }
コード例 #2
0
        /// <summary>
        /// Font Constructor
        /// </summary>
        /// <param name="fileName">Font filename</param>
        /// <param name="pointSize">Size of font</param>
        public Font(string fileName, int pointSize)
        {
            if (!Font.IsFontSystemInitialized)
            {
                Font.InitializeFontSystem();
            }

            this.Handle = SdlTtf.TTF_OpenFont(fileName, pointSize);
            if (this.Handle == IntPtr.Zero)
            {
                throw FontException.Generate();
            }
        }
コード例 #3
0
        /// <summary>
        /// Create a Font from a byte array in memory.
        /// </summary>
        /// <param name="array">A array of byte that should be the font data</param>
        /// <param name="pointSize">Size of font</param>
        public Font(byte[] array, int pointSize)
        {
            if (array == null)
            {
                throw new ArgumentNullException("array");
            }
            if (!Font.IsFontSystemInitialized)
            {
                Font.InitializeFontSystem();
            }

            this.Handle = SdlTtf.TTF_OpenFontRW(Sdl.SDL_RWFromMem(array, array.Length), 0, pointSize);
            if (this.Handle == IntPtr.Zero)
            {
                throw FontException.Generate();
            }
        }
コード例 #4
0
ファイル: FontException.cs プロジェクト: erin100280/Zelda.NET
 /// <summary>
 /// Font Exception
 /// </summary>
 public FontException()
 {
     FontException.Generate();
 }