[Konsole-devel] QFont::setRawName / QFont::exactMatch does not work

Waldo Bastian bastian at kde.org
Tue Jul 20 10:34:38 UTC 2004


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

Even if the font specified via setRawName is available, QFont::exactMatch 
returns false.

After calling QFont::setRawName with
"-misc-console-medium-r-normal--16-160-72-72-c-80-iso10646-1"

qt_fixXLFD() finds two results:

125         char **fontNames =
126             XListFonts( QPaintDevice::x11AppDisplay(), xlfd, 32768, 
&count );
127         if ( count > 0 )

(gdb) print count
$2 = 2
(gdb) print fontNames[0]
$3 = 0x810cb79 "-misc-console-medium-r-normal--16-160-72-72-c-80-iso10646-1"
(gdb) print fontNames[1]
$4 = 0x810cbb5 "-misc-console-medium-r-normal--16-160-72-72-c-80-iso10646-1"

However, Qt does not consider this an exact match:

(gdb) print exactMatch()
$8 = false

exactMatch() does:
    return d->rawMode ? engine->type() != QFontEngine::Box
                             : d->request == engine->fontDef;

d->request and engine->fontDef result in:

(gdb) print d->request
$9 = {family = {static null = {static null = <same as static member of an 
already seen type>, d = 0x804ba68,
      static shared_null = 0x804ba68}, d = 0x80ca880, static shared_null = 
0x804ba68}, addStyle = {static null = {
      static null = <same as static member of an already seen type>, d = 
0x804ba68, static shared_null = 0x804ba68}, d = 0x804ba68,
    static shared_null = 0x804ba68}, pointSize = 120, pixelSize = 16, 
styleHint = 5, styleStrategy = 1, weight = 50, italic = 0,
  fixedPitch = 1, stretch = 100, ignorePitch = 1, fixedPitchComputed = 0, 
reserved = 0}

(gdb) print d->engineForScript( 0 )->fontDef
$11 = {family = {static null = {static null = <same as static member of an 
already seen type>, d = 0x804ba68,
      static shared_null = 0x804ba68}, d = 0x804ba68, static shared_null = 
0x804ba68}, addStyle = {static null = {
      static null = <same as static member of an already seen type>, d = 
0x804ba68, static shared_null = 0x804ba68}, d = 0x804ba68,
    static shared_null = 0x804ba68}, pointSize = 0, pixelSize = 16, styleHint 
= 5, styleStrategy = 1, weight = 50, italic = 0,
  fixedPitch = 1, stretch = 100, ignorePitch = 1, fixedPitchComputed = 0, 
reserved = 0}

(gdb) print d->engineForScript( 0 )->fontDef.pointSize = 120
$13 = 120

(gdb) print exactMatch()
$15 = false

(gdb) print d->request.family.latin1()
$21 = 0x810da80 "Console [Misc]"

(gdb) print d->engineForScript( 0 )->fontDef.family.latin1()
$22 = 0x0

(gdb) print d->engineForScript( 0 )->fontDef.family = QString::fromLatin1
("Console [Misc]", -1)
$23 = {static null = {static null = <same as static member of an already seen 
type>, d = 0x804ba68,
    static shared_null = 0x804ba68}, d = 0x8113f68, static shared_null = 
0x804ba68}

(gdb) print exactMatch()
$25 = true


It seems that instead of loading the font that was specified, QFont tries to 
load "Console [Misc]" but the QFontDatabase doesn't know about it and ends up 
loading helvetica instead:

QFontPrivate::load: req.family = 'Console [Misc]'
QFontPrivate::load: Try req.family = 'Console [Misc]'
QFontDatabase::findFont
  request:
    family: Console [Misc], script: 0 (Latin)
    weight: 50, italic: 0
    stretch: 100
    pixelSize: 16
    pitch: m
engine = (nil)
QFontPrivate::load: Try req.family = '(null)'
QFontDatabase::findFont
  request:
    family: -- first in script -- [-- any --], script: 0 (Latin)
    weight: 50, italic: 0
    stretch: 100
    pixelSize: 16
    pitch: m
original pattern contains:
Pattern 4 of 16
        family: "Console"(s) "monospace"(s)
        size: 12(f)(s)
        slant: 0(i)(s)
        weight: 100(i)(s)

final pattern contains:
Pattern 4 of 16
        family: "Console"(s) "Bitstream Vera Sans Mono"(w) "Andale Mono"(w) 
"Courier New"(w) "Luxi Mono"(w) "Nimbus Mono L"(w) "Kochi Gothic"(w) "AR PL 
KaitiM GB"(w) "Baekmuk Dotum"(w) "monospace"(s) "helvetica"(w) "Helvetica"(w)
        size: 12(f)(s)
        slant: 0(i)(s)
        weight: 100(i)(s)

fontset contains:
    Bitstream Vera Sans Mono
    Bitstream Vera Sans Mono
    Bitstream Vera Sans Mono
    Bitstream Vera Sans Mono
    Luxi Mono
    Luxi Mono
    Luxi Mono
    Luxi Mono
    Luxi Mono
    Luxi Mono
    Luxi Mono
    Luxi Mono
    Nimbus Mono L
    Nimbus Mono L
    Nimbus Mono L
    Nimbus Mono L
    URW Gothic L
    URW Gothic L
    URW Palladio L
    Century Schoolbook L
    Luxi Sans
    Luxi Serif
    Nimbus Sans L
    URW Bookman L
    Nimbus Sans L
    Nimbus Roman No9 L
    Bitstream Vera Sans
    Luxi Serif
    Luxi Sans
    Bitstream Vera Serif
    Luxi Sans
    Luxi Serif
    Nimbus Sans L
    URW Bookman L
    Nimbus Sans L
    URW Palladio L
    Nimbus Roman No9 L
    Century Schoolbook L
    Bitstream Vera Serif
    Bitstream Vera Sans
    Luxi Serif
    Luxi Sans
    URW Chancery L
    URW Gothic L
    URW Gothic L
    Luxi Sans
    Luxi Serif
    Nimbus Roman No9 L
    Century Schoolbook L
    Nimbus Sans L
    URW Bookman L
    Nimbus Sans L
    URW Palladio L
    Luxi Sans
    Bitstream Vera Sans
    Luxi Serif
    Luxi Serif
    Luxi Sans
    URW Palladio L
    Nimbus Roman No9 L
    Century Schoolbook L
    Nimbus Sans L
    URW Bookman L
    Nimbus Sans L
    Bitstream Vera Sans
    Luxi Serif
    Luxi Sans
    Hershey-Gothic-German
    Hershey-Plain-Duplex
    Hershey-Plain-Triplex
    Hershey-Gothic-Italian
    Hershey-Plain-Duplex-Italic
    Hershey-Script-Complex
    Hershey-Script-Simplex
    Hershey-Plain-Triplex-Italic
    Hershey-Gothic-English
    Braille-HC
    Bitstream Charter
    Utopia
    Courier 10 Pitch
    Courier 10 Pitch
    Courier
    Bitstream Charter
    Bitstream Charter
    Utopia
    Bitstream Charter
    Standard Symbols L
    Courier 10 Pitch
    Courier 10 Pitch
    Courier
    Bitstream Charter
    Utopia
    Bitstream Charter
    Bitstream Charter
    Utopia
    Bitstream Charter
    Courier
    Utopia
    Utopia
    Utopia
    Courier
    Utopia
    Cursor
    Goha-Tibeb Zemen
    URW Antiqua T
    URW Grotesk T
    Dingbats
    font has char 0x0041
    font has char 0x0041
    font has char 0x2122
    font has char 0x222b
engine = 0x8116568


Cheers,
Waldo
- -- 
bastian at kde.org  |   KDE Community World Summit 2004  |  bastian at suse.com
bastian at kde.org  | 21-29 August, Ludwigsburg, Germany |  bastian at suse.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFA/PU+N4pvrENfboIRAtGKAJ4iD57BDHJdf02iwlXe6SHt0IfchACcCimz
WoZB9iTVmfmSK7NZsCdhlUY=
=gZ09
-----END PGP SIGNATURE-----



More information about the konsole-devel mailing list