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

List:       kde-bugs-dist
Subject:    Bug#24485: wrong font size at resolution != 75 dpi
From:       David Faure <david () mandrakesoft ! com>
Date:       2001-05-01 1:41:32
[Download RAW message or body]

On Wednesday 25 April 2001 19:11, Magnus Kessler wrote:
> David,
> 
> what you suggest is equivalent to the patch I posted earlier. It works fine 
> on the screen, but leads to fonts being too small on the printed page. 
Ooops, stupid me. Indeed, it does the same currently.

> Still, this is much better than the current situation, where neither screen nor 
> printed page are quite right (remember, currently the font size on the 
> printed page seems OK, but the line spacing is not in addition to the lines 
> being too short).

QFontMetrics::printerAdjusted()
{
    if ( painter && painter->device() &&
         painter->device()->devType() == QInternal::Printer) {
// [....]
        int res = QPaintDevice::x11AppDpiY();
        return ( val * 75 + 36 ) / res;
    else
        return val;
}

I'm guessing this is what's working against KWord.
I just don't know how to deactivate this code.... Maybe I'll simply have
to reverse the calculation and apply that factor to the font sizes when
printing. Huh :(

And I'm sure Qt3 is going to change all that, in addition.... 
(QFont is a completely different beast in Qt3).

> BTW, on a 75dpi display this patch looks equally OK, and the printed output 
> looks OK too. Presumably this has something todo with the fact that 75 dpi ~ 
> 72 dpi and rendering errors are too small to be noticed.

The above code matches this. With a DPI of 75dpi, no problem.

> I think much could be gained by only ever rendering with a zoom factor of 
> 1.00, i.e. no additional zoom is calculated into font-sizes, rectangles, etc. 
> If I understand QPainter correctly, a zoom factor can then be applied 
> separately in the form of a transformation matrix (or scaling of the 
> QPainter). Something like this is used in the Qt drawdemo and xform apps.

I tried that initially. Drawing a 12 pt font with a zoom of 500% leads
to a _really_ ugly result. To get a nice zoomed font, you want to use a bigger
font. Otherwise you just scale up a bitmapped output, which is just unbearable.

This is why we zoom the fonts. I took the solution from KPresenter, and Reggie
confirmed that there is no better way, to the best of his knowledge.

I plan to use scaling for zooms < 100% though, to get a more precise
result than we currently get (due to rounding errors, for instance in
paragraph heights, etc.)

> PS: from what I can see in the other koffice apps, they suffer from similar 
> scaling problems, all having been developed exclusively on 75dpi displays.

I'm not using a 75dpi display. But this issue isn't easy, yes.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://perso.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today

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

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