Bug 264909 - [CSS 2.1 Conformance] [testcase] font-family incorrectly selects the last of 2 generic font-family
Summary: [CSS 2.1 Conformance] [testcase] font-family incorrectly selects the last of ...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: 4.7.4
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords: reproducible, testcase
Depends on:
Blocks:
 
Reported: 2011-01-31 05:26 UTC by Gérard Talbot (no longer involved)
Modified: 2014-04-23 17:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.12.5


Attachments
Screen shot of topmost part of testcase B with my font settings in Konqueror 4.13.0 (125.04 KB, image/jpeg)
2014-04-19 09:50 UTC, Gérard Talbot (no longer involved)
Details
Screen shot of bottom part of testcase B with my font settings in Konqueror 4.13.0 (121.78 KB, image/jpeg)
2014-04-19 09:54 UTC, Gérard Talbot (no longer involved)
Details
Screen shot of testcase B + my font settings (89.70 KB, image/png)
2014-04-19 11:40 UTC, Andrea Iacovitti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gérard Talbot (no longer involved) 2011-01-31 05:26:30 UTC
Version:           4.5.5 (using KDE 4.5.5) 
OS:                Linux

CSS 2.1, section 15.2 Font matching algorithm
http://www.w3.org/TR/CSS21/fonts.html#algorithm

Konqueror should be selecting the first generic font-family available (and capable of rendering the glyphs), not the last.

Testcases
---------
Testcase A:
http://test.csswg.org/suites/css2.1/20110111/html4/c522-font-family-000.htm

Testcase B:
http://www.gtalbot.org/BrowserBugsSection/Konqueror4Bugs/font-family-generic.html

Relevant code chunk
-------------------

<style type="text/css">
h1#first-sentence {font-family: sans-serif, cursive;}
</style>
(...)
<h1 id="first-sentence">This 1st sentence should be in a sans-serif font.</h1>

Actual result: cursive font is selected and rendered

Expected result: sans-serif should be selected and rendered

Reproducible: Always

Steps to Reproduce:
Prerequesites: Make sure you have chosen correct font faces for respectively cursive and fantasy fonts. You may want to visit:

Most common cursive font (survey) under Windows, Mac and Linux: http://www.codestyle.org/css/font-family/sampler-Cursive.shtml

Most common fantasy font (survey) under Windows, Mac and Linux: http://www.codestyle.org/css/font-family/sampler-Fantasy.shtml

Load provided reduced self-explanatory testcases' urls

Actual Results:  
Testcase A:
http://test.csswg.org/suites/css2.1/20110111/html4/c522-font-family-000.htm
The 7th sentence is using a cursive font

Testcase B: 
http://www.gtalbot.org/BrowserBugsSection/Konqueror4Bugs/font-family-generic.html
1st, 3rd and 5th sentences are using the system default cursive font.
2nd, 4th and 6th sentences are using the system default fantasy font.


Expected Results:  
Testcase A:
http://test.csswg.org/suites/css2.1/20110111/html4/c522-font-family-000.htm
The 7th sentence should be using a sans-serif font

Testcase B: 
http://www.gtalbot.org/BrowserBugsSection/Konqueror4Bugs/font-family-generic.html
1st, 2nd, 5th and 6th sentences should be using the system default sans-serif font.
3rd and 4th sentences should be using the system default serif font.

Konqueror 4.5.5, KDE 4.5.5, Qt 4.7.0, Linux 2.6.35-25-generic-pae, i686 (32bit) here.
Comment 1 Gérard Talbot (no longer involved) 2011-07-28 20:19:03 UTC
Additional relevant testcase coming from CSS 1 test suite:

http://www.w3.org/Style/CSS/Test/CSS1/current/sec522.htm

and look for the sentence that tests 
.six {font-family: sans-serif,cursive;}

which says "This sentence should be in a sans-serif font, not cursive."

regards, Gérard
Comment 2 Gérard Talbot (no longer involved) 2012-01-13 06:29:24 UTC
Konqueror 4.7.4 (KHTML rendering engine)

CONFIRMING
Comment 3 Andrea Iacovitti 2014-04-19 05:35:29 UTC
I'm using kde 4.12 and i can not reproduce.
Comment 4 Gérard Talbot (no longer involved) 2014-04-19 09:50:03 UTC
Created attachment 86165 [details]
Screen shot of topmost part of testcase B with my font settings in Konqueror 4.13.0
Comment 5 Gérard Talbot (no longer involved) 2014-04-19 09:54:31 UTC
Created attachment 86166 [details]
Screen shot of bottom part of testcase B with my font settings in Konqueror 4.13.0

Andrea,

I am using
Linux 3.13.0-24-generic x86_64
Qt: 4.8.6
KDE development platform: 4.13.0
Description:    Ubuntu 14.04 LTS (Kubuntu 14.04 LTS)
Codename:       trusty
with Konqueror 4.13.0
Comment 6 Andrea Iacovitti 2014-04-19 11:40:41 UTC
Created attachment 86169 [details]
Screen shot of testcase B + my font settings

As you can see testcase B looks correct (the same apply to testcase A for me) and i have the exactly same configuration of you. I suspect the problem is in font setting module that doesn't correctly save font configuration.
In .kde/share/config/konquerorrc, [HTML Settings] section, there should be a "Fonts" configuration entry. Mine looks as follow:
Fonts=DejaVu Sans,DejaVu Sans Mono,DejaVu Serif,DejaVu Sans,URW Chancery L,Purisa,0
(as you can see it match what is in GUI conf part)
If your looks different, or not present at all, could you please try to substitute that line with the one i posted, restart konqueror, and see i it makes any difference?
Thank you.
Comment 7 Gérard Talbot (no longer involved) 2014-04-19 12:41:00 UTC
(In reply to comment #6)
> Created attachment 86169 [details]
> Screen shot of testcase B + my font settings
> 
> As you can see testcase B looks correct (the same apply to testcase A for
> me) and i have the exactly same configuration of you. 

No, not exactly same configuration!
Please change your "Caratteri Standard" from "DejaVu Sans" to "DejaVu Serif" like mine

> I suspect the problem
> is in font setting module that doesn't correctly save font configuration.
> In .kde/share/config/konquerorrc, [HTML Settings] section, there should be a
> "Fonts" configuration entry. Mine looks as follow:
> Fonts=DejaVu Sans,DejaVu Sans Mono,DejaVu Serif,DejaVu Sans,URW Chancery
> L,Purisa,0

Mine is exactly as following:

Fonts=DejaVu Serif,Monospace,DejaVu Serif,Sans Serif,URW Chancery L,Purisa,

It does not end with an "0" like yourself; it ends with a comma "," ... which is definitely strange... as all other value settings in .kde/share/config/konquerorrc all ends with a value (eg true eg Disabled eg Enabled eg 1) and not with a comma. 
Also I see Monospace and not DejaVu Sans Mono like you have.

> (as you can see it match what is in GUI conf part)
> If your looks different, or not present at all, could you please try to
> substitute that line with the one i posted, restart konqueror, and see i it
> makes any difference?

Huh... I can do that with Kate ?
Comment 8 Andrea Iacovitti 2014-04-19 13:42:49 UTC
> Mine is exactly as following:
> 
> Fonts=DejaVu Serif,Monospace,DejaVu Serif,Sans Serif,URW Chancery L,Purisa,
> 
> It does not end with an "0" like yourself; it ends with a comma "," ...
> which is definitely strange... as all other value settings in
> .kde/share/config/konquerorrc all ends with a value (eg true eg Disabled eg
> Enabled eg 1) and not with a comma. 
> Also I see Monospace and not DejaVu Sans Mono like you have.

You are confirming my suspects...
Based on the screen shot you posted your fonts config line should looks like:
Fonts=DejaVu Serif,DejaVu Sans Mono,DejaVu Serif,DejaVu Sans,URW Chancery L,Purisa,0
(the ending "0" should not really matter for this specific bug)

Yes, you can change it with Kate or whatever text editor you like. Beware to first close all running konqueror before doing that.
Comment 9 Gérard Talbot (no longer involved) 2014-04-19 16:31:57 UTC
(In reply to comment #8)
> > Mine is exactly as following:
> > 
> > Fonts=DejaVu Serif,Monospace,DejaVu Serif,Sans Serif,URW Chancery L,Purisa,
> > 
> > It does not end with an "0" like yourself; it ends with a comma "," ...
> > which is definitely strange... as all other value settings in
> > .kde/share/config/konquerorrc all ends with a value (eg true eg Disabled eg
> > Enabled eg 1) and not with a comma. 
> > Also I see Monospace and not DejaVu Sans Mono like you have.
> 
> You are confirming my suspects...
> Based on the screen shot you posted your fonts config line should looks like:
> Fonts=DejaVu Serif,DejaVu Sans Mono,DejaVu Serif,DejaVu Sans,URW Chancery
> L,Purisa,0
> (the ending "0" should not really matter for this specific bug)
> 
> Yes, you can change it with Kate or whatever text editor you like. Beware to
> first close all running konqueror before doing that.

Andrea,

I changed that editable configuration Fonts line to
Fonts=DejaVu Serif,DejaVu Sans Mono,DejaVu Serif,DejaVu Sans,URW Chancery L,Purisa,0
in/with Kate, then started Konqueror 4.13.0, then tried the 3 tests and each tests now PASS!

I wonder what really caused such configuration line to be wrong. Andrea, is it possible to create a new bug report about the font setting module that you suspect is not correctly saving font configuration?

I now mark this bug as Status: RESOLVED and Resolution: WORKSFORME.

All I can say is ** Thank you Andrea !! **

Gérard
Comment 10 Andrea Iacovitti 2014-04-23 17:33:47 UTC
Git commit 94ccee520bedb2284c277835f6001b7aaed2da71 by Andrea Iacovitti.
Committed on 23/04/2014 at 17:31.
Pushed by aiacovitti into branch 'KDE/4.12'.

Resolve generic font family names before using them in khtml.
FIXED-IN: 4.12.5

M  +18   -4    khtml/khtml_settings.cpp

http://commits.kde.org/kdelibs/94ccee520bedb2284c277835f6001b7aaed2da71