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

List:       koffice-devel
Subject:    Re: [PATCH] Font Size -1 Problem
From:       Nicolas Goutte <nicog () snafu ! de>
Date:       2001-11-23 20:34:27
[Download RAW message or body]

On Wednesday, 21. November 2001 23:39, David Faure wrote:
> On Wednesday 21 November 2001 21:06, Nicolas Goutte wrote:
> > >         // Verify if we have a valid point size
> > >         if ( font.pointSize() == -1 )
> > >             font.setPointSize( defaultFont.pointSize() );
> >
> > I have tried to be compatible with previous versions of KWord. They gave
> > me a 11pt font. If I use defaultFont.pointSize(), I get a 12pt one.
>
> This is very interesting. It proves that there is a bug with defaultFont !
> Your "general font" is configured in KControl to be 11pt then ?

No, Helvetica 12pt.

But every previous versions of KWord gave me 11pt (I have verified with KDE 
2.2.x (2001-09-22) / KOffice 1.1.x (2001-10-25?) )  Until recently, I thought 
that it was fixed somewhere, until I found out that 12*72/75 rounds down to 
11.

KWord CVS HEAD gives me 12pt.

(In both case with the empty document.)

> In KWDoc's constructor, I did:
> m_defaultFont.setPointSize( ptToLayoutUnit(
> QFontInfo(m_defaultFont).pointSize() ) ); this should get 11 from
> qfontinfo, and convert it to something like 11*20 on a 72 DPI display
> (11*1440/DPIY more precisely, I think).
>
> > However, we could argue if to keep such a compatibility is needed or not.
>
> The goal hasn't changed, we want the same fontsize as the one configured
> in KControl (and saved in kdeglobals) for the "general font". If we get
> a different result, there's a bug.

I understand. And yes, it is better if the user has control through kcontrol. 
He could set 11 temporarily if the layout of his KWord file is too much 
changed.

>
> > > I'm surprised that you can get a pointsize of -1 though.
> >
> > The default font (Helvetica) is a bitmap. It seems that in this case, QT
> > defaults to pixel sizes.
>
> Ah, that could be why I didn't see this bug. I don't have helvetica...
>
> > Without patch, it is with a <FONT> tag, refFormat is null or not null.
> > With patch, it is with <FONT> tag, refFormat is null.
>
> Then we definitely need to do the fix I was suggesting ("setting the font
> to the defaultFont if refFormat isn't set (as an else of the first if()").
> Can you test that ?

I will do! From what kdDebug tells me, it should work. If it does, I will 
commit it to CVS directly.

>
> > However, my test file has always <FONT> tags, as it was saved whit an old
> > KWord that always saved <FONT> tags.
>
> But the templates don't have FONT tags, so that the default font, coming
> from kcontrol, is used.

Ah, I understand the problem. Yes, then it is better to define correctly the 
font.

>
> > That is a possibility too, if you want to be incompatible with the
> > behaviour of old KWord versions.
>
> I think we should get the font from m_defaultFont, and fix m_defaultFont if
> necessary.

Have a nice day/evening/night!

_______________________________________________
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