mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 23:00:08 +00:00
Take font size also from the font description
This commit is contained in:
parent
d82895127e
commit
71c16bad33
@ -354,6 +354,11 @@ gtk_font_button_take_font_desc (GtkFontButton *font_button,
|
||||
else
|
||||
priv->font_desc = pango_font_description_from_string (_("Sans 12"));
|
||||
|
||||
if (pango_font_description_get_size_is_absolute (priv->font_desc))
|
||||
priv->font_size = pango_font_description_get_size (priv->font_desc);
|
||||
else
|
||||
priv->font_size = pango_font_description_get_size (priv->font_desc) / PANGO_SCALE;
|
||||
|
||||
gtk_font_button_update_font_data (font_button);
|
||||
gtk_font_button_update_font_info (font_button);
|
||||
|
||||
|
@ -320,17 +320,19 @@ spin_change_cb (GtkAdjustment *adjustment,
|
||||
GtkFontChooserWidget *fontchooser = (GtkFontChooserWidget*)user_data;
|
||||
GtkFontChooserWidgetPrivate *priv = fontchooser->priv;
|
||||
GtkAdjustment *slider_adj = gtk_range_get_adjustment (GTK_RANGE (priv->size_slider));
|
||||
|
||||
gdouble size = gtk_adjustment_get_value (adjustment);
|
||||
|
||||
priv->size = ((gint)size) * PANGO_SCALE;
|
||||
|
||||
desc = pango_context_get_font_description (gtk_widget_get_pango_context (priv->preview));
|
||||
pango_font_description_set_size (desc, priv->size);
|
||||
gtk_widget_override_font (priv->preview, desc);
|
||||
|
||||
g_object_notify (G_OBJECT (fontchooser), "font");
|
||||
g_object_notify (G_OBJECT (fontchooser), "font-desc");
|
||||
|
||||
if (pango_font_description_get_size_is_absolute (priv->font_desc))
|
||||
pango_font_description_set_absolute_size (priv->font_desc, size);
|
||||
else
|
||||
pango_font_description_set_size (priv->font_desc, priv->size);
|
||||
|
||||
/* If the new value is lower than the lower bound of the slider, we set
|
||||
* the slider adjustment to the lower bound value if it is not already set
|
||||
*/
|
||||
@ -350,6 +352,9 @@ spin_change_cb (GtkAdjustment *adjustment,
|
||||
gtk_adjustment_set_value (slider_adj, size);
|
||||
|
||||
gtk_widget_queue_draw (priv->preview);
|
||||
|
||||
g_object_notify (G_OBJECT (fontchooser), "font");
|
||||
g_object_notify (G_OBJECT (fontchooser), "font-desc");
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user