TTF_OpenFont() private méthode

private TTF_OpenFont ( string file, int ptsize ) : IntPtr
file string
ptsize int
Résultat System.IntPtr
        public void GlyphMetrics()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 12);
            int    minx;
            int    miny;
            int    maxx;
            int    maxy;
            int    advance;
            int    result;

            result = SdlTtf.TTF_GlyphMetrics(fontPtr, 1, out minx, out maxx, out miny, out maxy, out advance);
            Assert.AreEqual(-1, minx);
            Assert.AreEqual(4, maxx);
            Assert.AreEqual(0, miny);
            Assert.AreEqual(8, maxy);
            Assert.AreEqual(5, advance);
//			Console.WriteLine("minx: " + minx.ToString());
//			Console.WriteLine("maxx: " + maxx.ToString());
//			Console.WriteLine("miny: " + miny.ToString());
//			Console.WriteLine("maxy: " + maxy.ToString());
//			Console.WriteLine("advance: " + advance.ToString());
            this.Quit();
        }
Exemple #2
0
        public void FontHeight()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 9);

            Assert.AreEqual(SdlTtf.TTF_FontHeight(fontPtr), 12);
            this.Quit();
        }
Exemple #3
0
        public void OpenFont()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 10);

            Assert.IsFalse(fontPtr == IntPtr.Zero);
            this.Quit();
        }
Exemple #4
0
        public void FontFaceStyleName()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 10);

            //Console.WriteLine("FontFaceStyleName:" + SdlTtf.TTF_FontFaceStyleName(fontPtr).ToString());
            Assert.AreEqual(SdlTtf.TTF_FontFaceStyleName(fontPtr).ToString(), "Roman");
            this.Quit();
        }
Exemple #5
0
        public void FontFaces()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 10);

            Assert.AreEqual(SdlTtf.TTF_FontFaces(fontPtr), 4294967297);
            //Console.WriteLine("FontFaces:" + SdlTtf.TTF_FontFaces(fontPtr).ToString());
            this.Quit();
        }
Exemple #6
0
        public void FontLineSkip()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 10);

            Assert.AreEqual(17, SdlTtf.TTF_FontLineSkip(fontPtr));
            //Console.WriteLine("FontLineSkip:" + SdlTtf.TTF_FontLineSkip(fontPtr).ToString());
            this.Quit();
        }
Exemple #7
0
        public void FontAscent()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 10);

            Assert.AreEqual(12, SdlTtf.TTF_FontAscent(fontPtr));
            //Console.WriteLine("FontAscent:" + result.ToString());
            this.Quit();
        }
Exemple #8
0
        public void SetGetFontStyle()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 10);

            SdlTtf.TTF_SetFontStyle(fontPtr, SdlTtf.TTF_STYLE_BOLD | SdlTtf.TTF_STYLE_ITALIC);
            Assert.AreEqual(SdlTtf.TTF_STYLE_BOLD | SdlTtf.TTF_STYLE_ITALIC, SdlTtf.TTF_GetFontStyle(fontPtr));
            this.Quit();
        }
Exemple #9
0
        public void FontFaceIsFixedWidth()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 12);

            Assert.AreEqual(SdlTtf.TTF_FontFaceIsFixedWidth(fontPtr), 0);
            IntPtr fontPtrMono = SdlTtf.TTF_OpenFont("../../FreeMono.ttf", 12);

            Assert.IsTrue(SdlTtf.TTF_FontFaceIsFixedWidth(fontPtrMono) != 0);
            //Console.WriteLine("FontFaceIsFixedWidth:" +
            //	SdlTtf.TTF_FontFaceIsFixedWidth(fontPtrMono).ToString());
            this.Quit();
        }
Exemple #10
0
        public void SizeUNICODE()
        {
            this.Quit();
            this.Init();
            IntPtr fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 10);
            int    w;
            int    h;

            SdlTtf.TTF_SizeUNICODE(fontPtr, "hello", out w, out h);
            Console.WriteLine("w: " + w.ToString());
            Console.WriteLine("h: " + h.ToString());
            Assert.AreEqual(w, 22);
            Assert.AreEqual(17, h);
            this.Quit();
        }
Exemple #11
0
        public void RenderGlyph_Blended()
        {
            this.Quit();
            this.Init();
            IntPtr surfacePtr = VideoSetup();

            Sdl.SDL_Rect rect1   = new Sdl.SDL_Rect(0, 0, 400, 400);
            Sdl.SDL_Rect rect2   = new Sdl.SDL_Rect(0, 0, 400, 400);
            IntPtr       fontPtr = SdlTtf.TTF_OpenFont("../../FreeSans.ttf", 12);

            Sdl.SDL_Color colorfg        = new Sdl.SDL_Color(254, 0, 0);
            IntPtr        fontSurfacePtr = SdlTtf.TTF_RenderGlyph_Blended(fontPtr, 1000, colorfg);

            Assert.IsFalse(fontSurfacePtr == IntPtr.Zero);
            int result = Sdl.SDL_BlitSurface(fontSurfacePtr, ref rect1, surfacePtr, ref rect2);

            Assert.AreEqual(result, 0);
            Sdl.SDL_UpdateRect(surfacePtr, 0, 0, 400, 400);
            Thread.Sleep(sleepTime);
            this.Quit();
        }