1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 |
| #include <ft2build.h> | #include <freetype/freetype.h> | #include <freetype/fterrors.h> | #include <freetype/ftoutln.h> | #include <freetype/ftbitmap.h> | #include <freetype/fttrigon.h> | | //auxiliary function | void | finalizer(void* p1){} | | int main(int argc, char *argv[]) | { | //preamble | FT_Library alibrary = 0; | FT_Init_FreeType((FT_Library*)&alibrary); | | FT_Face face = 0; | FT_New_Face( | alibrary, | "testdata/sample.txt", | 0, | &face); | | void* data = malloc(256); | FT_Angle angle = FT_Atan2(72, 80); | FT_Fixed linearHoriAdvance = FT_Cos(angle); | FT_Bitmap bitmap; | FT_Bitmap_New(&bitmap); | | FT_Outline outline; | FT_Outline_New( | alibrary, | 5, | 6, | &outline); | | void* control_data = malloc(256); | void* other = malloc(256); | FT_GlyphSlotRec glyph = { | .library = alibrary, | .face = face, | .next = 0, | .reserved = 0, | .generic = (FT_Generic) {.data = data, .finalizer = &finalizer}, | .metrics = (FT_Glyph_Metrics) { | .width = 8, | .height = 16, | .horiBearingX = 3L, | .horiBearingY = 4L, | .horiAdvance = 5L, | .vertBearingX = 6L, | .vertBearingY = 7L, | .vertAdvance = 8L}, | .linearHoriAdvance = linearHoriAdvance, | .linearVertAdvance = linearHoriAdvance, | .advance = (FT_Vector) {.x = 8, .y = 16}, | .format = FT_GLYPH_FORMAT_COMPOSITE, | .bitmap = bitmap, | .bitmap_left = 3, | .bitmap_top = 4, | .outline = outline, | .num_subglyphs = 7, | .subglyphs = 0, | .control_data = control_data, | .control_len = 1, | .lsb_delta = 8L, | .rsb_delta = 9L, | .other = other, | .internal = 0}; | FT_Int* p_index = (FT_Int*) malloc(sizeof(FT_Int)*256); | FT_UInt p_flags [] = { | 0, | 1, | 2, | 3}; | FT_Int* p_arg1 = (FT_Int*) malloc(sizeof(FT_Int)*256); | FT_Int* p_arg2 = (FT_Int*) malloc(sizeof(FT_Int)*256); | FT_Matrix p_transform [] = { | (FT_Matrix) { | .xx = linearHoriAdvance, | .xy = linearHoriAdvance, | .yx = linearHoriAdvance, | .yy = linearHoriAdvance}, | (FT_Matrix) { | .xx = linearHoriAdvance, | .xy = linearHoriAdvance, | .yx = linearHoriAdvance, | .yy = linearHoriAdvance}, | (FT_Matrix) { | .xx = linearHoriAdvance, | .xy = linearHoriAdvance, | .yx = linearHoriAdvance, | .yy = linearHoriAdvance}, | (FT_Matrix) { | .xx = linearHoriAdvance, | .xy = linearHoriAdvance, | .yx = linearHoriAdvance, | .yy = linearHoriAdvance}, | (FT_Matrix) {0}}; | FT_Get_SubGlyph_Info( | &glyph, | 0, | p_index, | p_flags, | p_arg1, | p_arg2, | p_transform); //target call | return 0; | } |
|