/* cc -o pango-small-bug `pkg-config --cflags --libs pangocairo` pango-small-bug.c */

#include <stdio.h>
#include <cairo.h>

#include <pango/pangocairo.h>

#define FONT_SIZE 100

#define WIDTH FONT_SIZE * 8
#define HEIGHT FONT_SIZE * 1.2

static void
show_pango_small_bug (cairo_t *cr)
{
    PangoLayout *layout;
    PangoFontDescription *font_description;

    font_description = pango_font_description_new ();
    pango_font_description_set_family (font_description, "serif");
    pango_font_description_set_absolute
	    size (font_description, FONT_SIZE * PANGO_SCALE);

    layout = pango_cairo_create_layout (cr);
    pango_layout_set_font_description (layout, font_description);
    pango_layout_set_markup (layout, "not small<small>small</small>", -1);

    cairo_move_to (cr, 0, 0);

    pango_cairo_show_layout (cr, layout);

    g_object_unref (layout);
    pango_font_description_free (font_description);

}

int
main(int argc, char *argv[])
{
    cairo_t *cr;
    cairo_surface_t *surface;

    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
					  WIDTH, HEIGHT);
    cr = cairo_create (surface);

    show_pango_small_bug (cr);
    
    cairo_surface_write_to_png (surface, "pango-small-bug.png");
    cairo_destroy (cr);
    cairo_surface_destroy (surface);

    return 0;
}

