diff options
| author | Kenichi Handa | 2012-02-02 09:30:09 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-02-02 09:30:09 +0900 |
| commit | d2a51fd7a1d5d3c8f661c2068120b60e84eca875 (patch) | |
| tree | e2bb35b589f1f9948e9fafb64395a96e6f8ec754 | |
| parent | fce3fdeb947e51656675129592c8514be32b46bf (diff) | |
| download | emacs-d2a51fd7a1d5d3c8f661c2068120b60e84eca875.tar.gz emacs-d2a51fd7a1d5d3c8f661c2068120b60e84eca875.zip | |
Inhibit null-string composition component (Bug#6988).
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/composite.el | 10 | ||||
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 10 |
4 files changed, 26 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ad25d537f2b..2ee709f62b2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-02-01 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * composite.el (compose-region, compose-string): Signal error for | ||
| 4 | a null string component (Bug#6988). | ||
| 5 | |||
| 1 | 2012-01-31 Chong Yidong <cyd@gnu.org> | 6 | 2012-01-31 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * frame.el (set-frame-font): New arg ALL-FRAMES. | 8 | * frame.el (set-frame-font): New arg ALL-FRAMES. |
diff --git a/lisp/composite.el b/lisp/composite.el index 72317ac470e..739ec8bbcbd 100644 --- a/lisp/composite.el +++ b/lisp/composite.el | |||
| @@ -211,7 +211,7 @@ or a vector or list of integers and rules. | |||
| 211 | If it is a character, it is an alternate character to display instead | 211 | If it is a character, it is an alternate character to display instead |
| 212 | of the text in the region. | 212 | of the text in the region. |
| 213 | 213 | ||
| 214 | If it is a string, the elements are alternate characters. In | 214 | If it is a string, the elements are one or more alternate characters. In |
| 215 | this case, TAB element has a special meaning. If the first | 215 | this case, TAB element has a special meaning. If the first |
| 216 | character is TAB, the glyphs are displayed with left padding space | 216 | character is TAB, the glyphs are displayed with left padding space |
| 217 | so that no pixel overlaps with the previous column. If the last | 217 | so that no pixel overlaps with the previous column. If the last |
| @@ -234,7 +234,9 @@ text in the composition." | |||
| 234 | (let ((modified-p (buffer-modified-p)) | 234 | (let ((modified-p (buffer-modified-p)) |
| 235 | (inhibit-read-only t)) | 235 | (inhibit-read-only t)) |
| 236 | (if (or (vectorp components) (listp components)) | 236 | (if (or (vectorp components) (listp components)) |
| 237 | (setq components (encode-composition-components components))) | 237 | (setq components (encode-composition-components components)) |
| 238 | (if (= (length components) 0) | ||
| 239 | (error "Invalid composition component: %s" components))) | ||
| 238 | (compose-region-internal start end components modification-func) | 240 | (compose-region-internal start end components modification-func) |
| 239 | (restore-buffer-modified-p modified-p))) | 241 | (restore-buffer-modified-p modified-p))) |
| 240 | 242 | ||
| @@ -267,7 +269,9 @@ Optional 5th argument MODIFICATION-FUNC is a function to call to | |||
| 267 | adjust the composition when it gets invalid because of a change of | 269 | adjust the composition when it gets invalid because of a change of |
| 268 | text in the composition." | 270 | text in the composition." |
| 269 | (if (or (vectorp components) (listp components)) | 271 | (if (or (vectorp components) (listp components)) |
| 270 | (setq components (encode-composition-components components))) | 272 | (setq components (encode-composition-components components)) |
| 273 | (if (= (length components) 0) | ||
| 274 | (error "Invalid composition component: %s" components))) | ||
| 271 | (or start (setq start 0)) | 275 | (or start (setq start 0)) |
| 272 | (or end (setq end (length string))) | 276 | (or end (setq end (length string))) |
| 273 | (compose-string-internal string start end components modification-func) | 277 | (compose-string-internal string start end components modification-func) |
diff --git a/src/ChangeLog b/src/ChangeLog index d114f0897eb..c41202bcfee 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-02-01 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * xdisp.c (BUILD_COMPOSITE_GLYPH_STRING): Initialize first_s to | ||
| 4 | NULL (Bug#6988). | ||
| 5 | (x_produce_glyphs): If the component of a composition is a null | ||
| 6 | string, set it->pixel_width to 1 to avoid zero-width glyph. | ||
| 7 | |||
| 1 | 2012-01-31 Glenn Morris <rgm@gnu.org> | 8 | 2012-01-31 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * nsterm.m (syms_of_nsterm) <x-toolkit-scroll-bars>: | 10 | * nsterm.m (syms_of_nsterm) <x-toolkit-scroll-bars>: |
diff --git a/src/xdisp.c b/src/xdisp.c index c90184f4a4c..864517b950c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -22738,7 +22738,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) | |||
| 22738 | ptrdiff_t cmp_id = (row)->glyphs[area][START].u.cmp.id; \ | 22738 | ptrdiff_t cmp_id = (row)->glyphs[area][START].u.cmp.id; \ |
| 22739 | struct composition *cmp = composition_table[cmp_id]; \ | 22739 | struct composition *cmp = composition_table[cmp_id]; \ |
| 22740 | XChar2b *char2b; \ | 22740 | XChar2b *char2b; \ |
| 22741 | struct glyph_string *first_s IF_LINT (= NULL); \ | 22741 | struct glyph_string *first_s = NULL; \ |
| 22742 | int n; \ | 22742 | int n; \ |
| 22743 | \ | 22743 | \ |
| 22744 | char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \ | 22744 | char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \ |
| @@ -24400,7 +24400,7 @@ x_produce_glyphs (struct it *it) | |||
| 24400 | /* Initialize the bounding box. */ | 24400 | /* Initialize the bounding box. */ |
| 24401 | if (pcm) | 24401 | if (pcm) |
| 24402 | { | 24402 | { |
| 24403 | width = pcm->width; | 24403 | width = cmp->glyph_len > 0 ? pcm->width : 0; |
| 24404 | ascent = pcm->ascent; | 24404 | ascent = pcm->ascent; |
| 24405 | descent = pcm->descent; | 24405 | descent = pcm->descent; |
| 24406 | lbearing = pcm->lbearing; | 24406 | lbearing = pcm->lbearing; |
| @@ -24408,7 +24408,7 @@ x_produce_glyphs (struct it *it) | |||
| 24408 | } | 24408 | } |
| 24409 | else | 24409 | else |
| 24410 | { | 24410 | { |
| 24411 | width = font->space_width; | 24411 | width = cmp->glyph_len > 0 ? font->space_width : 0; |
| 24412 | ascent = FONT_BASE (font); | 24412 | ascent = FONT_BASE (font); |
| 24413 | descent = FONT_DESCENT (font); | 24413 | descent = FONT_DESCENT (font); |
| 24414 | lbearing = 0; | 24414 | lbearing = 0; |
| @@ -24595,6 +24595,10 @@ x_produce_glyphs (struct it *it) | |||
| 24595 | it->glyph_row->contains_overlapping_glyphs_p = 1; | 24595 | it->glyph_row->contains_overlapping_glyphs_p = 1; |
| 24596 | 24596 | ||
| 24597 | it->pixel_width = cmp->pixel_width; | 24597 | it->pixel_width = cmp->pixel_width; |
| 24598 | if (it->pixel_width == 0) | ||
| 24599 | /* We assure that all visible glyphs have at least 1-pixel | ||
| 24600 | width. */ | ||
| 24601 | it->pixel_width = 1; | ||
| 24598 | it->ascent = it->phys_ascent = cmp->ascent; | 24602 | it->ascent = it->phys_ascent = cmp->ascent; |
| 24599 | it->descent = it->phys_descent = cmp->descent; | 24603 | it->descent = it->phys_descent = cmp->descent; |
| 24600 | if (face->box != FACE_NO_BOX) | 24604 | if (face->box != FACE_NO_BOX) |