is R..." */
/* FIXME: Do we need an exception for characters from display
tables? */
- if (it->bidi_p && it->bidi_it.type == STRONG_R)
+ if (it->bidi_p && it->bidi_it.type == STRONG_R
+ && !inhibit_bidi_mirroring)
it->c = bidi_mirror_char (it->c);
/* Map via display table or translate control characters.
IT->c, IT->len etc. have been set to the next character by
doc: /* Non-nil means don't free realized faces. Internal use only. */);
inhibit_free_realized_faces = 0;
+ DEFVAR_BOOL ("inhibit-bidi-mirroring", inhibit_bidi_mirroring,
+ doc: /* Non-nil means don't mirror characters even when bidi context requires that.
+Intended for use during debugging and for testing bidi display;
+see biditest.el in the test suite. */);
+ inhibit_bidi_mirroring = 0;
+
#ifdef GLYPH_DEBUG
DEFVAR_BOOL ("inhibit-try-window-id", inhibit_try_window_id,
doc: /* Inhibit try_window_id display optimization. */);
;;; biditest.el --- test bidi reordering in GNU Emacs display engine.
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2014 Free Software Foundation, Inc.
;; Author: Eli Zaretskii
;; Maintainer: FSF
;;; Code:
(defun biditest-generate-testfile (input-file output-file)
- ""
+ "Generate a bidi test file OUTPUT-FILE from data in INPUT-FILE.
+
+INPUT-FILE should be in the format of the BidiCharacterTest.txt file
+available from the Unicode site, as part of the UCD database, see
+http://www.unicode.org/Public/UCD/latest/ucd/BidiCharacterTest.txt.
+
+The resulting file should be viewed with `inhibit-bidi-mirroring' set to t."
(let ((output-buf (get-buffer-create "*biditest-output*"))
(lnum 1)
tbuf)
(message "Generating output in %s ... done" output-file))))
(defun biditest-create-test ()
- ""
+ "Create a test file for testing the Emacs bidirectional display.
+
+The resulting file should be viewed with `inhibit-bidi-mirroring' set to t."
(biditest-generate-testfile (pop command-line-args-left)
(or (pop command-line-args-left)
"biditest.txt")))
+
+;; A handy function for displaying the resolved bidi levels.
+(defun bidi-levels ()
+ "Display the resolved bidirectional levels of characters on current line.
+
+The results can be compared with the levels stated in the
+BidiCharacterTest.txt file."
+ (interactive)
+ (message "%s" (bidi-resolved-levels)))
+
+(define-key global-map [f8] 'bidi-levels)