-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add title parameter to specify titles for SVGs and PDFs #15
Comments
AFAIK cairographics still doesn't support metadata so there is no way for Cairo to do that until that feature is added upstream. At least support for PDF metadata has been discussed on the cairographics lists some 7 years ago, but given that it's still not there I would not hold my breath. |
Since cairographics version 1.16 there is now cairo_pdf_surface_set_metadata |
Neat! |
After such an encouragement ;) this is now implemented for the PDF back-end. I have also added other metadata entries supported by cairo. Note that this requires cairo library version 1.16, the extra arguments will be silently ignored when used with older versions. Unfortunately, the SVG back-end in cairo has not added this option. I will close this issue for now. If someone is interested in SVG, they may need to file it upstream and it would be then easy to add it here since we have the precedent of handling this for PDF. |
It’s the little things! Having a their PDF viewer show something meaningful in its window title could just make the difference between some overworked PhD student rediscovering what that specific plot meant and how it fits into the whole. Thank you for doing it, I think I couldn’t have quickly figured out how to do the necessary incantations in pdf-backend.c |
And it works! With IRkernel/repr#156: > install.packages("Cairo", repo="https://rforge.net/")
> library(repr)
> plot(sqrt(1:10))
> title('roots')
> recordPlot() |> repr_pdf() |> writeBin('test.pdf') |
Both PDFs (through metadata) and SVGs (through
title
) have the capability for titles.instead of ignoring the
title
parameter, it should work for all output types that have the necessary capabilities.The text was updated successfully, but these errors were encountered: