aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2006-07-24 04:38:53 +0000
committerKenichi Handa2006-07-24 04:38:53 +0000
commitfcc1aec2970a41996982af76c4acd4085846326f (patch)
treefbd3e26fd5c037918d517ec969a92b58f848ae19 /src
parent5f935f7ca122a4c8926f0e806785e6e9028208e9 (diff)
downloademacs-fcc1aec2970a41996982af76c4acd4085846326f.tar.gz
emacs-fcc1aec2970a41996982af76c4acd4085846326f.zip
(it_props): Move the entry for Qauto_composed to just
before the entry for Qcompostion. (handle_auto_composed_prop): Call auto-composition-function with 4 args. (handle_composition_prop) [USE_FONT_BACKEND]: Set it->face_id from the font in gstring. (fill_composite_glyph_string): Check LGLYPH_FORM (g) to detect the end of valid glyph. (x_produce_glyphs): Don't update it->face_id if we are composing with gstring.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index fbd61f7e2be..b9b630d2e74 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -755,13 +755,13 @@ static enum prop_handled handle_auto_composed_prop P_ ((struct it *));
755 755
756static struct props it_props[] = 756static struct props it_props[] =
757{ 757{
758 {&Qauto_composed, AUTO_COMPOSED_PROP_IDX, handle_auto_composed_prop},
759 {&Qfontified, FONTIFIED_PROP_IDX, handle_fontified_prop}, 758 {&Qfontified, FONTIFIED_PROP_IDX, handle_fontified_prop},
760 /* Handle `face' before `display' because some sub-properties of 759 /* Handle `face' before `display' because some sub-properties of
761 `display' need to know the face. */ 760 `display' need to know the face. */
762 {&Qface, FACE_PROP_IDX, handle_face_prop}, 761 {&Qface, FACE_PROP_IDX, handle_face_prop},
763 {&Qdisplay, DISPLAY_PROP_IDX, handle_display_prop}, 762 {&Qdisplay, DISPLAY_PROP_IDX, handle_display_prop},
764 {&Qinvisible, INVISIBLE_PROP_IDX, handle_invisible_prop}, 763 {&Qinvisible, INVISIBLE_PROP_IDX, handle_invisible_prop},
764 {&Qauto_composed, AUTO_COMPOSED_PROP_IDX, handle_auto_composed_prop},
765 {&Qcomposition, COMPOSITION_PROP_IDX, handle_composition_prop}, 765 {&Qcomposition, COMPOSITION_PROP_IDX, handle_composition_prop},
766 {NULL, 0, NULL} 766 {NULL, 0, NULL}
767}; 767};
@@ -4479,7 +4479,7 @@ handle_auto_composed_prop (it)
4479 limit = make_number (find_next_newline_no_quit (pos, 1)); 4479 limit = make_number (find_next_newline_no_quit (pos, 1));
4480 4480
4481 next = (Fnext_single_property_change 4481 next = (Fnext_single_property_change
4482 (make_number (pos), Qauto_composed, it->string, limit)); 4482 (make_number (pos), Qauto_composed, it->string, limit));
4483 if (XINT (next) < XINT (limit)) 4483 if (XINT (next) < XINT (limit))
4484 { 4484 {
4485 /* The current point is auto-composed, but there exist 4485 /* The current point is auto-composed, but there exist
@@ -4507,13 +4507,40 @@ handle_auto_composed_prop (it)
4507 if (NILP (val)) 4507 if (NILP (val))
4508 { 4508 {
4509 int count = SPECPDL_INDEX (); 4509 int count = SPECPDL_INDEX ();
4510 Lisp_Object args[3]; 4510 Lisp_Object args[4];
4511 4511
4512 args[0] = Vauto_composition_function; 4512 args[0] = Vauto_composition_function;
4513 specbind (Qauto_composition_function, Qnil); 4513 specbind (Qauto_composition_function, Qnil);
4514 args[1] = make_number (pos); 4514 args[1] = make_number (pos);
4515 args[2] = it->string; 4515 args[2] = it->string;
4516 safe_call (3, args); 4516#ifdef USE_FONT_BACKEND
4517 if (enable_font_backend)
4518 {
4519 struct face *face = FACE_FROM_ID (it->f, it->face_id);
4520 int c;
4521
4522 if (STRINGP (it->string))
4523 {
4524 EMACS_INT pos_byte = IT_STRING_BYTEPOS (*it);
4525 const unsigned char *s = SDATA (it->string) + pos_byte;
4526
4527 if (STRING_MULTIBYTE (it->string))
4528 it->c = STRING_CHAR (s, 0);
4529 else
4530 it->c = *s;
4531 }
4532 else
4533 {
4534 EMACS_INT pos_byte = IT_BYTEPOS (*it);
4535
4536 it->c = FETCH_CHAR (pos_byte);
4537 }
4538 args[3] = font_at (it->c, this_pos, face, it->w, it->string);
4539 }
4540 else
4541#endif /* USE_FONT_BACKEND */
4542 args[3] = Qnil;
4543 safe_call (4, args);
4517 unbind_to (count, Qnil); 4544 unbind_to (count, Qnil);
4518 4545
4519 if (this_pos == pos) 4546 if (this_pos == pos)
@@ -4604,7 +4631,17 @@ handle_composition_prop (it)
4604 it->cmp_len = COMPOSITION_LENGTH (prop); 4631 it->cmp_len = COMPOSITION_LENGTH (prop);
4605#ifdef USE_FONT_BACKEND 4632#ifdef USE_FONT_BACKEND
4606 if (composition_table[id]->method == COMPOSITION_WITH_GLYPH_STRING) 4633 if (composition_table[id]->method == COMPOSITION_WITH_GLYPH_STRING)
4607 it->c = ' '; 4634 {
4635 Lisp_Object lgstring = AREF (XHASH_TABLE (composition_hash_table)
4636 ->key_and_value,
4637 cmp->hash_index * 2);
4638 Lisp_Object font_object = LGSTRING_FONT (lgstring);
4639 struct font *font = XSAVE_VALUE (font_object)->pointer;
4640 struct face *face = FACE_FROM_ID (it->f, it->face_id);
4641
4642 it->face_id = face_for_font (it->f, font, face);
4643 it->c = ' ';
4644 }
4608 else 4645 else
4609#endif /* USE_FONT_BACKEND */ 4646#endif /* USE_FONT_BACKEND */
4610 /* For a terminal, draw only the first character of the 4647 /* For a terminal, draw only the first character of the
@@ -18912,14 +18949,16 @@ fill_composite_glyph_string (s, faces, overlaps)
18912 = AREF (XHASH_TABLE (composition_hash_table)->key_and_value, 18949 = AREF (XHASH_TABLE (composition_hash_table)->key_and_value,
18913 s->cmp->hash_index * 2); 18950 s->cmp->hash_index * 2);
18914 18951
18915 for (i = 0; i < s->cmp->glyph_len; i++) 18952 for (i = 0, s->nchars = 0; i < s->cmp->glyph_len; i++, s->nchars++)
18916 { 18953 {
18917 Lisp_Object g = LGSTRING_GLYPH (gstring, i); 18954 Lisp_Object g = LGSTRING_GLYPH (gstring, i);
18918 unsigned code = XUINT (LGLYPH_CODE (g)); 18955 unsigned code;
18919 18956
18957 if (NILP (LGLYPH_FROM (g)))
18958 break;
18959 code = XUINT (LGLYPH_CODE (g));
18920 STORE_XCHAR2B (s->char2b + i, code >> 8, code & 0xFF); 18960 STORE_XCHAR2B (s->char2b + i, code >> 8, code & 0xFF);
18921 } 18961 }
18922 s->nchars = s->cmp->glyph_len;
18923 s->width = s->cmp->pixel_width; 18962 s->width = s->cmp->pixel_width;
18924 } 18963 }
18925 else 18964 else
@@ -20786,6 +20825,10 @@ x_produce_glyphs (it)
20786 it->char_to_display = unibyte_char_to_multibyte (it->c); 20825 it->char_to_display = unibyte_char_to_multibyte (it->c);
20787 } 20826 }
20788 20827
20828#ifdef USE_FONT_BACKEND
20829 if (cmp->method != COMPOSITION_WITH_GLYPH_STRING)
20830 {
20831#endif /* USE_FONT_BACKEND */
20789 /* Get face and font to use. Encode IT->char_to_display. */ 20832 /* Get face and font to use. Encode IT->char_to_display. */
20790 pos = STRINGP (it->string) ? IT_STRING_CHARPOS (*it) : IT_CHARPOS (*it); 20833 pos = STRINGP (it->string) ? IT_STRING_CHARPOS (*it) : IT_CHARPOS (*it);
20791 it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display, 20834 it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display,
@@ -20810,6 +20853,9 @@ x_produce_glyphs (it)
20810 if (font_info->vertical_centering) 20853 if (font_info->vertical_centering)
20811 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; 20854 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
20812 } 20855 }
20856#ifdef USE_FONT_BACKEND
20857 }
20858#endif
20813 20859
20814 /* There are no padding glyphs, so there is only one glyph to 20860 /* There are no padding glyphs, so there is only one glyph to
20815 produce for the composition. Important is that pixel_width, 20861 produce for the composition. Important is that pixel_width,