Ejemplo n.º 1
0
 /// <summary>
 /// Initialize Font subsystem.
 /// </summary>
 private static void InitializeFontSystem()
 {
     if (SdlTtf.TTF_Init() != (int)SdlFlag.Success)
     {
         FontException.Generate();
     }
 }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Font Exception
 /// </summary>
 public FontException()
 {
     FontException.Generate();
 }