emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-27 13ab70c: Avoid breaking Arabic shaping in 'window-text-pixel-si


From: Eli Zaretskii
Subject: emacs-27 13ab70c: Avoid breaking Arabic shaping in 'window-text-pixel-size'
Date: Mon, 9 Nov 2020 10:23:43 -0500 (EST)

branch: emacs-27
commit 13ab70c80e2e31fdf0a289c8e730a33a1cf5d6ae
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Avoid breaking Arabic shaping in 'window-text-pixel-size'
    
    * src/xdisp.c (CHAR_COMPOSED_P): If the bidi_p flag is not set,
    pass -1 to composition_reseat_it, so that the shaping engine will
    figure out the directionality of the text.  This is important,
    e.g., when using move_it_* functions in some context that is not
    redisplay, such as 'window-text-pixel-size'.  (Bug#44521)
---
 src/xdisp.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 60864c2..ac706d0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7221,14 +7221,21 @@ static next_element_function const 
get_next_element[NUM_IT_METHODS] =
 
 
 /* Return true iff a character at CHARPOS (and BYTEPOS) is composed
-   (possibly with the following characters).  */
+   (possibly with the following characters).
+
+  Note: we pass -1 as the "resolved bidi level" when the iterator
+  doesn't have the bidi_p flag set, because in that case we really
+  don't know what is the directionality of the text, so we leave it to
+  the shaping engine to figure that out.  */
 
 #define CHAR_COMPOSED_P(IT,CHARPOS,BYTEPOS,END_CHARPOS)                        
\
   ((IT)->cmp_it.id >= 0                                                        
\
    || ((IT)->cmp_it.stop_pos == (CHARPOS)                              \
        && composition_reseat_it (&(IT)->cmp_it, CHARPOS, BYTEPOS,      \
                                 END_CHARPOS, (IT)->w,                  \
-                                (IT)->bidi_it.resolved_level,          \
+                                (IT)->bidi_p                           \
+                                ? (IT)->bidi_it.resolved_level         \
+                                : -1,                                  \
                                 FACE_FROM_ID_OR_NULL ((IT)->f,         \
                                                       (IT)->face_id),  \
                                 (IT)->string)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]