diff options
| author | Kenichi Handa | 1997-06-21 00:45:44 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-06-21 00:45:44 +0000 |
| commit | 2da424f117c1c1e857a5e3eac40853bd46e04357 (patch) | |
| tree | 266168b3f240fce28f4a1bf2e333ede9987a459d /src | |
| parent | d5e7d534d765d46065cd397e7ae2adf50ca33cc4 (diff) | |
| download | emacs-2da424f117c1c1e857a5e3eac40853bd46e04357.tar.gz emacs-2da424f117c1c1e857a5e3eac40853bd46e04357.zip | |
(dumpglyphs): Use FS_LOAD_FONT.
(x_new_fontset): If frame F has already using FONTSET, avoid the
duplicated work. Use FS_LOAD_FONT.
(x_list_fonts): Call Fassoc to search Valternate_charset_table.
(x_load_font): Get around a buf of XListFonts
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/src/xterm.c b/src/xterm.c index 67335d4915e..934f3de3995 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -692,7 +692,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 692 | struct font_info *fontp; | 692 | struct font_info *fontp; |
| 693 | 693 | ||
| 694 | if ((fontset < 0 && (fontset = FRAME_FONTSET (f)) < 0) | 694 | if ((fontset < 0 && (fontset = FRAME_FONTSET (f)) < 0) |
| 695 | || !(fontp = fs_load_font (f, FRAME_X_FONT_TABLE (f), | 695 | || !(fontp = FS_LOAD_FONT (f, FRAME_X_FONT_TABLE (f), |
| 696 | charset, NULL, fontset))) | 696 | charset, NULL, fontset))) |
| 697 | goto font_not_found; | 697 | goto font_not_found; |
| 698 | 698 | ||
| @@ -5258,6 +5258,11 @@ x_new_fontset (f, fontsetname) | |||
| 5258 | if (fontset < 0) | 5258 | if (fontset < 0) |
| 5259 | return Qnil; | 5259 | return Qnil; |
| 5260 | 5260 | ||
| 5261 | if (f->output_data.x->fontset == fontset) | ||
| 5262 | /* This fontset is already set in frame F. There's nothing more | ||
| 5263 | to do. */ | ||
| 5264 | return build_string (fontsetname); | ||
| 5265 | |||
| 5261 | fontsetp = FRAME_FONTSET_DATA (f)->fontset_table[fontset]; | 5266 | fontsetp = FRAME_FONTSET_DATA (f)->fontset_table[fontset]; |
| 5262 | 5267 | ||
| 5263 | if (!fontsetp->fontname[CHARSET_ASCII]) | 5268 | if (!fontsetp->fontname[CHARSET_ASCII]) |
| @@ -5272,7 +5277,7 @@ x_new_fontset (f, fontsetname) | |||
| 5272 | 5277 | ||
| 5273 | /* Since x_new_font doesn't update any fontset information, do it now. */ | 5278 | /* Since x_new_font doesn't update any fontset information, do it now. */ |
| 5274 | f->output_data.x->fontset = fontset; | 5279 | f->output_data.x->fontset = fontset; |
| 5275 | fs_load_font (f, FRAME_X_FONT_TABLE (f), | 5280 | FS_LOAD_FONT (f, FRAME_X_FONT_TABLE (f), |
| 5276 | CHARSET_ASCII, XSTRING (result)->data, fontset); | 5281 | CHARSET_ASCII, XSTRING (result)->data, fontset); |
| 5277 | 5282 | ||
| 5278 | return build_string (fontsetname); | 5283 | return build_string (fontsetname); |
| @@ -6265,28 +6270,19 @@ x_list_fonts (f, pattern, size, maxnames) | |||
| 6265 | int size; | 6270 | int size; |
| 6266 | int maxnames; | 6271 | int maxnames; |
| 6267 | { | 6272 | { |
| 6268 | Lisp_Object list, patterns = Qnil, newlist = Qnil, key, tem, second_best; | 6273 | Lisp_Object list, patterns, newlist = Qnil, key, tem, second_best; |
| 6269 | Display *dpy = f != NULL ? FRAME_X_DISPLAY (f) : x_display_list->display; | 6274 | Display *dpy = f != NULL ? FRAME_X_DISPLAY (f) : x_display_list->display; |
| 6270 | 6275 | ||
| 6271 | for (list = Valternative_fontname_alist; CONSP (list); | 6276 | patterns = Fassoc (pattern, Valternative_fontname_alist); |
| 6272 | list = XCONS (list)->cdr) | 6277 | if (NILP (patterns)) |
| 6273 | { | 6278 | patterns = Fcons (pattern, Qnil); |
| 6274 | tem = XCONS (list)->car; | ||
| 6275 | if (CONSP (tem) | ||
| 6276 | && STRINGP (XCONS (tem)->car) | ||
| 6277 | && !NILP (Fstring_equal (XCONS (tem)->car, pattern))) | ||
| 6278 | { | ||
| 6279 | patterns = XCONS (tem)->cdr; | ||
| 6280 | break; | ||
| 6281 | } | ||
| 6282 | } | ||
| 6283 | 6279 | ||
| 6284 | for (patterns = Fcons (pattern, patterns); CONSP (patterns); | 6280 | for (; CONSP (patterns); patterns = XCONS (patterns)->cdr) |
| 6285 | patterns = XCONS (patterns)->cdr, pattern = XCONS (patterns)->car) | ||
| 6286 | { | 6281 | { |
| 6287 | int num_fonts; | 6282 | int num_fonts; |
| 6288 | char **names; | 6283 | char **names; |
| 6289 | 6284 | ||
| 6285 | pattern = XCONS (patterns)->car; | ||
| 6290 | /* See if we cached the result for this particular query. */ | 6286 | /* See if we cached the result for this particular query. */ |
| 6291 | if (f && (tem = XCONS (FRAME_X_DISPLAY_INFO (f)->name_list_element)->cdr, | 6287 | if (f && (tem = XCONS (FRAME_X_DISPLAY_INFO (f)->name_list_element)->cdr, |
| 6292 | key = Fcons (pattern, make_number (maxnames)), | 6288 | key = Fcons (pattern, make_number (maxnames)), |
| @@ -6462,6 +6458,11 @@ x_load_font (f, fontname, size) | |||
| 6462 | struct font_info *fontp; | 6458 | struct font_info *fontp; |
| 6463 | unsigned long value; | 6459 | unsigned long value; |
| 6464 | 6460 | ||
| 6461 | /* If we have found fonts by x_list_font, load one of them. If | ||
| 6462 | not, we still try to load a font by the name given as FONTNAME | ||
| 6463 | because XListFonts (called in x_list_font) of some X server has | ||
| 6464 | a bug of not finding a font even if the font surely exists and | ||
| 6465 | is loadable by XLoadQueryFont. */ | ||
| 6465 | if (!NILP (font_names)) | 6466 | if (!NILP (font_names)) |
| 6466 | fontname = (char *) XSTRING (XCONS (font_names)->car)->data; | 6467 | fontname = (char *) XSTRING (XCONS (font_names)->car)->data; |
| 6467 | 6468 | ||
| @@ -6536,6 +6537,29 @@ x_load_font (f, fontname, size) | |||
| 6536 | fontp->size = font->max_bounds.width; | 6537 | fontp->size = font->max_bounds.width; |
| 6537 | fontp->height = font->ascent + font->descent; | 6538 | fontp->height = font->ascent + font->descent; |
| 6538 | 6539 | ||
| 6540 | if (NILP (font_names)) | ||
| 6541 | { | ||
| 6542 | /* We come here because of a bug of XListFonts mentioned at | ||
| 6543 | the head of this block. Let's store this information in | ||
| 6544 | the cache for x_list_fonts. */ | ||
| 6545 | Lisp_Object lispy_name = build_string (fontname); | ||
| 6546 | Lisp_Object lispy_full_name = build_string (fontp->full_name); | ||
| 6547 | |||
| 6548 | XCONS (dpyinfo->name_list_element)->cdr | ||
| 6549 | = Fcons (Fcons (Fcons (lispy_name, make_number (256)), | ||
| 6550 | Fcons (Fcons (lispy_full_name, | ||
| 6551 | make_number (fontp->size)), | ||
| 6552 | Qnil)), | ||
| 6553 | XCONS (dpyinfo->name_list_element)->cdr); | ||
| 6554 | if (full_name) | ||
| 6555 | XCONS (dpyinfo->name_list_element)->cdr | ||
| 6556 | = Fcons (Fcons (Fcons (lispy_full_name, make_number (256)), | ||
| 6557 | Fcons (Fcons (lispy_full_name, | ||
| 6558 | make_number (fontp->size)), | ||
| 6559 | Qnil)), | ||
| 6560 | XCONS (dpyinfo->name_list_element)->cdr); | ||
| 6561 | } | ||
| 6562 | |||
| 6539 | /* The slot `encoding' specifies how to map a character | 6563 | /* The slot `encoding' specifies how to map a character |
| 6540 | code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to | 6564 | code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to |
| 6541 | the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F, | 6565 | the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F, |