Behavioral changes to KFontChooser
Chusslove Illich
caslav.ilic at gmx.net
Sun Dec 9 11:10:24 GMT 2007
(I wanted to make few tweaks to make it more translatable, but couldn't just
skim past the other issues, and it suckered me in...)
I consider the behavior of KFontChooser and KFontRequester at present to
have some usability problems. On top of that, there are crash situations:
e.g. in KCM Fonts, use "Set all fonts" to pick a font which doesn't have
bold style, then choose on "Window title" font (which is bold by default) --
crash.
The main usability issue I had is that the family/style/size combination in
KFontChooser need not at all times reflect an available combination, and the
preview shows something at random (e.g. when an arbitrary size is entered in
the size spinbox for non-vector font). And similarly, it is possible to
select a non-existing combo in that manner (e.g. the "Set all fonts" example
above).
The proposed fixes with the following patch (unfortunatelly longish):
http://caslav.gmxhome.de/misc/kdelibs-kdeui-fonts-2007-12-09.diff
* Make sure that an unavailable combination cannot be chosen by user or set
by setFont methods. Make sure that the font attribute widgets at any
moment contain only an available combination of family/style/size. Make
sure these widgets are in perfect sync, and with the sample text.
* "Smart" browsing through families: the style and size that user explicitly
selected are kept and always first tried when the family is switched, else
a near match. E.g. user selects style bold, then switches to a family
which doesn't have bold and the style reverts to regular, the switches to
a family which has bold and the style is again shown as bold (and same for
the size). This is for the use case of "I want a 10pt bold, let's see
what's there."
* The style listbox double checks available styles (try set/get style and
see if they match before showing it). Still renames Normal into Regular,
but no longer renames Oblique into Italic (but considers them as fallback
for each other when switching between families).
* The size listbox/spinbox operates in two modes here. When the font is
vector, size can be chosen arbitrary in the spinbox, but make sure it's
also displayed in the listbox; e.g. when moving from 28 (one of offered
sizes) to 29 (not offered), insert 29 into listbox, modify this item as
the user spins on to 30, 31, and remove it once 32 is reached (another
offered size). When the font is bitmap, spinbox clicks move to next
available size, not +-1; when an arbitrary value is entered, it gets
rounded away to neareast available size.
* The sample text. No longer a QLineEdit, but a QTextEdit with vertical
centering. So that the text wraps, shows scrollbar eventually, and the
translators can enter multiline samples, e.g. a verse (someone inquired
about it few months back on kde-i18n-doc). The SampleEdit widget in the
patch does this; it has a side effect of showing window background color
around centered text, instead of the text background, that I don't know
how to remove (but looks kind of neat to me anyway):
http://caslav.gmxhome.de/image/kde4-font-chooser-sampleedit-01.png
* The KFontRequester checks the font given to it, and modifies it to a near
available match, rather then accepting as is and letting label show
something not there. E.g. in the "Set all fonts" example above, when the
font with no bold style is picked the "Window title" font will revert to
regular.
This is my first involved take on GUI code (only pushing text around so
far), so don't restrain from corrective scolding.
--
Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071209/1beb1440/attachment.sig>
More information about the kde-core-devel
mailing list