/* Compile with
gcc -o weirdbug weirdbug.c -O6 -Wall -std=c99 -pedantic -W \
  `pkg-config --cflags --libs pango cairo pangocairo`
 */

#include <pango/pangocairo.h>

int
main (void)
{
  const double scale = 72/2.54;
  cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                                  2*scale, 2*scale);
  cairo_t *cr = cairo_create (surface);
  cairo_scale (cr, scale, scale);
  PangoFontDescription *fdesc = pango_font_description_new ();
  pango_font_description_set_family (fdesc, "DejaVu Sans");
  pango_font_description_set_size (fdesc, 1.2*PANGO_SCALE);
  PangoLayout *layout = pango_cairo_create_layout (cr);
  pango_layout_set_font_description (layout, fdesc);
  pango_layout_set_text (layout, "rc", -1);
  cairo_move_to (cr, 0., 0.);
  cairo_set_source_rgb (cr, 0., 0., 0.);
  pango_cairo_show_layout (cr, layout);
  cairo_show_page (cr);
  cairo_surface_write_to_png (surface, "output.png");
  return 0;
}
