Bug 87290

Summary: zoom percentage: locale problem?
Product: [Applications] okular Reporter: Daniel Franke <franke.daniel>
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED WORKSFORME    
Severity: normal CC: adrian
Priority: NOR    
Version First Reported In: 0.15.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Use locale info to compose zoom values
Patch against KDE_3_3_0_RELEASE
patch against KDE_3_3_2_RELEASE

Description Daniel Franke 2004-08-16 13:48:50 UTC
Version:           0.20 (using KDE 3.2.1, compiled sources)
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:                Linux (i686) release 2.4.21-99-default

I'm using German locale (Control-Center -> Region Setting -> Country -> Germany), therefore the decimal separator is set to ',' instead of '.' as opposed to other countries.

KGhostView offers the zoom percentage of "66.67" percent in it's dropdown box. Selecting this results in a _really_ small display (using '-' or '+' buttons works fine, though). 
In short: any percentage "x.y" results in a tiny document, whereas 'x,y' gives the expected zoom level. 
Changing the country to "default" changes this behaviour, the "x.y" percentages work perfectly well.

Bug or feature?
Comment 1 Antti Markus 2004-09-16 21:11:57 UTC
Created attachment 7553 [details]
Use locale info to compose zoom values

Patch applies to kgv_view.cpp.
Uses locale specific decimal separator for fractional zoom values and if
entered zoom value is not a number does nothing instead of scaling document to
0%.
Comment 2 Antti Markus 2004-09-17 20:03:20 UTC
Created attachment 7563 [details]
Patch against KDE_3_3_0_RELEASE

- uses locale info to compose fractional zoom values
- if entered zoom value is not a number then does nothing instead of zooming to
0%
Comment 3 Daniel Franke 2005-01-14 13:09:41 UTC
Has the patch (20040917) already been applied? 
If not, please ignore the rest of this comment. 

--
KGhostView 0.20, KDE-3.3.91 (beta1), CVS 050113
> - uses locale info to compose fractional zoom values 
Seems to work =)

> - if entered zoom value is not a number then does nothing instead 
> of zooming to 0% 
Doesn't work. Zooms to 0% if invalid numbers (in the sense of the locale - or strings) are given as zoom values.
Comment 4 Andrey Golovizin 2005-01-29 20:22:01 UTC
> - uses locale info to compose fractional zoom values
Well, there's another problem here. Setting decimal separator to "," breaks zooming to values like 125%, while 100% and 200% still works.
Comment 5 Andrey Golovizin 2005-01-29 22:41:14 UTC
Created attachment 9350 [details]
patch against KDE_3_3_2_RELEASE

The problem with zooming to 125% was KGhostView using sprintf() to create
string arguments for XChangeProperty(). sprintf() formats numbers like "1.00"
or "1,00", depending on the locale settings, while XChangeProperty() expects
them to use dot (".") as decimal separator regardless of your locale. This
patch makes it use QString("%1")::arg() instead. The latter always formats
numbers according to POSIX locale => zooming always works as expected.
Comment 6 Daniel Franke 2005-10-30 15:02:23 UTC
Although a patch is available for a couple of months now, this bug is still valid in KDE-3.4.3 (gentoo) ...
Comment 7 Adrián Chaves (Gallaecio) 2012-10-16 06:01:24 UTC
Does not apply to Okular.