diff options
| author | Robert Pluim | 2019-11-13 15:19:04 +0100 |
|---|---|---|
| committer | Robert Pluim | 2019-11-14 10:23:37 +0100 |
| commit | ca44f33be2e2c91dad4037c730408b2b1d4529dd (patch) | |
| tree | 4debce43ee5ff4b755a9cb84b75a855460edc17b /src/gtkutil.c | |
| parent | 4f45e89852129db6a3026187768c6ba5b30c39fe (diff) | |
| download | emacs-ca44f33be2e2c91dad4037c730408b2b1d4529dd.tar.gz emacs-ca44f33be2e2c91dad4037c730408b2b1d4529dd.zip | |
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, | |||
| 2228 | 2228 | ||
| 2229 | static char *x_last_font_name; | 2229 | static char *x_last_font_name; |
| 2230 | 2230 | ||
| 2231 | #if GTK_CHECK_VERSION (3, 2, 0) | ||
| 2232 | static gboolean | ||
| 2233 | xg_font_filter (const PangoFontFamily *family, | ||
| 2234 | const PangoFontFace *face, | ||
| 2235 | gpointer data) | ||
| 2236 | { | ||
| 2237 | const char *name = pango_font_family_get_name ((PangoFontFamily *)family); | ||
| 2238 | ptrdiff_t namelen = strlen (name); | ||
| 2239 | |||
| 2240 | if (font_is_ignored (name, namelen)) | ||
| 2241 | return FALSE; | ||
| 2242 | return TRUE; | ||
| 2243 | } | ||
| 2244 | #endif | ||
| 2245 | |||
| 2231 | /* Pop up a GTK font selector and return the name of the font the user | 2246 | /* Pop up a GTK font selector and return the name of the font the user |
| 2232 | selects, as a C string. The returned font name follows GTK's own | 2247 | selects, as a C string. The returned font name follows GTK's own |
| 2233 | format: | 2248 | format: |
| @@ -2247,6 +2262,9 @@ xg_get_font (struct frame *f, const char *default_name) | |||
| 2247 | w = gtk_font_chooser_dialog_new | 2262 | w = gtk_font_chooser_dialog_new |
| 2248 | ("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); | 2263 | ("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); |
| 2249 | 2264 | ||
| 2265 | #if GTK_CHECK_VERSION (3, 2, 0) | ||
| 2266 | gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (w), xg_font_filter, NULL, NULL); | ||
| 2267 | #endif | ||
| 2250 | if (default_name) | 2268 | if (default_name) |
| 2251 | { | 2269 | { |
| 2252 | /* Convert fontconfig names to Gtk names, i.e. remove - before | 2270 | /* Convert fontconfig names to Gtk names, i.e. remove - before |