diff options
| author | Eli Zaretskii | 2019-06-13 11:49:30 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-06-13 11:49:30 +0300 |
| commit | 769e9fa5ae2779f9eacc835784b88aea5cc5a396 (patch) | |
| tree | 28cc8bf42dbabcfe8b37c5ceb4e22ff0118c0edb | |
| parent | 4c3e78a9f4240bff6cf2bbc1f181dd167b712144 (diff) | |
| download | emacs-769e9fa5ae2779f9eacc835784b88aea5cc5a396.tar.gz emacs-769e9fa5ae2779f9eacc835784b88aea5cc5a396.zip | |
Fix text shaping of precomposed characters with HarfBuzz
* src/hbfont.c (hbfont_shape): Fix setting TO of lglyph for
the case when Lisp shape-gstring function performed some
compositions by itself. This happens with hebrew.el. See
https://lists.freedesktop.org/archives/harfbuzz/2019-June/007396.html
for the details of the problem this solves.
| -rw-r--r-- | src/hbfont.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/hbfont.c b/src/hbfont.c index 5923efd488d..623bee61cc8 100644 --- a/src/hbfont.c +++ b/src/hbfont.c | |||
| @@ -435,7 +435,17 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction) | |||
| 435 | 435 | ||
| 436 | /* All the glyphs in a cluster have the same values of FROM and TO. */ | 436 | /* All the glyphs in a cluster have the same values of FROM and TO. */ |
| 437 | LGLYPH_SET_FROM (lglyph, from); | 437 | LGLYPH_SET_FROM (lglyph, from); |
| 438 | LGLYPH_SET_TO (lglyph, to); | 438 | /* This heuristic is for when the Lisp shape-gstring function |
| 439 | substitutes known precomposed characters for decomposed | ||
| 440 | sequences. E.g., hebrew.el does that. This makes TEXT_LEN | ||
| 441 | be smaller than the original length of the composed character | ||
| 442 | sequence. In that case, we must not alter the largest TO, | ||
| 443 | because the display engine must know that all the characters | ||
| 444 | in the original sequence were processed by the composition. | ||
| 445 | If we don't do this, some of the composed characters will be | ||
| 446 | displayed again as separate glyphs. */ | ||
| 447 | if (!(to == text_len - 1 && LGLYPH_TO (lglyph) > to)) | ||
| 448 | LGLYPH_SET_TO (lglyph, to); | ||
| 439 | 449 | ||
| 440 | /* Not every glyph in a cluster maps directly to a single | 450 | /* Not every glyph in a cluster maps directly to a single |
| 441 | character; in general, N characters can yield M glyphs, where | 451 | character; in general, N characters can yield M glyphs, where |