| 1 | /* Exercise the installed BDF driver and the bitmap returned to a font client. */ |
| 2 | #include <ft2build.h> |
| 3 | #include FT_FREETYPE_H |
| 4 | |
| 5 | int main(void) |
| 6 | { |
| 7 | static const unsigned char font[] = |
| 8 | "STARTFONT 2.1\nFONT -vinix-test-medium-r-normal--8-80-72-72-c-80-iso10646-1\n" |
| 9 | "SIZE 8 72 72\nFONTBOUNDINGBOX 8 8 0 0\n" |
| 10 | "STARTPROPERTIES 4\nFONT_ASCENT 8\nFONT_DESCENT 0\n" |
| 11 | "CHARSET_REGISTRY \"ISO10646\"\nCHARSET_ENCODING \"1\"\nENDPROPERTIES\n" |
| 12 | "CHARS 1\nSTARTCHAR A\nENCODING 65\nSWIDTH 1000 0\nDWIDTH 8 0\n" |
| 13 | "BBX 8 8 0 0\nBITMAP\n18\n24\n42\n7E\n42\n42\n42\n00\nENDCHAR\nENDFONT\n"; |
| 14 | FT_Library library; |
| 15 | FT_Face face; |
| 16 | if (FT_Init_FreeType(&library) || |
| 17 | FT_New_Memory_Face(library, font, sizeof(font) - 1, 0, &face) || |
| 18 | FT_Select_Size(face, 0) || !FT_Get_Char_Index(face, 'A') || |
| 19 | FT_Load_Char(face, 'A', FT_LOAD_RENDER)) |
| 20 | return 1; |
| 21 | const FT_Bitmap *bitmap = &face->glyph->bitmap; |
| 22 | int failed = bitmap->rows != 8 || bitmap->width != 8 || |
| 23 | bitmap->pixel_mode != FT_PIXEL_MODE_MONO || bitmap->buffer[0] != 0x18; |
| 24 | FT_Done_Face(face); |
| 25 | FT_Done_FreeType(library); |
| 26 | return failed; |
| 27 | } |
| 28 | |