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

(encode_terminal_code): Fix handling of composition.

(produce_composite_glyph): For static composition, get pixel_width
from struct composition.
parent ce65fe7a
...@@ -627,7 +627,7 @@ encode_terminal_code (src, src_len, coding) ...@@ -627,7 +627,7 @@ encode_terminal_code (src, src_len, coding)
int c = LGLYPH_CHAR (g); int c = LGLYPH_CHAR (g);
if (! char_charset (c, charset_list, NULL)) if (! char_charset (c, charset_list, NULL))
break; c = '?';
buf += CHAR_STRING (c, buf); buf += CHAR_STRING (c, buf);
nchars++; nchars++;
} }
...@@ -636,17 +636,23 @@ encode_terminal_code (src, src_len, coding) ...@@ -636,17 +636,23 @@ encode_terminal_code (src, src_len, coding)
{ {
int c = COMPOSITION_GLYPH (cmp, i); int c = COMPOSITION_GLYPH (cmp, i);
if (! char_charset (c, charset_list, NULL)) if (c == '\t')
break; continue;
if (char_charset (c, charset_list, NULL))
{
if (CHAR_WIDTH (c) == 0
&& i > 0 && COMPOSITION_GLYPH (cmp, i - 1) == '\t')
/* Should be left-padded */
{
buf += CHAR_STRING (' ', buf);
nchars++;
}
}
else
c = '?';
buf += CHAR_STRING (c, buf); buf += CHAR_STRING (c, buf);
nchars++; nchars++;
} }
if (i == 0)
{
/* The first character of the composition is not encodable. */
*buf++ = '?';
nchars++;
}
} }
/* We must skip glyphs to be padded for a wide character. */ /* We must skip glyphs to be padded for a wide character. */
else if (! CHAR_GLYPH_PADDING_P (*src)) else if (! CHAR_GLYPH_PADDING_P (*src))
...@@ -1811,8 +1817,7 @@ produce_composite_glyph (it) ...@@ -1811,8 +1817,7 @@ produce_composite_glyph (it)
{ {
struct composition *cmp = composition_table[it->cmp_it.id]; struct composition *cmp = composition_table[it->cmp_it.id];
c = COMPOSITION_GLYPH (cmp, 0); it->pixel_width = cmp->width;
it->pixel_width = CHAR_WIDTH (it->c);
} }
else else
{ {
......
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