SoC #2 (KHTML Paged Media)

Allan Sandfeld Jensen kde at carewolf.com
Thu Sep 1 01:54:04 CEST 2005


So the project is over. The result is not quite final but is working and not 
far from being commitable to KDE 3.5.

I spend the 3 days of last week uncovering a bug between gcc and Qt. The bug 
was already known to for gcc 4.0, but I discovered it affected gcc 3.3 with 
-ffast-math as well. The basic result was broken post-script documents, that 
at first just look like a clipping mistakes.

After that I had to skip finishing a few goals, and have focused on getting a 
the pagination layout to work flawlessly. One of the assumption I made with 
only laying out one page at a time had to be removed. It was too difficulty 
in the KHTML framework to store the pagination. So I rewrote it to paginate 
all pages at once, which turned out to be a lot easier now that I understand 
the issues so much better.

The end result is this:
- I've rewritten all the KHTML pagination code to conform closer to the 
standard and enable better and cleaner page-breaks.
- I've fully implemented page-break-after/before/inside. 
- I've fully implemented orphans/widows
- Elements with display: fixed and fixed backgrounds now appear on every page
- I've written code to parse and interpret "@page" syntax, but do not apply it 
yet.
- I've written code to put KHTML into a paged non-print mode, but has not 
finished nor tested it.
- I've added the basis of a full document mode to the canvas to print/paint 
the entire document non-paged.
- I've designed a system for abstract px values, needed for high DPI devices, 
but have not had the time to implement it.

So not all of the high flying ideas came down to earth, but the new _working_ 
page layout system should form the basis for a strong printing future for 
KHTML.

The code can be found in KDE SVN under "branches/work/khtml-paged"

What remains to be done before committing to KDE 3.5 is
- More bug squishing
- Removing unfinished parts
- Basic speed and memory optimisations

`Allan


More information about the Kde-soc mailing list