comparison src/redisplay.c @ 4815:6540302eedf5

Fix query_string_geometry lookup domain
author Didier Verna <didier@lrde.epita.fr>
date Sat, 09 Jan 2010 15:31:25 +0100
parents 726060ee587c
children 91b3d00e717f
comparison
equal deleted inserted replaced
4814:ae2e0c1c8fae 4815:6540302eedf5
628 /* low-level interfaces onto device routines */ 628 /* low-level interfaces onto device routines */
629 /* */ 629 /* */
630 /***************************************************************************/ 630 /***************************************************************************/
631 631
632 static int 632 static int
633 redisplay_text_width_ichar_string (struct window *w, int findex, 633 redisplay_window_text_width_ichar_string (struct window *w, int findex,
634 Ichar *str, Charcount len) 634 Ichar *str, Charcount len)
635 { 635 {
636 unsigned char charsets[NUM_LEADING_BYTES]; 636 unsigned char charsets[NUM_LEADING_BYTES];
637 Lisp_Object window; 637 Lisp_Object window;
638 638
639 find_charsets_in_ichar_string (charsets, str, len); 639 find_charsets_in_ichar_string (charsets, str, len);
645 WINDOW_FACE_CACHEL (w, findex), str, len)); 645 WINDOW_FACE_CACHEL (w, findex), str, len));
646 } 646 }
647 647
648 static Ichar_dynarr *rtw_ichar_dynarr; 648 static Ichar_dynarr *rtw_ichar_dynarr;
649 649
650 int 650 static int
651 redisplay_text_width_string (struct window *w, int findex, 651 redisplay_window_text_width_string (struct window *w, int findex,
652 Ibyte *nonreloc, Lisp_Object reloc, 652 Ibyte *nonreloc, Lisp_Object reloc,
653 Bytecount offset, Bytecount len) 653 Bytecount offset, Bytecount len)
654 { 654 {
655 if (!rtw_ichar_dynarr) 655 if (!rtw_ichar_dynarr)
656 rtw_ichar_dynarr = Dynarr_new (Ichar); 656 rtw_ichar_dynarr = Dynarr_new (Ichar);
657 Dynarr_reset (rtw_ichar_dynarr); 657 Dynarr_reset (rtw_ichar_dynarr);
658 658
659 fixup_internal_substring (nonreloc, reloc, offset, &len); 659 fixup_internal_substring (nonreloc, reloc, offset, &len);
660 if (STRINGP (reloc)) 660 if (STRINGP (reloc))
661 nonreloc = XSTRING_DATA (reloc); 661 nonreloc = XSTRING_DATA (reloc);
662 convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr); 662 convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr);
663 return redisplay_text_width_ichar_string 663 return redisplay_window_text_width_ichar_string
664 (w, findex, Dynarr_atp (rtw_ichar_dynarr, 0), 664 (w, findex, Dynarr_atp (rtw_ichar_dynarr, 0),
665 Dynarr_length (rtw_ichar_dynarr)); 665 Dynarr_length (rtw_ichar_dynarr));
666 } 666 }
667 667
668 int 668 int
669 redisplay_frame_text_width_string (struct frame *f, Lisp_Object face, 669 redisplay_text_width_string (Lisp_Object domain, Lisp_Object face,
670 Ibyte *nonreloc, Lisp_Object reloc, 670 Ibyte *nonreloc, Lisp_Object reloc,
671 Bytecount offset, Bytecount len) 671 Bytecount offset, Bytecount len)
672 { 672 {
673 Lisp_Object window = DOMAIN_WINDOW (domain);
674 Lisp_Object frame = DOMAIN_FRAME (domain);
673 unsigned char charsets[NUM_LEADING_BYTES]; 675 unsigned char charsets[NUM_LEADING_BYTES];
674 Lisp_Object frame;
675 struct face_cachel cachel; 676 struct face_cachel cachel;
676 677
677 if (!rtw_ichar_dynarr) 678 if (!rtw_ichar_dynarr)
678 rtw_ichar_dynarr = Dynarr_new (Ichar); 679 rtw_ichar_dynarr = Dynarr_new (Ichar);
679 Dynarr_reset (rtw_ichar_dynarr); 680 Dynarr_reset (rtw_ichar_dynarr);
683 nonreloc = XSTRING_DATA (reloc); 684 nonreloc = XSTRING_DATA (reloc);
684 convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr); 685 convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr);
685 find_charsets_in_ibyte_string (charsets, nonreloc, len); 686 find_charsets_in_ibyte_string (charsets, nonreloc, len);
686 reset_face_cachel (&cachel); 687 reset_face_cachel (&cachel);
687 cachel.face = face; 688 cachel.face = face;
688 frame = wrap_frame (f); 689 ensure_face_cachel_complete (&cachel,
689 ensure_face_cachel_complete (&cachel, frame, charsets); 690 NILP (window) ? frame : window,
690 return DEVMETH (XDEVICE (FRAME_DEVICE (f)), 691 charsets);
691 text_width, (f, &cachel, Dynarr_atp (rtw_ichar_dynarr, 0), 692 return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (frame))),
693 text_width, (XFRAME (frame),
694 &cachel,
695 Dynarr_atp (rtw_ichar_dynarr, 0),
692 Dynarr_length (rtw_ichar_dynarr))); 696 Dynarr_length (rtw_ichar_dynarr)));
693 } 697 }
694 698
695 /* Return the display block from DL of the given TYPE. A display line 699 /* Return the display block from DL of the given TYPE. A display line
696 can have only one display block of each possible type. If DL does 700 can have only one display block of each possible type. If DL does
1125 if (!fi->proportional_p || data->font_is_bogus) 1129 if (!fi->proportional_p || data->font_is_bogus)
1126 { 1130 {
1127 Ichar ch = data->font_is_bogus ? '~' : data->ch; 1131 Ichar ch = data->font_is_bogus ? '~' : data->ch;
1128 1132
1129 data->last_char_width = 1133 data->last_char_width =
1130 redisplay_text_width_ichar_string (XWINDOW (data->window), 1134 redisplay_window_text_width_ichar_string
1131 data->findex, &ch, 1); 1135 (XWINDOW (data->window), data->findex, &ch, 1);
1132 } 1136 }
1133 else 1137 else
1134 data->last_char_width = -1; 1138 data->last_char_width = -1;
1135 1139
1136 if (!no_contribute_to_line_height) 1140 if (!no_contribute_to_line_height)
1143 data->last_findex = data->findex; 1147 data->last_findex = data->findex;
1144 } 1148 }
1145 1149
1146 width = data->last_char_width; 1150 width = data->last_char_width;
1147 if (width < 0) /* proportional fonts */ 1151 if (width < 0) /* proportional fonts */
1148 width = redisplay_text_width_ichar_string (XWINDOW (data->window), 1152 width = redisplay_window_text_width_ichar_string
1149 data->findex, 1153 (XWINDOW (data->window), data->findex, &data->ch, 1);
1150 &data->ch, 1);
1151 } 1154 }
1152 1155
1153 if (data->max_pixpos != -1 && (data->pixpos + width > data->max_pixpos)) 1156 if (data->max_pixpos != -1 && (data->pixpos + width > data->max_pixpos))
1154 { 1157 {
1155 return ADD_FAILED; 1158 return ADD_FAILED;
4176 int dash_pixsize; 4179 int dash_pixsize;
4177 Ibyte ch = '-'; 4180 Ibyte ch = '-';
4178 SET_CURRENT_MODE_CHARS_PIXSIZE; 4181 SET_CURRENT_MODE_CHARS_PIXSIZE;
4179 4182
4180 dash_pixsize = 4183 dash_pixsize =
4181 redisplay_text_width_string (w, findex, &ch, Qnil, 0, 4184 redisplay_window_text_width_string
4182 1); 4185 (w, findex, &ch, Qnil, 0, 1);
4183 4186
4184 if (dash_pixsize == 0) 4187 if (dash_pixsize == 0)
4185 num_to_add = 0; 4188 num_to_add = 0;
4186 else { 4189 else {
4187 num_to_add = (max_pixsize - cur_pixsize) / dash_pixsize; 4190 num_to_add = (max_pixsize - cur_pixsize) / dash_pixsize;