Texts in pdf are shorter than they should be
Probably rounding error accumulation. There are used integers for individual glyph positioning (TJ) and for widths array in pdf but computation during glyphs drawing probably works with little different numbers in pango units (or floats in cairo).
auto surface = cairo_pdf_surface_create("1_cairo.pdf", 2000, 800);
//auto surface = cairo_svg_surface_create("1_cairo.svg", 2000, 800);
auto ctx = cairo_create(surface);
auto layout = pango_cairo_create_layout(ctx);
auto desc = pango_font_description_new();
pango_font_description_set_family(desc, "LiberationSans");
pango_font_description_set_absolute_size(desc, pango_units_from_double(2));
pango_layout_set_font_description(layout, desc);
pango_layout_set_width(layout, pango_units_from_double(2000));
pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
string text;
for(int i = 0; i < 600; i++)text += "Text";
pango_layout_set_text(layout, text.data(), text.size());
pango_cairo_show_layout(ctx, layout);
cairo_show_page(ctx);
cairo_destroy(ctx);
cairo_surface_destroy(surface);
PDF:
SVG (how it is supposed to look in top-right corner):
Edited by misos1