public static unsafe FT_Face Create(FT_Library lib, string fontPath, int index) { FT_Face ff = new FT_Face(); int err = __CreateNativeFT_FACE(lib.handle, fontPath, index, ff.handle); if (ff.handle == IntPtr.Zero) { Console.WriteLine("ERROR, POINTER IS ZERO"); } if (err != 0) { throw new Exception($"Error: {err}"); } return(ff); }
public static unsafe FT_Char Load(FT_Face face, ulong charCode, int flags) { FT_Char ftc = new FT_Char(); __FTChar_Load(face.handle, charCode, flags); long adv = 0; fixed(int *sPtr = &ftc.size.x) fixed(int *bPtr = &ftc.bearing.x) __FTGlyph_Get_Info(face.handle, sPtr, bPtr, out adv); ftc.advance = (uint)adv; ftc.bitmap = new byte[ftc.size.x * ftc.size.y]; fixed(byte *bmpPtr = ftc.bitmap) __FTGlyph_Get_Bitmap(face.handle, bmpPtr); return(ftc); }