From: tomo Date: Fri, 9 Jun 2000 09:18:11 +0000 (+0000) Subject: (redisplay_text_width_charc_string): New function; delete X-Git-Tag: r21-2-34-utf-2000-0_16-1~50 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79ba2bd541c67cefd7f15e6e128606b2b97732d3;p=chise%2Fxemacs-chise.git (redisplay_text_width_charc_string): New function; delete `redisplay_text_width_emchar_string'. (rtw_charc_dynarr): New variable; renamed from `rtw_emchar_dynarr'. (redisplay_text_width_string): Use `rtw_charc_dynarr' instead of `rtw_emchar_dynarr'; use `convert_bufbyte_string_into_charc_dynarr' instead of `convert_bufbyte_string_into_emchar_dynarr'; use `redisplay_text_width_charc_string' instead of `redisplay_text_width_emchar_string'. (redisplay_frame_text_width_string): Use `rtw_charc_dynarr' instead of `rtw_emchar_dynarr'; use `convert_bufbyte_string_into_charc_dynarr' instead of `convert_bufbyte_string_into_emchar_dynarr'. (add_emchar_rune): Add instead of ; use `redisplay_text_width_charc_string' instead of `redisplay_text_width_emchar_string'. (create_text_block): Modify for change. (generate_formatted_string_db): Likewise. (create_string_text_block): Likewise. (pixel_to_glyph_translation): Likewise. --- diff --git a/src/redisplay.c b/src/redisplay.c index ad22495..66515ec 100644 --- a/src/redisplay.c +++ b/src/redisplay.c @@ -477,13 +477,13 @@ Lisp_Object Qtop_bottom; /***************************************************************************/ static int -redisplay_text_width_emchar_string (struct window *w, int findex, - Emchar *str, Charcount len) +redisplay_text_width_charc_string (struct window *w, int findex, + Charc *str, Charcount len) { Charset_ID charsets[NUM_LEADING_BYTES]; Lisp_Object window; - find_charsets_in_emchar_string (charsets, str, len); + find_charsets_in_charc_string (charsets, str, len); XSETWINDOW (window, w); ensure_face_cachel_complete (WINDOW_FACE_CACHEL (w, findex), window, charsets); @@ -492,24 +492,24 @@ redisplay_text_width_emchar_string (struct window *w, int findex, WINDOW_FACE_CACHEL (w, findex), str, len)); } -static Emchar_dynarr *rtw_emchar_dynarr; +static Charc_dynarr *rtw_charc_dynarr; int redisplay_text_width_string (struct window *w, int findex, Bufbyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount len) { - if (!rtw_emchar_dynarr) - rtw_emchar_dynarr = Dynarr_new (Emchar); - Dynarr_reset (rtw_emchar_dynarr); + if (!rtw_charc_dynarr) + rtw_charc_dynarr = Dynarr_new (Charc); + Dynarr_reset (rtw_charc_dynarr); fixup_internal_substring (nonreloc, reloc, offset, &len); if (STRINGP (reloc)) nonreloc = XSTRING_DATA (reloc); - convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); - return redisplay_text_width_emchar_string - (w, findex, Dynarr_atp (rtw_emchar_dynarr, 0), - Dynarr_length (rtw_emchar_dynarr)); + convert_bufbyte_string_into_charc_dynarr (nonreloc, len, rtw_charc_dynarr); + return redisplay_text_width_charc_string + (w, findex, Dynarr_atp (rtw_charc_dynarr, 0), + Dynarr_length (rtw_charc_dynarr)); } int @@ -521,22 +521,22 @@ redisplay_frame_text_width_string (struct frame *f, Lisp_Object face, Lisp_Object frame; struct face_cachel cachel; - if (!rtw_emchar_dynarr) - rtw_emchar_dynarr = Dynarr_new (Emchar); - Dynarr_reset (rtw_emchar_dynarr); + if (!rtw_charc_dynarr) + rtw_charc_dynarr = Dynarr_new (Charc); + Dynarr_reset (rtw_charc_dynarr); fixup_internal_substring (nonreloc, reloc, offset, &len); if (STRINGP (reloc)) nonreloc = XSTRING_DATA (reloc); - convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); + convert_bufbyte_string_into_charc_dynarr (nonreloc, len, rtw_charc_dynarr); find_charsets_in_bufbyte_string (charsets, nonreloc, len); reset_face_cachel (&cachel); cachel.face = face; XSETFRAME (frame, f); ensure_face_cachel_complete (&cachel, frame, charsets); return DEVMETH (XDEVICE (FRAME_DEVICE (f)), - text_width, (f, &cachel, Dynarr_atp (rtw_emchar_dynarr, 0), - Dynarr_length (rtw_emchar_dynarr))); + text_width, (f, &cachel, Dynarr_atp (rtw_charc_dynarr, 0), + Dynarr_length (rtw_charc_dynarr))); } /* Return the display block from DL of the given TYPE. A display line @@ -822,6 +822,7 @@ add_emchar_rune (pos_data *data) { struct rune rb, *crb; int width, local; + Charc char_glyph; if (data->start_col) { @@ -838,14 +839,16 @@ add_emchar_rune (pos_data *data) if (data->ch == '\n') { + char_glyph.charset = Vcharset_ascii; + char_glyph.code_point = '\n'; data->font_is_bogus = 0; /* Cheesy end-of-line pseudo-character. */ width = data->blank_width; } else { - Lisp_Object charset = CHAR_CHARSET (data->ch); - if (!EQ (charset, data->last_charset) || + char_glyph.code_point = ENCODE_CHAR (data->ch, char_glyph.charset); + if (!EQ (char_glyph.charset, data->last_charset) || data->findex != data->last_findex) { /* OK, we need to do things the hard way. */ @@ -853,7 +856,7 @@ add_emchar_rune (pos_data *data) struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, data->findex); Lisp_Object font_instance = ensure_face_cachel_contains_charset (cachel, data->window, - charset); + char_glyph.charset); Lisp_Font_Instance *fi; if (EQ (font_instance, Vthe_null_font_instance)) @@ -872,7 +875,7 @@ add_emchar_rune (pos_data *data) data->last_char_width = -1; data->new_ascent = max (data->new_ascent, (int) fi->ascent); data->new_descent = max (data->new_descent, (int) fi->descent); - data->last_charset = charset; + data->last_charset = char_glyph.charset; data->last_findex = data->findex; } @@ -880,9 +883,9 @@ add_emchar_rune (pos_data *data) if (width < 0) { /* bummer. Proportional fonts. */ - width = redisplay_text_width_emchar_string (XWINDOW (data->window), - data->findex, - &data->ch, 1); + width = redisplay_text_width_charc_string (XWINDOW (data->window), + data->findex, + &char_glyph, 1); } } @@ -913,7 +916,8 @@ add_emchar_rune (pos_data *data) data->bi_bufpos); else crb->bufpos = - bytecount_to_charcount (XSTRING_DATA (data->string), data->bi_bufpos); + bytecount_to_charcount (XSTRING_DATA (data->string), + data->bi_bufpos); } else if (data->is_modeline) crb->bufpos = data->modeline_charpos; @@ -921,7 +925,14 @@ add_emchar_rune (pos_data *data) /* Text but not in buffer */ crb->bufpos = 0; crb->type = RUNE_CHAR; - crb->object.chr.ch = data->font_is_bogus ? '~' : data->ch; + if (data->font_is_bogus) + { + char_glyph.charset = Vcharset_ascii; + char_glyph.code_point = '~'; + crb->object.cglyph = char_glyph; + } + else + crb->object.cglyph = char_glyph; crb->endpos = 0; if (data->cursor_type == CURSOR_ON) @@ -2533,7 +2544,9 @@ done: { struct rune *rb = Dynarr_atp (db->runes, elt); - if ((rb->type == RUNE_CHAR && rb->object.chr.ch == ' ') + if ((rb->type == RUNE_CHAR + && EQ (rb->object.cglyph.charset, Vcharset_ascii) + && rb->object.cglyph.code_point == ' ') || rb->type == RUNE_BLANK) { dl->bounds.left_white += rb->width; @@ -2553,8 +2566,11 @@ done: { struct rune *rb = Dynarr_atp (db->runes, elt); - if (!(rb->type == RUNE_CHAR && rb->object.chr.ch < 0x100 - && isspace (rb->object.chr.ch)) + if (!(rb->type == RUNE_CHAR + && (EQ (rb->object.cglyph.charset, Vcharset_ascii) + || EQ (rb->object.cglyph.charset, Vcharset_control_1) + || EQ (rb->object.cglyph.charset, Vcharset_latin_iso8859_1)) + && isspace (rb->object.cglyph.code_point)) && !rb->type == RUNE_BLANK) { dl->bounds.right_white = rb->xpos + rb->width; @@ -3551,9 +3567,11 @@ generate_formatted_string_db (Lisp_Object format_str, Lisp_Object result_str, { if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) { - len += (set_charptr_emchar - (strdata + len, Dynarr_atp (db->runes, - elt)->object.chr.ch)); + Charc ec = Dynarr_atp (db->runes, elt)->object.cglyph; + + len += (set_charptr_emchar (strdata + len, + DECODE_CHAR (ec.charset, + ec.code_point))); } } @@ -4782,7 +4800,9 @@ done: { struct rune *rb = Dynarr_atp (db->runes, elt); - if ((rb->type == RUNE_CHAR && rb->object.chr.ch == ' ') + if ((rb->type == RUNE_CHAR + && EQ (rb->object.cglyph.charset, Vcharset_ascii) + && rb->object.cglyph.code_point == ' ') || rb->type == RUNE_BLANK) { dl->bounds.left_white += rb->width; @@ -4802,8 +4822,11 @@ done: { struct rune *rb = Dynarr_atp (db->runes, elt); - if (!(rb->type == RUNE_CHAR && rb->object.chr.ch < 0x100 - && isspace (rb->object.chr.ch)) + if (!(rb->type == RUNE_CHAR + && (EQ (rb->object.cglyph.charset, Vcharset_ascii) + || EQ (rb->object.cglyph.charset, Vcharset_control_1) + || EQ (rb->object.cglyph.charset, Vcharset_latin_iso8859_1)) + && isspace (rb->object.cglyph.code_point)) && !rb->type == RUNE_BLANK) { dl->bounds.right_white = rb->xpos + rb->width; @@ -8704,7 +8727,9 @@ pixel_to_glyph_translation (struct frame *f, int x_coord, int y_coord, } else if (past_end || (rb->type == RUNE_CHAR - && rb->object.chr.ch == '\n')) + && EQ (rb->object.cglyph.charset, + Vcharset_ascii) + && rb->object.cglyph.code_point == '\n')) { (*row)--; /* At this point we may have glyphs in the right