Advertisement
Guest User

hinting problems

a guest
May 31st, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.07 KB | None | 0 0
  1. /* Demonstrates inconsistent hinting in monospaced font. */
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. #include <ft2build.h>
  7. #include FT_FREETYPE_H
  8.  
  9. int
  10. main( int     argc,
  11.       char**  argv )
  12. {
  13.   FT_Library    library;
  14.   FT_Face       face;
  15.  
  16.   FT_Error      error;
  17.  
  18.   char*         filename;
  19.   char*         text;
  20.  
  21.   int           i;
  22.   int           textlen;
  23.  
  24.   if ( argc != 3 )
  25.   {
  26.     fprintf ( stderr, "usage: %s font text\n", argv[0] );
  27.     exit( 1 );
  28.   }
  29.  
  30.   filename      = argv[1];                           /* first argument     */
  31.   text          = argv[2];
  32.   textlen       = strlen(text);
  33.  
  34.   error = FT_Init_FreeType( &library );              /* initialize library */
  35.   error = FT_New_Face( library, filename, 0, &face ); /* create face object */
  36.   error = FT_Set_Char_Size( face, 11 * 64, 0, 0, 0);
  37.  
  38.   for (i=0; i!=textlen; ++i)
  39.   {
  40.     error = FT_Load_Char(face, text[i], FT_LOAD_DEFAULT);
  41.     printf("%c:%ld\n", text[i], face->glyph->advance.x);
  42.   }
  43.  
  44.   FT_Done_Face    ( face );
  45.   FT_Done_FreeType( library );
  46.  
  47.   return 0;
  48. }
  49.  
  50. /* EOF */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement