Version: 3.1.12 Red Hat (Using KDE 3.1-10 Red Hat) (using KDE KDE 3.1.1) Installed from: RedHat RPMs OS: Linux Consider the simple HTML code and fontconfig files in attachment. I expect this combination of configuration and HTLM to yield the following results: A. Since the preferred sans-serif font is defined as "Luxi Sans", strings 1,2,3,4 should all be rendered with this font, and so the "TEST" word should look exactly the same in these four strings. B. Since the preferred serif font is defined as "Nimbus Roman No9 L", strings 5 and 6 should be rendered with this font, and so the "TEST" word should look exactly the same in these two strings. C. Since the preferred monospace font is defined as "Luxi Mono", strings 7,8,9 should be rendered with this font, and so the "TEST" word should look exactly the same in these three strings. ------------------------------------ The actual results are the following ------------------------------------ B. [GOOD] Strings 5 and 6 are rendered with the default serif font. They look identical when they're compared with xmag. A. Two out of four strings that should be rendered with the sans-serif font are rendered incorrectly. [BAD] String 3 seems to be rendered with the default serif font, though it is bigger than strings 5 and 6. [BAD] String 4 is rendered with the Comic Sans MS font. [GOOD] Strings 1 and 2 look identical in xmag. C. One of the strings that should be rendered with the monospace font is rendered incorrectly. [BAD] String 8 seems to be rendered with "Andale Mono", which is my 2nd preferred monospace font. It should be rendered with Luxi Mono. [GOOD] Strings 7 and 9 look identical in xmag. --------------- Further testing --------------- In fonts.conf, uncomment the following block of text near the top of the file. <match target="pattern"> <test qual="any" name="family"> <string>sans-serif</string> </test> <edit name="family" mode="assign"> <string>serif</string> </edit> </match> Stop all running instances of Konqueror and reopen the html page. This change of configuration should force 'sans', 'sans serif' and 'sans-serif' faces to adopt the default 'serif' font. In other words, strings 2,3,4 should be made identical to strings 5 and 6. It is not exactly what will happen: [GOOD] It will work for string 2 (using 'sans-serif' face). [BAD] String 3 will be using a serif face, but it's size will be different than strings 2,5,6. [BAD] String 4 will still render with Comic Sans. ------------------------------------- Configuration details and final notes ------------------------------------- rh9 as base distrib corefonts.sourceforge.net TTF package fontconfig 2.1.94 freetype 2.1.4 openoffice from rh9 distrib, from which the Andale Mono is coming from Default fontconfig and freetype packages from rh9 distribution have been upgraded in an attempt to solve the problem. I noticed that removing the corefonts package changed the results, but there still was font selection problems. I've mentionned this problem on fontconfig@fontconfig.org mailing list already (apr 19th, 20th 2003).
Created attachment 1393 [details] Fontconfig config file.
Created attachment 1394 [details] Sample HTML
Created attachment 1395 [details] Shows how strings are rendered on my system.
I forgot to mentionned one thing. I did the same test with Mozilla 1.3. It is generally better than Konqueror at picking the right font. However even Mozilla has a problem selecting the right font when requesting the 'monospace' face. It is also worthy of note that I have not defined user CSS and that I have not setup specific fonts in Konqueror, other than general family names "Sans", "Sans serif" and "Monospace".
I still have font selection problems in : KDE 3.2.1 Konqueror 3.2.1-0.1 RedHat binary RPMs OS Fedora 1 If you find my long explanation hard to understand, just open the sample html files. See how the "TEST" string renders with different spellings of font families. Even though the family is the same, different fonts will be picked.
mozilla requests the font with font config when it has to render them. konqueror removes all fonts in the specified list that aren't present on the system. As fontconfig doesn't give "mono", "sans-serif" or whatever back to the applications, konqueror doesn't see them and falls back to the default font: sans in your case.
Konq still has this behavior in KDE 3.2.2.
I good short description with less examples would be nice if this is still an issue.
Created attachment 15681 [details] Sample html testing font selection in Konqueror 3.5.2.
Created attachment 15682 [details] Shows how Konqueror 3.5.2 renders fonts.
Things have improved as of KDE 3.5.2 (RPM packages from kde-redhat.sf.net, FC4), but not everything is ok. Allow me to reexplain clearly. In my ~/.fonts.conf file, I have specified what fonts I want whenever generic font family names are used. <!-- serif font shall be Times New Roman --> <alias> <family>serif</family> <prefer> <family>Times New Roman</family> </prefer> </alias> <!-- sans-serif font shall be verdana --> <alias> <family>sans-serif</family> <prefer> <family>verdana</family> </prefer> </alias> <!-- monospace font shall be courier new --> <alias> <family>monospace</family> <prefer> <family>Courier New</family> </prefer> </alias> To see how Konqueror copes with that, I have written a small html file (id=15681). It displays "TEST" multiple times with equivalent font faces. Open the png and you will see what the result is in Konqueror: [ok] The 4 strings using sans serif fonts all use the same font. [ok] The 2 strings using serif fonts all use the same font. [ko] One of the three strings using monospace font does not render correctly. This is in spite of the following definition in /etc/fonts/fonts.conf: <match target="pattern"> <test qual="any" name="family"> <string>mono</string> </test> <edit name="family" mode="assign"> <string>monospace</string> </edit> </match> If you open the same html in Firefox, the result will be correct.
One long-standing bug, heh? Modern fontconfig has FcFontMatch. http://www.fontconfig.org/fontconfig-devel/r2109.html Shouldn't konqueror just use that to select a font? It seems that it doesn't, because otherwise it would use Liberation Sans when asked for Arial,sans-serif on my system. Despite default DejaVu Sans, available Liberation Sans is a better match for Arial and fontconfig knows it.
This bug is reproducible using a simpler testcase. Add the following to your ~/.fonts.conf: <fontconfig> <!-- should already be present --> <match target="pattern"> <test qual="any" name="family"> <string>nonexistantbugfont</string> </test> <edit name="family" mode="assign"> <string>monospace</string> </edit> </match> <!-- rest of file --> </fontconfig> <!-- should already be present -->
Created attachment 24218 [details] New testcase When the changes to ~/fonts.conf have been made both lines on this page should be displayed the same, however konqueror doesn't recognize the alias we defined and renders the second line using the default font.
Confirmed on trunk r793971.
If you "translate" some fontconfig configuration files into some Qt configuration files, you may be able to workaround the problem. AFAIK, konqueror understandably relies on Qt rather than fontconfig. There is even a python script for that on the internet, I believe. So the bug is actually in Qt. Qt should either improve its font intelligence, or, more realistically, should respect and rely on fontconfig.
*** Bug 74286 has been marked as a duplicate of this bug. ***
qt-copy's 0263-fix-fontconfig-handling.diff may (or may not?) be relevant here.
Message from the Bugsquad and Konqueror teams: This bug is closed as outdated, as we do not have the manpower to maintain the KDE3 version anymore. If you still can reproduce this issue with Konqueror 4.8.4 or later, please open a new report. Thank you for your understanding.