/*
** font.c
** 
** Made by (Arne Caspari)
** Login   <arne@arne-laptop>
** 
** Started on  Tue Dec 19 18:30:39 2006 Arne Caspari
** Last update Mon Jan  8 22:28:10 2007 Arne Caspari
*/

#include <pango/pangoft2.h>

#include <ft2build.h>
#include FT_FREETYPE_H

#define DEFAULT_FONT "Sans"


int main( int argc, char **argv )
{
   PangoContext         *context;
   PangoFontDescription *desc;
   PangoFT2FontMap      *fontmap;
   PangoLayout          *layout;
   FT_Bitmap             bitmap;
   int                   width;
   int                   height;
   const char * font = DEFAULT_FONT;

   int size = 10;
   const char * text = "foo";
   
   
   
   while( 1 )
   {
      fontmap = pango_ft2_font_map_new ();
      context = pango_ft2_font_map_create_context (fontmap);
      g_object_unref (fontmap);
      
      desc = pango_font_description_from_string (font);
      if (size > 0)
      {
	 pango_font_description_set_size (desc, 10 * PANGO_SCALE);
      }
      
      layout = pango_layout_new (context);
      pango_layout_set_font_description (layout, desc);
      pango_font_description_free (desc);
      
      pango_layout_set_text (layout, text, -1);

      pango_layout_get_size (layout, &width, &height);

      g_object_unref (layout);
      g_object_unref (context);
   }
   
   return 0;
}
