After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 724996 - Font Button too many decimal places
Font Button too many decimal places
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFontChooser
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-02-23 08:31 UTC by Steve Teale
Modified: 2014-08-15 19:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Steve Teale 2014-02-23 08:31:33 UTC
In my code, I provide a tool to increase or decrease font size by a small proportion.

I create a string containing the font family name, and the resulting size rounded to 2 decimal places, then use that in gtk_font_button_set_font_name().

The result is a font button displaying 4 decimal places, which I'm sure the user does not need to see.

I'm guessing that the string is parsed, then the size is converted to PANGO_SCALE units, then for the button converted back to decimal without appropriate rounding.

e.g. I use "Sans 12.15" as the argument to set_font_name, but the button has 12.1504
Comment 1 André Klapper 2014-02-23 11:33:37 UTC
Please provide a minimal testcase. Also, testing on a more recent GTK version is welcome in case you really still use 3.4.