diff options
Diffstat (limited to 'src/composite.c')
| -rw-r--r-- | src/composite.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/composite.c b/src/composite.c index 48824946e64..7cb97934a20 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -1167,7 +1167,9 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, | |||
| 1167 | characters to be composed. FACE, if non-NULL, is a base face of | 1167 | characters to be composed. FACE, if non-NULL, is a base face of |
| 1168 | the character. If STRING is not nil, it is a string containing the | 1168 | the character. If STRING is not nil, it is a string containing the |
| 1169 | character to check, and CHARPOS and BYTEPOS are indices in the | 1169 | character to check, and CHARPOS and BYTEPOS are indices in the |
| 1170 | string. In that case, FACE must not be NULL. | 1170 | string. In that case, FACE must not be NULL. PDIR is the base |
| 1171 | direction of the current paragraph, and is used to calculate the | ||
| 1172 | direction argument to pass to the font shaper. | ||
| 1171 | 1173 | ||
| 1172 | If the character is composed, setup members of CMP_IT (id, nglyphs, | 1174 | If the character is composed, setup members of CMP_IT (id, nglyphs, |
| 1173 | from, to, reversed_p), and return true. Otherwise, update | 1175 | from, to, reversed_p), and return true. Otherwise, update |
| @@ -1176,7 +1178,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, | |||
| 1176 | bool | 1178 | bool |
| 1177 | composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, | 1179 | composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, |
| 1178 | ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, | 1180 | ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, |
| 1179 | struct face *face, Lisp_Object string) | 1181 | bidi_dir_t pdir, struct face *face, Lisp_Object string) |
| 1180 | { | 1182 | { |
| 1181 | if (cmp_it->ch == -2) | 1183 | if (cmp_it->ch == -2) |
| 1182 | { | 1184 | { |
| @@ -1206,7 +1208,7 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, | |||
| 1206 | else if (w) | 1208 | else if (w) |
| 1207 | { | 1209 | { |
| 1208 | Lisp_Object lgstring = Qnil; | 1210 | Lisp_Object lgstring = Qnil; |
| 1209 | Lisp_Object val, elt; | 1211 | Lisp_Object val, elt, direction = Qnil; |
| 1210 | 1212 | ||
| 1211 | val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); | 1213 | val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); |
| 1212 | for (EMACS_INT i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)) | 1214 | for (EMACS_INT i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)) |
| @@ -1221,8 +1223,12 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, | |||
| 1221 | continue; | 1223 | continue; |
| 1222 | if (XFIXNAT (AREF (elt, 1)) != cmp_it->lookback) | 1224 | if (XFIXNAT (AREF (elt, 1)) != cmp_it->lookback) |
| 1223 | goto no_composition; | 1225 | goto no_composition; |
| 1226 | if (pdir == L2R) | ||
| 1227 | direction = QL2R; | ||
| 1228 | else if (pdir == R2L) | ||
| 1229 | direction = QR2L; | ||
| 1224 | lgstring = autocmp_chars (elt, charpos, bytepos, endpos, | 1230 | lgstring = autocmp_chars (elt, charpos, bytepos, endpos, |
| 1225 | w, face, string, QL2R); | 1231 | w, face, string, direction); |
| 1226 | if (composition_gstring_p (lgstring)) | 1232 | if (composition_gstring_p (lgstring)) |
| 1227 | break; | 1233 | break; |
| 1228 | lgstring = Qnil; | 1234 | lgstring = Qnil; |
| @@ -1246,8 +1252,12 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, | |||
| 1246 | else | 1252 | else |
| 1247 | bpos = CHAR_TO_BYTE (cpos); | 1253 | bpos = CHAR_TO_BYTE (cpos); |
| 1248 | } | 1254 | } |
| 1255 | if (pdir == L2R) | ||
| 1256 | direction = QR2L; | ||
| 1257 | else if (pdir == R2L) | ||
| 1258 | direction = QL2R; | ||
| 1249 | lgstring = autocmp_chars (elt, cpos, bpos, charpos + 1, w, face, | 1259 | lgstring = autocmp_chars (elt, cpos, bpos, charpos + 1, w, face, |
| 1250 | string, QR2L); | 1260 | string, direction); |
| 1251 | if (! composition_gstring_p (lgstring) | 1261 | if (! composition_gstring_p (lgstring) |
| 1252 | || cpos + LGSTRING_CHAR_LEN (lgstring) - 1 != charpos) | 1262 | || cpos + LGSTRING_CHAR_LEN (lgstring) - 1 != charpos) |
| 1253 | /* Composition failed or didn't cover the current | 1263 | /* Composition failed or didn't cover the current |