aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2010-09-27 14:27:28 +0900
committerKenichi Handa2010-09-27 14:27:28 +0900
commit4be9765d4bad14d68cdfee2a2c6afe1001d9516a (patch)
treecf5d1959dc767eee97d3e1cc096e8e850550e9b6
parent1114abdb3d5a0f4f86d7a28f8c523c6f07790208 (diff)
downloademacs-4be9765d4bad14d68cdfee2a2c6afe1001d9516a.tar.gz
emacs-4be9765d4bad14d68cdfee2a2c6afe1001d9516a.zip
Remove restriction on the number of glyphs in one composition.
-rw-r--r--src/ChangeLog26
-rw-r--r--src/dispextern.h39
-rw-r--r--src/dispnew.c8
-rw-r--r--src/term.c8
-rw-r--r--src/xdisp.c32
5 files changed, 76 insertions, 37 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a44d97d96a1..7f35c67039c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,29 @@
12010-09-27 Kenichi Handa <handa@m17n.org>
2
3 These changes are to remove restriction on the number of glyphs in
4 one composition.
5
6 * dispextern.h (struct glyph): Change the member "slice" to union.
7 Remove u.cmp.from and u.cmp.to. Give more bits to u.cmp.id.
8 (GLYPH_SLICE_EQUAL_P): Adjusted for the above change.
9
10 * dispnew.c (buffer_posn_from_coords): Use glyph->slice.img
11 instead of glyph->slice.
12 (marginal_area_string): Likewise.
13
14 * term.c (encode_terminal_code): Use glyph->slice.cmp instead of
15 glyph->u.cmp.
16 (append_composite_glyph): Likewise.
17
18 * xdisp.c (dump_glyph): Use glyph->slice.cmp instead of
19 glyph->u.cmp.
20 (fill_gstring_glyph_string, x_get_glyph_overhangs)
21 (append_composite_glyph): Likewise.
22 (fill_image_glyph_string): Use glyph->slice.img instead of
23 glyph->slice.
24 (append_glyph, produce_image_glyph, append_stretch_glyph)
25 (note_mouse_highlight): Likewise.
26
12010-09-22 Kenichi Handa <handa@m17n.org> 272010-09-22 Kenichi Handa <handa@m17n.org>
2 28
3 * xdisp.c (compute_stop_pos): Call composition_compute_stop_pos 29 * xdisp.c (compute_stop_pos): Call composition_compute_stop_pos
diff --git a/src/dispextern.h b/src/dispextern.h
index 6fd92ba940d..95c574ea339 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -394,7 +394,15 @@ struct glyph
394 w32_char_font_type. Otherwise it equals FONT_TYPE_UNKNOWN. */ 394 w32_char_font_type. Otherwise it equals FONT_TYPE_UNKNOWN. */
395 unsigned font_type : 3; 395 unsigned font_type : 3;
396 396
397 struct glyph_slice slice; 397 /* A union of sub-structures for different glyph types. */
398 union
399 {
400 /* Metrics of a partial glyph of an image (type == IMAGE_GLYPH). */
401 struct glyph_slice img;
402 /* Start and end indices of glyphs of a graphme cluster of a
403 composition (type == COMPOSITE_GLYPH). */
404 struct { int from, to; } cmp;
405 } slice;
398 406
399 /* A union of sub-structures for different glyph types. */ 407 /* A union of sub-structures for different glyph types. */
400 union 408 union
@@ -402,16 +410,13 @@ struct glyph
402 /* Character code for character glyphs (type == CHAR_GLYPH). */ 410 /* Character code for character glyphs (type == CHAR_GLYPH). */
403 unsigned ch; 411 unsigned ch;
404 412
405 /* Sub-structures for type == COMPOSITION_GLYPH. */ 413 /* Sub-structures for type == COMPOSITE_GLYPH. */
406 struct 414 struct
407 { 415 {
408 /* Flag to tell if the composition is automatic or not. */ 416 /* Flag to tell if the composition is automatic or not. */
409 unsigned automatic : 1; 417 unsigned automatic : 1;
410 /* ID of the composition. */ 418 /* ID of the composition. */
411 unsigned id : 23; 419 unsigned id : 31;
412 /* Start and end indices of glyphs of the composition. */
413 unsigned from : 4;
414 unsigned to : 4;
415 } cmp; 420 } cmp;
416 421
417 /* Image ID for image glyphs (type == IMAGE_GLYPH). */ 422 /* Image ID for image glyphs (type == IMAGE_GLYPH). */
@@ -443,13 +448,21 @@ struct glyph
443#define CHAR_GLYPH_SPACE_P(GLYPH) \ 448#define CHAR_GLYPH_SPACE_P(GLYPH) \
444 ((GLYPH).u.ch == SPACEGLYPH && (GLYPH).face_id == DEFAULT_FACE_ID) 449 ((GLYPH).u.ch == SPACEGLYPH && (GLYPH).face_id == DEFAULT_FACE_ID)
445 450
446/* Are glyph slices of glyphs *X and *Y equal */ 451/* Are glyph slices of glyphs *X and *Y equal? It assumes that both
447 452 glyphs have the same type.
448#define GLYPH_SLICE_EQUAL_P(X, Y) \ 453
449 ((X)->slice.x == (Y)->slice.x \ 454 Note: for composition glyphs, we don't have to compare slice.cmp.to
450 && (X)->slice.y == (Y)->slice.y \ 455 because they should be the same if and only if slice.cmp.from are
451 && (X)->slice.width == (Y)->slice.width \ 456 the same. */
452 && (X)->slice.height == (Y)->slice.height) 457
458#define GLYPH_SLICE_EQUAL_P(X, Y) \
459 ((X)->type == IMAGE_GLYPH \
460 ? ((X)->slice.img.x == (Y)->slice.img.x \
461 && (X)->slice.img.y == (Y)->slice.img.y \
462 && (X)->slice.img.width == (Y)->slice.img.width \
463 && (X)->slice.img.height == (Y)->slice.img.height) \
464 : ((X)->type != COMPOSITE_GLYPH \
465 || (X)->slice.cmp.from == (Y)->slice.cmp.from))
453 466
454/* Are glyphs *X and *Y displayed equal? */ 467/* Are glyphs *X and *Y displayed equal? */
455 468
diff --git a/src/dispnew.c b/src/dispnew.c
index 0869526c01d..acd2778c97d 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5457,8 +5457,8 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5457 if (img) 5457 if (img)
5458 { 5458 {
5459 *dy -= row->ascent - glyph->ascent; 5459 *dy -= row->ascent - glyph->ascent;
5460 *dx += glyph->slice.x; 5460 *dx += glyph->slice.img.x;
5461 *dy += glyph->slice.y; 5461 *dy += glyph->slice.img.y;
5462 /* Image slices positions are still relative to the entire image */ 5462 /* Image slices positions are still relative to the entire image */
5463 *width = img->width; 5463 *width = img->width;
5464 *height = img->height; 5464 *height = img->height;
@@ -5620,8 +5620,8 @@ marginal_area_string (struct window *w, enum window_part part, int *x, int *y, i
5620 if (img != NULL) 5620 if (img != NULL)
5621 *object = img->spec; 5621 *object = img->spec;
5622 y0 -= row->ascent - glyph->ascent; 5622 y0 -= row->ascent - glyph->ascent;
5623 x0 += glyph->slice.x; 5623 x0 += glyph->slice.img.x;
5624 y0 += glyph->slice.y; 5624 y0 += glyph->slice.img.y;
5625 } 5625 }
5626#endif 5626#endif
5627 } 5627 }
diff --git a/src/term.c b/src/term.c
index 2deca1014e8..4c4ae5e048b 100644
--- a/src/term.c
+++ b/src/term.c
@@ -598,7 +598,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
598 if (src->u.cmp.automatic) 598 if (src->u.cmp.automatic)
599 { 599 {
600 gstring = composition_gstring_from_id (src->u.cmp.id); 600 gstring = composition_gstring_from_id (src->u.cmp.id);
601 required = src->u.cmp.to + 1 - src->u.cmp.from; 601 required = src->slice.cmp.to + 1 - src->slice.cmp.from;
602 } 602 }
603 else 603 else
604 { 604 {
@@ -615,7 +615,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
615 } 615 }
616 616
617 if (src->u.cmp.automatic) 617 if (src->u.cmp.automatic)
618 for (i = src->u.cmp.from; i <= src->u.cmp.to; i++) 618 for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++)
619 { 619 {
620 Lisp_Object g = LGSTRING_GLYPH (gstring, i); 620 Lisp_Object g = LGSTRING_GLYPH (gstring, i);
621 int c = LGLYPH_CHAR (g); 621 int c = LGLYPH_CHAR (g);
@@ -1795,8 +1795,8 @@ append_composite_glyph (struct it *it)
1795 { 1795 {
1796 glyph->u.cmp.automatic = 1; 1796 glyph->u.cmp.automatic = 1;
1797 glyph->u.cmp.id = it->cmp_it.id; 1797 glyph->u.cmp.id = it->cmp_it.id;
1798 glyph->u.cmp.from = it->cmp_it.from; 1798 glyph->slice.cmp.from = it->cmp_it.from;
1799 glyph->u.cmp.to = it->cmp_it.to - 1; 1799 glyph->slice.cmp.to = it->cmp_it.to - 1;
1800 } 1800 }
1801 1801
1802 glyph->face_id = it->face_id; 1802 glyph->face_id = it->face_id;
diff --git a/src/xdisp.c b/src/xdisp.c
index be6ff1254eb..e067958490c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16214,7 +16214,7 @@ dump_glyph (row, glyph, area)
16214 if (glyph->u.cmp.automatic) 16214 if (glyph->u.cmp.automatic)
16215 fprintf (stderr, 16215 fprintf (stderr,
16216 "[%d-%d]", 16216 "[%d-%d]",
16217 glyph->u.cmp.from, glyph->u.cmp.to); 16217 glyph->slice.cmp.from, glyph->slice.cmp.to);
16218 fprintf (stderr, " . %4d %1.1d%1.1d\n", 16218 fprintf (stderr, " . %4d %1.1d%1.1d\n",
16219 glyph->face_id, 16219 glyph->face_id,
16220 glyph->left_box_line_p, 16220 glyph->left_box_line_p,
@@ -20600,8 +20600,8 @@ fill_gstring_glyph_string (struct glyph_string *s, int face_id,
20600 glyph = s->row->glyphs[s->area] + start; 20600 glyph = s->row->glyphs[s->area] + start;
20601 last = s->row->glyphs[s->area] + end; 20601 last = s->row->glyphs[s->area] + end;
20602 s->cmp_id = glyph->u.cmp.id; 20602 s->cmp_id = glyph->u.cmp.id;
20603 s->cmp_from = glyph->u.cmp.from; 20603 s->cmp_from = glyph->slice.cmp.from;
20604 s->cmp_to = glyph->u.cmp.to + 1; 20604 s->cmp_to = glyph->slice.cmp.to + 1;
20605 s->face = FACE_FROM_ID (s->f, face_id); 20605 s->face = FACE_FROM_ID (s->f, face_id);
20606 lgstring = composition_gstring_from_id (s->cmp_id); 20606 lgstring = composition_gstring_from_id (s->cmp_id);
20607 s->font = XFONT_OBJECT (LGSTRING_FONT (lgstring)); 20607 s->font = XFONT_OBJECT (LGSTRING_FONT (lgstring));
@@ -20609,8 +20609,8 @@ fill_gstring_glyph_string (struct glyph_string *s, int face_id,
20609 while (glyph < last 20609 while (glyph < last
20610 && glyph->u.cmp.automatic 20610 && glyph->u.cmp.automatic
20611 && glyph->u.cmp.id == s->cmp_id 20611 && glyph->u.cmp.id == s->cmp_id
20612 && s->cmp_to == glyph->u.cmp.from) 20612 && s->cmp_to == glyph->slice.cmp.from)
20613 s->cmp_to = (glyph++)->u.cmp.to + 1; 20613 s->cmp_to = (glyph++)->slice.cmp.to + 1;
20614 20614
20615 for (i = s->cmp_from; i < s->cmp_to; i++) 20615 for (i = s->cmp_from; i < s->cmp_to; i++)
20616 { 20616 {
@@ -20700,7 +20700,7 @@ fill_image_glyph_string (struct glyph_string *s)
20700 xassert (s->first_glyph->type == IMAGE_GLYPH); 20700 xassert (s->first_glyph->type == IMAGE_GLYPH);
20701 s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id); 20701 s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id);
20702 xassert (s->img); 20702 xassert (s->img);
20703 s->slice = s->first_glyph->slice; 20703 s->slice = s->first_glyph->slice.img;
20704 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); 20704 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
20705 s->font = s->face->font; 20705 s->font = s->face->font;
20706 s->width = s->first_glyph->pixel_width; 20706 s->width = s->first_glyph->pixel_width;
@@ -20806,8 +20806,8 @@ x_get_glyph_overhangs (struct glyph *glyph, struct frame *f, int *left, int *rig
20806 Lisp_Object gstring = composition_gstring_from_id (glyph->u.cmp.id); 20806 Lisp_Object gstring = composition_gstring_from_id (glyph->u.cmp.id);
20807 struct font_metrics metrics; 20807 struct font_metrics metrics;
20808 20808
20809 composition_gstring_width (gstring, glyph->u.cmp.from, 20809 composition_gstring_width (gstring, glyph->slice.cmp.from,
20810 glyph->u.cmp.to + 1, &metrics); 20810 glyph->slice.cmp.to + 1, &metrics);
20811 if (metrics.rbearing > metrics.width) 20811 if (metrics.rbearing > metrics.width)
20812 *right = metrics.rbearing - metrics.width; 20812 *right = metrics.rbearing - metrics.width;
20813 if (metrics.lbearing < 0) 20813 if (metrics.lbearing < 0)
@@ -21512,7 +21512,7 @@ append_glyph (struct it *it)
21512 glyph->glyph_not_available_p = it->glyph_not_available_p; 21512 glyph->glyph_not_available_p = it->glyph_not_available_p;
21513 glyph->face_id = it->face_id; 21513 glyph->face_id = it->face_id;
21514 glyph->u.ch = it->char_to_display; 21514 glyph->u.ch = it->char_to_display;
21515 glyph->slice = null_glyph_slice; 21515 glyph->slice.img = null_glyph_slice;
21516 glyph->font_type = FONT_TYPE_UNKNOWN; 21516 glyph->font_type = FONT_TYPE_UNKNOWN;
21517 if (it->bidi_p) 21517 if (it->bidi_p)
21518 { 21518 {
@@ -21569,13 +21569,14 @@ append_composite_glyph (struct it *it)
21569 { 21569 {
21570 glyph->u.cmp.automatic = 0; 21570 glyph->u.cmp.automatic = 0;
21571 glyph->u.cmp.id = it->cmp_it.id; 21571 glyph->u.cmp.id = it->cmp_it.id;
21572 glyph->slice.cmp.from = glyph->slice.cmp.to = 0;
21572 } 21573 }
21573 else 21574 else
21574 { 21575 {
21575 glyph->u.cmp.automatic = 1; 21576 glyph->u.cmp.automatic = 1;
21576 glyph->u.cmp.id = it->cmp_it.id; 21577 glyph->u.cmp.id = it->cmp_it.id;
21577 glyph->u.cmp.from = it->cmp_it.from; 21578 glyph->slice.cmp.from = it->cmp_it.from;
21578 glyph->u.cmp.to = it->cmp_it.to - 1; 21579 glyph->slice.cmp.to = it->cmp_it.to - 1;
21579 } 21580 }
21580 glyph->avoid_cursor_p = it->avoid_cursor_p; 21581 glyph->avoid_cursor_p = it->avoid_cursor_p;
21581 glyph->multibyte_p = it->multibyte_p; 21582 glyph->multibyte_p = it->multibyte_p;
@@ -21586,7 +21587,6 @@ append_composite_glyph (struct it *it)
21586 glyph->padding_p = 0; 21587 glyph->padding_p = 0;
21587 glyph->glyph_not_available_p = 0; 21588 glyph->glyph_not_available_p = 0;
21588 glyph->face_id = it->face_id; 21589 glyph->face_id = it->face_id;
21589 glyph->slice = null_glyph_slice;
21590 glyph->font_type = FONT_TYPE_UNKNOWN; 21590 glyph->font_type = FONT_TYPE_UNKNOWN;
21591 if (it->bidi_p) 21591 if (it->bidi_p)
21592 { 21592 {
@@ -21765,7 +21765,7 @@ produce_image_glyph (struct it *it)
21765 glyph->glyph_not_available_p = 0; 21765 glyph->glyph_not_available_p = 0;
21766 glyph->face_id = it->face_id; 21766 glyph->face_id = it->face_id;
21767 glyph->u.img_id = img->id; 21767 glyph->u.img_id = img->id;
21768 glyph->slice = slice; 21768 glyph->slice.img = slice;
21769 glyph->font_type = FONT_TYPE_UNKNOWN; 21769 glyph->font_type = FONT_TYPE_UNKNOWN;
21770 if (it->bidi_p) 21770 if (it->bidi_p)
21771 { 21771 {
@@ -21826,7 +21826,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
21826 glyph->face_id = it->face_id; 21826 glyph->face_id = it->face_id;
21827 glyph->u.stretch.ascent = ascent; 21827 glyph->u.stretch.ascent = ascent;
21828 glyph->u.stretch.height = height; 21828 glyph->u.stretch.height = height;
21829 glyph->slice = null_glyph_slice; 21829 glyph->slice.img = null_glyph_slice;
21830 glyph->font_type = FONT_TYPE_UNKNOWN; 21830 glyph->font_type = FONT_TYPE_UNKNOWN;
21831 if (it->bidi_p) 21831 if (it->bidi_p)
21832 { 21832 {
@@ -24513,8 +24513,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
24513 if ((image_map = Fplist_get (XCDR (img->spec), QCmap), 24513 if ((image_map = Fplist_get (XCDR (img->spec), QCmap),
24514 !NILP (image_map)) 24514 !NILP (image_map))
24515 && (hotspot = find_hot_spot (image_map, 24515 && (hotspot = find_hot_spot (image_map,
24516 glyph->slice.x + dx, 24516 glyph->slice.img.x + dx,
24517 glyph->slice.y + dy), 24517 glyph->slice.img.y + dy),
24518 CONSP (hotspot)) 24518 CONSP (hotspot))
24519 && (hotspot = XCDR (hotspot), CONSP (hotspot))) 24519 && (hotspot = XCDR (hotspot), CONSP (hotspot)))
24520 { 24520 {