Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Demonstrates inconsistent hinting in monospaced font. */
- #include <stdio.h>
- #include <string.h>
- #include <ft2build.h>
- #include FT_FREETYPE_H
- int
- main( int argc,
- char** argv )
- {
- FT_Library library;
- FT_Face face;
- FT_Error error;
- char* filename;
- char* text;
- int i;
- int textlen;
- if ( argc != 3 )
- {
- fprintf ( stderr, "usage: %s font text\n", argv[0] );
- exit( 1 );
- }
- filename = argv[1]; /* first argument */
- text = argv[2];
- textlen = strlen(text);
- error = FT_Init_FreeType( &library ); /* initialize library */
- error = FT_New_Face( library, filename, 0, &face ); /* create face object */
- error = FT_Set_Char_Size( face, 11 * 64, 0, 0, 0);
- for (i=0; i!=textlen; ++i)
- {
- error = FT_Load_Char(face, text[i], FT_LOAD_DEFAULT);
- printf("%c:%ld\n", text[i], face->glyph->advance.x);
- }
- FT_Done_Face ( face );
- FT_Done_FreeType( library );
- return 0;
- }
- /* EOF */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement