[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    RFC: #43578: vertical cell borders are not aligned correctly
From:       Philipp =?iso-8859-1?q?M=FCller?= <philipp.mueller () gmx ! de>
Date:       2002-07-08 15:31:32
[Download RAW message or body]

Hello List and KSpread developers,
 
I'm working (since weeks) on fixing this bug and (as I'm not that
experienced in finding) came last week to the real reason for the problem and 
started to fix it.

Bug in principle: On preview and printout vertical borders overlap corners.
 
The reason for the problem is that we cannot assume the correct width of lines 
on printout, more detailed to correctly paint the pixels for a correct 
corner.
 
To illustrate this a short picture of a corner and how we make it today:
 
    ...BBBBBB
    ...BBBBBB
y   AAAAABBBB
    AAAAABBBB
    AAAAABBBB
    AAAAA
    AAAAA
 
      x
The lines A (vertical) and B (horzontal) both have a width of 5 dots and
have the same end point at x/y.
The area where I made the dot's needs to be printed manually, to make a
"lovely" corner.
We currently take the width of the horizontal line devided by 2 and extent
the painting of the vertical line according to it (koBorder does it the other
way round, it extends the horizontal line but is in principle the same). 

This is correct on screen, but not on printout or preview. On printout it
may not be visible but on preview it is.
 
On printout you get rounding issues, as the width of 5 points is scaled to
the dpi of your printer. At least it is scaled to the dpi of you screen, when
in preview mode of ghostscript. But depending on the printer/preview zoom,
the scaling results in different rounded widths, which you cannot calculate in
behalf.
 
The current situation in KSpread is even worse as I previously forced the 
granularity to 72dpi (for a differnet reason), so we can only adjust our 
printing with this low resolution.
 
Rounding issue:
All lines are drawn with a width from the middle axis away. The width is 
scaled according to the dpi setting/zoom level. We don't know in behalf, if 
it with be scaled to an even or odd number, so we cannot decide if we need to 
add a pixel-line at the end of or crossed line or not. 
 
Okay, you can now already calculate with a resolution of 1440 dpi, but this
doesn't help you in preview, as there the resolution is again scaled down to
your physical screen and to the zoom level of preview. Again rounding and
ugly corners/overlapping lines.
 
So in any case you will get problems with nice corners if you use lines.
 
Now to the 2 topics why I bother you:
1st:
We need a real fix for KOffice 1.3. I've seen these overlapping lines in
KWord print preview too, so I'm rather sure, that it cannot be solved with the
current way of painting corners in koBorder.
 
My asumption is, that we need to paint all lines with rects and make width,
linestyle and color manually. Only with this way we don't depend on the
physical painting and scaling of the width of lines and can be sure that a 
corner starts at a give x/y - point.
 
2nd: 
I have at least a minimum fix for the current heavy mispainting of KSpread.
For a different reason we forced a resolution of 72dpi for all painting
calculation. This makes really ugly corners. My fix is to force now 1440 dpi 
for painting on printout, which includes a lot of adjustment in all painting 
routines.
 
My fix is a kind of hack, as it doesn't change the painting on screen, it
only adds a factor when we are on printout. The factor is 1.0 on screen, so no
painting on screen is affected at all. 

It's only 75% ready, so I didn't upload it yet and it may introduce some
subtil bugs on printout, which I forgot to test and fix. We will reprogram the
whole painting after the release of KOffice anyway, when we switch to koText.
Hard part are the text paintings, as text is already calculated in physical
coordinates of the resolution. Only col/row pos needs to be adjusted.
 
With my fix, we are at least as incorrect as KWord with table corners, this 
is what I can confirm so far.


So my 2 questions and 1 advice:
1. How do you think, we can avoid corner problems in future? Painting in
rect coordinates or do you have a different suggestion?
Or did I completely miss it and only found a bug in KWord?
I would like to have a correct koBorder, which can be reused in all KO
applications.

2. Shall I risk some printing problems and upload it for more testing before
rc1 (after more polishing on my side) or shall we rather stick with the 
current printout ugliness until KO1.3?

3. Please currently don't touch kspread_cell.cc too much, as there are most
changes and I want to avoid merging problems.


Flames, suggestions, comments...


Philipp
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic