public void OpenFontRW() { this.Quit(); this.Init(); IntPtr fontPtr = SdlTtf.TTF_OpenFontRW(Sdl.SDL_RWFromFile("../../FreeSans.ttf", "rb"), 1, 12); Assert.IsFalse(fontPtr == IntPtr.Zero); this.Quit(); }
/// <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(); } }