weblog d’un abbe

20080529

Devanagari script rendering in GNU Emacs

Filed under: Hacking — Tags: , , , , — abbe @ 0101

In one of my posting, I mentioned how, Emacs is able to render Devanagari script text flawlessly without any issue. But few days ago, I noticed that this is not true anymore. Rendering is not proper, probably something is broken between the builds, as I emerge emacs-cvs every two-three days. Following is the thumbnail of screenshot (click to enlarge) of issue I was facing.

Emacs 23 not rendering Devanagari text properly

I reported this issue on Emacs bugtracker. Anyways, I found a workaround against this issue after being pointed out by Kenichi Handa on how to view what font is used for rendering a particular character. C-u C-x = is the keybinding, just move your point to the desired character and do C-u C-x =. On my box, Emacs was using FreeSans (from GNU freefont) font to render the text. Probably, the appropriate font determination algorithm needs to be fixed in Emacs. Anyways, I hacked the following Emacs Lisp code for a workaround, which hints Emacs to use Lohit Hindi-11 Xft font:

(defun my-setup-hindi-rendering()
  "Setup Hindi rendering"
  (interactive)
  (set-fontset-font "fontset-default"
		    (cons (decode-char 'ucs ?\x0900)
			  (decode-char 'ucs ?\x097f))
		    "Lohit Hindi-11"))

I’ve wrapped the code in defun, because I’m looking for a proper fix. So whenever I need to fix that Devanagari script rendering issue, I do M-x my-setup-hindi-rendering. Anyone who is experiencing similar issue, can try this and report any bugs. Happy operating Emacs system… ;)

UPDATE: As of now, this bug is fixed in Emacs CVS. I’m running GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.8) of 2008-05-29 on chateau .

The Shocking Blue Green Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.