diff options
| author | Karl Heuer | 1994-11-02 06:18:45 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-11-02 06:18:45 +0000 |
| commit | 40a5b2e17b769cab2294a96d6d40b1a71f6ddf72 (patch) | |
| tree | 9c405b9fdf5c2dcfac124f5b0507e622f4595900 /src | |
| parent | 3c887943b4c30e46b0e1df2ddfdc64e2a10b8f36 (diff) | |
| download | emacs-40a5b2e17b769cab2294a96d6d40b1a71f6ddf72.tar.gz emacs-40a5b2e17b769cab2294a96d6d40b1a71f6ddf72.zip | |
(Fx_list_fonts): Don't bother to retrieve font info when there's no size_ref
to compare it against.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/src/xfns.c b/src/xfns.c index 6cd137bcea5..e9a65d44c9e 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -2866,7 +2866,9 @@ even if they match PATTERN and FACE.") | |||
| 2866 | { | 2866 | { |
| 2867 | int num_fonts; | 2867 | int num_fonts; |
| 2868 | char **names; | 2868 | char **names; |
| 2869 | #ifndef BROKEN_XLISTFONTSWITHINFO | ||
| 2869 | XFontStruct *info; | 2870 | XFontStruct *info; |
| 2871 | #endif | ||
| 2870 | XFontStruct *size_ref; | 2872 | XFontStruct *size_ref; |
| 2871 | Lisp_Object list; | 2873 | Lisp_Object list; |
| 2872 | FRAME_PTR f; | 2874 | FRAME_PTR f; |
| @@ -2943,18 +2945,20 @@ even if they match PATTERN and FACE.") | |||
| 2943 | BLOCK_INPUT; | 2945 | BLOCK_INPUT; |
| 2944 | 2946 | ||
| 2945 | /* Solaris 2.3 has a bug in XListFontsWithInfo. */ | 2947 | /* Solaris 2.3 has a bug in XListFontsWithInfo. */ |
| 2946 | #ifdef BROKEN_XLISTFONTSWITHINFO | 2948 | #ifndef BROKEN_XLISTFONTSWITHINFO |
| 2947 | names = XListFonts (FRAME_X_DISPLAY (f), | 2949 | if (size_ref) |
| 2948 | XSTRING (pattern)->data, | 2950 | names = XListFontsWithInfo (FRAME_X_DISPLAY (f), |
| 2949 | 2000, /* maxnames */ | 2951 | XSTRING (pattern)->data, |
| 2950 | &num_fonts); /* count_return */ | 2952 | 2000, /* maxnames */ |
| 2951 | #else | 2953 | &num_fonts, /* count_return */ |
| 2952 | names = XListFontsWithInfo (FRAME_X_DISPLAY (f), | 2954 | &info); /* info_return */ |
| 2953 | XSTRING (pattern)->data, | 2955 | else |
| 2954 | 2000, /* maxnames */ | ||
| 2955 | &num_fonts, /* count_return */ | ||
| 2956 | &info); /* info_return */ | ||
| 2957 | #endif | 2956 | #endif |
| 2957 | names = XListFonts (FRAME_X_DISPLAY (f), | ||
| 2958 | XSTRING (pattern)->data, | ||
| 2959 | 2000, /* maxnames */ | ||
| 2960 | &num_fonts); /* count_return */ | ||
| 2961 | |||
| 2958 | UNBLOCK_INPUT; | 2962 | UNBLOCK_INPUT; |
| 2959 | 2963 | ||
| 2960 | list = Qnil; | 2964 | list = Qnil; |
| @@ -2977,27 +2981,36 @@ even if they match PATTERN and FACE.") | |||
| 2977 | list = Qnil; | 2981 | list = Qnil; |
| 2978 | for (i = 0; i < num_fonts; i++) | 2982 | for (i = 0; i < num_fonts; i++) |
| 2979 | { | 2983 | { |
| 2980 | XFontStruct *thisinfo; | 2984 | int keeper; |
| 2981 | 2985 | ||
| 2986 | if (!size_ref) | ||
| 2987 | keeper = 1; | ||
| 2988 | else | ||
| 2989 | { | ||
| 2982 | #ifdef BROKEN_XLISTFONTSWITHINFO | 2990 | #ifdef BROKEN_XLISTFONTSWITHINFO |
| 2983 | BLOCK_INPUT; | 2991 | XFontStruct *thisinfo; |
| 2984 | thisinfo = XLoadQueryFont (FRAME_X_DISPLAY (f), names[i]); | 2992 | |
| 2985 | UNBLOCK_INPUT; | 2993 | BLOCK_INPUT; |
| 2994 | thisinfo = XLoadQueryFont (FRAME_X_DISPLAY (f), names[i]); | ||
| 2995 | UNBLOCK_INPUT; | ||
| 2996 | |||
| 2997 | keeper = thisinfo && same_size_fonts (thisinfo, size_ref); | ||
| 2986 | #else | 2998 | #else |
| 2987 | thisinfo = &info[i]; | 2999 | keeper = same_size_fonts (&info[i], size_ref); |
| 2988 | #endif | 3000 | #endif |
| 2989 | if (thisinfo && (! size_ref | 3001 | } |
| 2990 | || same_size_fonts (thisinfo, size_ref))) | 3002 | if (keeper) |
| 2991 | list = Fcons (build_string (names[i]), list); | 3003 | list = Fcons (build_string (names[i]), list); |
| 2992 | } | 3004 | } |
| 2993 | list = Fnreverse (list); | 3005 | list = Fnreverse (list); |
| 2994 | 3006 | ||
| 2995 | BLOCK_INPUT; | 3007 | BLOCK_INPUT; |
| 2996 | #ifdef BROKEN_XLISTFONTSWITHINFO | 3008 | #ifndef BROKEN_XLISTFONTSWITHINFO |
| 2997 | XFreeFontNames (names); | 3009 | if (size_ref) |
| 2998 | #else | 3010 | XFreeFontInfo (names, info, num_fonts); |
| 2999 | XFreeFontInfo (names, info, num_fonts); | 3011 | else |
| 3000 | #endif | 3012 | #endif |
| 3013 | XFreeFontNames (names); | ||
| 3001 | UNBLOCK_INPUT; | 3014 | UNBLOCK_INPUT; |
| 3002 | } | 3015 | } |
| 3003 | 3016 | ||