diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c index e03c740f29..e36c000f91 100644 --- a/gtk/gtkfontbutton.c +++ b/gtk/gtkfontbutton.c @@ -84,6 +84,8 @@ struct _GtkFontButtonPrivate PangoFontFace *font_face; PangoFontMap *font_map; gint font_size; + char *font_features; + char *language; gchar *preview_text; GtkFontFilterFunc font_filter; gpointer font_filter_data; @@ -162,6 +164,12 @@ clear_font_data (GtkFontButton *font_button) g_free (priv->fontname); priv->fontname = NULL; + + g_free (priv->font_features); + priv->font_features = NULL; + + g_free (priv->language); + priv->language = NULL; } static void @@ -721,6 +729,12 @@ gtk_font_button_get_property (GObject *object, case GTK_FONT_CHOOSER_PROP_FONT_DESC: g_value_set_boxed (value, gtk_font_button_get_font_desc (font_button)); break; + case GTK_FONT_CHOOSER_PROP_FONT_FEATURES: + g_value_set_string (value, priv->font_features); + break; + case GTK_FONT_CHOOSER_PROP_LANGUAGE: + g_value_set_string (value, priv->language); + break; case GTK_FONT_CHOOSER_PROP_LEVEL: g_value_set_flags (value, priv->level); break; @@ -1170,6 +1184,10 @@ response_cb (GtkDialog *dialog, if (priv->font_face) g_object_ref (priv->font_face); priv->font_size = gtk_font_chooser_get_font_size (font_chooser); + g_free (priv->font_features); + g_object_get (font_chooser, "font-features", &priv->font_features, NULL); + g_free (priv->language); + g_object_get (font_chooser, "language", &priv->language, NULL); /* Set label font */ gtk_font_button_update_font_info (font_button); @@ -1177,6 +1195,7 @@ response_cb (GtkDialog *dialog, g_object_notify (G_OBJECT (font_button), "font"); g_object_notify (G_OBJECT (font_button), "font-desc"); g_object_notify (G_OBJECT (font_button), "font-name"); + g_object_notify (G_OBJECT (font_button), "font-features"); g_object_thaw_notify (object); diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c index 169abf690f..c5dbb6177b 100644 --- a/gtk/gtkfontchooser.c +++ b/gtk/gtkfontchooser.c @@ -123,6 +123,39 @@ gtk_font_chooser_default_init (GtkFontChooserInterface *iface) GTK_FONT_CHOOSER_LEVEL_SIZE, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + /** + * GtkFontChooser:font-features: + * + * The selected font features, in a format that is compatible with + * CSS and with Pango attributes. + * + * Since: 3.22.30 + */ + g_object_interface_install_property + (iface, + g_param_spec_string ("font-features", + P_("Font features"), + P_("Font features as a string"), + "", + GTK_PARAM_READABLE)); + + /** + * GtkFontChooser:language: + * + * The language for which the #GtkFontChooser:font-features were + * selected, in a format that is compatible with CSS and with Pango + * attributes. + * + * Since: 3.22.30 + */ + g_object_interface_install_property + (iface, + g_param_spec_string ("language", + P_("Language"), + P_("Language for which features have been selected"), + "", + GTK_PARAM_READABLE)); + /** * GtkFontChooser::font-activated: * @self: the object which received the signal diff --git a/gtk/gtkfontchooserutils.c b/gtk/gtkfontchooserutils.c index 09469bd3c9..84079d276d 100644 --- a/gtk/gtkfontchooserutils.c +++ b/gtk/gtkfontchooserutils.c @@ -137,6 +137,12 @@ _gtk_font_chooser_install_properties (GObjectClass *klass) g_object_class_override_property (klass, GTK_FONT_CHOOSER_PROP_LEVEL, "level"); + g_object_class_override_property (klass, + GTK_FONT_CHOOSER_PROP_FONT_FEATURES, + "font-features"); + g_object_class_override_property (klass, + GTK_FONT_CHOOSER_PROP_LANGUAGE, + "language"); } /** diff --git a/gtk/gtkfontchooserutils.h b/gtk/gtkfontchooserutils.h index 8d4af1bd66..ac7bf18558 100644 --- a/gtk/gtkfontchooserutils.h +++ b/gtk/gtkfontchooserutils.h @@ -38,6 +38,8 @@ typedef enum { GTK_FONT_CHOOSER_PROP_PREVIEW_TEXT, GTK_FONT_CHOOSER_PROP_SHOW_PREVIEW_ENTRY, GTK_FONT_CHOOSER_PROP_LEVEL, + GTK_FONT_CHOOSER_PROP_FONT_FEATURES, + GTK_FONT_CHOOSER_PROP_LANGUAGE, GTK_FONT_CHOOSER_PROP_LAST } GtkFontChooserProp; diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index 34a6b9c823..57fe21c4e9 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -350,6 +350,12 @@ gtk_font_chooser_widget_get_property (GObject *object, case GTK_FONT_CHOOSER_PROP_LEVEL: g_value_set_flags (value, gtk_font_chooser_widget_get_level (fontchooser)); break; + case GTK_FONT_CHOOSER_PROP_FONT_FEATURES: + g_value_set_string (value, fontchooser->priv->font_features); + break; + case GTK_FONT_CHOOSER_PROP_LANGUAGE: + g_value_set_string (value, pango_language_to_string (fontchooser->priv->font_language)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1843,6 +1849,7 @@ update_font_features (GtkFontChooserWidget *fontchooser) { g_free (priv->font_features); priv->font_features = g_string_free (s, FALSE); + g_object_notify (G_OBJECT (fontchooser), "font-features"); } else g_string_free (s, TRUE); @@ -1870,6 +1877,7 @@ update_language (GtkFontChooserWidget *fontchooser) if (priv->font_language != lang) { priv->font_language = lang; + g_object_notify (G_OBJECT (fontchooser), "language"); } }