/* Cairo crashed when render some glyphs with specified fonts to PDF backend. * * a.out: cairo-array.c:182: * _cairo_array_index: Assertion `index < array->num_elements' failed. * Aborted (core dumped) */ #include #include int main() { cairo_surface_t *surface; cairo_t *cr; // select the pdf backend. surface = cairo_pdf_surface_create("out.pdf", 1, 1); cr = cairo_create(surface); // use the adobe-source-han-sans-cn-fonts. cairo_select_font_face(cr, "Source Han Sans CN", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); // core dumped. cairo_show_text(cr, "试"); // passed. // cairo_show_text(cr, "测"); cairo_destroy(cr); cairo_surface_destroy(surface); return 0; }