[Geany-devel] Printing fixes

Алексей Антипов 1a_antipov at xxxxx
Tue May 17 16:40:58 UTC 2011


Hi everybody,

I've recently tried printing come documents with Geany, and the result disappointed me. The right edges of lines would behave their own way, independent on printer settings and my own "field margins" patch. It seemed that the problem was deeper than just printer margins adjustment.

After all, I've created a patch containing a major code rewrite for printing.c. The main idea was to make use of Pango functionality for word wrapping and page calculations. That should fix the following issues:
 - When printing a non-ASCII UTF-8 text, long words go past right edge of the line
 - Add word wrapping abilities (use pango's WRAP_WORD_CHAR)
 - Use Pango capabilities to calculate page borders and other things more correctly

The only disadvantage of this code is that it takes more time to calculate page borders (i.e. where in text should a new page start). That's so because it would fill Pango layout with text and get its line count, repeating until lines_per_page is reached; all these actions give a more precise result, but are time consuming. I tried printing a 300-page Harry Potter book to PDF file, and the delay between sending a job and print start was several seconds. When printing typical amount of text (25-page formatted C code), the delay is neglectible.

Please consider the patch attached and some examples. These are PDF files with "lorem ipsum" printed from Geany in several variations both in English and Russian (2-byte UTF-8 chars). "Old" refer to current version of Geany, while "new" are for version with my patch.

The patch should be considered experimental, but, if you are interested in it, I can continue work and fix issues with it, if any

Regards,
Alexey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20110517/0aaaea80/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 50_printing.dpatch
Type: application/octet-stream
Size: 30645 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20110517/0aaaea80/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: examples.zip
Type: application/zip
Size: 219207 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20110517/0aaaea80/attachment.zip>


More information about the Devel mailing list