diff options
| author | Kenichi Handa | 2002-08-01 05:44:09 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-08-01 05:44:09 +0000 |
| commit | 6ab1fb6a7819c4efe8f3e43f3fa7fcd1423b3aab (patch) | |
| tree | ae43d6cd1d80e29fe4fb3c95aabc9c21b6bc11b1 /src/fontset.c | |
| parent | d8891a0f51d6349f8247cbb5937aa10b8b1bc688 (diff) | |
| download | emacs-6ab1fb6a7819c4efe8f3e43f3fa7fcd1423b3aab.tar.gz emacs-6ab1fb6a7819c4efe8f3e43f3fa7fcd1423b3aab.zip | |
(fs_load_font): If fontp->charset is not negative,
return fontp without setting its members.
Diffstat (limited to 'src/fontset.c')
| -rw-r--r-- | src/fontset.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/fontset.c b/src/fontset.c index e038000e865..1c1c1b12a4a 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -234,7 +234,7 @@ static int fontset_id_valid_p P_ ((int)); | |||
| 234 | static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); | 234 | static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); |
| 235 | static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object, | 235 | static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object, |
| 236 | Lisp_Object)); | 236 | Lisp_Object)); |
| 237 | 237 | static Lisp_Object find_font_encoding P_ ((char *)); | |
| 238 | 238 | ||
| 239 | 239 | ||
| 240 | /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/ | 240 | /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/ |
| @@ -792,14 +792,14 @@ make_fontset_for_ascii_face (f, base_fontset_id, face) | |||
| 792 | 792 | ||
| 793 | /* Load a font named FONTNAME on frame F. Return a pointer to the | 793 | /* Load a font named FONTNAME on frame F. Return a pointer to the |
| 794 | struct font_info of the loaded font. If loading fails, return | 794 | struct font_info of the loaded font. If loading fails, return |
| 795 | NULL. CHARSET_ID is an ID of charset to encode characters for this | 795 | NULL. CHARSET is an ID of charset to encode characters for this |
| 796 | font. */ | 796 | font. If it is -1, find one from Vfont_encoding_alist. */ |
| 797 | 797 | ||
| 798 | struct font_info * | 798 | struct font_info * |
| 799 | fs_load_font (f, fontname, charset_id) | 799 | fs_load_font (f, fontname, charset) |
| 800 | FRAME_PTR f; | 800 | FRAME_PTR f; |
| 801 | char *fontname; | 801 | char *fontname; |
| 802 | int charset_id; | 802 | int charset; |
| 803 | { | 803 | { |
| 804 | struct font_info *fontp; | 804 | struct font_info *fontp; |
| 805 | 805 | ||
| @@ -808,16 +808,25 @@ fs_load_font (f, fontname, charset_id) | |||
| 808 | return NULL; | 808 | return NULL; |
| 809 | 809 | ||
| 810 | fontp = (*load_font_func) (f, fontname, 0); | 810 | fontp = (*load_font_func) (f, fontname, 0); |
| 811 | if (!fontp) | 811 | if (! fontp || fontp->charset >= 0) |
| 812 | return NULL; | 812 | return fontp; |
| 813 | 813 | ||
| 814 | fontname = fontp->full_name; | 814 | fontname = fontp->full_name; |
| 815 | 815 | ||
| 816 | fontp->charset = charset_id; | 816 | if (charset < 0) |
| 817 | { | ||
| 818 | Lisp_Object charset_symbol; | ||
| 819 | |||
| 820 | charset_symbol = find_font_encoding (fontname); | ||
| 821 | if (CONSP (charset_symbol)) | ||
| 822 | charset_symbol = XCAR (charset_symbol); | ||
| 823 | charset = XINT (CHARSET_SYMBOL_ID (charset_symbol)); | ||
| 824 | } | ||
| 825 | fontp->charset = charset; | ||
| 817 | fontp->vertical_centering = 0; | 826 | fontp->vertical_centering = 0; |
| 818 | fontp->font_encoder = NULL; | 827 | fontp->font_encoder = NULL; |
| 819 | 828 | ||
| 820 | if (charset_id != charset_ascii) | 829 | if (charset != charset_ascii) |
| 821 | { | 830 | { |
| 822 | fontp->vertical_centering | 831 | fontp->vertical_centering |
| 823 | = (STRINGP (Vvertical_centering_font_regexp) | 832 | = (STRINGP (Vvertical_centering_font_regexp) |
| @@ -836,9 +845,9 @@ fs_load_font (f, fontname, charset_id) | |||
| 836 | #endif | 845 | #endif |
| 837 | 846 | ||
| 838 | 847 | ||
| 839 | /* Return ENCODING or a cons(ENCODING REPERTORY) of the font FONTNAME. | 848 | /* Return ENCODING or a cons of ENCODING and REPERTORY of the font |
| 840 | ENCODING is a charset symbol that specifies the encoding of the | 849 | FONTNAME. ENCODING is a charset symbol that specifies the encoding |
| 841 | font. REPERTORY is a charset symbol or nil. */ | 850 | of the font. REPERTORY is a charset symbol or nil. */ |
| 842 | 851 | ||
| 843 | 852 | ||
| 844 | static Lisp_Object | 853 | static Lisp_Object |