GtkFontButton: Limit the decimals shown for size

It doesn't make sense to show a font size with 6 digits. Use
the same formatting we use in the font chooser widget now.

https://bugzilla.gnome.org/show_bug.cgi?id=724996
This commit is contained in:
Matthias Clasen 2014-08-15 15:09:45 -04:00
parent a8ed0dd4ee
commit 1815790bd3

View File

@ -1160,7 +1160,7 @@ gtk_font_button_update_font_info (GtkFontButton *font_button)
if (font_button->priv->show_size)
{
/* mirror Pango, which doesn't translate this either */
gchar *size = g_strdup_printf ("%g%s",
gchar *size = g_strdup_printf ("%2.4g%s",
pango_font_description_get_size (priv->font_desc) / (double)PANGO_SCALE,
pango_font_description_get_size_is_absolute (priv->font_desc) ? "px" : "");