diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2009-11-23 08:55:08 +0000 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2009-11-23 08:55:08 +0000 |
commit | 581e51e8918b3ba9b58e67768a1de39ce5f1cbd3 (patch) | |
tree | b210e82974c9e4ab1d3cc1c0a9e86348a425526b /src/xfns.c | |
parent | 0f202d5d8fa1f0dea9c1e5e52e6ad66e4848aa75 (diff) | |
download | emacs-581e51e8918b3ba9b58e67768a1de39ce5f1cbd3.tar.gz |
Set Xft defaults if no XSETTING is found, better default for Gtk+ font dialog.
* xfns.c (Fx_select_font): Try to convert Fontconfig name to Gtk name
because that is what Gtk+ font dialog understands.
* font.c (font_make_object, Fcopy_font_spec): Use Fcopy_alist instead
of Fcopy_sequence.
(font_open_by_name): Put name given into QCname for font-object returned.
* frame.c (x_set_font): Save original font name as frame parameter
font-parameter.
* xsettings.c (set_default_xft_settings): New function.
(init_xfd_settings): Call set_default_xft_settings if no XSETTINGS window
is found.
Diffstat (limited to 'src/xfns.c')
-rw-r--r-- | src/xfns.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/xfns.c b/src/xfns.c index 0ae6f95b30b..27d0b025a24 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <math.h> #include <setjmp.h> +#include <ctype.h> #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -196,7 +197,7 @@ Lisp_Object Qnone; Lisp_Object Qsuppress_icon; Lisp_Object Qundefined_color; Lisp_Object Qcompound_text, Qcancel_timer; -static Lisp_Object Qfont_param; +Lisp_Object Qfont_param; /* In dispnew.c */ @@ -5607,20 +5608,34 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) GCPRO2(font_param, font); XSETFONT (font, FRAME_FONT (f)); - font_param = Ffont_get (font, intern_c_string (":name")); + font_param = Ffont_get (font, intern (":name")); if (STRINGP (font_param)) - default_name = SDATA (font_param); + default_name = xstrdup (SDATA (font_param)); else { font_param = Fframe_parameter (frame, Qfont_param); if (STRINGP (font_param)) - default_name = SDATA (font_param); + default_name = xstrdup (SDATA (font_param)); } if (default_name == NULL && x_last_font_name != NULL) - default_name = x_last_font_name; + default_name = xstrdup (x_last_font_name); + + /* Convert fontconfig names to Gtk names, i.e. remove - before number */ + if (default_name) + { + char *p = strrchr (default_name, '-'); + if (p) + { + char *ep = p+1; + while (isdigit (*ep)) + ++ep; + if (*ep == '\0') *p = ' '; + } + } name = xg_get_font_name (f, default_name); + xfree (default_name); if (name) { |