Updated PDF printing with Cairo
![](https://secure.gravatar.com/avatar/bad456b6678947bf0dbf4771eebf99d8.jpg?s=120&d=mm&r=g)
Hi,
I attached the updated PDF printing extension with Cairo. Now it has proper transparency handling and better text handling. Also, now it has it's own entry in the Save As dialog as "Cairo PDF". In order to use it you have to apply the following patch to Cairo 1.2: http://lists.freedesktop.org/archives/cairo/2006-July/007477.htm Without applying the patch you will get only fallback images most of the time. I already separated the patch into smaller ones and submitted it to be incorporated into Cairo. The resulting text output in this version differs from that of Inkscape's regarding the positioning of glyphs. Text printed in PDF will usually occupy more space horizontally/vertically than as it can be seen in Inkscape. This is especially true for vertical text in which case spaces are smaller between words. Does anyone have an idea how I could get the exact glyph positions used by libnrtype to render glyphs? [I could only come up with crazy ideas like calling Layout::show with a prepared nr_arena and then extracting the glyphs later from that nr_arena] Unfortunately the output of the about screen for Inkscape version 0.40 isn't correct; it might be because of the mess with transparency inheritance. After applying patch.bin to the Inkscape source tree copy the other files in the archive to their respective location and do the usual build process. Please feel free to try it out and report your experience on the list.
Regards, miklos
![](https://secure.gravatar.com/avatar/214fe9a0ecb4aed8994e8618ade6f5a8.jpg?s=120&d=mm&r=g)
Miklós Erdélyi wrote:
Hi,
I attached the updated PDF printing extension with Cairo. Now it has proper transparency handling and better text handling. Also, now it has it's own entry in the Save As dialog as "Cairo PDF". In order to use it you have to apply the following patch to Cairo 1.2: http://lists.freedesktop.org/archives/cairo/2006-July/007477.htm Without applying the patch you will get only fallback images most of the time. I already separated the patch into smaller ones and submitted it to be incorporated into Cairo. The resulting text output in this version differs from that of Inkscape's regarding the positioning of glyphs. Text printed in PDF will usually occupy more space horizontally/vertically than as it can be seen in Inkscape. This is especially true for vertical text in which case spaces are smaller between words. Does anyone have an idea how I could get the exact glyph positions used by libnrtype to render glyphs? [I could only come up with crazy ideas like calling Layout::show with a prepared nr_arena and then extracting the glyphs later from that nr_arena] Unfortunately the output of the about screen for Inkscape version 0.40 isn't correct; it might be because of the mess with transparency inheritance. After applying patch.bin to the Inkscape source tree copy the other files in the archive to their respective location and do the usual build process. Please feel free to try it out and report your experience on the list.
Regards, miklos
I've tried applying this and it seems to work great. Doing it this way will allow people to use either method of PDF output.
It would be good if someone on Linux could apply this, check it out, and commit it, so that people can give it a try. I can do it myself, but it would be safer if someone adjusted the automake stuff properly before committing.
I think that this is also a great first step toward using Cairo more generally as an alternate output engine.
Thanks, Miklos!
bob
![](https://secure.gravatar.com/avatar/afe7702806550fad40bf6cfb76ab3c02.jpg?s=120&d=mm&r=g)
Does anyone have an idea how I could get the exact glyph positions used by libnrtype to render glyphs? [I could only come up with crazy ideas like calling Layout::show with a prepared nr_arena and then extracting the glyphs later from that nr_arena]
Is Layout::characterAnchorPoint() (http://inkscape.modevia.com/doxygen/html/classInkscape_1_1Text_1_1Layout.php...) what you're after?
If not, could you describe more accurately which position you do want?
You may have noticed that the current printing support is built in to the Layout class (Layout::print()), so I wouldn't be at all surprised if there isn't enough information available on the outside to do what you're trying to do.
Richard.
![](https://secure.gravatar.com/avatar/214fe9a0ecb4aed8994e8618ade6f5a8.jpg?s=120&d=mm&r=g)
I just committed the files and did a win32 build here: http://inkscape.modevia.com/win32/Inkscape0607281436.zip
It does PDF transparencies fine. But, yes, Cairo needs the patch for gradients.
Makefile_insert looks ok, but can someone on Linux please check it out? Thanks.
bob
![](https://secure.gravatar.com/avatar/2d5c2921357acb3e472f0968ac01868f.jpg?s=120&d=mm&r=g)
Bob, I brought down :
It unpacked OK and started. However, after drawing one line and then trying to select it I got the attached error message and Inkscape aborted. I have had this happen before on a build but cannot remember how I got round it. This was a clean download with no file replacements.
regards, Erik
![](https://secure.gravatar.com/avatar/214fe9a0ecb4aed8994e8618ade6f5a8.jpg?s=120&d=mm&r=g)
Erik Halbert wrote:
Bob, I brought down :
It unpacked OK and started. However, after drawing one line and then trying to select it I got the attached error message and Inkscape aborted. I have had this happen before on a build but cannot remember how I got round it. This was a clean download with no file replacements.
regards, Erik
I have not seen that problem, and I do try to make sure that I use the same binary that I upload. That way I can really empathize with the user! ^^
In fact, I just tried that and didn't get see the problem. I'll look around some more to see if I can reproduce it.
bob
![](https://secure.gravatar.com/avatar/2d5c2921357acb3e472f0968ac01868f.jpg?s=120&d=mm&r=g)
Bob, I just reinstalled it with the same result. I do have several other versions of Inkscape running but this one should be separate. Before closing down it gives the attached message. What would the error log be called and where would it be?
Erik
participants (5)
-
Bob Jamison
-
Erik Halbert
-
Miklós Erdélyi
-
Richard Hughes
-
Ted Gould