diff options
author | Robert Pluim <rpluim@gmail.com> | 2019-11-13 15:19:04 +0100 |
---|---|---|
committer | Robert Pluim <rpluim@gmail.com> | 2019-11-14 10:23:37 +0100 |
commit | ca44f33be2e2c91dad4037c730408b2b1d4529dd (patch) | |
tree | 4debce43ee5ff4b755a9cb84b75a855460edc17b /src/gtkutil.c | |
parent | 4f45e89852129db6a3026187768c6ba5b30c39fe (diff) | |
download | emacs-ca44f33be2e2c91dad4037c730408b2b1d4529dd.tar.gz |
Make GTK font chooser respect face-ignored-fonts
* src/font.c (font_delete_unmatched): Move Vface_ignored_fonts
matching to...
(font_is_ignored): ..Here. New function.
* src/gtkutil.c (xg_font_filter): New function, uses font_is_ignored
to filter fonts.
(xg_get_font): Set GTK font chooser filter to xg_font_filter.
* src/gtkutil.h: Add prototype for font_is_ignored.
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r-- | src/gtkutil.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index 16d765533a7..c4d2ef9d80b 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -2228,6 +2228,21 @@ xg_get_file_name (struct frame *f, static char *x_last_font_name; +#if GTK_CHECK_VERSION (3, 2, 0) +static gboolean +xg_font_filter (const PangoFontFamily *family, + const PangoFontFace *face, + gpointer data) +{ + const char *name = pango_font_family_get_name ((PangoFontFamily *)family); + ptrdiff_t namelen = strlen (name); + + if (font_is_ignored (name, namelen)) + return FALSE; + return TRUE; +} +#endif + /* Pop up a GTK font selector and return the name of the font the user selects, as a C string. The returned font name follows GTK's own format: @@ -2247,6 +2262,9 @@ xg_get_font (struct frame *f, const char *default_name) w = gtk_font_chooser_dialog_new ("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); +#if GTK_CHECK_VERSION (3, 2, 0) + gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (w), xg_font_filter, NULL, NULL); +#endif if (default_name) { /* Convert fontconfig names to Gtk names, i.e. remove - before |