Mercurial > emacs
changeset 110598:ee58b36ab139
Remove restriction on the number of glyphs in one composition.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 27 Sep 2010 14:27:28 +0900 |
parents | 937bcfd8c509 |
children | 0e84d4500f6b |
files | src/ChangeLog src/dispextern.h src/dispnew.c src/term.c src/xdisp.c |
diffstat | 5 files changed, 76 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Sep 22 11:56:28 2010 +0900 +++ b/src/ChangeLog Mon Sep 27 14:27:28 2010 +0900 @@ -1,3 +1,29 @@ +2010-09-27 Kenichi Handa <handa@m17n.org> + + These changes are to remove restriction on the number of glyphs in + one composition. + + * dispextern.h (struct glyph): Change the member "slice" to union. + Remove u.cmp.from and u.cmp.to. Give more bits to u.cmp.id. + (GLYPH_SLICE_EQUAL_P): Adjusted for the above change. + + * dispnew.c (buffer_posn_from_coords): Use glyph->slice.img + instead of glyph->slice. + (marginal_area_string): Likewise. + + * term.c (encode_terminal_code): Use glyph->slice.cmp instead of + glyph->u.cmp. + (append_composite_glyph): Likewise. + + * xdisp.c (dump_glyph): Use glyph->slice.cmp instead of + glyph->u.cmp. + (fill_gstring_glyph_string, x_get_glyph_overhangs) + (append_composite_glyph): Likewise. + (fill_image_glyph_string): Use glyph->slice.img instead of + glyph->slice. + (append_glyph, produce_image_glyph, append_stretch_glyph) + (note_mouse_highlight): Likewise. + 2010-09-22 Kenichi Handa <handa@m17n.org> * xdisp.c (compute_stop_pos): Call composition_compute_stop_pos
--- a/src/dispextern.h Wed Sep 22 11:56:28 2010 +0900 +++ b/src/dispextern.h Mon Sep 27 14:27:28 2010 +0900 @@ -394,7 +394,15 @@ w32_char_font_type. Otherwise it equals FONT_TYPE_UNKNOWN. */ unsigned font_type : 3; - struct glyph_slice slice; + /* A union of sub-structures for different glyph types. */ + union + { + /* Metrics of a partial glyph of an image (type == IMAGE_GLYPH). */ + struct glyph_slice img; + /* Start and end indices of glyphs of a graphme cluster of a + composition (type == COMPOSITE_GLYPH). */ + struct { int from, to; } cmp; + } slice; /* A union of sub-structures for different glyph types. */ union @@ -402,16 +410,13 @@ /* Character code for character glyphs (type == CHAR_GLYPH). */ unsigned ch; - /* Sub-structures for type == COMPOSITION_GLYPH. */ + /* Sub-structures for type == COMPOSITE_GLYPH. */ struct { /* Flag to tell if the composition is automatic or not. */ unsigned automatic : 1; /* ID of the composition. */ - unsigned id : 23; - /* Start and end indices of glyphs of the composition. */ - unsigned from : 4; - unsigned to : 4; + unsigned id : 31; } cmp; /* Image ID for image glyphs (type == IMAGE_GLYPH). */ @@ -443,13 +448,21 @@ #define CHAR_GLYPH_SPACE_P(GLYPH) \ ((GLYPH).u.ch == SPACEGLYPH && (GLYPH).face_id == DEFAULT_FACE_ID) -/* Are glyph slices of glyphs *X and *Y equal */ - -#define GLYPH_SLICE_EQUAL_P(X, Y) \ - ((X)->slice.x == (Y)->slice.x \ - && (X)->slice.y == (Y)->slice.y \ - && (X)->slice.width == (Y)->slice.width \ - && (X)->slice.height == (Y)->slice.height) +/* Are glyph slices of glyphs *X and *Y equal? It assumes that both + glyphs have the same type. + + Note: for composition glyphs, we don't have to compare slice.cmp.to + because they should be the same if and only if slice.cmp.from are + the same. */ + +#define GLYPH_SLICE_EQUAL_P(X, Y) \ + ((X)->type == IMAGE_GLYPH \ + ? ((X)->slice.img.x == (Y)->slice.img.x \ + && (X)->slice.img.y == (Y)->slice.img.y \ + && (X)->slice.img.width == (Y)->slice.img.width \ + && (X)->slice.img.height == (Y)->slice.img.height) \ + : ((X)->type != COMPOSITE_GLYPH \ + || (X)->slice.cmp.from == (Y)->slice.cmp.from)) /* Are glyphs *X and *Y displayed equal? */
--- a/src/dispnew.c Wed Sep 22 11:56:28 2010 +0900 +++ b/src/dispnew.c Mon Sep 27 14:27:28 2010 +0900 @@ -5457,8 +5457,8 @@ if (img) { *dy -= row->ascent - glyph->ascent; - *dx += glyph->slice.x; - *dy += glyph->slice.y; + *dx += glyph->slice.img.x; + *dy += glyph->slice.img.y; /* Image slices positions are still relative to the entire image */ *width = img->width; *height = img->height; @@ -5620,8 +5620,8 @@ if (img != NULL) *object = img->spec; y0 -= row->ascent - glyph->ascent; - x0 += glyph->slice.x; - y0 += glyph->slice.y; + x0 += glyph->slice.img.x; + y0 += glyph->slice.img.y; } #endif }
--- a/src/term.c Wed Sep 22 11:56:28 2010 +0900 +++ b/src/term.c Mon Sep 27 14:27:28 2010 +0900 @@ -598,7 +598,7 @@ if (src->u.cmp.automatic) { gstring = composition_gstring_from_id (src->u.cmp.id); - required = src->u.cmp.to + 1 - src->u.cmp.from; + required = src->slice.cmp.to + 1 - src->slice.cmp.from; } else { @@ -615,7 +615,7 @@ } if (src->u.cmp.automatic) - for (i = src->u.cmp.from; i <= src->u.cmp.to; i++) + for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++) { Lisp_Object g = LGSTRING_GLYPH (gstring, i); int c = LGLYPH_CHAR (g); @@ -1795,8 +1795,8 @@ { glyph->u.cmp.automatic = 1; glyph->u.cmp.id = it->cmp_it.id; - glyph->u.cmp.from = it->cmp_it.from; - glyph->u.cmp.to = it->cmp_it.to - 1; + glyph->slice.cmp.from = it->cmp_it.from; + glyph->slice.cmp.to = it->cmp_it.to - 1; } glyph->face_id = it->face_id;
--- a/src/xdisp.c Wed Sep 22 11:56:28 2010 +0900 +++ b/src/xdisp.c Mon Sep 27 14:27:28 2010 +0900 @@ -16214,7 +16214,7 @@ if (glyph->u.cmp.automatic) fprintf (stderr, "[%d-%d]", - glyph->u.cmp.from, glyph->u.cmp.to); + glyph->slice.cmp.from, glyph->slice.cmp.to); fprintf (stderr, " . %4d %1.1d%1.1d\n", glyph->face_id, glyph->left_box_line_p, @@ -20600,8 +20600,8 @@ glyph = s->row->glyphs[s->area] + start; last = s->row->glyphs[s->area] + end; s->cmp_id = glyph->u.cmp.id; - s->cmp_from = glyph->u.cmp.from; - s->cmp_to = glyph->u.cmp.to + 1; + s->cmp_from = glyph->slice.cmp.from; + s->cmp_to = glyph->slice.cmp.to + 1; s->face = FACE_FROM_ID (s->f, face_id); lgstring = composition_gstring_from_id (s->cmp_id); s->font = XFONT_OBJECT (LGSTRING_FONT (lgstring)); @@ -20609,8 +20609,8 @@ while (glyph < last && glyph->u.cmp.automatic && glyph->u.cmp.id == s->cmp_id - && s->cmp_to == glyph->u.cmp.from) - s->cmp_to = (glyph++)->u.cmp.to + 1; + && s->cmp_to == glyph->slice.cmp.from) + s->cmp_to = (glyph++)->slice.cmp.to + 1; for (i = s->cmp_from; i < s->cmp_to; i++) { @@ -20700,7 +20700,7 @@ xassert (s->first_glyph->type == IMAGE_GLYPH); s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id); xassert (s->img); - s->slice = s->first_glyph->slice; + s->slice = s->first_glyph->slice.img; s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); s->font = s->face->font; s->width = s->first_glyph->pixel_width; @@ -20806,8 +20806,8 @@ Lisp_Object gstring = composition_gstring_from_id (glyph->u.cmp.id); struct font_metrics metrics; - composition_gstring_width (gstring, glyph->u.cmp.from, - glyph->u.cmp.to + 1, &metrics); + composition_gstring_width (gstring, glyph->slice.cmp.from, + glyph->slice.cmp.to + 1, &metrics); if (metrics.rbearing > metrics.width) *right = metrics.rbearing - metrics.width; if (metrics.lbearing < 0) @@ -21512,7 +21512,7 @@ glyph->glyph_not_available_p = it->glyph_not_available_p; glyph->face_id = it->face_id; glyph->u.ch = it->char_to_display; - glyph->slice = null_glyph_slice; + glyph->slice.img = null_glyph_slice; glyph->font_type = FONT_TYPE_UNKNOWN; if (it->bidi_p) { @@ -21569,13 +21569,14 @@ { glyph->u.cmp.automatic = 0; glyph->u.cmp.id = it->cmp_it.id; + glyph->slice.cmp.from = glyph->slice.cmp.to = 0; } else { glyph->u.cmp.automatic = 1; glyph->u.cmp.id = it->cmp_it.id; - glyph->u.cmp.from = it->cmp_it.from; - glyph->u.cmp.to = it->cmp_it.to - 1; + glyph->slice.cmp.from = it->cmp_it.from; + glyph->slice.cmp.to = it->cmp_it.to - 1; } glyph->avoid_cursor_p = it->avoid_cursor_p; glyph->multibyte_p = it->multibyte_p; @@ -21586,7 +21587,6 @@ glyph->padding_p = 0; glyph->glyph_not_available_p = 0; glyph->face_id = it->face_id; - glyph->slice = null_glyph_slice; glyph->font_type = FONT_TYPE_UNKNOWN; if (it->bidi_p) { @@ -21765,7 +21765,7 @@ glyph->glyph_not_available_p = 0; glyph->face_id = it->face_id; glyph->u.img_id = img->id; - glyph->slice = slice; + glyph->slice.img = slice; glyph->font_type = FONT_TYPE_UNKNOWN; if (it->bidi_p) { @@ -21826,7 +21826,7 @@ glyph->face_id = it->face_id; glyph->u.stretch.ascent = ascent; glyph->u.stretch.height = height; - glyph->slice = null_glyph_slice; + glyph->slice.img = null_glyph_slice; glyph->font_type = FONT_TYPE_UNKNOWN; if (it->bidi_p) { @@ -24513,8 +24513,8 @@ if ((image_map = Fplist_get (XCDR (img->spec), QCmap), !NILP (image_map)) && (hotspot = find_hot_spot (image_map, - glyph->slice.x + dx, - glyph->slice.y + dy), + glyph->slice.img.x + dx, + glyph->slice.img.y + dy), CONSP (hotspot)) && (hotspot = XCDR (hotspot), CONSP (hotspot))) {