aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2012-09-22 11:15:29 +0900
committerKenichi Handa2012-09-22 11:15:29 +0900
commit3cccbd87267735609a21df50b80b3aad07004555 (patch)
treed684898ffb505f726798696740b312be125d437c /src
parent0b97c030c678e7c77766e13e615ef2ce8394860a (diff)
downloademacs-3cccbd87267735609a21df50b80b3aad07004555.tar.gz
emacs-3cccbd87267735609a21df50b80b3aad07004555.zip
composite.c (composition_reseat_it): Handle the case that a grapheme cluster is not covered by a single font (Bug#12352).
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/composite.c51
2 files changed, 25 insertions, 31 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index be734134adf..8a05f19985f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12012-09-22 Kenichi Handa <handa@gnu.org>
2
3 * composite.c (composition_reseat_it): Handle the case that a
4 grapheme cluster is not covered by a single font (Bug#12352).
5
12012-09-17 Kenichi Handa <handa@gnu.org> 62012-09-17 Kenichi Handa <handa@gnu.org>
2 7
3 * font.c (Ffont_shape_gstring): Fix previous change; GLYPHs may 8 * font.c (Ffont_shape_gstring): Fix previous change; GLYPHs may
diff --git a/src/composite.c b/src/composite.c
index ae46df0a573..6c603fab3fc 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1219,9 +1219,6 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
1219 ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, 1219 ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w,
1220 struct face *face, Lisp_Object string) 1220 struct face *face, Lisp_Object string)
1221{ 1221{
1222 if (endpos < 0)
1223 endpos = NILP (string) ? BEGV : 0;
1224
1225 if (cmp_it->ch == -2) 1222 if (cmp_it->ch == -2)
1226 { 1223 {
1227 composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string); 1224 composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string);
@@ -1230,6 +1227,9 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
1230 return 0; 1227 return 0;
1231 } 1228 }
1232 1229
1230 if (endpos < 0)
1231 endpos = NILP (string) ? BEGV : 0;
1232
1233 if (cmp_it->ch < 0) 1233 if (cmp_it->ch < 0)
1234 { 1234 {
1235 /* We are looking at a static composition. */ 1235 /* We are looking at a static composition. */
@@ -1277,36 +1277,23 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
1277 { 1277 {
1278 ptrdiff_t cpos = charpos, bpos = bytepos; 1278 ptrdiff_t cpos = charpos, bpos = bytepos;
1279 1279
1280 while (1) 1280 cmp_it->reversed_p = 1;
1281 elt = XCAR (val);
1282 if (cmp_it->lookback > 0)
1281 { 1283 {
1282 elt = XCAR (val); 1284 cpos = charpos - cmp_it->lookback;
1283 if (cmp_it->lookback > 0) 1285 if (STRINGP (string))
1284 { 1286 bpos = string_char_to_byte (string, cpos);
1285 cpos = charpos - cmp_it->lookback; 1287 else
1286 if (STRINGP (string)) 1288 bpos = CHAR_TO_BYTE (cpos);
1287 bpos = string_char_to_byte (string, cpos);
1288 else
1289 bpos = CHAR_TO_BYTE (cpos);
1290 }
1291 lgstring = autocmp_chars (elt, cpos, bpos, charpos + 1, w, face,
1292 string);
1293 if (composition_gstring_p (lgstring)
1294 && cpos + LGSTRING_CHAR_LEN (lgstring) - 1 == charpos)
1295 break;
1296 /* Composition failed or didn't cover the current
1297 character. */
1298 if (cmp_it->lookback == 0)
1299 goto no_composition;
1300 lgstring = Qnil;
1301 /* Try to find a shorter composition that starts after CPOS. */
1302 composition_compute_stop_pos (cmp_it, charpos, bytepos, cpos,
1303 string);
1304 if (cmp_it->ch == -2 || cmp_it->stop_pos < charpos)
1305 goto no_composition;
1306 val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch);
1307 for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val));
1308 } 1289 }
1309 cmp_it->reversed_p = 1; 1290 lgstring = autocmp_chars (elt, cpos, bpos, charpos + 1, w, face,
1291 string);
1292 if (! composition_gstring_p (lgstring)
1293 || cpos + LGSTRING_CHAR_LEN (lgstring) - 1 != charpos)
1294 /* Composition failed or didn't cover the current
1295 character. */
1296 goto no_composition;
1310 } 1297 }
1311 if (NILP (lgstring)) 1298 if (NILP (lgstring))
1312 goto no_composition; 1299 goto no_composition;
@@ -1341,6 +1328,8 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
1341 /* BYTEPOS is calculated in composition_compute_stop_pos */ 1328 /* BYTEPOS is calculated in composition_compute_stop_pos */
1342 bytepos = -1; 1329 bytepos = -1;
1343 } 1330 }
1331 if (cmp_it->reversed_p)
1332 endpos = -1;
1344 composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string); 1333 composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string);
1345 return 0; 1334 return 0;
1346} 1335}