comparison src/composite.c @ 98214:5803b1114219

(fill_gstring_header): Don't check FROM and TO here. (composition_compute_stop_pos): Fix handling of static composition. (Fcomposition_get_gstring): Check FROM and TO at first.
author Kenichi Handa <handa@m17n.org>
date Thu, 18 Sep 2008 06:20:12 +0000
parents 52d26067a946
children 690a23ccfcf9
comparison
equal deleted inserted replaced
98213:52d26067a946 98214:5803b1114219
810 else 810 else
811 { 811 {
812 CHECK_STRING (string); 812 CHECK_STRING (string);
813 if (! STRING_MULTIBYTE (current_buffer->enable_multibyte_characters)) 813 if (! STRING_MULTIBYTE (current_buffer->enable_multibyte_characters))
814 error ("Attempt to shape unibyte text"); 814 error ("Attempt to shape unibyte text");
815 CHECK_NATNUM (start); 815 /* FROM and TO are checked by the caller. */
816 from = XINT (start); 816 from = XINT (start);
817 CHECK_NATNUM (end);
818 to = XINT (end); 817 to = XINT (end);
819 if (from < 0 || from > to || to > SCHARS (string)) 818 if (from < 0 || from > to || to > SCHARS (string))
820 args_out_of_range_3 (string, start, end); 819 args_out_of_range_3 (string, start, end);
821 from_byte = string_char_to_byte (string, from); 820 from_byte = string_char_to_byte (string, from);
822 } 821 }
1025 if (STRINGP (string)) 1024 if (STRINGP (string))
1026 FETCH_STRING_CHAR_ADVANCE (c, string, charpos, bytepos); 1025 FETCH_STRING_CHAR_ADVANCE (c, string, charpos, bytepos);
1027 else 1026 else
1028 FETCH_CHAR_ADVANCE (c, charpos, bytepos); 1027 FETCH_CHAR_ADVANCE (c, charpos, bytepos);
1029 if (c == '\n') 1028 if (c == '\n')
1030 break; 1029 {
1030 cmp_it->ch = -2;
1031 break;
1032 }
1031 val = CHAR_TABLE_REF (Vcomposition_function_table, c); 1033 val = CHAR_TABLE_REF (Vcomposition_function_table, c);
1032 if (! NILP (val)) 1034 if (! NILP (val))
1033 { 1035 {
1034 Lisp_Object elt; 1036 Lisp_Object elt;
1035 1037
1048 return; 1050 return;
1049 } 1051 }
1050 } 1052 }
1051 } 1053 }
1052 cmp_it->stop_pos = charpos; 1054 cmp_it->stop_pos = charpos;
1053 cmp_it->ch = -2;
1054 } 1055 }
1055 1056
1056 /* Check if the character at CHARPOS (and BYTEPOS) is composed 1057 /* Check if the character at CHARPOS (and BYTEPOS) is composed
1057 (possibly with the following charaters) on window W. ENDPOS limits 1058 (possibly with the following charaters) on window W. ENDPOS limits
1058 characters to be composed. FACE, in non-NULL, is a base face of 1059 characters to be composed. FACE, in non-NULL, is a base face of
1489 Lisp_Object font_object, from, to, string; 1490 Lisp_Object font_object, from, to, string;
1490 { 1491 {
1491 Lisp_Object gstring, header; 1492 Lisp_Object gstring, header;
1492 EMACS_INT frompos, topos; 1493 EMACS_INT frompos, topos;
1493 1494
1495 CHECK_NATNUM (from);
1496 CHECK_NATNUM (to);
1494 if (! NILP (font_object)) 1497 if (! NILP (font_object))
1495 CHECK_FONT_OBJECT (font_object); 1498 CHECK_FONT_OBJECT (font_object);
1496 header = fill_gstring_header (Qnil, from, to, font_object, string); 1499 header = fill_gstring_header (Qnil, from, to, font_object, string);
1497 gstring = gstring_lookup_cache (header); 1500 gstring = gstring_lookup_cache (header);
1498 if (! NILP (gstring)) 1501 if (! NILP (gstring))
1499 return gstring; 1502 return gstring;
1500 1503
1501 /* Maybe we should check this at the function's entry. --Stef */ 1504 frompos = XINT (from);
1502 CHECK_NATNUM (from); frompos = XINT (from); 1505 topos = XINT (to);
1503 CHECK_NATNUM (to); topos = XINT (to);
1504
1505 if (LGSTRING_GLYPH_LEN (gstring_work) < topos - frompos) 1506 if (LGSTRING_GLYPH_LEN (gstring_work) < topos - frompos)
1506 gstring_work = Fmake_vector (make_number (topos - frompos + 2), Qnil); 1507 gstring_work = Fmake_vector (make_number (topos - frompos + 2), Qnil);
1507 LGSTRING_SET_HEADER (gstring_work, header); 1508 LGSTRING_SET_HEADER (gstring_work, header);
1508 LGSTRING_SET_ID (gstring_work, Qnil); 1509 LGSTRING_SET_ID (gstring_work, Qnil);
1509 fill_gstring_body (gstring_work); 1510 fill_gstring_body (gstring_work);