Cannot use an opentype font with an empty postscript name
When using an opentype font with an empty postscript name nothing is renderered because the font isn't embedded in the pdf.
For example, compiling and running plop.c with font in the same directory Cantarell-Regular_1.otf (I used ttx
on Cantarell, removed the postscript name and then regenerated font using ttx too) will create a pdf without the font.
After few investigations, I think the issue is here:
https://github.com/freedesktop/cairo/blob/63f0d6268469dcd12316ea405a026f4be900dd79/src/cairo-cff-subset.c#L2049
the function cff_index_append_copy
uses a cairo_malloc
with a zero argument which returns NULL
and finally the status reflect a memory issue when it's just an empty string.
So an easy fix is to handle the 0 case in cff_index_append_copy
.