Subject: bug#12111: 23.4; Display problem with devanagari

From: Stefan Kangas <[email-masked]>
Date: Wed, 18 Nov 2020 07:13:24 -0800

Hi Rustom,

(You sent the below bug report 8 years ago, but it didn't get a reply at
the time.)

Rustom Mody <[email-masked]> writes:

> I see a certain wrong behavior with emacs involving fonts and unicode (devanagari).
>
> I have a small elisp function that generates devanagari in a new buffer.
> When the unicode is generated, the display is wrong.
> If the badly displaying buffer is saved, emacs is exited and restarted, it is displayed correct.
>
> The problem could be with the (adobe) font. However there is also some issue with the display in emacs which is perhaps not correct.
>
> To make it happen the following are needed:
> .Xresources containing the 1 line:
> emacs*font: -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso10646-1
>
> Of course the font should be installed.
>
> A text file called roman.txt with the two lines (for translating to devanagari)
> -----------------
> saMprApte
> DukRRiMkaraNe
> ----------------
>
> The following elisp in a file say apply-input-method.el
> Now call emacs as
> emacs -q -l apply-input-method.el roman.txt
> (-Q does not work)
> And then call F4 ie rpm-apply-input-method.
>
> A new frame should open with two lines of devanagari with the newline between the two lines *looking* as though it is 1 page wide,
> though it is only 1 newline.
>
> In short the newline displays as though it were some 20 or so lines.

I tried your recipe on the current master branch, and I get a buffer
with exactly two lines and these characters:

संप्राप्ते
डुकृंकरणे

Does that look correct to you?

Are you still seeing this on a recent version of Emacs, such as the
recently released version 27.1?

Thanks in advance.

>
> The elisp file: apply-input-method.el
> ----------------------
> (setq rpm-input-method "devanagari-itrans")
>
> (defun rpm-apply-input-method ()
>   "buffer to buffer apply input method with buffering windowing stuff mixed up"
>   (interactive)
>   (let* ((inp (buffer-substring-no-properties (point-min) (point-max)))
>      (filename (file-name-nondirectory (buffer-file-name)))
>      (outname (concat (file-name-sans-extension filename)
>                    "-hi"
>                    (file-name-extension filename t)))
>      (p))
>     (switch-to-buffer-other-frame outname)
>     (save-excursion
>       (save-window-excursion
>     (setq buffer-file-coding-system 'utf-8)
>     (set-input-method rpm-input-method t)
>     (setq p (point))
>     (erase-buffer)
>     (execute-kbd-macro inp)))
>     (goto-char p)
>     (other-frame 1)))
>
> (global-set-key [f4] 'rpm-apply-input-method)
>
> If Emacs crashed, and you have the Emacs process in the gdb debugger,
> please include the output from the following gdb commands:
>     `bt full' and `xbacktrace'.
> For information about debugging Emacs, please read the file
> /usr/share/emacs/23.4/etc/DEBUG.
>
> In GNU Emacs 23.4.1 (i486-pc-linux-gnu, GTK+ Version 2.24.10)
>  of 2012-04-08 on biber, modified by Debian
> Windowing system distributor `The X.Org Foundation', version 11.0.11201902
> configured using `configure  '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
> '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
> '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.4/site-lisp:/usr/share/emacs/site-lisp'
> '--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu'
> 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall -DDEBIAN -O2'
> 'CPPFLAGS=-D_FORTIFY_SOURCE=2''
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: en_US.UTF-8
>   value of $XMODIFIERS: nil
>   locale-coding-system: utf-8-unix
>   default enable-multibyte-characters: t
>
> Major mode: Text
>
> Minor modes in effect:
>   tooltip-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> <f4> <switch-frame> <switch-frame> <help-echo> <help-echo>
> <help-echo> <help-echo> <help-echo> <help-echo> <switch-frame>
> <down-mouse-4> <mouse-4> <double-down-mouse-4> <double-mouse-4>
> <triple-down-mouse-4> <triple-mouse-4> <down-mouse-5>
> <mouse-5> <double-down-mouse-5> <double-mouse-5> <triple-down-mouse-5>
> <triple-mouse-5> <down-mouse-4> <mouse-4> <double-down-mouse-4>
> <double-mouse-4> <triple-down-mouse-4> <triple-mouse-4>
> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
> <help-echo> M-x r e p o r t - e m <tab> <return>
>
> Recent messages:
> Loading /etc/emacs/site-start.d/50global.el (source)...done
> Loading /etc/emacs/site-start.d/50ledger.el (source)...done
> Loading /etc/emacs/site-start.d/50lilypond-data.el (source)...done
> Loading /etc/emacs/site-start.d/50psvn.el (source)...done
> Loading /etc/emacs/site-start.d/50pydb.el (source)...done
> For information about GNU Emacs and the GNU system, type C-h C-a.
> Loading quail/indian...done
> byte-code: Beginning of buffer [3 times]
> byte-code: End of buffer [3 times]
> byte-code: Beginning of buffer [2 times]
> byte-code: Beginning of buffer
>
> Load-path shadows:
> /usr/share/emacs/23.4/site-lisp/cscope/xcscope hides /usr/share/emacs/site-lisp/xcscope
> /usr/share/emacs/23.4/site-lisp/cdargs hides /usr/share/emacs/site-lisp/cdargs
> /usr/share/emacs/23.4/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
> /usr/share/emacs/site-lisp/tree-widget hides /usr/share/emacs/23.4/lisp/tree-widget
> /usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/23.4/lisp/textmodes/flyspell
> /usr/share/emacs23/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/23.4/lisp/textmodes/ispell
>
> Features:
> (shadow sort mail-extr message sendmail ecomplete rfc822 mml mml-sec
> password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
> rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
> time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1
> hex-util hashcash mail-utils emacsbug cus-start cus-load ind-util
> regexp-opt quail help-mode easymenu view tooltip ediff-hook vc-hooks
> lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
> image fringe lisp-mode register page menu-bar rfn-eshadow timer select
> scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
> frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
> tai-viet lao korean japanese hebrew greek romanian slovak czech european
> ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
> simple abbrev loaddefs button minibuffer faces cus-face files
> text-properties overlay md5 base64 format env code-pages mule custom
> widget hashtable-print-readable backquote make-network-process dbusbind
> system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)