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

List:       koffice-devel
Subject:    
From:       David Faure <faure () kde ! org>
Date:       2003-04-29 1:04:08
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Qt-3.1.2

One bug and one patch for the font loading mechanism, when XFT is _not_ present.
First, I found the obvious following typo when trying to debug the problem described \
below:

Index: qfont_x11.cpp
===================================================================
RCS file: /home/kde/qt-copy/src/kernel/qfont_x11.cpp,v
retrieving revision 1.79
diff -u -p -r1.79 qfont_x11.cpp
- --- qfont_x11.cpp	3 Mar 2003 16:44:36 -0000	1.79
+++ qfont_x11.cpp	29 Apr 2003 00:44:37 -0000
@@ -1973,7 +1973,7 @@ QCString QFontPrivate::bestMatch( const 
 			      tokens[Spacing],
 			      tokens[CharsetRegistry],
 			      tokens[CharsetEncoding] );
- -	    best.scale = bestScalable.score;
+	    best.score = bestScalable.score;
 	    best.scale = bestScalable.scale;
 	    best.name = bestName.data();
 	}

However this doesn't fix my bug.

On this system (no RENDER extension -> no libXft being used), I have the font
- -ms-arial-medium-r-normal--0-0-0-0-p-0-iso8859-1
which is smoothly-scalable, and seen by QFontDatabase.
I have no ms-arial font in another charset.

I'm trying to load that font with the following code snippet:
#include <qfont.h>
#include <qfontinfo.h>
#include <qapplication.h>

int main ( int argc, char **argv)
{
    QApplication app( argc, argv);
    QFont fn( "Arial [Ms]", 12 );
    fn.setStyleStrategy( QFont::ForceOutline );
    qDebug("QFontInfo says: %s", QFontInfo(fn).family().latin1());
    return 0;
};

However it won't load the scalable latin1 Arial font, it will choose
the ugly, not scalable helvetica font, because it's Unicode. And this
despite the ForceOutline flag!

More precisely, I get \
-adobe-helvetica-medium-r-normal--17-120-100-100-p-88-iso10646-1 which is definitely \
NOT scalable (QFontDatabase agrees on that).

I enabled QFONTLOADER_DEBUG and QFONTLOADER_DEBUG_VERBOSE, added my own 
debug output too, and here's what I get:

QFontLoader: trying to load unicode font
QFontLoader: getting font name for family Arial [Ms]
QFontLoader: getting font name for family Arial [Ms], qt_has_xft:0 preferbitmap:0 \
rawMode:0 findFont request.family=Arial [Ms] familyName=arial foundryName=ms \
addStyle=* Trying bestMatch with pattern=-ms-arial-*-*-*-*-*-*-*-*-*-*-iso10646-1
bestMatch: returning (null)
bestFamilyMember: comparing bestScore=0 with prettyGoodScore=412
Trying bestMatch with pattern=-*-arial-*-*-*-*-*-*-*-*-*-*-iso10646-1
bestMatch: returning (null)
Trying bestMatch with pattern=-ms-arial-*-*-*-*-*-*-*-*-*-*-unicode-*
bestMatch: returning (null)
bestFamilyMember: comparing bestScore=0 with prettyGoodScore=412
Trying bestMatch with pattern=-*-arial-*-*-*-*-*-*-*-*-*-*-unicode-*
bestMatch: returning (null)
 substitution: trying familyName=helvetica foundryName=(null) addStyle=*
bestFamilyMember: comparing bestScore=0 with prettyGoodScore=412
Trying bestMatch with pattern=-*-helvetica-*-*-*-*-*-*-*-*-*-*-iso10646-1
bestMatch: returning -adobe-helvetica-medium-r-normal--17-120-100-100-p-88-iso10646-1
findFont: after substitution, returning \
                -adobe-helvetica-medium-r-normal--17-120-100-100-p-88-iso10646-1 \
                (unicode)
QFontLoader: putting \
'-adobe-helvetica-medium-r-normal--17-120-100-100-p-88-iso10646-1' (64) into name \
dict QFont::load: using name \
                '-adobe-helvetica-medium-r-normal--17-120-100-100-p-88-iso10646-1'
QFontLoader: useCore set. will load font \
                '-adobe-helvetica-medium-r-normal--17-120-100-100-p-88-iso10646-1'
QFontLoader: 0x8079db0 loading font for 47 iso10646-1
        -adobe-helvetica-medium-r-normal--17-120-100-100-p-88-iso10646-1
QFontLoader: unicode font has individual charstructs
QFontLoader: m1 0 x1 34 m2 0 x2 255
QFontLoader: unicode font doesn't have undefined char?
QFontLoader: unicode font has char 0x0030 for 0 iso8859-1
QFontInfo says: helvetica [adobe]

It considers the non-scalable helvetica unicode font "good enough" and doesn't even
try to find the latin1 arial font...

I remember Lars saying "if ForceOutline gets you a bitmap font there's
definitely a bug". I'm afraid that's the case.

Thanks for fixing, this is creating *much* trouble in KWord (users select
a font in the font dialog, and end up with another one, which doesn't scale at
all when zooming...).

- -- 
David FAURE, faure@kde.org, sponsored by TrollTech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
How to write a Makefile.am for KDE/Qt code:
http://developer.kde.org/documentation/other/makefile_am_howto.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+rc+I72KcVAmwbhARAvvtAJ9xXVP9cON/OiBSQ3l7pSBE3diR1gCffXj9
cwh/XfkpXrkPz8fvWt9A04Q=
=E2ZF
-----END PGP SIGNATURE-----

_______________________________________________
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