+ {
+#if USE_NEW_GTK_FONT_CHOOSER
+ /* Use the GTK3 font chooser. */
+ PangoFontDescription *desc
+ = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (w));
+
+ if (desc)
+ {
+ Lisp_Object args[8];
+ const char *name = pango_font_description_get_family (desc);
+ PangoWeight weight = pango_font_description_get_weight (desc);
+ PangoStyle style = pango_font_description_get_style (desc);
+
+ args[0] = QCname;
+ args[1] = build_string (name);
+
+ args[2] = QCsize;
+ args[3] = make_float (((double) pango_font_description_get_size (desc))
+ / PANGO_SCALE);
+
+ args[4] = QCweight;
+ args[5] = XG_WEIGHT_TO_SYMBOL (weight);
+
+ args[6] = QCslant;
+ args[7] = XG_STYLE_TO_SYMBOL (style);
+
+ font = Ffont_spec (8, args);
+
+ pango_font_description_free (desc);
+ xfree (x_last_font_name);
+ x_last_font_name = xstrdup (name);
+ }
+
+#else /* Use old font selector, which just returns the font name. */
+
+ char *font_name
+ = gtk_font_selection_dialog_get_font_name (GTK_FONT_CHOOSER (w));
+
+ if (font_name)
+ {
+ font = build_string (font_name);
+ g_free (x_last_font_name);
+ x_last_font_name = font_name;
+ }
+#endif /* USE_NEW_GTK_FONT_CHOOSER */
+ }