/* gcc -Wall -g -O0 -o font-scaling font-scaling.c `pkg-config --cflags --libs pangocairo` */

#include <pango/pangocairo.h>

int
main (int argc, char **argv)
{
	cairo_surface_t *surf;
	cairo_t *cr;
	int i;
	PangoFontDescription *font_desc;

	surf = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1000, 1200);
	cr = cairo_create (surf);

	cairo_set_source_rgb (cr, 1, 1, 1);
	cairo_paint (cr);

	cairo_set_source_rgb (cr, 0, 0, 0);

	font_desc = pango_font_description_from_string ("Sans 12");

	for (i = 0; i < 10; i++) {
		PangoLayout *layout;
		int x, y;
		double scale;

		x = 20;
		y = 50 + i * 100;
		scale = 1 + i;

		cairo_save (cr);

		cairo_move_to (cr, x, y);
		cairo_scale (cr, scale, scale);

		layout = pango_cairo_create_layout (cr);
		pango_layout_set_font_description (layout, font_desc);
		pango_layout_set_text (layout, "Te", -1);

		pango_cairo_show_layout (cr, layout);
		g_object_unref (layout);

		cairo_restore (cr);
	}

	cairo_surface_write_to_png (surf, "letter-spacing.png");

	return 0;
}
