Commit d2a51fd7 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

Inhibit null-string composition component (Bug#6988).

parent fce3fdeb
2012-02-01 Kenichi Handa <handa@m17n.org>
* composite.el (compose-region, compose-string): Signal error for
a null string component (Bug#6988).
2012-01-31 Chong Yidong <cyd@gnu.org> 2012-01-31 Chong Yidong <cyd@gnu.org>
* frame.el (set-frame-font): New arg ALL-FRAMES. * frame.el (set-frame-font): New arg ALL-FRAMES.
......
...@@ -211,7 +211,7 @@ or a vector or list of integers and rules. ...@@ -211,7 +211,7 @@ or a vector or list of integers and rules.
If it is a character, it is an alternate character to display instead If it is a character, it is an alternate character to display instead
of the text in the region. of the text in the region.
If it is a string, the elements are alternate characters. In If it is a string, the elements are one or more alternate characters. In
this case, TAB element has a special meaning. If the first this case, TAB element has a special meaning. If the first
character is TAB, the glyphs are displayed with left padding space character is TAB, the glyphs are displayed with left padding space
so that no pixel overlaps with the previous column. If the last so that no pixel overlaps with the previous column. If the last
...@@ -234,7 +234,9 @@ text in the composition." ...@@ -234,7 +234,9 @@ text in the composition."
(let ((modified-p (buffer-modified-p)) (let ((modified-p (buffer-modified-p))
(inhibit-read-only t)) (inhibit-read-only t))
(if (or (vectorp components) (listp components)) (if (or (vectorp components) (listp components))
(setq components (encode-composition-components components))) (setq components (encode-composition-components components))
(if (= (length components) 0)
(error "Invalid composition component: %s" components)))
(compose-region-internal start end components modification-func) (compose-region-internal start end components modification-func)
(restore-buffer-modified-p modified-p))) (restore-buffer-modified-p modified-p)))
...@@ -267,7 +269,9 @@ Optional 5th argument MODIFICATION-FUNC is a function to call to ...@@ -267,7 +269,9 @@ Optional 5th argument MODIFICATION-FUNC is a function to call to
adjust the composition when it gets invalid because of a change of adjust the composition when it gets invalid because of a change of
text in the composition." text in the composition."
(if (or (vectorp components) (listp components)) (if (or (vectorp components) (listp components))
(setq components (encode-composition-components components))) (setq components (encode-composition-components components))
(if (= (length components) 0)
(error "Invalid composition component: %s" components)))
(or start (setq start 0)) (or start (setq start 0))
(or end (setq end (length string))) (or end (setq end (length string)))
(compose-string-internal string start end components modification-func) (compose-string-internal string start end components modification-func)
......
2012-02-01 Kenichi Handa <handa@m17n.org>
* xdisp.c (BUILD_COMPOSITE_GLYPH_STRING): Initialize first_s to
NULL (Bug#6988).
(x_produce_glyphs): If the component of a composition is a null
string, set it->pixel_width to 1 to avoid zero-width glyph.
2012-01-31 Glenn Morris <rgm@gnu.org> 2012-01-31 Glenn Morris <rgm@gnu.org>
* nsterm.m (syms_of_nsterm) <x-toolkit-scroll-bars>: * nsterm.m (syms_of_nsterm) <x-toolkit-scroll-bars>:
......
...@@ -22738,7 +22738,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) ...@@ -22738,7 +22738,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
ptrdiff_t cmp_id = (row)->glyphs[area][START].u.cmp.id; \ ptrdiff_t cmp_id = (row)->glyphs[area][START].u.cmp.id; \
struct composition *cmp = composition_table[cmp_id]; \ struct composition *cmp = composition_table[cmp_id]; \
XChar2b *char2b; \ XChar2b *char2b; \
struct glyph_string *first_s IF_LINT (= NULL); \ struct glyph_string *first_s = NULL; \
int n; \ int n; \
\ \
char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \ char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \
...@@ -24400,7 +24400,7 @@ x_produce_glyphs (struct it *it) ...@@ -24400,7 +24400,7 @@ x_produce_glyphs (struct it *it)
/* Initialize the bounding box. */ /* Initialize the bounding box. */
if (pcm) if (pcm)
{ {
width = pcm->width; width = cmp->glyph_len > 0 ? pcm->width : 0;
ascent = pcm->ascent; ascent = pcm->ascent;
descent = pcm->descent; descent = pcm->descent;
lbearing = pcm->lbearing; lbearing = pcm->lbearing;
...@@ -24408,7 +24408,7 @@ x_produce_glyphs (struct it *it) ...@@ -24408,7 +24408,7 @@ x_produce_glyphs (struct it *it)
} }
else else
{ {
width = font->space_width; width = cmp->glyph_len > 0 ? font->space_width : 0;
ascent = FONT_BASE (font); ascent = FONT_BASE (font);
descent = FONT_DESCENT (font); descent = FONT_DESCENT (font);
lbearing = 0; lbearing = 0;
...@@ -24595,6 +24595,10 @@ x_produce_glyphs (struct it *it) ...@@ -24595,6 +24595,10 @@ x_produce_glyphs (struct it *it)
it->glyph_row->contains_overlapping_glyphs_p = 1; it->glyph_row->contains_overlapping_glyphs_p = 1;
   
it->pixel_width = cmp->pixel_width; it->pixel_width = cmp->pixel_width;
if (it->pixel_width == 0)
/* We assure that all visible glyphs have at least 1-pixel
width. */
it->pixel_width = 1;
it->ascent = it->phys_ascent = cmp->ascent; it->ascent = it->phys_ascent = cmp->ascent;
it->descent = it->phys_descent = cmp->descent; it->descent = it->phys_descent = cmp->descent;
if (face->box != FACE_NO_BOX) if (face->box != FACE_NO_BOX)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment