void DoWork() { ANT_Library library; ANT_Face face; ANT_GlyphSlot slot; // transformation matrix ANT_Matrix matrix = new ANT_Matrix(); // untransformed origin ANT_Vector pen = new ANT_Vector(); ANT_Error error; string filename; string text; double angle; int target_height; int n, num_chars; filename = Common.Example_AltNETType_FontFileName; text = "AltNETType = FreeType.NET"; num_chars = text.Length; // use 25 degrees angle = (25.0 / 360) * 3.14159 * 2; target_height = HEIGHT; // initialize library error = ANT.ANT_Init_AltNETType(out library); // error handling omitted // create face object error = ANT.ANT_New_Face(library, filename, 0, out face); // error handling omitted if (error != ANT_Error.ANT_Err_Ok) { return; } // use 50pt at 100dpi // set character size error = ANT.ANT_Set_Char_Size(face, 50 * 64, 0, 96, 0); // error handling omitted slot = face.glyph; // set up matrix matrix.xx = (int)(Math.Cos(angle) * 0x10000L); matrix.xy = (int)(-Math.Sin(angle) * 0x10000L); matrix.yx = (int)(Math.Sin(angle) * 0x10000L); matrix.yy = (int)(Math.Cos(angle) * 0x10000L); // the pen position in 26.6 cartesian space coordinates; // start at (25, 503) relative to the upper left corner pen.x = 15 * 64; pen.y = (target_height - (HEIGHT - 20)) * 64; for (n = 0; n < num_chars; n++) { // set transformation ANT.ANT_Set_Transform(face, matrix, pen); // load glyph image into the slot (erase previous one) error = ANT.ANT_Load_Char(face, text[n], ANT_LOAD.ANT_LOAD_RENDER); if (error != ANT_Error.ANT_Err_Ok) { // ignore errors continue; } // now, draw to our target surface (convert position) draw_bitmap(slot.bitmap, slot.bitmap_left, target_height - slot.bitmap_top); // increment pen position pen.x += slot.advance.x; pen.y += slot.advance.y; } show_image(); ANT.ANT_Done_Face(ref face); ANT.ANT_Done_AltNETType(ref library); }