Summary: | [test case] Wrong font selected when HTML specifies fontconfig aliases | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Philippe A <futhark77> |
Component: | khtml renderer | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED UNMAINTAINED | ||
Severity: | normal | CC: | fonts-bugs, marciano, rdieter |
Priority: | NOR | ||
Version: | 3.1.2 | ||
Target Milestone: | --- | ||
Platform: | RedHat Enterprise Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
Fontconfig config file.
Sample HTML Shows how strings are rendered on my system. Sample html testing font selection in Konqueror 3.5.2. Shows how Konqueror 3.5.2 renders fonts. New testcase |
Description
Philippe A
2003-04-20 22:59:26 UTC
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. |