Subscripts and superscripts are too small and incorrectly offset
Render this text with Pangocairo using Gentium: super<sup>4</sup> sub<sub>4</sub>
. In the output file the subscript and superscript text is too small and the subscript one gets printed way too low. Here is a comparison picture of the output with Pangocairo and LibreOffice:
A full program to demonstrate the issue:
#include <pango/pangocairo.h>
#include <cairo-pdf.h>
#include <locale.h>
#include <assert.h>
int main() {
setlocale(LC_ALL, "");
cairo_surface_t *surface = cairo_pdf_surface_create("pangocairotest.pdf", 595, 842);
cairo_t *cr = cairo_create(surface);
PangoLayout *layout = pango_cairo_create_layout(cr);
PangoFontDescription *desc;
desc = pango_font_description_from_string("Gentium");
assert(desc);
pango_font_description_set_absolute_size(desc, 10 * PANGO_SCALE);
pango_layout_set_font_description(layout, desc);
pango_font_description_free(desc);
cairo_move_to(cr, 72, 72);
pango_layout_set_markup(layout, "super<sup>4</sup> sub<sub>4</sub>", -1);
pango_cairo_update_layout(cr, layout);
pango_cairo_show_layout(cr, layout);
pango_layout_set_attributes(layout, NULL);
cairo_surface_destroy(surface);
cairo_destroy(cr);
return 0;
}