Skip to content

Fix setting antialiasing by editing Cairo context.

Jehan Pagès requested to merge Jehan/poppler:master into master

Some context: I am a GIMP developer, and importing PDF with antialiasing broke. After looking at your code, I realize you are always overriding the antialiasing in the Cairo context. This made sense for the CLI tool (for which I see you made this change), but not for people using the glib API as we simply create a cairo context, set it however we like and run poppler_page_render(). This used to work for years, but now this is broken.

So here is a fix. :-)

Thanks!

Commit 853e9499 added setAntialias() to CairoOutputDev, in particular to allow setting up antialiasing on the pdftocairo utils through a CLI option (-antialias). Unfortunately this broke applications which used the glib API and used to simply set the antialiasing through the Cairo context, and now always get the default antialiasing (even if we added a new API, it would break API behavior and simplicity).

Instead only use the antialias member if it is set to non-default, which means it has been changed explicitly by some means. Keep the cairo context as-is otherwise.

Edited by Albert Astals Cid

Merge request reports