diff options
| author | Kenichi Handa | 2002-07-26 04:08:30 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-07-26 04:08:30 +0000 |
| commit | 8093092d28f94d522ee2f5d92da2a9392c0fb17a (patch) | |
| tree | e3d022d420af5e2c37e61410f960e5f8646a25c2 /src | |
| parent | 40cbb819fa66b8117f05983c26dcd319cfcc7e1d (diff) | |
| download | emacs-8093092d28f94d522ee2f5d92da2a9392c0fb17a.tar.gz emacs-8093092d28f94d522ee2f5d92da2a9392c0fb17a.zip | |
(x_produce_glyphs): Use ASCII_CHAR_P, not
SINGLE_BYTE_CHAR_P. Fix the logic of handling non-ASCII char when
it->multibyte_p is zero.
(XTread_socket): Use ASCII_CHAR_P, not SINGLE_BYTE_CHAR_P.
(x_new_fontset): If FONTSETNAME doesn't match any existing
fontsets, create a new one.
(x_get_font_repertory): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 135 |
1 files changed, 117 insertions, 18 deletions
diff --git a/src/xterm.c b/src/xterm.c index 821866e638c..93aee69e307 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -1813,18 +1813,13 @@ x_produce_glyphs (it) | |||
| 1813 | /* Maybe translate single-byte characters to multibyte, or the | 1813 | /* Maybe translate single-byte characters to multibyte, or the |
| 1814 | other way. */ | 1814 | other way. */ |
| 1815 | it->char_to_display = it->c; | 1815 | it->char_to_display = it->c; |
| 1816 | if (!ASCII_BYTE_P (it->c)) | 1816 | if (! ASCII_CHAR_P (it->c) |
| 1817 | && ! it->multibyte_p) | ||
| 1817 | { | 1818 | { |
| 1818 | if (unibyte_display_via_language_environment | 1819 | if (SINGLE_BYTE_CHAR_P (it->c) |
| 1819 | && SINGLE_BYTE_CHAR_P (it->c)) | 1820 | && unibyte_display_via_language_environment) |
| 1820 | { | 1821 | it->char_to_display = unibyte_char_to_multibyte (it->c); |
| 1821 | it->char_to_display = unibyte_char_to_multibyte (it->c); | 1822 | if (! SINGLE_BYTE_CHAR_P (it->c)) |
| 1822 | it->multibyte_p = 1; | ||
| 1823 | it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display); | ||
| 1824 | face = FACE_FROM_ID (it->f, it->face_id); | ||
| 1825 | } | ||
| 1826 | else if (!SINGLE_BYTE_CHAR_P (it->c) | ||
| 1827 | && !it->multibyte_p) | ||
| 1828 | { | 1823 | { |
| 1829 | it->multibyte_p = 1; | 1824 | it->multibyte_p = 1; |
| 1830 | it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display); | 1825 | it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display); |
| @@ -10714,7 +10709,7 @@ XTread_socket (sd, bufp, numchars, expected) | |||
| 10714 | c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, | 10709 | c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, |
| 10715 | nbytes - i, len); | 10710 | nbytes - i, len); |
| 10716 | 10711 | ||
| 10717 | bufp->kind = (SINGLE_BYTE_CHAR_P (c) | 10712 | bufp->kind = (ASCII_CHAR_P (c) |
| 10718 | ? ascii_keystroke | 10713 | ? ascii_keystroke |
| 10719 | : multibyte_char_keystroke); | 10714 | : multibyte_char_keystroke); |
| 10720 | bufp->code = c; | 10715 | bufp->code = c; |
| @@ -12278,20 +12273,29 @@ x_new_fontset (f, fontsetname) | |||
| 12278 | int fontset = fs_query_fontset (build_string (fontsetname), 0); | 12273 | int fontset = fs_query_fontset (build_string (fontsetname), 0); |
| 12279 | Lisp_Object result; | 12274 | Lisp_Object result; |
| 12280 | 12275 | ||
| 12281 | if (fontset < 0) | 12276 | if (fontset >= 0 && f->output_data.x->fontset == fontset) |
| 12282 | return Qnil; | ||
| 12283 | |||
| 12284 | if (f->output_data.x->fontset == fontset) | ||
| 12285 | /* This fontset is already set in frame F. There's nothing more | 12277 | /* This fontset is already set in frame F. There's nothing more |
| 12286 | to do. */ | 12278 | to do. */ |
| 12287 | return fontset_name (fontset); | 12279 | return fontset_name (fontset); |
| 12288 | 12280 | ||
| 12289 | result = x_new_font (f, (XSTRING (fontset_ascii (fontset))->data)); | 12281 | if (fontset >= 0) |
| 12282 | result = x_new_font (f, (XSTRING (fontset_ascii (fontset))->data)); | ||
| 12283 | else | ||
| 12284 | result = x_new_font (f, fontsetname); | ||
| 12290 | 12285 | ||
| 12291 | if (!STRINGP (result)) | 12286 | if (!STRINGP (result)) |
| 12292 | /* Can't load ASCII font. */ | 12287 | /* Can't load ASCII font. */ |
| 12293 | return Qnil; | 12288 | return Qnil; |
| 12294 | 12289 | ||
| 12290 | if (fontset < 0) | ||
| 12291 | { | ||
| 12292 | Lisp_Object fontlist; | ||
| 12293 | |||
| 12294 | fontlist = Fcons (Fcons (Qascii, Fcons (result, Qnil)), Qnil); | ||
| 12295 | Fnew_fontset (result, fontlist); | ||
| 12296 | fontset = fs_query_fontset (result, 0); | ||
| 12297 | } | ||
| 12298 | |||
| 12295 | /* Since x_new_font doesn't update any fontset information, do it now. */ | 12299 | /* Since x_new_font doesn't update any fontset information, do it now. */ |
| 12296 | f->output_data.x->fontset = fontset; | 12300 | f->output_data.x->fontset = fontset; |
| 12297 | 12301 | ||
| @@ -12301,7 +12305,7 @@ x_new_fontset (f, fontsetname) | |||
| 12301 | xic_set_xfontset (f, XSTRING (fontset_ascii (fontset))->data); | 12305 | xic_set_xfontset (f, XSTRING (fontset_ascii (fontset))->data); |
| 12302 | #endif | 12306 | #endif |
| 12303 | 12307 | ||
| 12304 | return build_string (fontsetname); | 12308 | return fontset_name (fontset); |
| 12305 | } | 12309 | } |
| 12306 | 12310 | ||
| 12307 | /* Compute actual fringe widths */ | 12311 | /* Compute actual fringe widths */ |
| @@ -14459,6 +14463,101 @@ x_find_ccl_program (fontp) | |||
| 14459 | } | 14463 | } |
| 14460 | 14464 | ||
| 14461 | 14465 | ||
| 14466 | /* Return a char-table whose elements are t if the font FONT_INFO | ||
| 14467 | contains a glyph for the corresponding character, and nil if not. | ||
| 14468 | |||
| 14469 | Fixme: For the moment, this function works only for fonts whose | ||
| 14470 | glyph encoding is the same as Unicode (e.g. ISO10646-1 fonts). */ | ||
| 14471 | |||
| 14472 | Lisp_Object | ||
| 14473 | x_get_font_repertory (f, font_info) | ||
| 14474 | FRAME_PTR f; | ||
| 14475 | struct font_info *font_info; | ||
| 14476 | { | ||
| 14477 | XFontStruct *font = (XFontStruct *) font_info->font; | ||
| 14478 | struct charset *charset = CHARSET_FROM_ID (font_info->charset); | ||
| 14479 | Lisp_Object table; | ||
| 14480 | int min_byte1, max_byte1, min_byte2, max_byte2; | ||
| 14481 | |||
| 14482 | table = Fmake_char_table (Qnil, Qnil); | ||
| 14483 | |||
| 14484 | min_byte1 = font->min_byte1; | ||
| 14485 | max_byte1 = font->max_byte1; | ||
| 14486 | min_byte2 = font->min_char_or_byte2; | ||
| 14487 | max_byte2 = font->max_char_or_byte2; | ||
| 14488 | if (min_byte1 == 0 && max_byte1 == 0) | ||
| 14489 | { | ||
| 14490 | if (! font->per_char || font->all_chars_exist == True) | ||
| 14491 | char_table_set_range (table, min_byte2, max_byte2, Qt); | ||
| 14492 | else | ||
| 14493 | { | ||
| 14494 | XCharStruct *pcm = font->per_char; | ||
| 14495 | int from = -1; | ||
| 14496 | int i; | ||
| 14497 | |||
| 14498 | for (i = min_byte2; i <= max_byte2; i++, pcm++) | ||
| 14499 | { | ||
| 14500 | if (pcm->width == 0 && pcm->rbearing == pcm->lbearing) | ||
| 14501 | { | ||
| 14502 | if (from >= 0) | ||
| 14503 | { | ||
| 14504 | char_table_set_range (table, from, i - 1, Qt); | ||
| 14505 | from = -1; | ||
| 14506 | } | ||
| 14507 | } | ||
| 14508 | else if (from < 0) | ||
| 14509 | from = i; | ||
| 14510 | } | ||
| 14511 | if (from >= 0) | ||
| 14512 | char_table_set_range (table, from, i - 1, Qt); | ||
| 14513 | } | ||
| 14514 | } | ||
| 14515 | else | ||
| 14516 | { | ||
| 14517 | if (! font->per_char || font->all_chars_exist == True) | ||
| 14518 | { | ||
| 14519 | int i; | ||
| 14520 | |||
| 14521 | for (i = min_byte1; i <= max_byte1; i++) | ||
| 14522 | char_table_set_range (table, | ||
| 14523 | (i << 8) | min_byte2, (i << 8) | max_byte2, | ||
| 14524 | Qt); | ||
| 14525 | } | ||
| 14526 | else | ||
| 14527 | { | ||
| 14528 | XCharStruct *pcm = font->per_char; | ||
| 14529 | int i; | ||
| 14530 | |||
| 14531 | for (i = min_byte1; i <= max_byte1; i++) | ||
| 14532 | { | ||
| 14533 | int from = -1; | ||
| 14534 | int j; | ||
| 14535 | |||
| 14536 | for (j = min_byte2; j <= max_byte2; j++, pcm++) | ||
| 14537 | { | ||
| 14538 | if (pcm->width == 0 && pcm->rbearing == pcm->lbearing) | ||
| 14539 | { | ||
| 14540 | if (from >= 0) | ||
| 14541 | { | ||
| 14542 | char_table_set_range (table, (i << 8) | from, | ||
| 14543 | (i << 8) | (j - 1), Qt); | ||
| 14544 | from = -1; | ||
| 14545 | } | ||
| 14546 | } | ||
| 14547 | else if (from < 0) | ||
| 14548 | from = j; | ||
| 14549 | } | ||
| 14550 | if (from >= 0) | ||
| 14551 | char_table_set_range (table, (i << 8) | from, | ||
| 14552 | (i << 8) | (j - 1), Qt); | ||
| 14553 | } | ||
| 14554 | } | ||
| 14555 | } | ||
| 14556 | |||
| 14557 | return table; | ||
| 14558 | } | ||
| 14559 | |||
| 14560 | |||
| 14462 | 14561 | ||
| 14463 | /*********************************************************************** | 14562 | /*********************************************************************** |
| 14464 | Initialization | 14563 | Initialization |