Example #1
0
        public void RenderText(string text, DrawBitmapF drawBitmap, int penx, int peny)
        {
            int code;

            FT.FT_FaceRec facerec = FT.HandleToRecord <FT.FT_FaceRec>(face_);
            IntPtr        slot    = facerec.glyph;

            foreach (char c in text)
            {
                code = FT.FT_Load_Char(face_, c, FT.FT_LOAD_RENDER /*|FT.FT_LOAD_TARGET_NORMAL*/);
                if (code != 0)
                {
                    continue;
                }

                FT.FT_GlyphSlotRec slotrec = FT.HandleToRecord <FT.FT_GlyphSlotRec>(slot);
                //Bitmap bitmap = new Bitmap(slotrec.bitmap);

                //                drawBitmap(bitmap, penx + slotrec.bitmap_left, peny + slotrec.bitmap_top);
                //drawBitmap(bitmap, penx + slotrec.bitmap_left, peny - slotrec.bitmap_top);
                drawBitmap(slotrec.bitmap, penx + slotrec.bitmap_left, peny - slotrec.bitmap_top);
                penx += (slotrec.advance.x >> 6);
            }
        }
Example #2
0
        public void RenderText(string text, DrawBitmapF drawBitmap, int penx, int peny)
        {
            int code;

            FT.FT_FaceRec facerec = FT.HandleToRecord<FT.FT_FaceRec>(face_);
            IntPtr slot = facerec.glyph;

            foreach (char c in text)
            {
                code = FT.FT_Load_Char(face_, c, FT.FT_LOAD_RENDER/*|FT.FT_LOAD_TARGET_NORMAL*/);
                if (code != 0) { continue; }

                FT.FT_GlyphSlotRec slotrec = FT.HandleToRecord<FT.FT_GlyphSlotRec>(slot);
                //Bitmap bitmap = new Bitmap(slotrec.bitmap);

            //                drawBitmap(bitmap, penx + slotrec.bitmap_left, peny + slotrec.bitmap_top);
                //drawBitmap(bitmap, penx + slotrec.bitmap_left, peny - slotrec.bitmap_top);
                drawBitmap(slotrec.bitmap, penx + slotrec.bitmap_left, peny - slotrec.bitmap_top);
                penx += (slotrec.advance.x >> 6);
            }
        }