Bug 305747 - KFontChooser selects the wrong style
Summary: KFontChooser selects the wrong style
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: 4.8.4
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 289745 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-25 08:56 UTC by Irina Rempt
Modified: 2012-08-27 19:40 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.1


Attachments
senthitest.odt - sample of novel text containing all relevant styles (19.31 KB, application/vnd.oasis.opendocument.text)
2012-08-25 09:41 UTC, Irina Rempt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Irina Rempt 2012-08-25 08:56:39 UTC
Changing elements of a paragraph style other than the font set the font to the first item in the list of font attributes, in this case Italic.

Reproducible: Sometimes

Steps to Reproduce:
1. Open the edit box for an existing paragraph style
2. Change something (in this case the  spacing)
3. Apply and close.
Actual Results:  
All my text in the Standard style was suddenly italic.

Expected Results:  
Should have stayed roman as that wasn't the thing I changed.
Comment 1 Irina Rempt 2012-08-25 09:41:31 UTC
Created attachment 73455 [details]
senthitest.odt - sample of novel text containing all relevant styles

Made .odt document from scratch, then pasted in all text as plain (made with kate) and applied styles as they occurred.
Comment 2 Camilla Boemann 2012-08-25 10:09:50 UTC
I can reproduce

it became bold for me though - but definitely the same thing
Comment 3 Camilla Boemann 2012-08-26 08:44:45 UTC
Ah some insight.

The case I could reproduce is with the DejaVu fonts - It appears they don't have a Regular style (they call it Book instead) but somehow this throws off the font dialog so it changes it to the top most selection (in my case Bold)

If you go in a see the font without changing any you can see the dialog is already set to Bold. The reason it takes some other change to apply this change is that the buggy change s not registered as a user change and thus we don't do anything with it.

Troublesome
Comment 4 Camilla Boemann 2012-08-26 09:57:56 UTC
This is a bug in KFontChooser.

It assumes there is a Regular style (for DejaVu that equivalent style is called Book). Failing to find Regular it just defaults to the top style in the list, which happens to be for exampl Bold

It can be observed anywhere- I'm able to reproduce in Kate as well
Comment 5 Camilla Boemann 2012-08-26 10:02:46 UTC
It seems to happen with every font - more investigation needed
Comment 6 Christoph Feck 2012-08-26 12:17:05 UTC

*** This bug has been marked as a duplicate of bug 289745 ***
Comment 7 Chusslove Illich 2012-08-27 19:33:09 UTC
Git commit 5227487c17ad0e67907883762e41cb8918fa0f53 by Chusslove Illich (Часлав Илић).
Committed on 27/08/2012 at 21:24.
Pushed by ilic into branch 'KDE/4.9'.

Match font style with human-readable style name using custom identifier.

Style strings returned by QFontDatabase::styleString() are sometimes
not surviving serialization/deserialization roundtrip, which can cause
wrong style to be highlighted in style box when the dialog is opened.
If the user then closes the dialog without touching the style box,
the resulting font style is changed. To avoid this, construct
internal style identifiers and use them for matching instead.

Solution provided by Casper Boemann.
FIXED-IN: 4.9.1

M  +24   -3    kdeui/fonts/kfontchooser.cpp

http://commits.kde.org/kdelibs/5227487c17ad0e67907883762e41cb8918fa0f53
Comment 8 Christoph Feck 2012-08-27 19:40:56 UTC
*** Bug 289745 has been marked as a duplicate of this bug. ***