Guillaume Pothier wrote:
Hmm funny, part the problem seems to be with kpdf/okular then, as I
can indeed see the circled numbers in acroread.
Generally when you are having issues with a PDF file is is best to check
it with acroread. Many PDF viewers do not have complete support for
everything in the PDF Reference.
However, the generated
pdf is very slow to open, both with kpdf and acroread. In the former
the whole page takes about 7 seconds to get (incorrectly) rendered. In
the latter I can see the circled numbers appearing one after another,
like two elements per second; it takes about 5s to render the whole
page.
What is happening here is you are drawing circles with a fill and stroke
and an opacity of 86%. To achieve this effect in cairo requires drawing
the fill and stroke in a group then painting the group through a mask
with alpha = 86%. In the PDF file there is a group for the fill and
stroke of the circle that is painted through a soft mask containing a
solid fill with alpha = 86%.
The reason for the slow rendering is that currently cairo creates this
group and smask with the size of the page. The problem for PDF viewers
is that they need to render the fill and stroke to an image the size of
the page then composite the image though an smask the size of the page.
Obviously this is not ideal. Cairo should create groups with the exact
size of the group. This is something I intend to fix.
I imported the generated pdf back into inkscape, and it seems the
structure just isn't right. There is an awful lot of nested groups
that contain only one leaf element. Many of those are paths filled
with a pattern, it seems those patterns are the circled numbers. It
seems the main image is also a pattern-filled path with some clipping.
The PDF structure that cairo writes is not optimized for importing. This
is something that I intend to fix. I have previously focussed on
eliminating unnecessary rasterization in the cairo PDF output. Now that
work is complete I can do more to optimize the PDF output.